Completed
Push — master ( db65f2...f113eb )
by Yannick
27:29
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.
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.
live-czml.php 3 patches
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.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -50,30 +50,30 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
53
-    // Assuming the angles are in radians.
54
-    $c1 = cos($heading/2);
55
-    $s1 = sin($heading/2);
56
-    $c2 = cos($attitude/2);
57
-    $s2 = sin($attitude/2);
58
-    $c3 = cos($bank/2);
59
-    $s3 = sin($bank/2);
60
-    $c1c2 = $c1*$c2;
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);
53
+	// Assuming the angles are in radians.
54
+	$c1 = cos($heading/2);
55
+	$s1 = sin($heading/2);
56
+	$c2 = cos($attitude/2);
57
+	$s2 = sin($attitude/2);
58
+	$c3 = cos($bank/2);
59
+	$s3 = sin($bank/2);
60
+	$c1c2 = $c1*$c2;
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);
67 67
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
68 68
 
69 69
 }
70 70
 
71 71
 
72 72
 if (isset($_GET['download'])) {
73
-    if ($_GET['download'] == "true")
74
-    {
73
+	if ($_GET['download'] == "true")
74
+	{
75 75
 	header('Content-disposition: attachment; filename="flightairmap.json"');
76
-    }
76
+	}
77 77
 }
78 78
 header('Content-Type: text/javascript');
79 79
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
185 185
 		$coord = explode(',',$_GET['coord']);
186 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
-		    && $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)) {
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
 	}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
209 209
 		$coord = explode(',',$_GET['coord']);
210 210
 		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) 
211
-		    && $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
+			&& $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)) {
212 212
 			$coord = array();
213 213
 		}
214 214
 	}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
230 230
 		$coord = explode(',',$_GET['coord']);
231 231
 		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) 
232
-		    && $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)) {
232
+			&& $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)) {
233 233
 			$coord = array();
234 234
 		}
235 235
 	}
@@ -350,10 +350,10 @@  discard block
 block discarded – undo
350 350
 			$image = "images/placeholder_thumb.png";
351 351
 		}
352 352
 
353
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
354
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
355
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
356
-                if ($prev_flightaware_id != $id) {
353
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
354
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
355
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
356
+				if ($prev_flightaware_id != $id) {
357 357
 			if ($prev_flightaware_id != '') {
358 358
 				/*
359 359
 				if ($nblatlong == 1) {
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
450 450
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
451 451
 						} else $aircraft_shadow = '';
452
-	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
452
+							$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
453 453
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
454 454
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
455 455
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
481 481
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
482 482
 						}
483
-    						$output .= '},';
483
+							$output .= '},';
484 484
 					} elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') {
485 485
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.'';
486 486
 						$output .= ',"heightReference": "'.$heightrelative.'"';
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
489 489
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
490 490
 						}
491
-    						$output .= '},';
491
+							$output .= '},';
492 492
 					} elseif ($aircraft_icao != '') {
493 493
 						$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
494 494
 						if (isset($aircraft_info[0]['engine_type'])) {
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 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
 	}
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	$coord = array();
207 207
 	//if (isset($_GET['coord']) && $_GET['coord'] != '') {
208 208
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
209
-		$coord = explode(',',$_GET['coord']);
210
-		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) 
209
+		$coord = explode(',', $_GET['coord']);
210
+		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) 
211 211
 		    && $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)) {
212 212
 			$coord = array();
213 213
 		}
214 214
 	}
215 215
 	$previous_filter = $filter;
216 216
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) {
217
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine']));
218
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
217
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackMarine']));
218
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
219 219
 	} elseif (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '' && !empty($coord)) {
220
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true,$_COOKIE['MapTrack']);
220
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true, $_COOKIE['MapTrack']);
221 221
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
222
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
222
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
223 223
 	} else {
224 224
 		$spotter_array = array();
225 225
 	}
@@ -227,20 +227,20 @@  discard block
 block discarded – undo
227 227
 } else {
228 228
 	$coord = array();
229 229
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
230
-		$coord = explode(',',$_GET['coord']);
231
-		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) 
230
+		$coord = explode(',', $_GET['coord']);
231
+		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) 
232 232
 		    && $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)) {
233 233
 			$coord = array();
234 234
 		}
235 235
 	}
236 236
 	$previous_filter = $filter;
237 237
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) {
238
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack']));
239
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
238
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrack']));
239
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
240 240
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
241
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true,$_COOKIE['MapTrack']);
241
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true, $_COOKIE['MapTrack']);
242 242
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
243
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
243
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
244 244
 	} else {
245 245
 		$spotter_array = array();
246 246
 	}
@@ -250,19 +250,19 @@  discard block
 block discarded – undo
250 250
 if (!empty($spotter_array) && isset($coord)) {
251 251
 	if ($tracker) {
252 252
 		if (isset($_GET['archive'])) {
253
-			$flightcnt = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter);
253
+			$flightcnt = $TrackerArchive->getLiveTrackerCount($begindate, $enddate, $filter);
254 254
 		} else {
255 255
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
256 256
 		}
257 257
 	} elseif ($marine) {
258 258
 		if (isset($_GET['archive'])) {
259
-			$flightcnt = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter);
259
+			$flightcnt = $MarineArchive->getLiveMarineCount($begindate, $enddate, $filter);
260 260
 		} else {
261 261
 			$flightcnt = $MarineLive->getLiveMarineCount($filter);
262 262
 		}
263 263
 	} else {
264 264
 		if (isset($_GET['archive'])) {
265
-			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
265
+			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
266 266
 		} else {
267 267
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
268 268
 		}
@@ -270,17 +270,17 @@  discard block
 block discarded – undo
270 270
 	if ($flightcnt == '') $flightcnt = 0;
271 271
 } else $flightcnt = 0;
272 272
 
273
-$sqltime = round(microtime(true)-$begintime,2);
273
+$sqltime = round(microtime(true) - $begintime, 2);
274 274
 $minitime = time();
275 275
 $minitracktime_begin = time();
276 276
 $minitracktime = $minitracktime_begin;
277 277
 $maxitime = 0;
278
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
278
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
279 279
 $modelsdb = array();
280 280
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
281
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
282
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
283
-			if (isset($row[1]) ){
281
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
282
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
283
+			if (isset($row[1])) {
284 284
 				$model = $row[0];
285 285
 				$modelsdb[$model] = $row[1];
286 286
 			}
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
 }
291 291
 $modelsdb2 = array();
292 292
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
293
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
294
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
295
-			if (isset($row[1]) ){
293
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
294
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
295
+			if (isset($row[1])) {
296 296
 				$model = $row[0];
297 297
 				$glb = $row[1];
298 298
 				if (isset($row[2])) {
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 if (!empty($spotter_array) && is_array($spotter_array))
339 339
 {
340 340
 	$nblatlong = 0;
341
-	foreach($spotter_array as $spotter_item)
341
+	foreach ($spotter_array as $spotter_item)
342 342
 	{
343 343
 		$j++;
344 344
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
 			}
393 393
 			if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
394 394
 			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
395
-			if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",';
395
+			if (isset($spotter_item['ident'])) $output .= '"ident": "'.$spotter_item['ident'].'",';
396 396
 			if ($tracker) {
397 397
 				if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",';
398
-				$output.= '"type": "tracker"';
398
+				$output .= '"type": "tracker"';
399 399
 			} elseif ($marine) {
400 400
 				if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",';
401
-				$output.= '"type": "marine"';
401
+				$output .= '"type": "marine"';
402 402
 			} else {
403 403
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
404 404
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -412,14 +412,14 @@  discard block
 block discarded – undo
412 412
 						if (isset($airline_icao)) {
413 413
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
414 414
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
415
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
415
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
416 416
 							}
417 417
 						}
418 418
 					}
419 419
 					//if ($ident != '') $output.= '"ident": "'.$ident.'",';
420 420
 				}
421
-				$output.= '"gltf2": %gltf2%,';
422
-				$output.= '"type": "flight"';
421
+				$output .= '"gltf2": %gltf2%,';
422
+				$output .= '"type": "flight"';
423 423
 			}
424 424
 			$output .= '},';
425 425
 
@@ -790,8 +790,8 @@  discard block
 block discarded – undo
790 790
 					$output .= '},';
791 791
 				}
792 792
 			}
793
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
794
-			else $output = str_replace('%onground%','false',$output);
793
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
794
+			else $output = str_replace('%onground%', 'false', $output);
795 795
 
796 796
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
797 797
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
808 808
 			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
809 809
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
810
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
810
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
811 811
 			$output .= $spotter_item['longitude'].', ';
812 812
 			$output .= $spotter_item['latitude'];
813 813
 			$prevlong = $spotter_item['longitude'];
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
836 836
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
837 837
 		} else {
838
-			$nblatlong = $nblatlong+1;
839
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
838
+			$nblatlong = $nblatlong + 1;
839
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
840 840
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
841 841
 			if ($spotter_item['ground_speed'] == 0) {
842 842
 				$output .= $prevlong.', ';
@@ -877,26 +877,26 @@  discard block
 block discarded – undo
877 877
 $output .= ']';
878 878
 if (isset($globalArchive) && $globalArchive === TRUE) {
879 879
 	if (isset($begindateinitial)) {
880
-		$output = str_replace('%minitime%',date("c",$begindateinitial),$output);
881
-	} elseif ((time()-$globalLiveInterval) > $minitime) {
882
-		if (time()-$globalLiveInterval > $maxitime) {
883
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
880
+		$output = str_replace('%minitime%', date("c", $begindateinitial), $output);
881
+	} elseif ((time() - $globalLiveInterval) > $minitime) {
882
+		if (time() - $globalLiveInterval > $maxitime) {
883
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
884 884
 		} else {
885
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
885
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
886 886
 		}
887 887
 	}
888
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
888
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
889 889
 } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
890
-	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
890
+	$output = str_replace('%minitime%', date("c", $minitracktime), $output);
891 891
 } else {
892
-	$output = str_replace('%minitime%',date("c",$minitime),$output);
892
+	$output = str_replace('%minitime%', date("c", $minitime), $output);
893 893
 }
894 894
 if (isset($enddateinitial)) {
895
-	$output = str_replace('%maxitime%',date("c",$enddateinitial),$output);
895
+	$output = str_replace('%maxitime%', date("c", $enddateinitial), $output);
896 896
 } else {
897
-	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
897
+	$output = str_replace('%maxitime%', date("c", $maxitime), $output);
898 898
 }
899
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
900
-else $output = str_replace('%gltf2%','false',$output);
899
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
900
+else $output = str_replace('%gltf2%', 'false', $output);
901 901
 print $output;
902 902
 ?>
Please login to merge, or discard this patch.
aircraft-data.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime);
18
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime);
21
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 	} else {
24 24
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 }
31 31
 if (isset($_GET['flightaware_id'])) {
32
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
32
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
33 33
 	if (isset($_GET['currenttime'])) {
34
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
34
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
35 35
 		$currenttime = round($currenttime/1000);
36
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime);
36
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime);
37 37
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
38 38
 			$from_archive = true;
39 39
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
40
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime);
40
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime);
41 41
 		}
42 42
 	} else {
43 43
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
58 58
 	{
59 59
 		if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
60
-			$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
60
+			$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
61 61
 		} else $image = $spotter_item['image_thumbnail'];
62 62
 	}
63 63
 	/* else {
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
85 85
 		if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
86 86
 			if ($spotter_item['departure_airport_time'] > 2460) {
87
-				print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>';
87
+				print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>';
88 88
 			} else {
89 89
 				print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>';
90 90
 			}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
94 94
 		if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
95 95
 			if ($spotter_item['arrival_airport_time'] > 2460) {
96
-				print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>';
96
+				print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>';
97 97
 			} else {
98 98
 				print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>';
99 99
 			}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	print '<span>'._("Aircraft").'</span>';
113 113
 	if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
114 114
 	if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
115
-		$aircraft_names = explode('/',$spotter_item['aircraft_name']);
115
+		$aircraft_names = explode('/', $spotter_item['aircraft_name']);
116 116
 		if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
117 117
 		else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
118 118
 	} elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	print '<div id="altitude"><span>'._("Altitude").'</span>';
123 123
 	if (isset($globalGroundAltitude) && $globalGroundAltitude) {
124 124
 		try {
125
-			$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
126
-		} catch(Exception $e) {
125
+			$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
126
+		} catch (Exception $e) {
127 127
 			// If catched not exist
128 128
 		}
129 129
 	}
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	if (isset($globalCam) && $globalCam) {
168 168
 		require_once(dirname(__FILE__).'/require/class.Common.php');
169 169
 		$Common = new Common();
170
-		$azimuth = round($Common->azimuth($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude']));
171
-		$distance = $Common->distance($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude'],'m');
172
-		$plunge = round($Common->plunge($globalCenterAltitude,$spotter_item['real_altitude'],$distance));
170
+		$azimuth = round($Common->azimuth($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude']));
171
+		$distance = $Common->distance($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude'], 'm');
172
+		$plunge = round($Common->plunge($globalCenterAltitude, $spotter_item['real_altitude'], $distance));
173 173
 		print '<div id="camcoordinates"><span>'._("Cam Coordinates").'</span>';
174 174
 		print 'azimuth: '.$azimuth;
175 175
 		print ' / ';
@@ -179,16 +179,16 @@  discard block
 block discarded – undo
179 179
 		print '</div>';
180 180
 		//echo $Common->getData('http://127.0.0.1/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true);
181 181
 		//echo $Common->getData('file://'.dirname(__FILE__).'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true);
182
-		echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true);
182
+		echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge, 'get', '', '', '', '', '', '', false, true);
183 183
 	}
184 184
   
185 185
 	print '<div id="heading"><span>'._("Heading").'</span><span class="heading">'.$spotter_item['heading'].'</span>°</div>';
186 186
 	if (isset($spotter_item['verticalrate']) && $spotter_item['verticalrate'] != '') {
187 187
 		print '<div id="verticalrate"><span>'._("Vertical rate").'</span>';
188 188
 		if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
189
-			print $spotter_item['verticalrate']. ' ft/min';
189
+			print $spotter_item['verticalrate'].' ft/min';
190 190
 		} else {
191
-			print round($spotter_item['verticalrate']*0.3048). ' m/min';
191
+			print round($spotter_item['verticalrate']*0.3048).' m/min';
192 192
 		}
193 193
 		print '</div>';
194 194
 	}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	print '</div>';
224 224
 	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
225 225
 	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
226
-	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
226
+	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>';
227 227
 	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
228 228
 	print '</div>';
229 229
 }
Please login to merge, or discard this patch.
Braces   +52 added lines, -19 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@  discard block
 block discarded – undo
58 58
 	{
59 59
 		if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
60 60
 			$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
61
-		} else $image = $spotter_item['image_thumbnail'];
61
+		} else {
62
+			$image = $spotter_item['image_thumbnail'];
63
+		}
62 64
 	}
63 65
 	/* else {
64 66
 		$image = "images/placeholder_thumb.png";
@@ -75,10 +77,14 @@  discard block
 block discarded – undo
75 77
 	print '<div class="callsign-details">';
76 78
 	if ($spotter_item['ident'] != 'Not Available') {
77 79
 		print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a>';
78
-		if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />';
80
+		if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) {
81
+			print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />';
82
+		}
79 83
 		print '</div>';
80 84
 	}
81
-	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
85
+	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') {
86
+		print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
87
+	}
82 88
 	print '</div>';
83 89
 	if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') {
84 90
 		print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
@@ -110,15 +116,25 @@  discard block
 block discarded – undo
110 116
 	print '</div>';
111 117
 	print '<div id="aircraft">';
112 118
 	print '<span>'._("Aircraft").'</span>';
113
-	if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
119
+	if (isset($spotter_item['aircraft_wiki'])) {
120
+		print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
121
+	}
114 122
 	if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
115 123
 		$aircraft_names = explode('/',$spotter_item['aircraft_name']);
116
-		if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
117
-		else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
118
-	} elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
119
-	else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
124
+		if (count($aircraft_names) == 1) {
125
+			print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
126
+		} else {
127
+			print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
128
+		}
129
+	} elseif (isset($spotter_item['aircraft_type'])) {
130
+		print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
131
+	} else {
132
+		print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
133
+	}
120 134
 	print '</div>';
121
-	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
135
+	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
136
+		print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
137
+	}
122 138
 
123 139
 	print '<div id="altitude"><span>'._("Altitude").'</span>';
124 140
 	if (isset($globalGroundAltitude) && $globalGroundAltitude) {
@@ -131,11 +147,17 @@  discard block
 block discarded – undo
131 147
 
132 148
 	print '<span class="altitude">';
133 149
 	if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
134
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
135
-		else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
150
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
151
+			print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
152
+		} else {
153
+			print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
154
+		}
136 155
 	} else {
137
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
138
-		else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
156
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
157
+			print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
158
+		} else {
159
+			print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
160
+		}
139 161
 	}
140 162
 	print '</span>';
141 163
 
@@ -200,8 +222,11 @@  discard block
 block discarded – undo
200 222
 	}
201 223
 	if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
202 224
 		print '<div id="pilot"><span>'._("Pilot").'</span>';
203
-		if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
204
-		else print $spotter_item['pilot_name'];
225
+		if (isset($spotter_item['pilot_id'])) {
226
+			print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
227
+		} else {
228
+			print $spotter_item['pilot_name'];
229
+		}
205 230
 		print '</div>';
206 231
 	}
207 232
 	if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') {
@@ -227,10 +252,18 @@  discard block
 block discarded – undo
227 252
 	}
228 253
 	print '</div>';
229 254
 	print '</div>';
230
-	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
231
-	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
232
-	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
233
-	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
255
+	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
256
+		print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
257
+	}
258
+	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
259
+		print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
260
+	}
261
+	if (isset($spotter_item['acars']['message'])) {
262
+		print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
263
+	}
264
+	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
265
+		print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
266
+	}
234 267
 	print '</div>';
235 268
 }
236 269
 ?>
Please login to merge, or discard this patch.
airport-geojson.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		date_default_timezone_set('UTC');
28 28
 		//waypoint plotting
29 29
 		$output .= '{"type": "Feature",';
30
-		    $output .= '"properties": {';
30
+			$output .= '"properties": {';
31 31
 			$output .= '"name": '.json_encode(str_replace('"',"'",$spotter_item['name'])).',';
32 32
 			$output .= '"city": '.json_encode(str_replace('"',"'",$spotter_item['city'])).',';
33 33
 			$output .= '"country": "'.$spotter_item['country'].'",';
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 			$output .= '"homepage": "'.$spotter_item['home_link'].'",';
51 51
 			$output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"';
52 52
 //			$output .= '"photo": "'.$spotter_item['image_thumbnail'].'",';
53
-		    $output .= '},';
54
-		    $output .= '"geometry": {';
53
+			$output .= '},';
54
+			$output .= '"geometry": {';
55 55
 			$output .= '"type": "Point",';
56 56
 			$output .= '"coordinates": [';
57
-			    $output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
57
+				$output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
58 58
 			$output .= ']';
59
-		    $output .= '}';
59
+			$output .= '}';
60 60
 		$output .= '},';
61 61
 	}
62 62
 	$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 if (isset($_GET['coord'])) 
13 13
 {
14
-	$coords = explode(',',$_GET['coord']);
14
+	$coords = explode(',', $_GET['coord']);
15 15
 	$spotter_array = $Spotter->getAllAirportInfobyCoord($coords);
16 16
 } else {
17 17
 	$spotter_array = $Spotter->getAllAirportInfo();
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
             
23 23
 if (!empty($spotter_array))
24 24
 {	  
25
-	foreach($spotter_array as $spotter_item)
25
+	foreach ($spotter_array as $spotter_item)
26 26
 	{
27 27
 		date_default_timezone_set('UTC');
28 28
 		//waypoint plotting
29 29
 		$output .= '{"type": "Feature",';
30 30
 		    $output .= '"properties": {';
31
-			$output .= '"name": '.json_encode(str_replace('"',"'",$spotter_item['name'])).',';
32
-			$output .= '"city": '.json_encode(str_replace('"',"'",$spotter_item['city'])).',';
31
+			$output .= '"name": '.json_encode(str_replace('"', "'", $spotter_item['name'])).',';
32
+			$output .= '"city": '.json_encode(str_replace('"', "'", $spotter_item['city'])).',';
33 33
 			$output .= '"country": "'.$spotter_item['country'].'",';
34 34
 			$output .= '"altitude": "'.$spotter_item['altitude'].'",';
35
-			$output .= '"popupContent": '.json_encode(str_replace('"',"'",$spotter_item['name']).' : '.str_replace('"',"'",$spotter_item['city']).', '.$spotter_item['country']).',';
35
+			$output .= '"popupContent": '.json_encode(str_replace('"', "'", $spotter_item['name']).' : '.str_replace('"', "'", $spotter_item['city']).', '.$spotter_item['country']).',';
36 36
 			if ($spotter_item['type'] == 'large_airport') {
37 37
 				$output .= '"icon": "'.$globalURL.'/images/airport.png",';
38 38
 			} elseif ($spotter_item['type'] == 'heliport') {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		    $output .= '}';
60 60
 		$output .= '},';
61 61
 	}
62
-	$output  = substr($output, 0, -1);
62
+	$output = substr($output, 0, -1);
63 63
 }
64 64
 $output .= ']}';
65 65
 print $output;
Please login to merge, or discard this patch.
weather-json.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@
 block discarded – undo
9 9
 	header('Content-disposition: attachment; filename="weather.json"');
10 10
 }
11 11
 header('Content-Type: text/javascript');
12
-$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
13
-$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
12
+$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
13
+$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
14 14
 if ($latitude == '' || $longitude == '') return '';
15 15
 //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n";
16
-$airports = $Spotter->closestAirports($latitude,$longitude,200);
16
+$airports = $Spotter->closestAirports($latitude, $longitude, 200);
17 17
 //print_r($airports);
18 18
 $METAR = new METAR();
19 19
 $Weather = new Weather();
20 20
 $i = 0;
21 21
 $ew = true;
22
-while($ew) {
22
+while ($ew) {
23 23
 	$met = $METAR->getMETAR($airports[$i]['icao']);
24 24
 	//print_r($met);
25 25
 	if (!empty($met)) {
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
 header('Content-Type: text/javascript');
12 12
 $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
13 13
 $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
14
-if ($latitude == '' || $longitude == '') return '';
14
+if ($latitude == '' || $longitude == '') {
15
+	return '';
16
+}
15 17
 //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n";
16 18
 $airports = $Spotter->closestAirports($latitude,$longitude,200);
17 19
 //print_r($airports);
@@ -36,7 +38,9 @@  discard block
 block discarded – undo
36 38
 		}
37 39
 	}
38 40
 	$i++;
39
-	if ($i >= count($airports)) $ew = false;
40
-}
41
+	if ($i >= count($airports)) {
42
+		$ew = false;
43
+	}
44
+	}
41 45
 
42 46
 ?>
43 47
\ No newline at end of file
Please login to merge, or discard this patch.
index.php 3 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 /*
20 20
 } else {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		    <div class="form-group">
202 202
 			<label><?php echo _("From:"); ?></label>
203 203
 			<div class='input-group date' id='datetimepicker1'>
204
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
204
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i", $_COOKIE['archive_begin']).' UTC'; ?>" required />
205 205
 			    <span class="input-group-addon">
206 206
 				<span class="glyphicon glyphicon-calendar"></span>
207 207
 			    </span>
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		    <div class="form-group">
211 211
 			<label><?php echo _("To:"); ?></label>
212 212
 			<div class='input-group date' id='datetimepicker2'>
213
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
213
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i", $_COOKIE['archive_end']).' UTC'; ?>" />
214 214
 			    <span class="input-group-addon">
215 215
 				<span class="glyphicon glyphicon-calendar"></span>
216 216
 			    </span>
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
 		    <li><?php echo _("Type of Terrain:"); ?>
379 379
 			<select  class="selectpicker" onchange="terrainType(this);">
380 380
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
381
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
382
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
383
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
381
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
382
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
383
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option>
384 384
 			</select>
385 385
 		    </li>
386 386
 <?php
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
453 453
 <?php
454 454
     }
455
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
455
+    if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
456 456
 ?>
457 457
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
458 458
 <?php
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
 					$Spotter = new Spotter();
634 634
 					$allairlinenames = $Spotter->getAllAirlineNames();
635 635
 				}
636
-				foreach($allairlinenames as $airline) {
636
+				foreach ($allairlinenames as $airline) {
637 637
 					$airline_name = $airline['airline_name'];
638
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
639
-					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
638
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
639
+					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) {
640 640
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
641 641
 					} else {
642 642
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
656 656
 			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
657 657
 			    <?php
658
-				foreach($allalliancenames as $alliance) {
658
+				foreach ($allalliancenames as $alliance) {
659 659
 					$alliance_name = $alliance['alliance'];
660 660
 					if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) {
661 661
 						echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>';
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
 				*/
692 692
 				$Source = new Source();
693 693
 				$datasource = $Source->getLocationInfoByType('gs');
694
-				foreach($datasource as $src) {
695
-					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) {
694
+				foreach ($datasource as $src) {
695
+					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) {
696 696
 						echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>';
697 697
 					} else {
698 698
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
781 781
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
782 782
 					
783
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
783
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
784 784
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
785 785
 					} else {
786 786
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
51 51
 </tr></table></div>
52 52
 <?php
53
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
53
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
54 54
 ?>
55 55
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
56 56
 <?php
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
75 75
 <?php
76 76
 	}
77
-    }
77
+	}
78 78
 ?>
79 79
 
80 80
 <div id="sidebar" class="sidebar collapsed">
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	<li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
86 86
 	<li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
87 87
 <?php
88
-    //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
88
+	//if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
89 89
 	if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) {
90 90
 ?>
91 91
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
92 92
 <?php
93 93
 	}
94
-    //}
94
+	//}
95 95
 ?>
96 96
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
97 97
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 ?>
106 106
 
107 107
 <?php
108
-    if (isset($globalMap3D) && $globalMap3D) {
108
+	if (isset($globalMap3D) && $globalMap3D) {
109 109
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
110 110
 ?>
111 111
 	<li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	<li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
116 116
 <?php
117 117
 	}
118
-    }
118
+	}
119 119
 ?>
120 120
     </ul>
121 121
 
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 		    </div>
276 276
 		</li>
277 277
 		<?php
278
-		    if (isset($globalDemo) && $globalDemo) {
278
+			if (isset($globalDemo) && $globalDemo) {
279 279
 		?>
280 280
 		<li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li>
281 281
 		<?php
282
-		    } else {
282
+			} else {
283 283
 		?>
284 284
 		<li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li>
285 285
 		<?php
286
-		    }
286
+			}
287 287
 		?>
288 288
 	    </ul>
289 289
 	    <ul>
@@ -302,83 +302,83 @@  discard block
 block discarded – undo
302 302
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
303 303
 					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
304 304
 					else $MapType = $_COOKIE['MapType'];
305
-			    ?>
305
+				?>
306 306
 			<select  class="selectpicker" onchange="mapType(this);">
307 307
 			    <?php
308 308
 				} else {
309 309
 					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
310 310
 					else $MapType = $_COOKIE['MapType3D'];
311
-			    ?>
311
+				?>
312 312
 			<select  class="selectpicker" onchange="mapType3D(this);">
313 313
 			    <?php
314 314
 				}
315
-			    ?>
315
+				?>
316 316
 			    <?php
317 317
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
318
-			    ?>
318
+				?>
319 319
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
320 320
 			    <?php
321 321
 				} else {
322
-				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
323
-			    ?>
322
+					if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
323
+				?>
324 324
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
325 325
 			    <?php
326
-				    }
327
-			    ?>
326
+					}
327
+				?>
328 328
 			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
329 329
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
330 330
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
331 331
 			    <?php
332
-				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
333
-			    ?>
332
+					if (isset($globalBingMapKey) && $globalBingMapKey != '') {
333
+				?>
334 334
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
335 335
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
336 336
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
337 337
 			    <?php
338
-				    }
339
-			    ?>
338
+					}
339
+				?>
340 340
 			    <?php
341
-				    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
342
-			    ?>
341
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
342
+				?>
343 343
 			    <?php
344 344
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
345
-			    ?>
345
+				?>
346 346
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
347 347
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
348 348
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
349 349
 			    <?php
350 350
 					}
351
-			    ?>
351
+				?>
352 352
 			    <?php
353 353
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
354
-			    ?>
354
+				?>
355 355
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
356 356
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
357 357
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
358 358
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
359 359
 			    <?php
360 360
 					}
361
-			    ?>
361
+				?>
362 362
 			    <?php
363 363
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
364
-			    ?>
364
+				?>
365 365
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
366 366
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
367 367
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
368 368
 			    <?php
369 369
 					}
370
-			    ?>
370
+				?>
371 371
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
372 372
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
373 373
 			    <?php
374
-				    }
375
-			    ?>
374
+					}
375
+				?>
376 376
 			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
377 377
 			    <?php
378
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
378
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
379 379
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
380 380
 					else $MapBoxId = $_COOKIE['MapTypeId'];
381
-			    ?>
381
+				?>
382 382
 			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
383 383
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
384 384
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
@@ -393,17 +393,17 @@  discard block
 block discarded – undo
393 393
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
394 394
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
395 395
 			    <?php
396
-				    }
397
-			    ?>
396
+					}
397
+				?>
398 398
 			    <!--<option value="OpenSeaMap"<?php if ($MapType == 'OpenSeaMap') print ' selected'; ?>>OpenSeaMap</option>-->
399 399
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
400 400
 			    <?php
401 401
 				}
402
-			    ?>
402
+				?>
403 403
 			</select>
404 404
 		    </li>
405 405
 <?php
406
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
406
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
407 407
 ?>
408 408
 		    <li><?php echo _("Type of Terrain:"); ?>
409 409
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -414,18 +414,18 @@  discard block
 block discarded – undo
414 414
 			</select>
415 415
 		    </li>
416 416
 <?php
417
-    }
417
+	}
418 418
 ?>
419 419
 
420 420
 <?php
421
-    if (isset($globalMap3D) && $globalMap3D) {
421
+	if (isset($globalMap3D) && $globalMap3D) {
422 422
 ?>
423 423
 		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
424 424
 <?php
425
-    }
425
+	}
426 426
 ?>
427 427
 <?php
428
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
428
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
429 429
 ?>
430 430
 		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
431 431
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
449 449
 <?php
450 450
 	}
451
-    }
451
+	}
452 452
 ?>
453 453
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
454 454
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
@@ -467,82 +467,82 @@  discard block
 block discarded – undo
467 467
 	}
468 468
 ?>
469 469
 <?php
470
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
470
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
471 471
 ?>
472 472
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
473 473
 		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
474 474
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
475 475
 		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
476 476
 <?php
477
-    }
478
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
477
+	}
478
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
479 479
 ?>
480 480
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
481 481
 <?php
482
-    }
482
+	}
483 483
 ?>
484 484
 		    <?php
485 485
 			if (function_exists('array_column')) {
486
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
487
-		    ?>
486
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
487
+			?>
488 488
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
489 489
 		    <?php
490
-			    }
490
+				}
491 491
 			} elseif (isset($globalSources)) {
492
-			    $dispolar = false;
493
-			    foreach ($globalSources as $testsource) {
494
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
495
-			    }
496
-			    if ($dispolar) {
497
-		    ?>
492
+				$dispolar = false;
493
+				foreach ($globalSources as $testsource) {
494
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
495
+				}
496
+				if ($dispolar) {
497
+			?>
498 498
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
499 499
 		    <?php
500
-			    }
501
-		        }
502
-		    ?>
500
+				}
501
+				}
502
+			?>
503 503
 <?php
504
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
504
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
505 505
 ?>
506 506
 
507 507
 		    <?php
508 508
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
509
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
510
-		    ?>
509
+					if (extension_loaded('gd') && function_exists('gd_info')) {
510
+			?>
511 511
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
512 512
 		    <?php 
513 513
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
514
-		    ?>
514
+			?>
515 515
 			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
516 516
 		    <?php
517 517
 				}
518
-			    }
519
-		        }
520
-		    ?>
518
+				}
519
+				}
520
+			?>
521 521
 		    <?php
522 522
 			if (isset($globalMarine) && $globalMarine === TRUE) {
523
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
524
-		    ?>
523
+				if (extension_loaded('gd') && function_exists('gd_info')) {
524
+			?>
525 525
 		    <li><?php echo _("Marine icon color:"); ?>
526 526
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
527 527
 		    </li>
528 528
 		    <?php
529
-			    }
530
-		        }
531
-		    ?>
529
+				}
530
+				}
531
+			?>
532 532
 		    <?php
533 533
 			if (isset($globalTracker) && $globalTracker === TRUE) {
534
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
535
-		    ?>
534
+				if (extension_loaded('gd') && function_exists('gd_info')) {
535
+			?>
536 536
 		    <li><?php echo _("Tracker icon color:"); ?>
537 537
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
538 538
 		    </li>
539 539
 		    <?php
540
-			    }
541
-		        }
542
-		    ?>
540
+				}
541
+				}
542
+			?>
543 543
 		    <?php
544 544
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
545
-		    ?>
545
+			?>
546 546
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
547 547
 			<div class="range">
548 548
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -551,9 +551,9 @@  discard block
 block discarded – undo
551 551
 		    </li>
552 552
 		    <?php
553 553
 			}
554
-		    ?>
554
+			?>
555 555
 <?php
556
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
556
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
557 557
 ?>
558 558
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
559 559
 			<div class="range">
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		    </li>
592 592
 <?php
593 593
 	}
594
-    }
594
+	}
595 595
 ?>
596 596
 		    <li><?php echo _("Distance unit:"); ?>
597 597
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -624,19 +624,19 @@  discard block
 block discarded – undo
624 624
 		    <ul>
625 625
 		    <?php
626 626
 			if (!isset($globalAircraft) || $globalAircraft) {
627
-		    ?>
627
+			?>
628 628
 		    <?php
629 629
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
630
-		    ?>
630
+			?>
631 631
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
632 632
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
633 633
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
634 634
 		    <?php
635 635
 			}
636
-		    ?>
636
+			?>
637 637
 		    <?php
638 638
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
639
-		    ?>
639
+			?>
640 640
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
641 641
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
642 642
 			<?php } ?>
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 			<?php } ?>
646 646
 		    <?php
647 647
 			}
648
-		    ?>
648
+			?>
649 649
 		    <li><?php echo _("Display airlines:"); ?>
650 650
 		    <br/>
651 651
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
666 666
 					}
667 667
 				}
668
-			    ?>
668
+				?>
669 669
 			</select>
670 670
 		    </li>
671 671
 		    <?php
672 672
 			$Spotter = new Spotter();
673 673
 			$allalliancenames = $Spotter->getAllAllianceNames();
674 674
 			if (!empty($allalliancenames)) {
675
-		    ?>
675
+			?>
676 676
 		    <li><?php echo _("Display alliance:"); ?>
677 677
 		    <br/>
678 678
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -686,18 +686,18 @@  discard block
 block discarded – undo
686 686
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
687 687
 					}
688 688
 				}
689
-			    ?>
689
+				?>
690 690
 			</select>
691 691
 		    </li>
692 692
 		    <?php
693 693
 			}
694
-		    ?>
694
+			?>
695 695
 		    <?php
696 696
 			}
697
-		    ?>
697
+			?>
698 698
 		    <?php
699 699
 			if (isset($globalAPRS) && $globalAPRS) {
700
-		    ?>
700
+			?>
701 701
 		    <li><?php echo _("Display APRS sources name:"); ?>
702 702
 			<select class="selectpicker" multiple onchange="sources(this);">
703 703
 			    <?php
@@ -721,18 +721,18 @@  discard block
 block discarded – undo
721 721
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
722 722
 					}
723 723
 				}
724
-			    ?>
724
+				?>
725 725
 			</select>
726 726
 		    </li>
727 727
 		    <?php
728 728
 			}
729
-		    ?>
729
+			?>
730 730
 		    <?php
731 731
 			if (!isset($globalAircraft) || $globalAircraft) {
732
-		    ?>
732
+			?>
733 733
 		    <?php
734
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
735
-		    ?>
734
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
735
+			?>
736 736
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
737 737
 			<select class="selectpicker" onchange="airlinestype(this);">
738 738
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -742,14 +742,14 @@  discard block
 block discarded – undo
742 742
 			</select>
743 743
 		    </li>
744 744
 		    <?php
745
-			    }
746
-		    ?>
745
+				}
746
+			?>
747 747
 		    <?php
748 748
 			}
749
-		    ?>
749
+			?>
750 750
 		    <?php
751 751
 			if (isset($globalMarine) && $globalMarine) {
752
-		    ?>
752
+			?>
753 753
 		    <li>
754 754
 			<?php echo _("Display vessels with MMSI:"); ?>
755 755
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 						foreach ($races as $race) {
769 769
 							print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>';
770 770
 						}
771
-			    ?>
771
+				?>
772 772
 			</select>
773 773
 		    </li>
774 774
 
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 					}
777 777
 				}
778 778
 			}
779
-		    ?>
779
+			?>
780 780
 		    <li>
781 781
 			<?php echo _("Display with ident:"); ?>
782 782
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	    </form>
790 790
     	</div>
791 791
 <?php
792
-    if (isset($globalSatellite) && $globalSatellite) {
792
+	if (isset($globalSatellite) && $globalSatellite) {
793 793
 ?>
794 794
         <div class="sidebar-pane" id="satellites">
795 795
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -829,14 +829,14 @@  discard block
 block discarded – undo
829 829
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
830 830
 					}
831 831
 				}
832
-			    ?>
832
+				?>
833 833
 			</select>
834 834
 		    </li>
835 835
 		</ul>
836 836
 	    </form>
837 837
 	</div>
838 838
 <?php
839
-    }
839
+	}
840 840
 ?>
841 841
     </div>
842 842
 </div>
Please login to merge, or discard this patch.
Braces   +558 added lines, -141 removed lines patch added patch discarded remove patch
@@ -52,7 +52,10 @@  discard block
 block discarded – undo
52 52
 <?php
53 53
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
54 54
 ?>
55
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
55
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
56
+	print '?tsk='.$tsk;
57
+}
58
+?>"></script>
56 59
 <?php
57 60
 	if (!isset($globalAircraft) || $globalAircraft) {
58 61
 ?>
@@ -142,7 +145,10 @@  discard block
 block discarded – undo
142 145
 ?>
143 146
 			<h1>Weather</h1>
144 147
 			<ul>
145
-				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display weather on 3D map"); ?></label></div></li>
148
+				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) {
149
+	print 'checked';
150
+}
151
+?> ><?php echo _("Display weather on 3D map"); ?></label></div></li>
146 152
 			</ul>
147 153
 <?php
148 154
 	}
@@ -159,13 +165,22 @@  discard block
 block discarded – undo
159 165
 <?php
160 166
 		if (!isset($globalAircraft) || $globalAircraft) {
161 167
 ?>
162
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
163
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
168
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
169
+	print 'checked';
170
+}
171
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
172
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
173
+	print 'checked';
174
+}
175
+?> /><?php echo _("Display airspace"); ?></label></div></li>
164 176
 <?php
165 177
 		}
166 178
 		if (isset($globalMarine) && $globalMarine) {
167 179
 ?>
168
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="loadOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
180
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="loadOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
181
+	print 'checked';
182
+}
183
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
169 184
 <?php
170 185
 		}
171 186
 ?>
@@ -179,8 +194,14 @@  discard block
 block discarded – undo
179 194
 <?php
180 195
 		if (!isset($globalAircraft) || $globalAircraft) {
181 196
 ?>
182
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
183
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
197
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
198
+	print 'checked';
199
+}
200
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
201
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
202
+	print 'checked';
203
+}
204
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
184 205
 <?php
185 206
 		}
186 207
 ?>
@@ -194,14 +215,32 @@  discard block
 block discarded – undo
194 215
 		<h1>NOTAM</h1>
195 216
 		<form>
196 217
 			<ul>
197
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
218
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
219
+	print 'checked';
220
+}
221
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
198 222
 				<li><?php echo _("NOTAM scope:"); ?>
199 223
 					<select class="selectpicker" onchange="notamscope(this);">
200
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
201
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
202
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
203
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
204
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
224
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
225
+	print ' selected';
226
+}
227
+?>>All</option>
228
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
229
+	print ' selected';
230
+}
231
+?>>Airport/Enroute warning</option>
232
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
233
+	print ' selected';
234
+}
235
+?>>Airport warning</option>
236
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
237
+	print ' selected';
238
+}
239
+?>>Navigation warning</option>
240
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
241
+	print ' selected';
242
+}
243
+?>>Enroute warning</option>
205 244
 					</select
206 245
 				</li>
207 246
 			</ul>
@@ -229,7 +268,10 @@  discard block
 block discarded – undo
229 268
 		    <div class="form-group">
230 269
 			<label><?php echo _("From:"); ?></label>
231 270
 			<div class='input-group date' id='datetimepicker1'>
232
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
271
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
272
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC';
273
+}
274
+?>" required />
233 275
 			    <span class="input-group-addon">
234 276
 				<span class="glyphicon glyphicon-calendar"></span>
235 277
 			    </span>
@@ -238,7 +280,10 @@  discard block
 block discarded – undo
238 280
 		    <div class="form-group">
239 281
 			<label><?php echo _("To:"); ?></label>
240 282
 			<div class='input-group date' id='datetimepicker2'>
241
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
283
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') {
284
+	print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC';
285
+}
286
+?>" />
242 287
 			    <span class="input-group-addon">
243 288
 				<span class="glyphicon glyphicon-calendar"></span>
244 289
 			    </span>
@@ -270,8 +315,20 @@  discard block
 block discarded – undo
270 315
 		    </script>
271 316
 		<li><?php echo _("Playback speed:"); ?>
272 317
 		    <div class="range">
273
-			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
274
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
318
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
319
+	print $_POST['archivespeed'];
320
+} elseif (isset($_COOKIE['archive_speed'])) {
321
+	print $_COOKIE['archive_speed'];
322
+} else {
323
+	print '1';
324
+}
325
+?>">
326
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
327
+	print $_COOKIE['archive_speed'];
328
+} else {
329
+	print '1';
330
+}
331
+?></output>
275 332
 		    </div>
276 333
 		</li>
277 334
 		<?php
@@ -300,14 +357,20 @@  discard block
 block discarded – undo
300 357
 		    <li><?php echo _("Type of Map:"); ?>
301 358
 			    <?php
302 359
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
303
-					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
304
-					else $MapType = $_COOKIE['MapType'];
360
+					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
361
+						$MapType = $globalMapProvider;
362
+					} else {
363
+						$MapType = $_COOKIE['MapType'];
364
+					}
305 365
 			    ?>
306 366
 			<select  class="selectpicker" onchange="mapType(this);">
307 367
 			    <?php
308 368
 				} else {
309
-					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
310
-					else $MapType = $_COOKIE['MapType3D'];
369
+					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') {
370
+						$MapType = $globalMapProvider;
371
+					} else {
372
+						$MapType = $_COOKIE['MapType3D'];
373
+					}
311 374
 			    ?>
312 375
 			<select  class="selectpicker" onchange="mapType3D(this);">
313 376
 			    <?php
@@ -316,24 +379,48 @@  discard block
 block discarded – undo
316 379
 			    <?php
317 380
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
318 381
 			    ?>
319
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
382
+			    <option value="offline"<?php if ($MapType == 'offline') {
383
+	print ' selected';
384
+}
385
+?>>Natural Earth (local)</option>
320 386
 			    <?php
321 387
 				} else {
322 388
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
323 389
 			    ?>
324
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
390
+			    <option value="offline"<?php if ($MapType == 'offline') {
391
+	print ' selected';
392
+}
393
+?>>Natural Earth (local)</option>
325 394
 			    <?php
326 395
 				    }
327 396
 			    ?>
328
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
329
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
330
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
397
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
398
+	print ' selected';
399
+}
400
+?>>ArcGIS Streetmap</option>
401
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
402
+	print ' selected';
403
+}
404
+?>>ArcGIS Satellite</option>
405
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') {
406
+	print ' selected';
407
+}
408
+?>>ArcGIS Ocean</option>
331 409
 			    <?php
332 410
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
333 411
 			    ?>
334
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
335
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
336
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
412
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
413
+	print ' selected';
414
+}
415
+?>>Bing-Aerial</option>
416
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
417
+	print ' selected';
418
+}
419
+?>>Bing-Hybrid</option>
420
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
421
+	print ' selected';
422
+}
423
+?>>Bing-Road</option>
337 424
 			    <?php
338 425
 				    }
339 426
 			    ?>
@@ -343,60 +430,147 @@  discard block
 block discarded – undo
343 430
 			    <?php
344 431
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
345 432
 			    ?>
346
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
347
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
348
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
433
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
434
+	print ' selected';
435
+}
436
+?>>Here-Aerial</option>
437
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
438
+	print ' selected';
439
+}
440
+?>>Here-Hybrid</option>
441
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
442
+	print ' selected';
443
+}
444
+?>>Here-Road</option>
349 445
 			    <?php
350 446
 					}
351 447
 			    ?>
352 448
 			    <?php
353 449
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
354 450
 			    ?>
355
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
356
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
357
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
358
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
451
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
452
+	print ' selected';
453
+}
454
+?>>Google Roadmap</option>
455
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
456
+	print ' selected';
457
+}
458
+?>>Google Satellite</option>
459
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
460
+	print ' selected';
461
+}
462
+?>>Google Hybrid</option>
463
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
464
+	print ' selected';
465
+}
466
+?>>Google Terrain</option>
359 467
 			    <?php
360 468
 					}
361 469
 			    ?>
362 470
 			    <?php
363 471
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
364 472
 			    ?>
365
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
366
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
367
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
473
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
474
+	print ' selected';
475
+}
476
+?>>MapQuest-OSM</option>
477
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
478
+	print ' selected';
479
+}
480
+?>>MapQuest-Aerial</option>
481
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
482
+	print ' selected';
483
+}
484
+?>>MapQuest-Hybrid</option>
368 485
 			    <?php
369 486
 					}
370 487
 			    ?>
371
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
372
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
488
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
489
+	print ' selected';
490
+}
491
+?>>Yandex</option>
492
+			    <option value="offline"<?php if ($MapType == 'offline') {
493
+	print ' selected';
494
+}
495
+?>>Natural Earth</option>
373 496
 			    <?php
374 497
 				    }
375 498
 			    ?>
376
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
499
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
500
+	print ' selected';
501
+}
502
+?>>National Geographic Street</option>
377 503
 			    <?php
378 504
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
379
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
380
-					else $MapBoxId = $_COOKIE['MapTypeId'];
505
+					if (!isset($_COOKIE['MapTypeId'])) {
506
+						$MapBoxId = 'default';
507
+					} else {
508
+						$MapBoxId = $_COOKIE['MapTypeId'];
509
+					}
381 510
 			    ?>
382
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
383
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
384
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
385
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
386
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
387
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
388
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
389
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
390
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
391
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
392
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
393
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
394
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
511
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
512
+	print ' selected';
513
+}
514
+?>>Mapbox GL</option>
515
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
516
+	print ' selected';
517
+}
518
+?>>Mapbox default</option>
519
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
520
+	print ' selected';
521
+}
522
+?>>Mapbox streets</option>
523
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
524
+	print ' selected';
525
+}
526
+?>>Mapbox light</option>
527
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
528
+	print ' selected';
529
+}
530
+?>>Mapbox dark</option>
531
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
532
+	print ' selected';
533
+}
534
+?>>Mapbox satellite</option>
535
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
536
+	print ' selected';
537
+}
538
+?>>Mapbox streets-satellite</option>
539
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
540
+	print ' selected';
541
+}
542
+?>>Mapbox streets-basic</option>
543
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
544
+	print ' selected';
545
+}
546
+?>>Mapbox comic</option>
547
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
548
+	print ' selected';
549
+}
550
+?>>Mapbox outdoors</option>
551
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
552
+	print ' selected';
553
+}
554
+?>>Mapbox pencil</option>
555
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
556
+	print ' selected';
557
+}
558
+?>>Mapbox pirates</option>
559
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
560
+	print ' selected';
561
+}
562
+?>>Mapbox emerald</option>
395 563
 			    <?php
396 564
 				    }
397 565
 			    ?>
398
-			    <!--<option value="OpenSeaMap"<?php if ($MapType == 'OpenSeaMap') print ' selected'; ?>>OpenSeaMap</option>-->
399
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
566
+			    <!--<option value="OpenSeaMap"<?php if ($MapType == 'OpenSeaMap') {
567
+	print ' selected';
568
+}
569
+?>>OpenSeaMap</option>-->
570
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
571
+	print ' selected';
572
+}
573
+?>>OpenStreetMap</option>
400 574
 			    <?php
401 575
 				}
402 576
 			    ?>
@@ -407,10 +581,22 @@  discard block
 block discarded – undo
407 581
 ?>
408 582
 		    <li><?php echo _("Type of Terrain:"); ?>
409 583
 			<select  class="selectpicker" onchange="terrainType(this);">
410
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
411
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
412
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
413
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
584
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
585
+	print ' selected';
586
+}
587
+?>>stk terrain</option>
588
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
589
+	print ' selected';
590
+}
591
+?>>ellipsoid</option>
592
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
593
+	print ' selected';
594
+}
595
+?>>vr terrain</option>
596
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
597
+	print ' selected';
598
+}
599
+?>>ArticDEM</option>
414 600
 			</select>
415 601
 		    </li>
416 602
 <?php
@@ -420,59 +606,116 @@  discard block
 block discarded – undo
420 606
 <?php
421 607
     if (isset($globalMap3D) && $globalMap3D) {
422 608
 ?>
423
-		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
609
+		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') {
610
+	print 'checked';
611
+}
612
+?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
424 613
 <?php
425 614
     }
426 615
 ?>
427 616
 <?php
428 617
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
429 618
 ?>
430
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
619
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
620
+	print 'checked';
621
+}
622
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
431 623
 
432 624
 <?php
433 625
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
434 626
 ?>
435
-		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
436
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
437
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
438
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
439
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
627
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
628
+	print 'checked';
629
+}
630
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
631
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
632
+	print 'checked';
633
+}
634
+?> ><?php echo _("Display flight path"); ?></label></div></li>
635
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) {
636
+	print 'checked';
637
+}
638
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
639
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
640
+	print 'checked';
641
+}
642
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
643
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
644
+	print 'checked';
645
+}
646
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
440 647
 <?php
441 648
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
442 649
 ?>
443
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
650
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
651
+	print 'checked';
652
+}
653
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
444 654
 <?php
445 655
 	}
446 656
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
447 657
 ?>
448
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
658
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
659
+	print 'checked';
660
+}
661
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
449 662
 <?php
450 663
 	}
451 664
     }
452 665
 ?>
453
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
454
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
455
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
456
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
666
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
667
+	print 'checked';
668
+}
669
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
670
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
671
+	print 'checked';
672
+}
673
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
674
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
675
+	print 'checked';
676
+}
677
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
678
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
679
+	print 'checked';
680
+}
681
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
457 682
 <?php
458 683
 	if (isset($globalFires)) {
459 684
 ?>
460
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
685
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
686
+	print 'checked';
687
+}
688
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
461 689
 <?php
462 690
 	}
463 691
 	if (isset($globalMap3D) && $globalMap3D) {
464 692
 ?>
465
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
693
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') {
694
+	print 'checked';
695
+}
696
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
466 697
 <?php
467 698
 	}
468 699
 ?>
469 700
 <?php
470 701
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
471 702
 ?>
472
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
473
-		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
474
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
475
-		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
703
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
704
+	print 'checked';
705
+}
706
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
707
+		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) {
708
+	print 'checked';
709
+}
710
+?> ><?php echo _("Use shadows"); ?></label></div></li>
711
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
712
+	print 'checked';
713
+}
714
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
715
+		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) {
716
+	print 'checked';
717
+}
718
+?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
476 719
 <?php
477 720
     }
478 721
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -485,17 +728,25 @@  discard block
 block discarded – undo
485 728
 			if (function_exists('array_column')) {
486 729
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
487 730
 		    ?>
488
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
731
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
732
+	print 'checked';
733
+}
734
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
489 735
 		    <?php
490 736
 			    }
491 737
 			} elseif (isset($globalSources)) {
492 738
 			    $dispolar = false;
493 739
 			    foreach ($globalSources as $testsource) {
494
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
740
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
741
+			        	$dispolar = true;
742
+			        }
495 743
 			    }
496 744
 			    if ($dispolar) {
497 745
 		    ?>
498
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
746
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
747
+	print 'checked';
748
+}
749
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
499 750
 		    <?php
500 751
 			    }
501 752
 		        }
@@ -508,11 +759,21 @@  discard block
 block discarded – undo
508 759
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
509 760
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
510 761
 		    ?>
511
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
762
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
763
+	print 'checked';
764
+}
765
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
512 766
 		    <?php 
513 767
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
514 768
 		    ?>
515
-			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
769
+			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
770
+	print $_COOKIE['IconColor'];
771
+} elseif (isset($globalAircraftIconColor)) {
772
+	print $globalAircraftIconColor;
773
+} else {
774
+	print '1a3151';
775
+}
776
+?>"></li>
516 777
 		    <?php
517 778
 				}
518 779
 			    }
@@ -523,7 +784,14 @@  discard block
 block discarded – undo
523 784
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
524 785
 		    ?>
525 786
 		    <li><?php echo _("Marine icon color:"); ?>
526
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
787
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
788
+	print $_COOKIE['MarineIconColor'];
789
+} elseif (isset($globalMarineIconColor)) {
790
+	print $globalMarineIconColor;
791
+} else {
792
+	print '1a3151';
793
+}
794
+?>">
527 795
 		    </li>
528 796
 		    <?php
529 797
 			    }
@@ -534,7 +802,14 @@  discard block
 block discarded – undo
534 802
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
535 803
 		    ?>
536 804
 		    <li><?php echo _("Tracker icon color:"); ?>
537
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
805
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
806
+	print $_COOKIE['TrackerIconColor'];
807
+} elseif (isset($globalTrackerIconColor)) {
808
+	print $globalTrackerIconColor;
809
+} else {
810
+	print '1a3151';
811
+}
812
+?>">
538 813
 		    </li>
539 814
 		    <?php
540 815
 			    }
@@ -545,8 +820,22 @@  discard block
 block discarded – undo
545 820
 		    ?>
546 821
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
547 822
 			<div class="range">
548
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
549
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
823
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
824
+	print $_COOKIE['AirportZoom'];
825
+} elseif (isset($globalAirportZoom)) {
826
+	print $globalAirportZoom;
827
+} else {
828
+	print '7';
829
+}
830
+?>">
831
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
832
+	print $_COOKIE['AirportZoom'];
833
+} elseif (isset($globalAirportZoom)) {
834
+	print $globalAirportZoom;
835
+} else {
836
+	print '7';
837
+}
838
+?></output>
550 839
 			</div>
551 840
 		    </li>
552 841
 		    <?php
@@ -557,17 +846,40 @@  discard block
 block discarded – undo
557 846
 ?>
558 847
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
559 848
 			<div class="range">
560
-			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>">
561
-			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output>
849
+			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) {
850
+	print $_COOKIE['resolutionScale'];
851
+} else {
852
+	print '1';
853
+}
854
+?>">
855
+			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) {
856
+	print $_COOKIE['resolutionScale'];
857
+} else {
858
+	print '1';
859
+}
860
+?></output>
562 861
 			</div>
563 862
 		    </li>
564 863
 <?php
565 864
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
566 865
 ?>
567
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li>
568
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
866
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
867
+	print 'checked';
868
+}
869
+?> > <?php echo _("Use airlines liveries"); ?></li>
870
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
871
+	print 'checked';
872
+}
873
+?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
569 874
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
570
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
875
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
876
+	print $_COOKIE['IconColor'];
877
+} elseif (isset($globalAircraftIconColor)) {
878
+	print $globalAircraftIconColor;
879
+} else {
880
+	print 'ff0000';
881
+}
882
+?>">
571 883
 		    </li>
572 884
 <?php
573 885
 	}
@@ -575,9 +887,19 @@  discard block
 block discarded – undo
575 887
 <?php
576 888
 	if (isset($globalMarine) && $globalMarine === TRUE) {
577 889
 ?>
578
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
890
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
891
+	print 'checked';
892
+}
893
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
579 894
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
580
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
895
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
896
+	print $_COOKIE['MarineIconColor'];
897
+} elseif (isset($globalMarineIconColor)) {
898
+	print $globalMarineIconColor;
899
+} else {
900
+	print 'ff0000';
901
+}
902
+?>">
581 903
 		    </li>
582 904
 <?php
583 905
 	}
@@ -585,9 +907,19 @@  discard block
 block discarded – undo
585 907
 <?php
586 908
 	if (isset($globalTracker) && $globalTracker === TRUE) {
587 909
 ?>
588
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
910
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
911
+	print 'checked';
912
+}
913
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
589 914
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
590
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
915
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
916
+	print $_COOKIE['TrackerIconColor'];
917
+} elseif (isset($globalTrackerIconColor)) {
918
+	print $globalTrackerIconColor;
919
+} else {
920
+	print 'ff0000';
921
+}
922
+?>">
591 923
 		    </li>
592 924
 <?php
593 925
 	}
@@ -595,22 +927,46 @@  discard block
 block discarded – undo
595 927
 ?>
596 928
 		    <li><?php echo _("Distance unit:"); ?>
597 929
 			<select class="selectpicker" onchange="unitdistance(this);">
598
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
599
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
600
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
930
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
931
+	echo ' selected';
932
+}
933
+?>>km</option>
934
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
935
+	echo ' selected';
936
+}
937
+?>>nm</option>
938
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
939
+	echo ' selected';
940
+}
941
+?>>mi</option>
601 942
 		        </select>
602 943
 		    </li>
603 944
 		    <li><?php echo _("Altitude unit:"); ?>
604 945
 			<select class="selectpicker" onchange="unitaltitude(this);">
605
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
606
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
946
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
947
+	echo ' selected';
948
+}
949
+?>>m</option>
950
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
951
+	echo ' selected';
952
+}
953
+?>>feet</option>
607 954
 		        </select>
608 955
 		    </li>
609 956
 		    <li><?php echo _("Speed unit:"); ?>
610 957
 			<select class="selectpicker" onchange="unitspeed(this);">
611
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
612
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
613
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
958
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
959
+	echo ' selected';
960
+}
961
+?>>km/h</option>
962
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
963
+	echo ' selected';
964
+}
965
+?>>mph</option>
966
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
967
+	echo ' selected';
968
+}
969
+?>>knots</option>
614 970
 		        </select>
615 971
 		    </li>
616 972
 
@@ -628,9 +984,18 @@  discard block
 block discarded – undo
628 984
 		    <?php
629 985
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
630 986
 		    ?>
631
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
632
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
633
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
987
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
988
+	print 'checked';
989
+}
990
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
991
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
992
+	print 'checked';
993
+}
994
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
995
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
996
+	print 'checked';
997
+}
998
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
634 999
 		    <?php
635 1000
 			}
636 1001
 		    ?>
@@ -638,10 +1003,16 @@  discard block
 block discarded – undo
638 1003
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
639 1004
 		    ?>
640 1005
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
641
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
1006
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
1007
+	print 'checked';
1008
+}
1009
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
642 1010
 			<?php } ?>
643 1011
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
644
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
1012
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
1013
+	print 'checked';
1014
+}
1015
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
645 1016
 			<?php } ?>
646 1017
 		    <?php
647 1018
 			}
@@ -658,7 +1029,9 @@  discard block
 block discarded – undo
658 1029
 				}
659 1030
 				foreach($allairlinenames as $airline) {
660 1031
 					$airline_name = $airline['airline_name'];
661
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
1032
+					if (strlen($airline_name) > 30) {
1033
+						$airline_name = substr($airline_name,0,30).'...';
1034
+					}
662 1035
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
663 1036
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
664 1037
 					} else {
@@ -676,7 +1049,10 @@  discard block
 block discarded – undo
676 1049
 		    <li><?php echo _("Display alliance:"); ?>
677 1050
 		    <br/>
678 1051
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
679
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
1052
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
1053
+	echo ' selected';
1054
+}
1055
+?>><?php echo _("All"); ?></option>
680 1056
 			    <?php
681 1057
 				foreach($allalliancenames as $alliance) {
682 1058
 					$alliance_name = $alliance['alliance'];
@@ -735,10 +1111,22 @@  discard block
 block discarded – undo
735 1111
 		    ?>
736 1112
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
737 1113
 			<select class="selectpicker" onchange="airlinestype(this);">
738
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
739
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
740
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
741
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1114
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1115
+	echo ' selected';
1116
+}
1117
+?>><?php echo _("All"); ?></option>
1118
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1119
+	echo ' selected';
1120
+}
1121
+?>><?php echo _("Passenger"); ?></option>
1122
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1123
+	echo ' selected';
1124
+}
1125
+?>><?php echo _("Cargo"); ?></option>
1126
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1127
+	echo ' selected';
1128
+}
1129
+?>><?php echo _("Military"); ?></option>
742 1130
 			</select>
743 1131
 		    </li>
744 1132
 		    <?php
@@ -752,7 +1140,10 @@  discard block
 block discarded – undo
752 1140
 		    ?>
753 1141
 		    <li>
754 1142
 			<?php echo _("Display vessels with MMSI:"); ?>
755
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1143
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1144
+	print $_COOKIE['filter_mmsi'];
1145
+}
1146
+?>" />
756 1147
 		    </li>
757 1148
 			<?php
758 1149
 				if (isset($globalVM) && $globalVM) {
@@ -779,7 +1170,10 @@  discard block
 block discarded – undo
779 1170
 		    ?>
780 1171
 		    <li>
781 1172
 			<?php echo _("Display with ident:"); ?>
782
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1173
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1174
+	print $_COOKIE['filter_ident'];
1175
+}
1176
+?>" />
783 1177
 		    </li>
784 1178
 		</ul>
785 1179
 	    </form>
@@ -795,7 +1189,10 @@  discard block
 block discarded – undo
795 1189
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
796 1190
 	    <form>
797 1191
 		<ul>
798
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1192
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1193
+	print 'checked';
1194
+}
1195
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
799 1196
 		    <li><?php echo _("Type:"); ?>
800 1197
 			<select class="selectpicker" multiple onchange="sattypes(this);">
801 1198
 			    <?php
@@ -803,25 +1200,45 @@  discard block
 block discarded – undo
803 1200
 				$types = $Satellite->get_tle_types();
804 1201
 				foreach ($types as $type) {
805 1202
 					$type_name = $type['tle_type'];
806
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
807
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
808
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
809
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
810
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
811
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
812
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
813
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
814
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
815
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
816
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
817
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
818
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
819
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
820
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
821
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
822
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
823
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
824
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1203
+					if ($type_name == 'musson') {
1204
+						$type_name = 'Russian LEO Navigation';
1205
+					} else if ($type_name == 'nnss') {
1206
+						$type_name = 'Navi Navigation Satellite System';
1207
+					} else if ($type_name == 'sbas') {
1208
+						$type_name = 'Satellite-Based Augmentation System';
1209
+					} else if ($type_name == 'glo-ops') {
1210
+						$type_name = 'Glonass Operational';
1211
+					} else if ($type_name == 'gps-ops') {
1212
+						$type_name = 'GPS Operational';
1213
+					} else if ($type_name == 'argos') {
1214
+						$type_name = 'ARGOS Data Collection System';
1215
+					} else if ($type_name == 'tdrss') {
1216
+						$type_name = 'Tracking and Data Relay Satellite System';
1217
+					} else if ($type_name == 'sarsat') {
1218
+						$type_name = 'Search & Rescue';
1219
+					} else if ($type_name == 'dmc') {
1220
+						$type_name = 'Disaster Monitoring';
1221
+					} else if ($type_name == 'resource') {
1222
+						$type_name = 'Earth Resources';
1223
+					} else if ($type_name == 'stations') {
1224
+						$type_name = 'Space Stations';
1225
+					} else if ($type_name == 'geo') {
1226
+						$type_name = 'Geostationary';
1227
+					} else if ($type_name == 'amateur') {
1228
+						$type_name = 'Amateur Radio';
1229
+					} else if ($type_name == 'x-comm') {
1230
+						$type_name = 'Experimental';
1231
+					} else if ($type_name == 'other-comm') {
1232
+						$type_name = 'Other Comm';
1233
+					} else if ($type_name == 'science') {
1234
+						$type_name = 'Space & Earth Science';
1235
+					} else if ($type_name == 'military') {
1236
+						$type_name = 'Miscellaneous Military';
1237
+					} else if ($type_name == 'radar') {
1238
+						$type_name = 'Radar Calibration';
1239
+					} else if ($type_name == 'tle-new') {
1240
+						$type_name = 'Last 30 days launches';
1241
+					}
825 1242
 					
826 1243
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
827 1244
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
require/class.Marine.php 4 patches
Doc Comments   +3 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
@@ -694,25 +694,6 @@  discard block
 block discarded – undo
694 694
 	*
695 695
 	* @param String $fammarine_id the ID
696 696
 	* @param String $ident the marine ident
697
-	* @param String $departure_airport_icao the departure airport
698
-	* @param String $arrival_airport_icao the arrival airport
699
-	* @param String $latitude latitude of flight
700
-	* @param String $longitude latitude of flight
701
-	* @param String $waypoints waypoints of flight
702
-	* @param String $heading heading of flight
703
-	* @param String $groundspeed speed of flight
704
-	* @param String $date date of flight
705
-	* @param String $departure_airport_time departure time of flight
706
-	* @param String $arrival_airport_time arrival time of flight
707
-	* @param String $squawk squawk code of flight
708
-	* @param String $route_stop route stop of flight
709
-	* @param String $highlight highlight or not
710
-	* @param String $ModeS ModesS code of flight
711
-	* @param String $registration registration code of flight
712
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
713
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
714
-	* @param String $verticalrate vertival rate of flight
715
-	* @return String success or false
716 697
 	*/
717 698
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '')
718 699
 	{
@@ -1310,6 +1291,7 @@  discard block
 block discarded – undo
1310 1291
 	/**
1311 1292
 	* Counts all hours
1312 1293
 	*
1294
+	* @param string $orderby
1313 1295
 	* @return Array the hour list
1314 1296
 	*
1315 1297
 	*/
@@ -1661,7 +1643,7 @@  discard block
 block discarded – undo
1661 1643
 	/**
1662 1644
 	* Parses the direction degrees to working
1663 1645
 	*
1664
-	* @param Float $direction the direction in degrees
1646
+	* @param integer $direction the direction in degrees
1665 1647
 	* @return Array the direction information
1666 1648
 	*
1667 1649
 	*/
Please login to merge, or discard this patch.
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 
90 90
 	/**
91
-	* Executes the SQL statements to get the spotter information
92
-	*
93
-	* @param String $query the SQL query
94
-	* @param Array $params parameter of the query
95
-	* @param String $limitQuery the limit query
96
-	* @return Array the spotter information
97
-	*
98
-	*/
91
+	 * Executes the SQL statements to get the spotter information
92
+	 *
93
+	 * @param String $query the SQL query
94
+	 * @param Array $params parameter of the query
95
+	 * @param String $limitQuery the limit query
96
+	 * @return Array the spotter information
97
+	 *
98
+	 */
99 99
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
100 100
 	{
101 101
 		date_default_timezone_set('UTC');
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	
231 231
 	
232 232
 	/**
233
-	* Gets all the spotter information based on the latest data entry
234
-	*
235
-	* @return Array the spotter information
236
-	*
237
-	*/
233
+	 * Gets all the spotter information based on the latest data entry
234
+	 *
235
+	 * @return Array the spotter information
236
+	 *
237
+	 */
238 238
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
239 239
 	{
240 240
 		global $global_query;
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 	}
284 284
 
285 285
 	/**
286
-	* Gets all the spotter information based on the callsign
287
-	*
288
-	* @return Array the spotter information
289
-	*
290
-	*/
286
+	 * Gets all the spotter information based on the callsign
287
+	 *
288
+	 * @return Array the spotter information
289
+	 *
290
+	 */
291 291
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
292 292
 	{
293 293
 		global $global_query;
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 	}
340 340
 
341 341
 	/**
342
-	* Gets all the marine information based on the type
343
-	*
344
-	* @return Array the marine information
345
-	*
346
-	*/
342
+	 * Gets all the marine information based on the type
343
+	 *
344
+	 * @return Array the marine information
345
+	 *
346
+	 */
347 347
 	public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array())
348 348
 	{
349 349
 		global $global_query;
@@ -451,12 +451,12 @@  discard block
 block discarded – undo
451 451
 
452 452
 
453 453
 	/**
454
-	* Gets all source name
455
-	*
456
-	* @param String type format of source
457
-	* @return Array list of source name
458
-	*
459
-	*/
454
+	 * Gets all source name
455
+	 *
456
+	 * @param String type format of source
457
+	 * @return Array list of source name
458
+	 *
459
+	 */
460 460
 	public function getAllSourceName($type = '',$filters = array())
461 461
 	{
462 462
 		$filter_query = $this->getFilter($filters,true,true);
@@ -486,11 +486,11 @@  discard block
 block discarded – undo
486 486
 
487 487
 
488 488
 	/**
489
-	* Gets a list of all idents/callsigns
490
-	*
491
-	* @return Array list of ident/callsign names
492
-	*
493
-	*/
489
+	 * Gets a list of all idents/callsigns
490
+	 *
491
+	 * @return Array list of ident/callsign names
492
+	 *
493
+	 */
494 494
 	public function getAllIdents($filters = array())
495 495
 	{
496 496
 		$filter_query = $this->getFilter($filters,true,true);
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 	}
515 515
 
516 516
 	/**
517
-	* Gets all info from a mmsi
518
-	*
519
-	* @return Array ident
520
-	*
521
-	*/
517
+	 * Gets all info from a mmsi
518
+	 *
519
+	 * @return Array ident
520
+	 *
521
+	 */
522 522
 	public function getIdentity($mmsi)
523 523
 	{
524 524
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
 	}
532 532
 
533 533
 	/**
534
-	* Add identity
535
-	*
536
-	*/
534
+	 * Add identity
535
+	 *
536
+	 */
537 537
 	public function addIdentity($mmsi,$imo,$ident,$callsign,$type)
538 538
 	{
539 539
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -599,13 +599,13 @@  discard block
 block discarded – undo
599 599
 	}
600 600
 
601 601
 	/**
602
-	* Update ident tracker data
603
-	*
604
-	* @param String $fammarine_id the ID
605
-	* @param String $ident the marine ident
606
-	* @return String success or false
607
-	*
608
-	*/
602
+	 * Update ident tracker data
603
+	 *
604
+	 * @param String $fammarine_id the ID
605
+	 * @param String $ident the marine ident
606
+	 * @return String success or false
607
+	 *
608
+	 */
609 609
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
610 610
 	{
611 611
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 	}
621 621
 
622 622
 	/**
623
-	* Update arrival marine data
624
-	*
625
-	* @param String $fammarine_id the ID
626
-	* @param String $arrival_code the marine ident
627
-	* @return String success or false
628
-	*
629
-	*/
623
+	 * Update arrival marine data
624
+	 *
625
+	 * @param String $fammarine_id the ID
626
+	 * @param String $arrival_code the marine ident
627
+	 * @return String success or false
628
+	 *
629
+	 */
630 630
 	public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL)
631 631
 	{
632 632
 		$query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id';
@@ -641,19 +641,19 @@  discard block
 block discarded – undo
641 641
 	}
642 642
 
643 643
 	/**
644
-	* Update Status data
645
-	*
646
-	* @param String $fammarine_id the ID
647
-	* @param String $status_id the marine status id
648
-	* @param String $status the marine status
649
-	* @return String success or false
650
-	*
651
-	*/
644
+	 * Update Status data
645
+	 *
646
+	 * @param String $fammarine_id the ID
647
+	 * @param String $status_id the marine status id
648
+	 * @param String $status the marine status
649
+	 * @return String success or false
650
+	 *
651
+	 */
652 652
 	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
653 653
 	{
654 654
 
655 655
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
656
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
656
+				$query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
657 657
 
658 658
 		try {
659 659
 			$sth = $this->db->prepare($query);
@@ -666,17 +666,17 @@  discard block
 block discarded – undo
666 666
 
667 667
 	}
668 668
 	/**
669
-	* Update latest marine data
670
-	*
671
-	* @param String $fammarine_id the ID
672
-	* @param String $ident the marine ident
673
-	* @return String success or false
674
-	*
675
-	*/	
669
+	 * Update latest marine data
670
+	 *
671
+	 * @param String $fammarine_id the ID
672
+	 * @param String $ident the marine ident
673
+	 * @return String success or false
674
+	 *
675
+	 */	
676 676
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
677 677
 	{
678 678
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
679
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
679
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
680 680
 
681 681
 		try {
682 682
 			$sth = $this->db->prepare($query);
@@ -690,30 +690,30 @@  discard block
 block discarded – undo
690 690
 	}
691 691
 
692 692
 	/**
693
-	* Adds a new spotter data
694
-	*
695
-	* @param String $fammarine_id the ID
696
-	* @param String $ident the marine ident
697
-	* @param String $departure_airport_icao the departure airport
698
-	* @param String $arrival_airport_icao the arrival airport
699
-	* @param String $latitude latitude of flight
700
-	* @param String $longitude latitude of flight
701
-	* @param String $waypoints waypoints of flight
702
-	* @param String $heading heading of flight
703
-	* @param String $groundspeed speed of flight
704
-	* @param String $date date of flight
705
-	* @param String $departure_airport_time departure time of flight
706
-	* @param String $arrival_airport_time arrival time of flight
707
-	* @param String $squawk squawk code of flight
708
-	* @param String $route_stop route stop of flight
709
-	* @param String $highlight highlight or not
710
-	* @param String $ModeS ModesS code of flight
711
-	* @param String $registration registration code of flight
712
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
713
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
714
-	* @param String $verticalrate vertival rate of flight
715
-	* @return String success or false
716
-	*/
693
+	 * Adds a new spotter data
694
+	 *
695
+	 * @param String $fammarine_id the ID
696
+	 * @param String $ident the marine ident
697
+	 * @param String $departure_airport_icao the departure airport
698
+	 * @param String $arrival_airport_icao the arrival airport
699
+	 * @param String $latitude latitude of flight
700
+	 * @param String $longitude latitude of flight
701
+	 * @param String $waypoints waypoints of flight
702
+	 * @param String $heading heading of flight
703
+	 * @param String $groundspeed speed of flight
704
+	 * @param String $date date of flight
705
+	 * @param String $departure_airport_time departure time of flight
706
+	 * @param String $arrival_airport_time arrival time of flight
707
+	 * @param String $squawk squawk code of flight
708
+	 * @param String $route_stop route stop of flight
709
+	 * @param String $highlight highlight or not
710
+	 * @param String $ModeS ModesS code of flight
711
+	 * @param String $registration registration code of flight
712
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
713
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
714
+	 * @param String $verticalrate vertival rate of flight
715
+	 * @return String success or false
716
+	 */
717 717
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '')
718 718
 	{
719 719
 		global $globalURL, $globalMarineImageFetch;
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 			$sth->execute($query_values);
833 833
 			$this->db = null;
834 834
 		} catch (PDOException $e) {
835
-		    return "error : ".$e->getMessage();
835
+			return "error : ".$e->getMessage();
836 836
 		}
837 837
 		
838 838
 		return "success";
@@ -841,11 +841,11 @@  discard block
 block discarded – undo
841 841
 	
842 842
   
843 843
 	/**
844
-	* Gets the aircraft ident within the last hour
845
-	*
846
-	* @return String the ident
847
-	*
848
-	*/
844
+	 * Gets the aircraft ident within the last hour
845
+	 *
846
+	 * @return String the ident
847
+	 *
848
+	 */
849 849
 	public function getIdentFromLastHour($ident)
850 850
 	{
851 851
 		global $globalDBdriver, $globalTimezone;
@@ -861,11 +861,11 @@  discard block
 block discarded – undo
861 861
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
862 862
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
863 863
 			$query_data = array(':ident' => $ident);
864
-    		}
864
+			}
865 865
 		
866 866
 		$sth = $this->db->prepare($query);
867 867
 		$sth->execute($query_data);
868
-    		$ident_result='';
868
+			$ident_result='';
869 869
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
870 870
 		{
871 871
 			$ident_result = $row['ident'];
@@ -876,11 +876,11 @@  discard block
 block discarded – undo
876 876
 	
877 877
 	
878 878
 	/**
879
-	* Gets the aircraft data from the last 20 seconds
880
-	*
881
-	* @return Array the spotter data
882
-	*
883
-	*/
879
+	 * Gets the aircraft data from the last 20 seconds
880
+	 *
881
+	 * @return Array the spotter data
882
+	 *
883
+	 */
884 884
 	public function getRealTimeData($q = '')
885 885
 	{
886 886
 		global $globalDBdriver;
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
 	
919 919
 
920 920
 	/**
921
-	* Gets all number of flight over countries
922
-	*
923
-	* @return Array the airline country list
924
-	*
925
-	*/
921
+	 * Gets all number of flight over countries
922
+	 *
923
+	 * @return Array the airline country list
924
+	 *
925
+	 */
926 926
 
927 927
 	public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
928 928
 	{
@@ -995,11 +995,11 @@  discard block
 block discarded – undo
995 995
 	
996 996
 	
997 997
 	/**
998
-	* Gets all callsigns that have flown over
999
-	*
1000
-	* @return Array the callsign list
1001
-	*
1002
-	*/
998
+	 * Gets all callsigns that have flown over
999
+	 *
1000
+	 * @return Array the callsign list
1001
+	 *
1002
+	 */
1003 1003
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
1004 1004
 	{
1005 1005
 		global $globalDBdriver;
@@ -1066,11 +1066,11 @@  discard block
 block discarded – undo
1066 1066
 
1067 1067
 
1068 1068
 	/**
1069
-	* Counts all dates
1070
-	*
1071
-	* @return Array the date list
1072
-	*
1073
-	*/
1069
+	 * Counts all dates
1070
+	 *
1071
+	 * @return Array the date list
1072
+	 *
1073
+	 */
1074 1074
 	public function countAllDates($filters = array())
1075 1075
 	{
1076 1076
 		global $globalTimezone, $globalDBdriver;
@@ -1116,11 +1116,11 @@  discard block
 block discarded – undo
1116 1116
 	
1117 1117
 	
1118 1118
 	/**
1119
-	* Counts all dates during the last 7 days
1120
-	*
1121
-	* @return Array the date list
1122
-	*
1123
-	*/
1119
+	 * Counts all dates during the last 7 days
1120
+	 *
1121
+	 * @return Array the date list
1122
+	 *
1123
+	 */
1124 1124
 	public function countAllDatesLast7Days($filters = array())
1125 1125
 	{
1126 1126
 		global $globalTimezone, $globalDBdriver;
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
 			$query .= " GROUP BY date_name 
1143 1143
 								ORDER BY date_name ASC";
1144 1144
 			$query_data = array(':offset' => $offset);
1145
-    		}
1145
+			}
1146 1146
 		
1147 1147
 		$sth = $this->db->prepare($query);
1148 1148
 		$sth->execute($query_data);
@@ -1162,11 +1162,11 @@  discard block
 block discarded – undo
1162 1162
 	}
1163 1163
 
1164 1164
 	/**
1165
-	* Counts all dates during the last month
1166
-	*
1167
-	* @return Array the date list
1168
-	*
1169
-	*/
1165
+	 * Counts all dates during the last month
1166
+	 *
1167
+	 * @return Array the date list
1168
+	 *
1169
+	 */
1170 1170
 	public function countAllDatesLastMonth($filters = array())
1171 1171
 	{
1172 1172
 		global $globalTimezone, $globalDBdriver;
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 			$query .= " GROUP BY date_name 
1189 1189
 								ORDER BY date_name ASC";
1190 1190
 			$query_data = array(':offset' => $offset);
1191
-    		}
1191
+			}
1192 1192
 		
1193 1193
 		$sth = $this->db->prepare($query);
1194 1194
 		$sth->execute($query_data);
@@ -1210,11 +1210,11 @@  discard block
 block discarded – undo
1210 1210
 
1211 1211
 
1212 1212
 	/**
1213
-	* Counts all month
1214
-	*
1215
-	* @return Array the month list
1216
-	*
1217
-	*/
1213
+	 * Counts all month
1214
+	 *
1215
+	 * @return Array the month list
1216
+	 *
1217
+	 */
1218 1218
 	public function countAllMonths($filters = array())
1219 1219
 	{
1220 1220
 		global $globalTimezone, $globalDBdriver;
@@ -1259,11 +1259,11 @@  discard block
 block discarded – undo
1259 1259
 	
1260 1260
 
1261 1261
 	/**
1262
-	* Counts all dates during the last year
1263
-	*
1264
-	* @return Array the date list
1265
-	*
1266
-	*/
1262
+	 * Counts all dates during the last year
1263
+	 *
1264
+	 * @return Array the date list
1265
+	 *
1266
+	 */
1267 1267
 	public function countAllMonthsLastYear($filters)
1268 1268
 	{
1269 1269
 		global $globalTimezone, $globalDBdriver;
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 			$query .= " GROUP BY year_name, month_name
1286 1286
 								ORDER BY year_name, month_name ASC";
1287 1287
 			$query_data = array(':offset' => $offset);
1288
-    		}
1288
+			}
1289 1289
 		
1290 1290
 		$sth = $this->db->prepare($query);
1291 1291
 		$sth->execute($query_data);
@@ -1308,11 +1308,11 @@  discard block
 block discarded – undo
1308 1308
 	
1309 1309
 	
1310 1310
 	/**
1311
-	* Counts all hours
1312
-	*
1313
-	* @return Array the hour list
1314
-	*
1315
-	*/
1311
+	 * Counts all hours
1312
+	 *
1313
+	 * @return Array the hour list
1314
+	 *
1315
+	 */
1316 1316
 	public function countAllHours($orderby,$filters = array())
1317 1317
 	{
1318 1318
 		global $globalTimezone, $globalDBdriver;
@@ -1375,11 +1375,11 @@  discard block
 block discarded – undo
1375 1375
 	
1376 1376
 	
1377 1377
 	/**
1378
-	* Counts all hours by date
1379
-	*
1380
-	* @return Array the hour list
1381
-	*
1382
-	*/
1378
+	 * Counts all hours by date
1379
+	 *
1380
+	 * @return Array the hour list
1381
+	 *
1382
+	 */
1383 1383
 	public function countAllHoursByDate($date, $filters = array())
1384 1384
 	{
1385 1385
 		global $globalTimezone, $globalDBdriver;
@@ -1423,11 +1423,11 @@  discard block
 block discarded – undo
1423 1423
 	
1424 1424
 	
1425 1425
 	/**
1426
-	* Counts all hours by a ident/callsign
1427
-	*
1428
-	* @return Array the hour list
1429
-	*
1430
-	*/
1426
+	 * Counts all hours by a ident/callsign
1427
+	 *
1428
+	 * @return Array the hour list
1429
+	 *
1430
+	 */
1431 1431
 	public function countAllHoursByIdent($ident, $filters = array())
1432 1432
 	{
1433 1433
 		global $globalTimezone, $globalDBdriver;
@@ -1472,11 +1472,11 @@  discard block
 block discarded – undo
1472 1472
 	
1473 1473
 	
1474 1474
 	/**
1475
-	* Counts all vessels
1476
-	*
1477
-	* @return Integer the number of vessels
1478
-	*
1479
-	*/
1475
+	 * Counts all vessels
1476
+	 *
1477
+	 * @return Integer the number of vessels
1478
+	 *
1479
+	 */
1480 1480
 	public function countOverallMarine($filters = array(),$year = '',$month = '')
1481 1481
 	{
1482 1482
 		global $globalDBdriver;
@@ -1511,11 +1511,11 @@  discard block
 block discarded – undo
1511 1511
 	}
1512 1512
 	
1513 1513
 	/**
1514
-	* Counts all vessel type
1515
-	*
1516
-	* @return Integer the number of vessels
1517
-	*
1518
-	*/
1514
+	 * Counts all vessel type
1515
+	 *
1516
+	 * @return Integer the number of vessels
1517
+	 *
1518
+	 */
1519 1519
 	public function countOverallMarineTypes($filters = array(),$year = '',$month = '')
1520 1520
 	{
1521 1521
 		global $globalDBdriver;
@@ -1550,11 +1550,11 @@  discard block
 block discarded – undo
1550 1550
 	
1551 1551
   
1552 1552
 	/**
1553
-	* Counts all hours of today
1554
-	*
1555
-	* @return Array the hour list
1556
-	*
1557
-	*/
1553
+	 * Counts all hours of today
1554
+	 *
1555
+	 * @return Array the hour list
1556
+	 *
1557
+	 */
1558 1558
 	public function countAllHoursFromToday($filters = array())
1559 1559
 	{
1560 1560
 		global $globalTimezone, $globalDBdriver;
@@ -1594,12 +1594,12 @@  discard block
 block discarded – undo
1594 1594
 	}
1595 1595
     
1596 1596
     
1597
-     /**
1598
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1599
-	*
1600
-	* @return Integer the Barrie Spotter ID
1597
+	 /**
1598
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1599
+	  *
1600
+	  * @return Integer the Barrie Spotter ID
1601 1601
 q	*
1602
-	*/
1602
+	  */
1603 1603
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1604 1604
 	{
1605 1605
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1620,13 +1620,13 @@  discard block
 block discarded – undo
1620 1620
   
1621 1621
  
1622 1622
 	/**
1623
-	* Parses a date string
1624
-	*
1625
-	* @param String $dateString the date string
1626
-	* @param String $timezone the timezone of a user
1627
-	* @return Array the time information
1628
-	*
1629
-	*/
1623
+	 * Parses a date string
1624
+	 *
1625
+	 * @param String $dateString the date string
1626
+	 * @param String $timezone the timezone of a user
1627
+	 * @return Array the time information
1628
+	 *
1629
+	 */
1630 1630
 	public function parseDateString($dateString, $timezone = '')
1631 1631
 	{
1632 1632
 		$time_array = array();
@@ -1659,12 +1659,12 @@  discard block
 block discarded – undo
1659 1659
 	}
1660 1660
 	
1661 1661
 	/**
1662
-	* Parses the direction degrees to working
1663
-	*
1664
-	* @param Float $direction the direction in degrees
1665
-	* @return Array the direction information
1666
-	*
1667
-	*/
1662
+	 * Parses the direction degrees to working
1663
+	 *
1664
+	 * @param Float $direction the direction in degrees
1665
+	 * @return Array the direction information
1666
+	 *
1667
+	 */
1668 1668
 	public function parseDirection($direction = 0)
1669 1669
 	{
1670 1670
 		if ($direction == '') $direction = 0;
@@ -1743,12 +1743,12 @@  discard block
 block discarded – undo
1743 1743
 	
1744 1744
 	
1745 1745
 	/**
1746
-	* Gets Country from latitude/longitude
1747
-	*
1748
-	* @param Float $latitude latitute of the flight
1749
-	* @param Float $longitude longitute of the flight
1750
-	* @return String the countrie
1751
-	*/
1746
+	 * Gets Country from latitude/longitude
1747
+	 *
1748
+	 * @param Float $latitude latitute of the flight
1749
+	 * @param Float $longitude longitute of the flight
1750
+	 * @return String the countrie
1751
+	 */
1752 1752
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1753 1753
 	{
1754 1754
 		global $globalDBdriver, $globalDebug;
@@ -1785,11 +1785,11 @@  discard block
 block discarded – undo
1785 1785
 	}
1786 1786
 
1787 1787
 	/**
1788
-	* Gets Country from iso2
1789
-	*
1790
-	* @param String $iso2 ISO2 country code
1791
-	* @return String the countrie
1792
-	*/
1788
+	 * Gets Country from iso2
1789
+	 *
1790
+	 * @param String $iso2 ISO2 country code
1791
+	 * @return String the countrie
1792
+	 */
1793 1793
 	public function getCountryFromISO2($iso2)
1794 1794
 	{
1795 1795
 		global $globalDBdriver, $globalDebug;
@@ -1818,12 +1818,12 @@  discard block
 block discarded – undo
1818 1818
 
1819 1819
 	
1820 1820
 	/**
1821
-	* Gets the short url from bit.ly
1822
-	*
1823
-	* @param String $url the full url
1824
-	* @return String the bit.ly url
1825
-	*
1826
-	*/
1821
+	 * Gets the short url from bit.ly
1822
+	 *
1823
+	 * @param String $url the full url
1824
+	 * @return String the bit.ly url
1825
+	 *
1826
+	 */
1827 1827
 	public function getBitlyURL($url)
1828 1828
 	{
1829 1829
 		global $globalBitlyAccessToken;
@@ -1850,11 +1850,11 @@  discard block
 block discarded – undo
1850 1850
 
1851 1851
 	
1852 1852
 	/**
1853
-	* Gets all vessels types that have flown over
1854
-	*
1855
-	* @return Array the vessel type list
1856
-	*
1857
-	*/
1853
+	 * Gets all vessels types that have flown over
1854
+	 *
1855
+	 * @return Array the vessel type list
1856
+	 *
1857
+	 */
1858 1858
 	public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1859 1859
 	{
1860 1860
 		global $globalDBdriver;
@@ -1920,11 +1920,11 @@  discard block
 block discarded – undo
1920 1920
 	}
1921 1921
 
1922 1922
 	/**
1923
-	* Gets all the tracker information
1924
-	*
1925
-	* @return Array the tracker information
1926
-	*
1927
-	*/
1923
+	 * Gets all the tracker information
1924
+	 *
1925
+	 * @return Array the tracker information
1926
+	 *
1927
+	 */
1928 1928
 	public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1929 1929
 	{
1930 1930
 		global $globalTimezone, $globalDBdriver;
Please login to merge, or discard this patch.
Spacing   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once(dirname(__FILE__).'/class.Image.php');
3 3
 $global_query = "SELECT marine_output.* FROM marine_output";
4 4
 
5
-class Marine{
5
+class Marine {
6 6
 	public $db;
7 7
 	
8 8
 	public function __construct($dbc = null) {
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 	* @return Array the SQL part
18 18
 	*/
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 spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id";
39
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.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'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id";
41
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.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']."'";
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
82 82
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
83 83
 		if ($filter_query_where != '') {
84
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
84
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
85 85
 		}
86 86
 		$filter_query = $filter_query_join.$filter_query_where;
87 87
 		return $filter_query;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	* @return Array the spotter information
97 97
 	*
98 98
 	*/
99
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
99
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
100 100
 	{
101 101
 		date_default_timezone_set('UTC');
102 102
 		if (!is_string($query))
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 			$sth = $this->db->prepare($query.$limitQuery);
117 117
 			$sth->execute($params);
118 118
 		} catch (PDOException $e) {
119
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
119
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
120 120
 			exit();
121 121
 		}
122 122
 		
123 123
 		$num_rows = 0;
124 124
 		$spotter_array = array();
125
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
125
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
126 126
 		{
127 127
 			$num_rows++;
128 128
 			$temp_array = array();
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 			}
162 162
 			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
163 163
 
164
-			if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "")
164
+			if (isset($temp_array['mmsi']) && $temp_array['mmsi'] != "")
165 165
 			{
166 166
 				$Image = new Image($this->db);
167
-				if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']);
167
+				if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']);
168 168
 				else $image_array = $Image->getMarineImage($temp_array['mmsi']);
169 169
 				unset($Image);
170 170
 				if (count($image_array) > 0) {
@@ -200,17 +200,17 @@  discard block
 block discarded – undo
200 200
 				{
201 201
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
202 202
 				} else {
203
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
203
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
204 204
 				}
205 205
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
206
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
207
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
206
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
207
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
208 208
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
209 209
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
210 210
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
211 211
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
212
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
213
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
212
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
213
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
214 214
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
215 215
 					}
216 216
 				}
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 		if ($limit != "")
244 244
 		{
245 245
 			$limit_array = explode(",", $limit);
246
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
247
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
246
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
247
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
248 248
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
249 249
 			{
250 250
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 		} else {
259 259
 			$orderby_query = " ORDER BY marine_output.date DESC";
260 260
 		}
261
-		$query  = $global_query.$filter_query." ".$orderby_query;
262
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
261
+		$query = $global_query.$filter_query." ".$orderby_query;
262
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
263 263
 		return $spotter_array;
264 264
 	}
265 265
     
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 		if ($id == '') return array();
278 278
 		$additional_query = "marine_output.fammarine_id = :id";
279 279
 		$query_values = array(':id' => $id);
280
-		$query  = $global_query." WHERE ".$additional_query." ";
281
-		$spotter_array = $this->getDataFromDB($query,$query_values);
280
+		$query = $global_query." WHERE ".$additional_query." ";
281
+		$spotter_array = $this->getDataFromDB($query, $query_values);
282 282
 		return $spotter_array;
283 283
 	}
284 284
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		$query_values = array();
298 298
 		$limit_query = '';
299 299
 		$additional_query = '';
300
-		$filter_query = $this->getFilter($filter,true,true);
300
+		$filter_query = $this->getFilter($filter, true, true);
301 301
 		if ($ident != "")
302 302
 		{
303 303
 			if (!is_string($ident))
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 		{
314 314
 			$limit_array = explode(",", $limit);
315 315
 			
316
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
317
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
316
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
317
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
318 318
 			
319 319
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
320 320
 			{
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		$query_values = array();
354 354
 		$limit_query = '';
355 355
 		$additional_query = '';
356
-		$filter_query = $this->getFilter($filter,true,true);
356
+		$filter_query = $this->getFilter($filter, true, true);
357 357
 		if (!is_string($type))
358 358
 		{
359 359
 			return false;
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 		{
367 367
 			$limit_array = explode(",", $limit);
368 368
 			
369
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
370
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
369
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
370
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
371 371
 			
372 372
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
373 373
 			{
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 		return $spotter_array;
392 392
 	}
393 393
 	
394
-	public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array())
394
+	public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array())
395 395
 	{
396 396
 		global $global_query, $globalTimezone, $globalDBdriver;
397 397
 		
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 		$limit_query = '';
400 400
 		$additional_query = '';
401 401
 
402
-		$filter_query = $this->getFilter($filter,true,true);
402
+		$filter_query = $this->getFilter($filter, true, true);
403 403
 		
404 404
 		if ($date != "")
405 405
 		{
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 		{
426 426
 			$limit_array = explode(",", $limit);
427 427
 			
428
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
429
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
428
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
429
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
430 430
 			
431 431
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
432 432
 			{
@@ -457,11 +457,11 @@  discard block
 block discarded – undo
457 457
 	* @return Array list of source name
458 458
 	*
459 459
 	*/
460
-	public function getAllSourceName($type = '',$filters = array())
460
+	public function getAllSourceName($type = '', $filters = array())
461 461
 	{
462
-		$filter_query = $this->getFilter($filters,true,true);
462
+		$filter_query = $this->getFilter($filters, true, true);
463 463
 		$query_values = array();
464
-		$query  = "SELECT DISTINCT marine_output.source_name 
464
+		$query = "SELECT DISTINCT marine_output.source_name 
465 465
 				FROM marine_output".$filter_query." marine_output.source_name <> ''";
466 466
 		if ($type != '') {
467 467
 			$query_values = array(':type' => $type);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		$source_array = array();
477 477
 		$temp_array = array();
478 478
 		
479
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
479
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
480 480
 		{
481 481
 			$temp_array['source_name'] = $row['source_name'];
482 482
 			$source_array[] = $temp_array;
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	*/
494 494
 	public function getAllIdents($filters = array())
495 495
 	{
496
-		$filter_query = $this->getFilter($filters,true,true);
497
-		$query  = "SELECT DISTINCT marine_output.ident
496
+		$filter_query = $this->getFilter($filters, true, true);
497
+		$query = "SELECT DISTINCT marine_output.ident
498 498
 								FROM marine_output".$filter_query." marine_output.ident <> '' 
499 499
 								ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0";
500 500
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		$ident_array = array();
505 505
 		$temp_array = array();
506 506
 		
507
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
507
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
508 508
 		{
509 509
 			$temp_array['ident'] = $row['ident'];
510 510
 			$ident_array[] = $temp_array;
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 	*/
522 522
 	public function getIdentity($mmsi)
523 523
 	{
524
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
524
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
525 525
 		$query  = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1";
526 526
 		$sth = $this->db->prepare($query);
527 527
 		$sth->execute(array(':mmsi' => $mmsi));
@@ -534,23 +534,23 @@  discard block
 block discarded – undo
534 534
 	* Add identity
535 535
 	*
536 536
 	*/
537
-	public function addIdentity($mmsi,$imo,$ident,$callsign,$type)
537
+	public function addIdentity($mmsi, $imo, $ident, $callsign, $type)
538 538
 	{
539
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
539
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
540 540
 		if ($mmsi != '') {
541
-			$imo = filter_var($imo,FILTER_SANITIZE_NUMBER_INT);
542
-			$ident = filter_var($ident,FILTER_SANITIZE_STRING);
543
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
544
-			$type = filter_var($type,FILTER_SANITIZE_STRING);
541
+			$imo = filter_var($imo, FILTER_SANITIZE_NUMBER_INT);
542
+			$ident = filter_var($ident, FILTER_SANITIZE_STRING);
543
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
544
+			$type = filter_var($type, FILTER_SANITIZE_STRING);
545 545
 			$identinfo = $this->getIdentity($mmsi);
546 546
 			if (empty($identinfo)) {
547
-				$query  = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)";
547
+				$query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)";
548 548
 				$sth = $this->db->prepare($query);
549
-				$sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':call_sign' => $callsign,':ship_name' => $ident,':type' => $type));
549
+				$sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':call_sign' => $callsign, ':ship_name' => $ident, ':type' => $type));
550 550
 			} elseif ($ident != '' && $identinfo['ship_name'] != $ident) {
551
-				$query  = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi";
551
+				$query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi";
552 552
 				$sth = $this->db->prepare($query);
553
-				$sth->execute(array(':mmsi' => $mmsi,':ship_name' => $ident,':type' => $type));
553
+				$sth->execute(array(':mmsi' => $mmsi, ':ship_name' => $ident, ':type' => $type));
554 554
 			}
555 555
 		}
556 556
 	}
@@ -571,12 +571,12 @@  discard block
 block discarded – undo
571 571
 		} else $offset = '+00:00';
572 572
 
573 573
 		if ($globalDBdriver == 'mysql') {
574
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date
574
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date
575 575
 								FROM marine_output
576 576
 								WHERE marine_output.date <> '' 
577 577
 								ORDER BY marine_output.date ASC LIMIT 0,100";
578 578
 		} else {
579
-			$query  = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
579
+			$query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
580 580
 								FROM marine_output
581 581
 								WHERE marine_output.date <> '' 
582 582
 								ORDER BY marine_output.date ASC LIMIT 0,100";
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 		$date_array = array();
589 589
 		$temp_array = array();
590 590
 		
591
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
591
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
592 592
 		{
593 593
 			$temp_array['date'] = $row['date'];
594 594
 
@@ -606,10 +606,10 @@  discard block
 block discarded – undo
606 606
 	* @return String success or false
607 607
 	*
608 608
 	*/
609
-	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
609
+	public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL)
610 610
 	{
611 611
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
612
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
612
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident);
613 613
 		try {
614 614
 			$sth = $this->db->prepare($query);
615 615
 			$sth->execute($query_values);
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 	* @return String success or false
628 628
 	*
629 629
 	*/
630
-	public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL)
630
+	public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '', $fromsource = NULL)
631 631
 	{
632 632
 		$query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id';
633
-		$query_values = array(':fammarine_id' => $fammarine_id,':arrival_code' => $arrival_code);
633
+		$query_values = array(':fammarine_id' => $fammarine_id, ':arrival_code' => $arrival_code);
634 634
 		try {
635 635
 			$sth = $this->db->prepare($query);
636 636
 			$sth->execute($query_values);
@@ -649,11 +649,11 @@  discard block
 block discarded – undo
649 649
 	* @return String success or false
650 650
 	*
651 651
 	*/
652
-	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
652
+	public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '')
653 653
 	{
654 654
 
655 655
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
656
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
656
+                $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id);
657 657
 
658 658
 		try {
659 659
 			$sth = $this->db->prepare($query);
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
677 677
 	{
678 678
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
679
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
679
+                $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident);
680 680
 
681 681
 		try {
682 682
 			$sth = $this->db->prepare($query);
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 	* @param String $verticalrate vertival rate of flight
715 715
 	* @return String success or false
716 716
 	*/
717
-	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '')
717
+	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $format_source = '', $source_name = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '')
718 718
 	{
719 719
 		global $globalURL, $globalMarineImageFetch;
720 720
 		
@@ -781,36 +781,36 @@  discard block
 block discarded – undo
781 781
 		}
782 782
 
783 783
     
784
-		if ($date == "" || strtotime($date) < time()-20*60)
784
+		if ($date == "" || strtotime($date) < time() - 20*60)
785 785
 		{
786 786
 			$date = date("Y-m-d H:i:s", time());
787 787
 		}
788 788
 
789
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
790
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
791
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
792
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
793
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
794
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
795
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
796
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING);
797
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
798
-		$status = filter_var($status,FILTER_SANITIZE_STRING);
799
-		$type_id = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT);
800
-		$status_id = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT);
801
-		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
802
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
803
-		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
804
-		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
805
-		$captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING);
806
-		$captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING);
807
-		$race_id = filter_var($race_id,FILTER_SANITIZE_STRING);
808
-		$race_name = filter_var($race_name,FILTER_SANITIZE_STRING);
789
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
790
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
791
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
792
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
793
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
794
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
795
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
796
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING);
797
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
798
+		$status = filter_var($status, FILTER_SANITIZE_STRING);
799
+		$type_id = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT);
800
+		$status_id = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT);
801
+		$imo = filter_var($imo, FILTER_SANITIZE_STRING);
802
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
803
+		$arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING);
804
+		$arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING);
805
+		$captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING);
806
+		$captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING);
807
+		$race_id = filter_var($race_id, FILTER_SANITIZE_STRING);
808
+		$race_name = filter_var($race_name, FILTER_SANITIZE_STRING);
809 809
 		if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) {
810 810
 			$Image = new Image($this->db);
811
-			$image_array = $Image->getMarineImage($mmsi,$imo,$ident);
811
+			$image_array = $Image->getMarineImage($mmsi, $imo, $ident);
812 812
 			if (!isset($image_array[0]['mmsi'])) {
813
-				$Image->addMarineImage($mmsi,$imo,$ident);
813
+				$Image->addMarineImage($mmsi, $imo, $ident);
814 814
 			}
815 815
 			unset($Image);
816 816
 		}
@@ -823,10 +823,10 @@  discard block
 block discarded – undo
823 823
 		if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
824 824
 		if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
825 825
 		if ($arrival_date == '') $arrival_date = NULL;
826
-		$query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) 
826
+		$query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) 
827 827
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name)";
828 828
 
829
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':type_id' => $type_id,':status' => $status,':status_id' => $status_id,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name);
829
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':type_id' => $type_id, ':status' => $status, ':status_id' => $status_id, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name);
830 830
 		try {
831 831
 			$sth = $this->db->prepare($query);
832 832
 			$sth->execute($query_values);
@@ -850,13 +850,13 @@  discard block
 block discarded – undo
850 850
 	{
851 851
 		global $globalDBdriver, $globalTimezone;
852 852
 		if ($globalDBdriver == 'mysql') {
853
-			$query  = "SELECT marine_output.ident FROM marine_output 
853
+			$query = "SELECT marine_output.ident FROM marine_output 
854 854
 								WHERE marine_output.ident = :ident 
855 855
 								AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
856 856
 								AND marine_output.date < UTC_TIMESTAMP()";
857 857
 			$query_data = array(':ident' => $ident);
858 858
 		} else {
859
-			$query  = "SELECT marine_output.ident FROM marine_output 
859
+			$query = "SELECT marine_output.ident FROM marine_output 
860 860
 								WHERE marine_output.ident = :ident 
861 861
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
862 862
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
@@ -865,8 +865,8 @@  discard block
 block discarded – undo
865 865
 		
866 866
 		$sth = $this->db->prepare($query);
867 867
 		$sth->execute($query_data);
868
-    		$ident_result='';
869
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
868
+    		$ident_result = '';
869
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
870 870
 		{
871 871
 			$ident_result = $row['ident'];
872 872
 		}
@@ -892,8 +892,8 @@  discard block
 block discarded – undo
892 892
 				return false;
893 893
 			} else {
894 894
 				$q_array = explode(" ", $q);
895
-				foreach ($q_array as $q_item){
896
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
895
+				foreach ($q_array as $q_item) {
896
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
897 897
 					$additional_query .= " AND (";
898 898
 					$additional_query .= "(marine_output.ident like '%".$q_item."%')";
899 899
 					$additional_query .= ")";
@@ -901,11 +901,11 @@  discard block
 block discarded – undo
901 901
 			}
902 902
 		}
903 903
 		if ($globalDBdriver == 'mysql') {
904
-			$query  = "SELECT marine_output.* FROM marine_output 
904
+			$query = "SELECT marine_output.* FROM marine_output 
905 905
 				WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
906 906
 				AND marine_output.date < UTC_TIMESTAMP()";
907 907
 		} else {
908
-			$query  = "SELECT marine_output.* FROM marine_output 
908
+			$query = "SELECT marine_output.* FROM marine_output 
909 909
 				WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
910 910
 				AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
911 911
 		}
@@ -924,16 +924,16 @@  discard block
 block discarded – undo
924 924
 	*
925 925
 	*/
926 926
 
927
-	public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
927
+	public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
928 928
 	{
929 929
 		global $globalDBdriver, $globalArchive;
930 930
 		//$filter_query = $this->getFilter($filters,true,true);
931
-		$Connection= new Connection($this->db);
931
+		$Connection = new Connection($this->db);
932 932
 		if (!$Connection->tableExists('countries')) return array();
933 933
 		require_once('class.SpotterLive.php');
934 934
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
935 935
 			$MarineLive = new MarineLive($this->db);
936
-			$filter_query = $MarineLive->getFilter($filters,true,true);
936
+			$filter_query = $MarineLive->getFilter($filters, true, true);
937 937
 			$filter_query .= " over_country IS NOT NULL AND over_country <> ''";
938 938
 			if ($olderthanmonths > 0) {
939 939
 				if ($globalDBdriver == 'mysql') {
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 		} else {
954 954
 			require_once(dirname(__FILE__)."/class.MarineArchive.php");
955 955
 			$MarineArchive = new MarineArchive($this->db);
956
-			$filter_query = $MarineArchive->getFilter($filters,true,true);
956
+			$filter_query = $MarineArchive->getFilter($filters, true, true);
957 957
 			$filter_query .= " over_country <> ''";
958 958
 			if ($olderthanmonths > 0) {
959 959
 				if ($globalDBdriver == 'mysql') {
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 		$flight_array = array();
982 982
 		$temp_array = array();
983 983
         
984
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
984
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
985 985
 		{
986 986
 			$temp_array['marine_count'] = $row['nb'];
987 987
 			$temp_array['marine_country'] = $row['name'];
@@ -1000,11 +1000,11 @@  discard block
 block discarded – undo
1000 1000
 	* @return Array the callsign list
1001 1001
 	*
1002 1002
 	*/
1003
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
1003
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
1004 1004
 	{
1005 1005
 		global $globalDBdriver;
1006
-		$filter_query = $this->getFilter($filters,true,true);
1007
-		$query  = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count 
1006
+		$filter_query = $this->getFilter($filters, true, true);
1007
+		$query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count 
1008 1008
                     FROM marine_output".$filter_query." marine_output.ident <> ''";
1009 1009
 		 if ($olderthanmonths > 0) {
1010 1010
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -1018,28 +1018,28 @@  discard block
 block discarded – undo
1018 1018
 		if ($year != '') {
1019 1019
 			if ($globalDBdriver == 'mysql') {
1020 1020
 				$query .= " AND YEAR(marine_output.date) = :year";
1021
-				$query_values = array_merge($query_values,array(':year' => $year));
1021
+				$query_values = array_merge($query_values, array(':year' => $year));
1022 1022
 			} else {
1023 1023
 				$query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year";
1024
-				$query_values = array_merge($query_values,array(':year' => $year));
1024
+				$query_values = array_merge($query_values, array(':year' => $year));
1025 1025
 			}
1026 1026
 		}
1027 1027
 		if ($month != '') {
1028 1028
 			if ($globalDBdriver == 'mysql') {
1029 1029
 				$query .= " AND MONTH(marine_output.date) = :month";
1030
-				$query_values = array_merge($query_values,array(':month' => $month));
1030
+				$query_values = array_merge($query_values, array(':month' => $month));
1031 1031
 			} else {
1032 1032
 				$query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month";
1033
-				$query_values = array_merge($query_values,array(':month' => $month));
1033
+				$query_values = array_merge($query_values, array(':month' => $month));
1034 1034
 			}
1035 1035
 		}
1036 1036
 		if ($day != '') {
1037 1037
 			if ($globalDBdriver == 'mysql') {
1038 1038
 				$query .= " AND DAY(marine_output.date) = :day";
1039
-				$query_values = array_merge($query_values,array(':day' => $day));
1039
+				$query_values = array_merge($query_values, array(':day' => $day));
1040 1040
 			} else {
1041 1041
 				$query .= " AND EXTRACT(DAY FROM marine_output.date) = :day";
1042
-				$query_values = array_merge($query_values,array(':day' => $day));
1042
+				$query_values = array_merge($query_values, array(':day' => $day));
1043 1043
 			}
1044 1044
 		}
1045 1045
 		$query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC";
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 		$callsign_array = array();
1052 1052
 		$temp_array = array();
1053 1053
         
1054
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1054
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1055 1055
 		{
1056 1056
 			$temp_array['callsign_icao'] = $row['ident'];
1057 1057
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 		$date_array = array();
1104 1104
 		$temp_array = array();
1105 1105
         
1106
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1106
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1107 1107
 		{
1108 1108
 			$temp_array['date_name'] = $row['date_name'];
1109 1109
 			$temp_array['date_count'] = $row['date_count'];
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 			$datetime = new DateTime();
1130 1130
 			$offset = $datetime->format('P');
1131 1131
 		} else $offset = '+00:00';
1132
-		$filter_query = $this->getFilter($filters,true,true);
1132
+		$filter_query = $this->getFilter($filters, true, true);
1133 1133
 		if ($globalDBdriver == 'mysql') {
1134 1134
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
1135 1135
 								FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 		$date_array = array();
1151 1151
 		$temp_array = array();
1152 1152
         
1153
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1153
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1154 1154
 		{
1155 1155
 			$temp_array['date_name'] = $row['date_name'];
1156 1156
 			$temp_array['date_count'] = $row['date_count'];
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
 			$datetime = new DateTime();
1176 1176
 			$offset = $datetime->format('P');
1177 1177
 		} else $offset = '+00:00';
1178
-		$filter_query = $this->getFilter($filters,true,true);
1178
+		$filter_query = $this->getFilter($filters, true, true);
1179 1179
 		if ($globalDBdriver == 'mysql') {
1180 1180
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
1181 1181
 								FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 		$date_array = array();
1197 1197
 		$temp_array = array();
1198 1198
         
1199
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1199
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1200 1200
 		{
1201 1201
 			$temp_array['date_name'] = $row['date_name'];
1202 1202
 			$temp_array['date_count'] = $row['date_count'];
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
 		$date_array = array();
1244 1244
 		$temp_array = array();
1245 1245
         
1246
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1246
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1247 1247
 		{
1248 1248
 			$temp_array['month_name'] = $row['month_name'];
1249 1249
 			$temp_array['year_name'] = $row['year_name'];
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 			$datetime = new DateTime();
1273 1273
 			$offset = $datetime->format('P');
1274 1274
 		} else $offset = '+00:00';
1275
-		$filter_query = $this->getFilter($filters,true,true);
1275
+		$filter_query = $this->getFilter($filters, true, true);
1276 1276
 		if ($globalDBdriver == 'mysql') {
1277 1277
 			$query  = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
1278 1278
 								FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 		$date_array = array();
1294 1294
 		$temp_array = array();
1295 1295
         
1296
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1296
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1297 1297
 		{
1298 1298
 			$temp_array['year_name'] = $row['year_name'];
1299 1299
 			$temp_array['month_name'] = $row['month_name'];
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 	* @return Array the hour list
1314 1314
 	*
1315 1315
 	*/
1316
-	public function countAllHours($orderby,$filters = array())
1316
+	public function countAllHours($orderby, $filters = array())
1317 1317
 	{
1318 1318
 		global $globalTimezone, $globalDBdriver;
1319 1319
 		if ($globalTimezone != '') {
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 		$hour_array = array();
1362 1362
 		$temp_array = array();
1363 1363
         
1364
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1364
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1365 1365
 		{
1366 1366
 			$temp_array['hour_name'] = $row['hour_name'];
1367 1367
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1383,8 +1383,8 @@  discard block
 block discarded – undo
1383 1383
 	public function countAllHoursByDate($date, $filters = array())
1384 1384
 	{
1385 1385
 		global $globalTimezone, $globalDBdriver;
1386
-		$filter_query = $this->getFilter($filters,true,true);
1387
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
1386
+		$filter_query = $this->getFilter($filters, true, true);
1387
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
1388 1388
 		if ($globalTimezone != '') {
1389 1389
 			date_default_timezone_set($globalTimezone);
1390 1390
 			$datetime = new DateTime($date);
@@ -1392,12 +1392,12 @@  discard block
 block discarded – undo
1392 1392
 		} else $offset = '+00:00';
1393 1393
 
1394 1394
 		if ($globalDBdriver == 'mysql') {
1395
-			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1395
+			$query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1396 1396
 								FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date
1397 1397
 								GROUP BY hour_name 
1398 1398
 								ORDER BY hour_name ASC";
1399 1399
 		} else {
1400
-			$query  = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1400
+			$query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1401 1401
 								FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
1402 1402
 								GROUP BY hour_name 
1403 1403
 								ORDER BY hour_name ASC";
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 		$hour_array = array();
1410 1410
 		$temp_array = array();
1411 1411
         
1412
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1412
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1413 1413
 		{
1414 1414
 			$temp_array['hour_name'] = $row['hour_name'];
1415 1415
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1431,8 +1431,8 @@  discard block
 block discarded – undo
1431 1431
 	public function countAllHoursByIdent($ident, $filters = array())
1432 1432
 	{
1433 1433
 		global $globalTimezone, $globalDBdriver;
1434
-		$filter_query = $this->getFilter($filters,true,true);
1435
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1434
+		$filter_query = $this->getFilter($filters, true, true);
1435
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1436 1436
 		if ($globalTimezone != '') {
1437 1437
 			date_default_timezone_set($globalTimezone);
1438 1438
 			$datetime = new DateTime();
@@ -1440,12 +1440,12 @@  discard block
 block discarded – undo
1440 1440
 		} else $offset = '+00:00';
1441 1441
 
1442 1442
 		if ($globalDBdriver == 'mysql') {
1443
-			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1443
+			$query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1444 1444
 								FROM marine_output".$filter_query." marine_output.ident = :ident 
1445 1445
 								GROUP BY hour_name 
1446 1446
 								ORDER BY hour_name ASC";
1447 1447
 		} else {
1448
-			$query  = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1448
+			$query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1449 1449
 								FROM marine_output".$filter_query." marine_output.ident = :ident 
1450 1450
 								GROUP BY hour_name 
1451 1451
 								ORDER BY hour_name ASC";
@@ -1453,12 +1453,12 @@  discard block
 block discarded – undo
1453 1453
       
1454 1454
 		
1455 1455
 		$sth = $this->db->prepare($query);
1456
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
1456
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
1457 1457
       
1458 1458
 		$hour_array = array();
1459 1459
 		$temp_array = array();
1460 1460
         
1461
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1461
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1462 1462
 		{
1463 1463
 			$temp_array['hour_name'] = $row['hour_name'];
1464 1464
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1477,33 +1477,33 @@  discard block
 block discarded – undo
1477 1477
 	* @return Integer the number of vessels
1478 1478
 	*
1479 1479
 	*/
1480
-	public function countOverallMarine($filters = array(),$year = '',$month = '')
1480
+	public function countOverallMarine($filters = array(), $year = '', $month = '')
1481 1481
 	{
1482 1482
 		global $globalDBdriver;
1483 1483
 		//$queryi  = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output";
1484
-		$queryi  = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output";
1484
+		$queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output";
1485 1485
 		$query_values = array();
1486 1486
 		$query = '';
1487 1487
 		if ($year != '') {
1488 1488
 			if ($globalDBdriver == 'mysql') {
1489 1489
 				$query .= " AND YEAR(marine_output.date) = :year";
1490
-				$query_values = array_merge($query_values,array(':year' => $year));
1490
+				$query_values = array_merge($query_values, array(':year' => $year));
1491 1491
 			} else {
1492 1492
 				$query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year";
1493
-				$query_values = array_merge($query_values,array(':year' => $year));
1493
+				$query_values = array_merge($query_values, array(':year' => $year));
1494 1494
 			}
1495 1495
 		}
1496 1496
 		if ($month != '') {
1497 1497
 			if ($globalDBdriver == 'mysql') {
1498 1498
 				$query .= " AND MONTH(marine_output.date) = :month";
1499
-				$query_values = array_merge($query_values,array(':month' => $month));
1499
+				$query_values = array_merge($query_values, array(':month' => $month));
1500 1500
 			} else {
1501 1501
 				$query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month";
1502
-				$query_values = array_merge($query_values,array(':month' => $month));
1502
+				$query_values = array_merge($query_values, array(':month' => $month));
1503 1503
 			}
1504 1504
 		}
1505 1505
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1506
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1506
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1507 1507
 		
1508 1508
 		$sth = $this->db->prepare($queryi);
1509 1509
 		$sth->execute($query_values);
@@ -1516,32 +1516,32 @@  discard block
 block discarded – undo
1516 1516
 	* @return Integer the number of vessels
1517 1517
 	*
1518 1518
 	*/
1519
-	public function countOverallMarineTypes($filters = array(),$year = '',$month = '')
1519
+	public function countOverallMarineTypes($filters = array(), $year = '', $month = '')
1520 1520
 	{
1521 1521
 		global $globalDBdriver;
1522
-		$queryi  = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output";
1522
+		$queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output";
1523 1523
 		$query_values = array();
1524 1524
 		$query = '';
1525 1525
 		if ($year != '') {
1526 1526
 			if ($globalDBdriver == 'mysql') {
1527 1527
 				$query .= " AND YEAR(marine_output.date) = :year";
1528
-				$query_values = array_merge($query_values,array(':year' => $year));
1528
+				$query_values = array_merge($query_values, array(':year' => $year));
1529 1529
 			} else {
1530 1530
 				$query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year";
1531
-				$query_values = array_merge($query_values,array(':year' => $year));
1531
+				$query_values = array_merge($query_values, array(':year' => $year));
1532 1532
 			}
1533 1533
 		}
1534 1534
 		if ($month != '') {
1535 1535
 			if ($globalDBdriver == 'mysql') {
1536 1536
 				$query .= " AND MONTH(marine_output.date) = :month";
1537
-				$query_values = array_merge($query_values,array(':month' => $month));
1537
+				$query_values = array_merge($query_values, array(':month' => $month));
1538 1538
 			} else {
1539 1539
 				$query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month";
1540
-				$query_values = array_merge($query_values,array(':month' => $month));
1540
+				$query_values = array_merge($query_values, array(':month' => $month));
1541 1541
 			}
1542 1542
 		}
1543 1543
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1544
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1544
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1545 1545
 		
1546 1546
 		$sth = $this->db->prepare($queryi);
1547 1547
 		$sth->execute($query_values);
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
 	public function countAllHoursFromToday($filters = array())
1559 1559
 	{
1560 1560
 		global $globalTimezone, $globalDBdriver;
1561
-		$filter_query = $this->getFilter($filters,true,true);
1561
+		$filter_query = $this->getFilter($filters, true, true);
1562 1562
 		if ($globalTimezone != '') {
1563 1563
 			date_default_timezone_set($globalTimezone);
1564 1564
 			$datetime = new DateTime();
@@ -1566,12 +1566,12 @@  discard block
 block discarded – undo
1566 1566
 		} else $offset = '+00:00';
1567 1567
 
1568 1568
 		if ($globalDBdriver == 'mysql') {
1569
-			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1569
+			$query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1570 1570
 								FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE()
1571 1571
 								GROUP BY hour_name 
1572 1572
 								ORDER BY hour_name ASC";
1573 1573
 		} else {
1574
-			$query  = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1574
+			$query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1575 1575
 								FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
1576 1576
 								GROUP BY hour_name 
1577 1577
 								ORDER BY hour_name ASC";
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
 		$hour_array = array();
1584 1584
 		$temp_array = array();
1585 1585
         
1586
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1586
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1587 1587
 		{
1588 1588
 			$temp_array['hour_name'] = $row['hour_name'];
1589 1589
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1602,9 +1602,9 @@  discard block
 block discarded – undo
1602 1602
 	*/
1603 1603
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1604 1604
 	{
1605
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
1605
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
1606 1606
 
1607
-		$query  = "SELECT marine_output.marine_id
1607
+		$query = "SELECT marine_output.marine_id
1608 1608
 				FROM marine_output 
1609 1609
 				WHERE marine_output.fammarine_id = '".$fammarine_id."'";
1610 1610
         
@@ -1612,7 +1612,7 @@  discard block
 block discarded – undo
1612 1612
 		$sth = $this->db->prepare($query);
1613 1613
 		$sth->execute();
1614 1614
 
1615
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1615
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1616 1616
 		{
1617 1617
 			return $row['marine_id'];
1618 1618
 		}
@@ -1637,23 +1637,23 @@  discard block
 block discarded – undo
1637 1637
 		}
1638 1638
 		
1639 1639
 		$current_date = date("Y-m-d H:i:s");
1640
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
1640
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
1641 1641
 		
1642 1642
 		$diff = abs(strtotime($current_date) - strtotime($date));
1643 1643
 
1644
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
1644
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
1645 1645
 		$years = $time_array['years'];
1646 1646
 		
1647
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
1647
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
1648 1648
 		$months = $time_array['months'];
1649 1649
 		
1650
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
1650
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
1651 1651
 		$days = $time_array['days'];
1652
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
1652
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
1653 1653
 		$hours = $time_array['hours'];
1654
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
1654
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
1655 1655
 		$minutes = $time_array['minutes'];
1656
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1656
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1657 1657
 		
1658 1658
 		return $time_array;
1659 1659
 	}
@@ -1676,63 +1676,63 @@  discard block
 block discarded – undo
1676 1676
 			$temp_array['direction_degree'] = $direction;
1677 1677
 			$temp_array['direction_shortname'] = "N";
1678 1678
 			$temp_array['direction_fullname'] = "North";
1679
-		} elseif ($direction >= 22.5 && $direction < 45){
1679
+		} elseif ($direction >= 22.5 && $direction < 45) {
1680 1680
 			$temp_array['direction_degree'] = $direction;
1681 1681
 			$temp_array['direction_shortname'] = "NNE";
1682 1682
 			$temp_array['direction_fullname'] = "North-Northeast";
1683
-		} elseif ($direction >= 45 && $direction < 67.5){
1683
+		} elseif ($direction >= 45 && $direction < 67.5) {
1684 1684
 			$temp_array['direction_degree'] = $direction;
1685 1685
 			$temp_array['direction_shortname'] = "NE";
1686 1686
 			$temp_array['direction_fullname'] = "Northeast";
1687
-		} elseif ($direction >= 67.5 && $direction < 90){
1687
+		} elseif ($direction >= 67.5 && $direction < 90) {
1688 1688
 			$temp_array['direction_degree'] = $direction;
1689 1689
 			$temp_array['direction_shortname'] = "ENE";
1690 1690
 			$temp_array['direction_fullname'] = "East-Northeast";
1691
-		} elseif ($direction >= 90 && $direction < 112.5){
1691
+		} elseif ($direction >= 90 && $direction < 112.5) {
1692 1692
 			$temp_array['direction_degree'] = $direction;
1693 1693
 			$temp_array['direction_shortname'] = "E";
1694 1694
 			$temp_array['direction_fullname'] = "East";
1695
-		} elseif ($direction >= 112.5 && $direction < 135){
1695
+		} elseif ($direction >= 112.5 && $direction < 135) {
1696 1696
 			$temp_array['direction_degree'] = $direction;
1697 1697
 			$temp_array['direction_shortname'] = "ESE";
1698 1698
 			$temp_array['direction_fullname'] = "East-Southeast";
1699
-		} elseif ($direction >= 135 && $direction < 157.5){
1699
+		} elseif ($direction >= 135 && $direction < 157.5) {
1700 1700
 			$temp_array['direction_degree'] = $direction;
1701 1701
 			$temp_array['direction_shortname'] = "SE";
1702 1702
 			$temp_array['direction_fullname'] = "Southeast";
1703
-		} elseif ($direction >= 157.5 && $direction < 180){
1703
+		} elseif ($direction >= 157.5 && $direction < 180) {
1704 1704
 			$temp_array['direction_degree'] = $direction;
1705 1705
 			$temp_array['direction_shortname'] = "SSE";
1706 1706
 			$temp_array['direction_fullname'] = "South-Southeast";
1707
-		} elseif ($direction >= 180 && $direction < 202.5){
1707
+		} elseif ($direction >= 180 && $direction < 202.5) {
1708 1708
 			$temp_array['direction_degree'] = $direction;
1709 1709
 			$temp_array['direction_shortname'] = "S";
1710 1710
 			$temp_array['direction_fullname'] = "South";
1711
-		} elseif ($direction >= 202.5 && $direction < 225){
1711
+		} elseif ($direction >= 202.5 && $direction < 225) {
1712 1712
 			$temp_array['direction_degree'] = $direction;
1713 1713
 			$temp_array['direction_shortname'] = "SSW";
1714 1714
 			$temp_array['direction_fullname'] = "South-Southwest";
1715
-		} elseif ($direction >= 225 && $direction < 247.5){
1715
+		} elseif ($direction >= 225 && $direction < 247.5) {
1716 1716
 			$temp_array['direction_degree'] = $direction;
1717 1717
 			$temp_array['direction_shortname'] = "SW";
1718 1718
 			$temp_array['direction_fullname'] = "Southwest";
1719
-		} elseif ($direction >= 247.5 && $direction < 270){
1719
+		} elseif ($direction >= 247.5 && $direction < 270) {
1720 1720
 			$temp_array['direction_degree'] = $direction;
1721 1721
 			$temp_array['direction_shortname'] = "WSW";
1722 1722
 			$temp_array['direction_fullname'] = "West-Southwest";
1723
-		} elseif ($direction >= 270 && $direction < 292.5){
1723
+		} elseif ($direction >= 270 && $direction < 292.5) {
1724 1724
 			$temp_array['direction_degree'] = $direction;
1725 1725
 			$temp_array['direction_shortname'] = "W";
1726 1726
 			$temp_array['direction_fullname'] = "West";
1727
-		} elseif ($direction >= 292.5 && $direction < 315){
1727
+		} elseif ($direction >= 292.5 && $direction < 315) {
1728 1728
 			$temp_array['direction_degree'] = $direction;
1729 1729
 			$temp_array['direction_shortname'] = "WNW";
1730 1730
 			$temp_array['direction_fullname'] = "West-Northwest";
1731
-		} elseif ($direction >= 315 && $direction < 337.5){
1731
+		} elseif ($direction >= 315 && $direction < 337.5) {
1732 1732
 			$temp_array['direction_degree'] = $direction;
1733 1733
 			$temp_array['direction_shortname'] = "NW";
1734 1734
 			$temp_array['direction_fullname'] = "Northwest";
1735
-		} elseif ($direction >= 337.5 && $direction < 360){
1735
+		} elseif ($direction >= 337.5 && $direction < 360) {
1736 1736
 			$temp_array['direction_degree'] = $direction;
1737 1737
 			$temp_array['direction_shortname'] = "NNW";
1738 1738
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -1749,11 +1749,11 @@  discard block
 block discarded – undo
1749 1749
 	* @param Float $longitude longitute of the flight
1750 1750
 	* @return String the countrie
1751 1751
 	*/
1752
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1752
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
1753 1753
 	{
1754 1754
 		global $globalDBdriver, $globalDebug;
1755
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1756
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1755
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1756
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1757 1757
 	
1758 1758
 		$Connection = new Connection($this->db);
1759 1759
 		if (!$Connection->tableExists('countries')) return '';
@@ -1793,7 +1793,7 @@  discard block
 block discarded – undo
1793 1793
 	public function getCountryFromISO2($iso2)
1794 1794
 	{
1795 1795
 		global $globalDBdriver, $globalDebug;
1796
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1796
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
1797 1797
 	
1798 1798
 		$Connection = new Connection($this->db);
1799 1799
 		if (!$Connection->tableExists('countries')) return '';
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
 		
1842 1842
 		$bitly_data = json_decode($bitly_data);
1843 1843
 		$bitly_url = '';
1844
-		if ($bitly_data->status_txt = "OK"){
1844
+		if ($bitly_data->status_txt = "OK") {
1845 1845
 			$bitly_url = $bitly_data->data->url;
1846 1846
 		}
1847 1847
 
@@ -1855,11 +1855,11 @@  discard block
 block discarded – undo
1855 1855
 	* @return Array the vessel type list
1856 1856
 	*
1857 1857
 	*/
1858
-	public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1858
+	public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
1859 1859
 	{
1860 1860
 		global $globalDBdriver;
1861
-		$filter_query = $this->getFilter($filters,true,true);
1862
-		$query  = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id 
1861
+		$filter_query = $this->getFilter($filters, true, true);
1862
+		$query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id 
1863 1863
 		    FROM marine_output ".$filter_query." marine_output.type <> '' AND marine_output.type_id IS NOT NULL";
1864 1864
 		if ($olderthanmonths > 0) {
1865 1865
 			if ($globalDBdriver == 'mysql') {
@@ -1879,28 +1879,28 @@  discard block
 block discarded – undo
1879 1879
 		if ($year != '') {
1880 1880
 			if ($globalDBdriver == 'mysql') {
1881 1881
 				$query .= " AND YEAR(marine_output.date) = :year";
1882
-				$query_values = array_merge($query_values,array(':year' => $year));
1882
+				$query_values = array_merge($query_values, array(':year' => $year));
1883 1883
 			} else {
1884 1884
 				$query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year";
1885
-				$query_values = array_merge($query_values,array(':year' => $year));
1885
+				$query_values = array_merge($query_values, array(':year' => $year));
1886 1886
 			}
1887 1887
 		}
1888 1888
 		if ($month != '') {
1889 1889
 			if ($globalDBdriver == 'mysql') {
1890 1890
 				$query .= " AND MONTH(marine_output.date) = :month";
1891
-				$query_values = array_merge($query_values,array(':month' => $month));
1891
+				$query_values = array_merge($query_values, array(':month' => $month));
1892 1892
 			} else {
1893 1893
 				$query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month";
1894
-				$query_values = array_merge($query_values,array(':month' => $month));
1894
+				$query_values = array_merge($query_values, array(':month' => $month));
1895 1895
 			}
1896 1896
 		}
1897 1897
 		if ($day != '') {
1898 1898
 			if ($globalDBdriver == 'mysql') {
1899 1899
 				$query .= " AND DAY(marine_output.date) = :day";
1900
-				$query_values = array_merge($query_values,array(':day' => $day));
1900
+				$query_values = array_merge($query_values, array(':day' => $day));
1901 1901
 			} else {
1902 1902
 				$query .= " AND EXTRACT(DAY FROM marine_output.date) = :day";
1903
-				$query_values = array_merge($query_values,array(':day' => $day));
1903
+				$query_values = array_merge($query_values, array(':day' => $day));
1904 1904
 			}
1905 1905
 		}
1906 1906
 		$query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC";
@@ -1909,7 +1909,7 @@  discard block
 block discarded – undo
1909 1909
 		$sth->execute($query_values);
1910 1910
 		$marine_array = array();
1911 1911
 		$temp_array = array();
1912
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1912
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1913 1913
 		{
1914 1914
 			$temp_array['marine_type'] = $row['marine_type'];
1915 1915
 			$temp_array['marine_type_id'] = $row['marine_type_id'];
@@ -1925,13 +1925,13 @@  discard block
 block discarded – undo
1925 1925
 	* @return Array the tracker information
1926 1926
 	*
1927 1927
 	*/
1928
-	public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1928
+	public function searchMarineData($q = '', $callsign = '', $mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
1929 1929
 	{
1930 1930
 		global $globalTimezone, $globalDBdriver;
1931 1931
 		date_default_timezone_set('UTC');
1932 1932
 		$query_values = array();
1933 1933
 		$additional_query = '';
1934
-		$filter_query = $this->getFilter($filters,true,true);
1934
+		$filter_query = $this->getFilter($filters, true, true);
1935 1935
 		if ($q != "")
1936 1936
 		{
1937 1937
 			if (!is_string($q))
@@ -1939,8 +1939,8 @@  discard block
 block discarded – undo
1939 1939
 				return false;
1940 1940
 			} else {
1941 1941
 				$q_array = explode(" ", $q);
1942
-				foreach ($q_array as $q_item){
1943
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
1942
+				foreach ($q_array as $q_item) {
1943
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
1944 1944
 					$additional_query .= " AND (";
1945 1945
 					if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR ";
1946 1946
 					if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR ";
@@ -1952,42 +1952,42 @@  discard block
 block discarded – undo
1952 1952
 		}
1953 1953
 		if ($callsign != "")
1954 1954
 		{
1955
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
1955
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
1956 1956
 			if (!is_string($callsign))
1957 1957
 			{
1958 1958
 				return false;
1959 1959
 			} else {
1960 1960
 				$additional_query .= " AND marine_output.ident = :callsign";
1961
-				$query_values = array_merge($query_values,array(':callsign' => $callsign));
1961
+				$query_values = array_merge($query_values, array(':callsign' => $callsign));
1962 1962
 			}
1963 1963
 		}
1964 1964
 		if ($mmsi != "")
1965 1965
 		{
1966
-			$mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING);
1966
+			$mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING);
1967 1967
 			if (!is_numeric($mmsi))
1968 1968
 			{
1969 1969
 				return false;
1970 1970
 			} else {
1971 1971
 				$additional_query .= " AND marine_output.mmsi = :mmsi";
1972
-				$query_values = array_merge($query_values,array(':mmsi' => $mmsi));
1972
+				$query_values = array_merge($query_values, array(':mmsi' => $mmsi));
1973 1973
 			}
1974 1974
 		}
1975 1975
 		if ($imo != "")
1976 1976
 		{
1977
-			$imo = filter_var($imo,FILTER_SANITIZE_STRING);
1977
+			$imo = filter_var($imo, FILTER_SANITIZE_STRING);
1978 1978
 			if (!is_numeric($imo))
1979 1979
 			{
1980 1980
 				return false;
1981 1981
 			} else {
1982 1982
 				$additional_query .= " AND marine_output.imo = :imo";
1983
-				$query_values = array_merge($query_values,array(':imo' => $imo));
1983
+				$query_values = array_merge($query_values, array(':imo' => $imo));
1984 1984
 			}
1985 1985
 		}
1986 1986
 		if ($date_posted != "")
1987 1987
 		{
1988 1988
 			$date_array = explode(",", $date_posted);
1989
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
1990
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
1989
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
1990
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
1991 1991
 			if ($globalTimezone != '') {
1992 1992
 				date_default_timezone_set($globalTimezone);
1993 1993
 				$datetime = new DateTime();
@@ -2014,8 +2014,8 @@  discard block
 block discarded – undo
2014 2014
 		if ($limit != "")
2015 2015
 		{
2016 2016
 			$limit_array = explode(",", $limit);
2017
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
2018
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
2017
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
2018
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
2019 2019
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
2020 2020
 			{
2021 2021
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
@@ -2033,28 +2033,28 @@  discard block
 block discarded – undo
2033 2033
 			}
2034 2034
 		}
2035 2035
 		if ($origLat != "" && $origLon != "" && $dist != "") {
2036
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
2036
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
2037 2037
 			if ($globalDBdriver == 'mysql') {
2038
-				$query="SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance 
2038
+				$query = "SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance 
2039 2039
 				    FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND marine_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and marine_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
2040 2040
 				    AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
2041 2041
 			} else {
2042
-				$query="SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance 
2042
+				$query = "SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance 
2043 2043
 				    FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
2044 2044
 				    AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
2045 2045
 			}
2046 2046
 		} else {
2047
-			$query  = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' 
2047
+			$query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' 
2048 2048
 			    ".$additional_query."
2049 2049
 			    ".$orderby_query;
2050 2050
 		}
2051
-		$marine_array = $this->getDataFromDB($query, $query_values,$limit_query);
2051
+		$marine_array = $this->getDataFromDB($query, $query_values, $limit_query);
2052 2052
 		return $marine_array;
2053 2053
 	}
2054 2054
 
2055 2055
 	public function getOrderBy()
2056 2056
 	{
2057
-		$orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
2057
+		$orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
2058 2058
 		
2059 2059
 		return $orderby;
2060 2060
 		
Please login to merge, or discard this patch.
Braces   +218 added lines, -77 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. (Marine)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (Marine)');
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) {
@@ -78,8 +82,11 @@  discard block
 block discarded – undo
78 82
 				$filter_query_where .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
79 83
 			}
80 84
 		}
81
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
82
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
85
+		if ($filter_query_where == '' && $where) {
86
+			$filter_query_where = ' WHERE';
87
+		} elseif ($filter_query_where != '' && $and) {
88
+			$filter_query_where .= ' AND';
89
+		}
83 90
 		if ($filter_query_where != '') {
84 91
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
85 92
 		}
@@ -133,39 +140,75 @@  discard block
 block discarded – undo
133 140
 				$temp_array['spotter_id'] = $row['spotter_archive_id'];
134 141
 			} elseif (isset($row['spotter_archive_output_id'])) {
135 142
 				$temp_array['spotter_id'] = $row['spotter_archive_output_id'];
136
-			*/} 
137
-			elseif (isset($row['marineid'])) {
143
+			*/} elseif (isset($row['marineid'])) {
138 144
 				$temp_array['marine_id'] = $row['marineid'];
139 145
 			} else {
140 146
 				$temp_array['marine_id'] = '';
141 147
 			}
142
-			if (isset($row['fammarine_id'])) $temp_array['fammarine_id'] = $row['fammarine_id'];
143
-			if (isset($row['mmsi'])) $temp_array['mmsi'] = $row['mmsi'];
144
-			if (isset($row['type'])) $temp_array['type'] = $row['type'];
145
-			if (isset($row['type_id'])) $temp_array['type_id'] = $row['type_id'];
146
-			if (isset($row['status'])) $temp_array['status'] = $row['status'];
147
-			if (isset($row['status_id'])) $temp_array['status_id'] = $row['status_id'];
148
-			if (isset($row['captain_id'])) $temp_array['captain_id'] = $row['captain_id'];
149
-			if (isset($row['captain_name'])) $temp_array['captain_name'] = $row['captain_name'];
150
-			if (isset($row['race_id'])) $temp_array['race_id'] = $row['race_id'];
151
-			if (isset($row['race_name'])) $temp_array['race_name'] = $row['race_name'];
152
-			if (isset($row['ident'])) $temp_array['ident'] = $row['ident'];
153
-			if (isset($row['arrival_port_name'])) $temp_array['arrival_port_name'] = $row['arrival_port_name'];
154
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
155
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
156
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
148
+			if (isset($row['fammarine_id'])) {
149
+				$temp_array['fammarine_id'] = $row['fammarine_id'];
150
+			}
151
+			if (isset($row['mmsi'])) {
152
+				$temp_array['mmsi'] = $row['mmsi'];
153
+			}
154
+			if (isset($row['type'])) {
155
+				$temp_array['type'] = $row['type'];
156
+			}
157
+			if (isset($row['type_id'])) {
158
+				$temp_array['type_id'] = $row['type_id'];
159
+			}
160
+			if (isset($row['status'])) {
161
+				$temp_array['status'] = $row['status'];
162
+			}
163
+			if (isset($row['status_id'])) {
164
+				$temp_array['status_id'] = $row['status_id'];
165
+			}
166
+			if (isset($row['captain_id'])) {
167
+				$temp_array['captain_id'] = $row['captain_id'];
168
+			}
169
+			if (isset($row['captain_name'])) {
170
+				$temp_array['captain_name'] = $row['captain_name'];
171
+			}
172
+			if (isset($row['race_id'])) {
173
+				$temp_array['race_id'] = $row['race_id'];
174
+			}
175
+			if (isset($row['race_name'])) {
176
+				$temp_array['race_name'] = $row['race_name'];
177
+			}
178
+			if (isset($row['ident'])) {
179
+				$temp_array['ident'] = $row['ident'];
180
+			}
181
+			if (isset($row['arrival_port_name'])) {
182
+				$temp_array['arrival_port_name'] = $row['arrival_port_name'];
183
+			}
184
+			if (isset($row['latitude'])) {
185
+				$temp_array['latitude'] = $row['latitude'];
186
+			}
187
+			if (isset($row['longitude'])) {
188
+				$temp_array['longitude'] = $row['longitude'];
189
+			}
190
+			if (isset($row['format_source'])) {
191
+				$temp_array['format_source'] = $row['format_source'];
192
+			}
157 193
 			if (isset($row['heading'])) {
158 194
 				$temp_array['heading'] = $row['heading'];
159 195
 				$heading_direction = $this->parseDirection($row['heading']);
160
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
196
+				if (isset($heading_direction[0]['direction_fullname'])) {
197
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
198
+				}
199
+			}
200
+			if (isset($row['ground_speed'])) {
201
+				$temp_array['ground_speed'] = $row['ground_speed'];
161 202
 			}
162
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
163 203
 
164 204
 			if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "")
165 205
 			{
166 206
 				$Image = new Image($this->db);
167
-				if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']);
168
-				else $image_array = $Image->getMarineImage($temp_array['mmsi']);
207
+				if (isset($temp_array['ident']) && $temp_array['ident'] != '') {
208
+					$image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']);
209
+				} else {
210
+					$image_array = $Image->getMarineImage($temp_array['mmsi']);
211
+				}
169 212
 				unset($Image);
170 213
 				if (count($image_array) > 0) {
171 214
 					$temp_array['image'] = $image_array[0]['image'];
@@ -217,13 +260,21 @@  discard block
 block discarded – undo
217 260
 			}
218 261
 			
219 262
 			$fromsource = NULL;
220
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
221
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
222
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
263
+			if (isset($row['source_name']) && $row['source_name'] != '') {
264
+				$temp_array['source_name'] = $row['source_name'];
265
+			}
266
+			if (isset($row['over_country']) && $row['over_country'] != '') {
267
+				$temp_array['over_country'] = $row['over_country'];
268
+			}
269
+			if (isset($row['distance']) && $row['distance'] != '') {
270
+				$temp_array['distance'] = $row['distance'];
271
+			}
223 272
 			$temp_array['query_number_rows'] = $num_rows;
224 273
 			$spotter_array[] = $temp_array;
225 274
 		}
226
-		if ($num_rows == 0) return array();
275
+		if ($num_rows == 0) {
276
+			return array();
277
+		}
227 278
 		$spotter_array[0]['query_number_rows'] = $num_rows;
228 279
 		return $spotter_array;
229 280
 	}	
@@ -249,8 +300,12 @@  discard block
 block discarded – undo
249 300
 			{
250 301
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
251 302
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
252
-			} else $limit_query = "";
253
-		} else $limit_query = "";
303
+			} else {
304
+				$limit_query = "";
305
+			}
306
+		} else {
307
+			$limit_query = "";
308
+		}
254 309
 		if ($sort != "")
255 310
 		{
256 311
 			$search_orderby_array = $this->getOrderBy();
@@ -274,7 +329,9 @@  discard block
 block discarded – undo
274 329
 		global $global_query;
275 330
 		
276 331
 		date_default_timezone_set('UTC');
277
-		if ($id == '') return array();
332
+		if ($id == '') {
333
+			return array();
334
+		}
278 335
 		$additional_query = "marine_output.fammarine_id = :id";
279 336
 		$query_values = array(':id' => $id);
280 337
 		$query  = $global_query." WHERE ".$additional_query." ";
@@ -470,8 +527,11 @@  discard block
 block discarded – undo
470 527
 		$query .= " ORDER BY marine_output.source_name ASC";
471 528
 
472 529
 		$sth = $this->db->prepare($query);
473
-		if (!empty($query_values)) $sth->execute($query_values);
474
-		else $sth->execute();
530
+		if (!empty($query_values)) {
531
+			$sth->execute($query_values);
532
+		} else {
533
+			$sth->execute();
534
+		}
475 535
 
476 536
 		$source_array = array();
477 537
 		$temp_array = array();
@@ -526,8 +586,11 @@  discard block
 block discarded – undo
526 586
 		$sth = $this->db->prepare($query);
527 587
 		$sth->execute(array(':mmsi' => $mmsi));
528 588
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
529
-		if (isset($result[0])) return $result[0];
530
-		else return array();
589
+		if (isset($result[0])) {
590
+			return $result[0];
591
+		} else {
592
+			return array();
593
+		}
531 594
 	}
532 595
 
533 596
 	/**
@@ -568,7 +631,9 @@  discard block
 block discarded – undo
568 631
 			date_default_timezone_set($globalTimezone);
569 632
 			$datetime = new DateTime();
570 633
 			$offset = $datetime->format('P');
571
-		} else $offset = '+00:00';
634
+		} else {
635
+			$offset = '+00:00';
636
+		}
572 637
 
573 638
 		if ($globalDBdriver == 'mysql') {
574 639
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date
@@ -818,11 +883,21 @@  discard block
 block discarded – undo
818 883
 			$latitude = 0;
819 884
 			$longitude = 0;
820 885
 		}
821
-		if ($type_id == '') $type_id = NULL;
822
-		if ($status_id == '') $status_id = NULL;
823
-		if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
824
-		if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
825
-		if ($arrival_date == '') $arrival_date = NULL;
886
+		if ($type_id == '') {
887
+			$type_id = NULL;
888
+		}
889
+		if ($status_id == '') {
890
+			$status_id = NULL;
891
+		}
892
+		if ($heading == '' || $Common->isInteger($heading) === false) {
893
+			$heading = 0;
894
+		}
895
+		if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
896
+			$groundspeed = 0;
897
+		}
898
+		if ($arrival_date == '') {
899
+			$arrival_date = NULL;
900
+		}
826 901
 		$query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) 
827 902
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name)";
828 903
 
@@ -929,7 +1004,9 @@  discard block
 block discarded – undo
929 1004
 		global $globalDBdriver, $globalArchive;
930 1005
 		//$filter_query = $this->getFilter($filters,true,true);
931 1006
 		$Connection= new Connection($this->db);
932
-		if (!$Connection->tableExists('countries')) return array();
1007
+		if (!$Connection->tableExists('countries')) {
1008
+			return array();
1009
+		}
933 1010
 		require_once('class.SpotterLive.php');
934 1011
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
935 1012
 			$MarineLive = new MarineLive($this->db);
@@ -973,7 +1050,9 @@  discard block
 block discarded – undo
973 1050
 			$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT fammarine_id,over_country FROM marine_archive".$filter_query.") l ON c.iso2 = l.over_country ";
974 1051
 		}
975 1052
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
976
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
1053
+		if ($limit) {
1054
+			$query .= " LIMIT 10 OFFSET 0";
1055
+		}
977 1056
 
978 1057
 		$sth = $this->db->prepare($query);
979 1058
 		$sth->execute();
@@ -1007,12 +1086,18 @@  discard block
 block discarded – undo
1007 1086
 		$query  = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count 
1008 1087
                     FROM marine_output".$filter_query." marine_output.ident <> ''";
1009 1088
 		 if ($olderthanmonths > 0) {
1010
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
1011
-			else $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1089
+			if ($globalDBdriver == 'mysql') {
1090
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
1091
+			} else {
1092
+				$query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1093
+			}
1012 1094
 		}
1013 1095
 		if ($sincedate != '') {
1014
-			if ($globalDBdriver == 'mysql') $query .= " AND marine_output.date > '".$sincedate."'";
1015
-			else $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
1096
+			if ($globalDBdriver == 'mysql') {
1097
+				$query .= " AND marine_output.date > '".$sincedate."'";
1098
+			} else {
1099
+				$query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
1100
+			}
1016 1101
 		}
1017 1102
 		$query_values = array();
1018 1103
 		if ($year != '') {
@@ -1043,7 +1128,9 @@  discard block
 block discarded – undo
1043 1128
 			}
1044 1129
 		}
1045 1130
 		$query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC";
1046
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
1131
+		if ($limit) {
1132
+			$query .= " LIMIT 10 OFFSET 0";
1133
+		}
1047 1134
       		
1048 1135
 		$sth = $this->db->prepare($query);
1049 1136
 		$sth->execute($query_values);
@@ -1078,7 +1165,9 @@  discard block
 block discarded – undo
1078 1165
 			date_default_timezone_set($globalTimezone);
1079 1166
 			$datetime = new DateTime();
1080 1167
 			$offset = $datetime->format('P');
1081
-		} else $offset = '+00:00';
1168
+		} else {
1169
+			$offset = '+00:00';
1170
+		}
1082 1171
 
1083 1172
 		if ($globalDBdriver == 'mysql') {
1084 1173
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1128,7 +1217,9 @@  discard block
 block discarded – undo
1128 1217
 			date_default_timezone_set($globalTimezone);
1129 1218
 			$datetime = new DateTime();
1130 1219
 			$offset = $datetime->format('P');
1131
-		} else $offset = '+00:00';
1220
+		} else {
1221
+			$offset = '+00:00';
1222
+		}
1132 1223
 		$filter_query = $this->getFilter($filters,true,true);
1133 1224
 		if ($globalDBdriver == 'mysql') {
1134 1225
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1174,7 +1265,9 @@  discard block
 block discarded – undo
1174 1265
 			date_default_timezone_set($globalTimezone);
1175 1266
 			$datetime = new DateTime();
1176 1267
 			$offset = $datetime->format('P');
1177
-		} else $offset = '+00:00';
1268
+		} else {
1269
+			$offset = '+00:00';
1270
+		}
1178 1271
 		$filter_query = $this->getFilter($filters,true,true);
1179 1272
 		if ($globalDBdriver == 'mysql') {
1180 1273
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1222,7 +1315,9 @@  discard block
 block discarded – undo
1222 1315
 			date_default_timezone_set($globalTimezone);
1223 1316
 			$datetime = new DateTime();
1224 1317
 			$offset = $datetime->format('P');
1225
-		} else $offset = '+00:00';
1318
+		} else {
1319
+			$offset = '+00:00';
1320
+		}
1226 1321
 
1227 1322
 		if ($globalDBdriver == 'mysql') {
1228 1323
 			$query  = "SELECT YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -1271,7 +1366,9 @@  discard block
 block discarded – undo
1271 1366
 			date_default_timezone_set($globalTimezone);
1272 1367
 			$datetime = new DateTime();
1273 1368
 			$offset = $datetime->format('P');
1274
-		} else $offset = '+00:00';
1369
+		} else {
1370
+			$offset = '+00:00';
1371
+		}
1275 1372
 		$filter_query = $this->getFilter($filters,true,true);
1276 1373
 		if ($globalDBdriver == 'mysql') {
1277 1374
 			$query  = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -1320,7 +1417,9 @@  discard block
 block discarded – undo
1320 1417
 			date_default_timezone_set($globalTimezone);
1321 1418
 			$datetime = new DateTime();
1322 1419
 			$offset = $datetime->format('P');
1323
-		} else $offset = '+00:00';
1420
+		} else {
1421
+			$offset = '+00:00';
1422
+		}
1324 1423
 
1325 1424
 		$orderby_sql = '';
1326 1425
 		if ($orderby == "hour")
@@ -1389,7 +1488,9 @@  discard block
 block discarded – undo
1389 1488
 			date_default_timezone_set($globalTimezone);
1390 1489
 			$datetime = new DateTime($date);
1391 1490
 			$offset = $datetime->format('P');
1392
-		} else $offset = '+00:00';
1491
+		} else {
1492
+			$offset = '+00:00';
1493
+		}
1393 1494
 
1394 1495
 		if ($globalDBdriver == 'mysql') {
1395 1496
 			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1437,7 +1538,9 @@  discard block
 block discarded – undo
1437 1538
 			date_default_timezone_set($globalTimezone);
1438 1539
 			$datetime = new DateTime();
1439 1540
 			$offset = $datetime->format('P');
1440
-		} else $offset = '+00:00';
1541
+		} else {
1542
+			$offset = '+00:00';
1543
+		}
1441 1544
 
1442 1545
 		if ($globalDBdriver == 'mysql') {
1443 1546
 			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1502,8 +1605,11 @@  discard block
 block discarded – undo
1502 1605
 				$query_values = array_merge($query_values,array(':month' => $month));
1503 1606
 			}
1504 1607
 		}
1505
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1506
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1608
+		if (empty($query_values)) {
1609
+			$queryi .= $this->getFilter($filters);
1610
+		} else {
1611
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1612
+		}
1507 1613
 		
1508 1614
 		$sth = $this->db->prepare($queryi);
1509 1615
 		$sth->execute($query_values);
@@ -1540,8 +1646,11 @@  discard block
 block discarded – undo
1540 1646
 				$query_values = array_merge($query_values,array(':month' => $month));
1541 1647
 			}
1542 1648
 		}
1543
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1544
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1649
+		if (empty($query_values)) {
1650
+			$queryi .= $this->getFilter($filters);
1651
+		} else {
1652
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1653
+		}
1545 1654
 		
1546 1655
 		$sth = $this->db->prepare($queryi);
1547 1656
 		$sth->execute($query_values);
@@ -1563,7 +1672,9 @@  discard block
 block discarded – undo
1563 1672
 			date_default_timezone_set($globalTimezone);
1564 1673
 			$datetime = new DateTime();
1565 1674
 			$offset = $datetime->format('P');
1566
-		} else $offset = '+00:00';
1675
+		} else {
1676
+			$offset = '+00:00';
1677
+		}
1567 1678
 
1568 1679
 		if ($globalDBdriver == 'mysql') {
1569 1680
 			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1667,7 +1778,9 @@  discard block
 block discarded – undo
1667 1778
 	*/
1668 1779
 	public function parseDirection($direction = 0)
1669 1780
 	{
1670
-		if ($direction == '') $direction = 0;
1781
+		if ($direction == '') {
1782
+			$direction = 0;
1783
+		}
1671 1784
 		$direction_array = array();
1672 1785
 		$temp_array = array();
1673 1786
 
@@ -1756,7 +1869,9 @@  discard block
 block discarded – undo
1756 1869
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1757 1870
 	
1758 1871
 		$Connection = new Connection($this->db);
1759
-		if (!$Connection->tableExists('countries')) return '';
1872
+		if (!$Connection->tableExists('countries')) {
1873
+			return '';
1874
+		}
1760 1875
 	
1761 1876
 		try {
1762 1877
 			/*
@@ -1776,9 +1891,13 @@  discard block
 block discarded – undo
1776 1891
 			$sth->closeCursor();
1777 1892
 			if (count($row) > 0) {
1778 1893
 				return $row;
1779
-			} else return '';
1894
+			} else {
1895
+				return '';
1896
+			}
1780 1897
 		} catch (PDOException $e) {
1781
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1898
+			if (isset($globalDebug) && $globalDebug) {
1899
+				echo 'Error : '.$e->getMessage()."\n";
1900
+			}
1782 1901
 			return '';
1783 1902
 		}
1784 1903
 	
@@ -1796,7 +1915,9 @@  discard block
 block discarded – undo
1796 1915
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1797 1916
 	
1798 1917
 		$Connection = new Connection($this->db);
1799
-		if (!$Connection->tableExists('countries')) return '';
1918
+		if (!$Connection->tableExists('countries')) {
1919
+			return '';
1920
+		}
1800 1921
 	
1801 1922
 		try {
1802 1923
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -1808,9 +1929,13 @@  discard block
 block discarded – undo
1808 1929
 			$sth->closeCursor();
1809 1930
 			if (count($row) > 0) {
1810 1931
 				return $row;
1811
-			} else return '';
1932
+			} else {
1933
+				return '';
1934
+			}
1812 1935
 		} catch (PDOException $e) {
1813
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1936
+			if (isset($globalDebug) && $globalDebug) {
1937
+				echo 'Error : '.$e->getMessage()."\n";
1938
+			}
1814 1939
 			return '';
1815 1940
 		}
1816 1941
 	
@@ -1828,7 +1953,9 @@  discard block
 block discarded – undo
1828 1953
 	{
1829 1954
 		global $globalBitlyAccessToken;
1830 1955
 		
1831
-		if ($globalBitlyAccessToken == '') return $url;
1956
+		if ($globalBitlyAccessToken == '') {
1957
+			return $url;
1958
+		}
1832 1959
         
1833 1960
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
1834 1961
 		
@@ -1904,7 +2031,9 @@  discard block
 block discarded – undo
1904 2031
 			}
1905 2032
 		}
1906 2033
 		$query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC";
1907
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
2034
+		if ($limit) {
2035
+			$query .= " LIMIT 10 OFFSET 0";
2036
+		}
1908 2037
 		$sth = $this->db->prepare($query);
1909 2038
 		$sth->execute($query_values);
1910 2039
 		$marine_array = array();
@@ -1942,9 +2071,15 @@  discard block
 block discarded – undo
1942 2071
 				foreach ($q_array as $q_item){
1943 2072
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
1944 2073
 					$additional_query .= " AND (";
1945
-					if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR ";
1946
-					if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR ";
1947
-					if (is_int($q_item)) $additional_query .= "(marine_output.imo = '".$q_item."') OR ";
2074
+					if (is_int($q_item)) {
2075
+						$additional_query .= "(marine_output.marine_id = '".$q_item."') OR ";
2076
+					}
2077
+					if (is_int($q_item)) {
2078
+						$additional_query .= "(marine_output.mmsi = '".$q_item."') OR ";
2079
+					}
2080
+					if (is_int($q_item)) {
2081
+						$additional_query .= "(marine_output.imo = '".$q_item."') OR ";
2082
+					}
1948 2083
 					$additional_query .= "(marine_output.ident like '%".$q_item."%') OR ";
1949 2084
 					$additional_query .= ")";
1950 2085
 				}
@@ -1992,7 +2127,9 @@  discard block
 block discarded – undo
1992 2127
 				date_default_timezone_set($globalTimezone);
1993 2128
 				$datetime = new DateTime();
1994 2129
 				$offset = $datetime->format('P');
1995
-			} else $offset = '+00:00';
2130
+			} else {
2131
+				$offset = '+00:00';
2132
+			}
1996 2133
 			if ($date_array[1] != "")
1997 2134
 			{
1998 2135
 				$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
@@ -2019,8 +2156,12 @@  discard block
 block discarded – undo
2019 2156
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
2020 2157
 			{
2021 2158
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
2022
-			} else $limit_query = "";
2023
-		} else $limit_query = "";
2159
+			} else {
2160
+				$limit_query = "";
2161
+			}
2162
+		} else {
2163
+			$limit_query = "";
2164
+		}
2024 2165
 		if ($sort != "")
2025 2166
 		{
2026 2167
 			$search_orderby_array = $this->getOrderBy();
Please login to merge, or discard this patch.
require/class.MarineLive.php 4 patches
Doc Comments   +1 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	* Get SQL query part for filter used
17 17
 	* @param Array $filter the filter
18
-	* @return Array the SQL part
18
+	* @return string the SQL part
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -915,10 +915,6 @@  discard block
 block discarded – undo
915 915
 	*
916 916
 	* @param String $fammarine_id the ID from flightaware
917 917
 	* @param String $ident the flight ident
918
-	* @param String $aircraft_icao the aircraft type
919
-	* @param String $departure_airport_icao the departure airport
920
-	* @param String $arrival_airport_icao the arrival airport
921
-	* @return String success or false
922 918
 	*
923 919
 	*/
924 920
 	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 = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '')
Please login to merge, or discard this patch.
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	/**
99
-	* Gets all the spotter information based on the latest data entry
100
-	*
101
-	* @return Array the spotter information
102
-	*
103
-	*/
99
+	 * Gets all the spotter information based on the latest data entry
100
+	 *
101
+	 * @return Array the spotter information
102
+	 *
103
+	 */
104 104
 	public function getLiveMarineData($limit = '', $sort = '', $filter = array())
105 105
 	{
106 106
 		global $globalDBdriver, $globalLiveInterval;
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 	}
144 144
 
145 145
 	/**
146
-	* Gets Minimal Live Spotter data
147
-	*
148
-	* @return Array the spotter information
149
-	*
150
-	*/
146
+	 * Gets Minimal Live Spotter data
147
+	 *
148
+	 * @return Array the spotter information
149
+	 *
150
+	 */
151 151
 	public function getMinLiveMarineData($filter = array())
152 152
 	{
153 153
 		global $globalDBdriver, $globalLiveInterval;
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	}
178 178
 
179 179
 	/**
180
-	* Gets Minimal Live Spotter data since xx seconds
181
-	*
182
-	* @return Array the spotter information
183
-	*
184
-	*/
180
+	 * Gets Minimal Live Spotter data since xx seconds
181
+	 *
182
+	 * @return Array the spotter information
183
+	 *
184
+	 */
185 185
 	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '')
186 186
 	{
187 187
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
 	}
262 262
 
263 263
 	/**
264
-	* Gets number of latest data entry
265
-	*
266
-	* @return String number of entry
267
-	*
268
-	*/
264
+	 * Gets number of latest data entry
265
+	 *
266
+	 * @return String number of entry
267
+	 *
268
+	 */
269 269
 	public function getLiveMarineCount($filter = array())
270 270
 	{
271 271
 		global $globalDBdriver, $globalLiveInterval;
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
 	}
291 291
 
292 292
 	/**
293
-	* Gets all the spotter information based on the latest data entry and coord
294
-	*
295
-	* @return Array the spotter information
296
-	*
297
-	*/
293
+	 * Gets all the spotter information based on the latest data entry and coord
294
+	 *
295
+	 * @return Array the spotter information
296
+	 *
297
+	 */
298 298
 	public function getLiveMarineDatabyCoord($coord, $filter = array())
299 299
 	{
300 300
 		global $globalDBdriver, $globalLiveInterval;
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	}
319 319
 
320 320
 	/**
321
-	* Gets all the spotter information based on the latest data entry and coord
322
-	*
323
-	* @return Array the spotter information
324
-	*
325
-	*/
321
+	 * Gets all the spotter information based on the latest data entry and coord
322
+	 *
323
+	 * @return Array the spotter information
324
+	 *
325
+	 */
326 326
 	public function getMinLiveMarineDatabyCoord($coord, $filter = array())
327 327
 	{
328 328
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 	}
392 392
 
393 393
 	/**
394
-	* Gets all the spotter information based on a user's latitude and longitude
395
-	*
396
-	* @return Array the spotter information
397
-	*
398
-	*/
394
+	 * Gets all the spotter information based on a user's latitude and longitude
395
+	 *
396
+	 * @return Array the spotter information
397
+	 *
398
+	 */
399 399
 	public function getLatestMarineForLayar($lat, $lng, $radius, $interval)
400 400
 	{
401 401
 		$Marine = new Marine($this->db);
@@ -408,75 +408,75 @@  discard block
 block discarded – undo
408 408
 		if ($lng != '')
409 409
 		{
410 410
 			if (!is_numeric($lng))
411
-                        {
412
-                                return false;
413
-                        }
414
-                }
415
-
416
-                if ($radius != '')
417
-                {
418
-                        if (!is_numeric($radius))
419
-                        {
420
-                                return false;
421
-                        }
422
-                }
411
+						{
412
+								return false;
413
+						}
414
+				}
415
+
416
+				if ($radius != '')
417
+				{
418
+						if (!is_numeric($radius))
419
+						{
420
+								return false;
421
+						}
422
+				}
423 423
 		$additional_query = '';
424 424
 		if ($interval != '')
425
-                {
426
-                        if (!is_string($interval))
427
-                        {
428
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
429
-			        return false;
430
-                        } else {
431
-                if ($interval == '1m')
432
-                {
433
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
434
-                } else if ($interval == '15m'){
435
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
436
-                } 
437
-            }
438
-                } else {
439
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
440
-        }
441
-
442
-                $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 
425
+				{
426
+						if (!is_string($interval))
427
+						{
428
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
429
+					return false;
430
+						} else {
431
+				if ($interval == '1m')
432
+				{
433
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
434
+				} else if ($interval == '15m'){
435
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
436
+				} 
437
+			}
438
+				} else {
439
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
440
+		}
441
+
442
+				$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 
443 443
                    WHERE marine_live.latitude <> '' 
444 444
                                    AND marine_live.longitude <> '' 
445 445
                    ".$additional_query."
446 446
                    HAVING distance < :radius  
447 447
                                    ORDER BY distance";
448 448
 
449
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
449
+				$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
450 450
 
451
-                return $spotter_array;
452
-        }
451
+				return $spotter_array;
452
+		}
453 453
 
454 454
     
455
-        /**
456
-	* Gets all the spotter information based on a particular callsign
457
-	*
458
-	* @return Array the spotter information
459
-	*
460
-	*/
455
+		/**
456
+		 * Gets all the spotter information based on a particular callsign
457
+		 *
458
+		 * @return Array the spotter information
459
+		 *
460
+		 */
461 461
 	public function getLastLiveMarineDataByIdent($ident)
462 462
 	{
463 463
 		$Marine = new Marine($this->db);
464 464
 		date_default_timezone_set('UTC');
465 465
 
466 466
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
467
-                $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';
467
+				$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';
468 468
 
469 469
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
470 470
 
471 471
 		return $spotter_array;
472 472
 	}
473 473
 
474
-        /**
475
-	* Gets all the spotter information based on a particular callsign
476
-	*
477
-	* @return Array the spotter information
478
-	*
479
-	*/
474
+		/**
475
+		 * Gets all the spotter information based on a particular callsign
476
+		 *
477
+		 * @return Array the spotter information
478
+		 *
479
+		 */
480 480
 	public function getDateLiveMarineDataByIdent($ident,$date)
481 481
 	{
482 482
 		$Marine = new Marine($this->db);
@@ -489,11 +489,11 @@  discard block
 block discarded – undo
489 489
 	}
490 490
 
491 491
 	/**
492
-	* Gets all the spotter information based on a particular MMSI
493
-	*
494
-	* @return Array the spotter information
495
-	*
496
-	*/
492
+	 * Gets all the spotter information based on a particular MMSI
493
+	 *
494
+	 * @return Array the spotter information
495
+	 *
496
+	 */
497 497
 	public function getDateLiveMarineDataByMMSI($mmsi,$date)
498 498
 	{
499 499
 		$Marine = new Marine($this->db);
@@ -505,51 +505,51 @@  discard block
 block discarded – undo
505 505
 		return $spotter_array;
506 506
 	}
507 507
 
508
-        /**
509
-	* Gets last spotter information based on a particular callsign
510
-	*
511
-	* @return Array the spotter information
512
-	*
513
-	*/
508
+		/**
509
+		 * Gets last spotter information based on a particular callsign
510
+		 *
511
+		 * @return Array the spotter information
512
+		 *
513
+		 */
514 514
 	public function getLastLiveMarineDataById($id)
515 515
 	{
516 516
 		$Marine = new Marine($this->db);
517 517
 		date_default_timezone_set('UTC');
518 518
 
519 519
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
520
-                $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';
520
+				$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';
521 521
 
522 522
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
523 523
 
524 524
 		return $spotter_array;
525 525
 	}
526 526
 
527
-        /**
528
-	* Gets last spotter information based on a particular callsign
529
-	*
530
-	* @return Array the spotter information
531
-	*
532
-	*/
527
+		/**
528
+		 * Gets last spotter information based on a particular callsign
529
+		 *
530
+		 * @return Array the spotter information
531
+		 *
532
+		 */
533 533
 	public function getDateLiveMarineDataById($id,$date)
534 534
 	{
535 535
 		$Marine = new Marine($this->db);
536 536
 		date_default_timezone_set('UTC');
537 537
 
538 538
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
539
-                $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';
540
-                $date = date('c',$date);
539
+				$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';
540
+				$date = date('c',$date);
541 541
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
542 542
 
543 543
 		return $spotter_array;
544 544
 	}
545 545
 
546 546
 
547
-        /**
548
-	* Gets all the spotter information based on a particular id
549
-	*
550
-	* @return Array the spotter information
551
-	*
552
-	*/
547
+		/**
548
+		 * Gets all the spotter information based on a particular id
549
+		 *
550
+		 * @return Array the spotter information
551
+		 *
552
+		 */
553 553
 	public function getAllLiveMarineDataById($id,$liveinterval = false)
554 554
 	{
555 555
 		global $globalDBdriver, $globalLiveInterval;
@@ -577,18 +577,18 @@  discard block
 block discarded – undo
577 577
 		return $spotter_array;
578 578
 	}
579 579
 
580
-        /**
581
-	* Gets all the spotter information based on a particular ident
582
-	*
583
-	* @return Array the spotter information
584
-	*
585
-	*/
580
+		/**
581
+		 * Gets all the spotter information based on a particular ident
582
+		 *
583
+		 * @return Array the spotter information
584
+		 *
585
+		 */
586 586
 	public function getAllLiveMarineDataByIdent($ident)
587 587
 	{
588 588
 		date_default_timezone_set('UTC');
589 589
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
590 590
 		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
591
-    		try {
591
+			try {
592 592
 			
593 593
 			$sth = $this->db->prepare($query);
594 594
 			$sth->execute(array(':ident' => $ident));
@@ -602,23 +602,23 @@  discard block
 block discarded – undo
602 602
 
603 603
 
604 604
 	/**
605
-	* Deletes all info in the table
606
-	*
607
-	* @return String success or false
608
-	*
609
-	*/
605
+	 * Deletes all info in the table
606
+	 *
607
+	 * @return String success or false
608
+	 *
609
+	 */
610 610
 	public function deleteLiveMarineData()
611 611
 	{
612 612
 		global $globalDBdriver;
613 613
 		if ($globalDBdriver == 'mysql') {
614 614
 			//$query  = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date";
615 615
 			$query  = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date';
616
-            		//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
616
+					//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
617 617
 		} else {
618 618
 			$query  = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date";
619 619
 		}
620 620
         
621
-    		try {
621
+			try {
622 622
 			
623 623
 			$sth = $this->db->prepare($query);
624 624
 			$sth->execute();
@@ -630,18 +630,18 @@  discard block
 block discarded – undo
630 630
 	}
631 631
 
632 632
 	/**
633
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
634
-	*
635
-	* @return String success or false
636
-	*
637
-	*/
633
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
634
+	 *
635
+	 * @return String success or false
636
+	 *
637
+	 */
638 638
 	public function deleteLiveMarineDataNotUpdated()
639 639
 	{
640 640
 		global $globalDBdriver, $globalDebug;
641 641
 		if ($globalDBdriver == 'mysql') {
642 642
 			//$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0';
643
-    			$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
644
-    			try {
643
+				$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
644
+				try {
645 645
 				
646 646
 				$sth = $this->db->prepare($query);
647 647
 				$sth->execute();
@@ -649,8 +649,8 @@  discard block
 block discarded – undo
649 649
 				return "error";
650 650
 			}
651 651
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
652
-                        $i = 0;
653
-                        $j =0;
652
+						$i = 0;
653
+						$j =0;
654 654
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
655 655
 			foreach($all as $row)
656 656
 			{
@@ -658,20 +658,20 @@  discard block
 block discarded – undo
658 658
 				$j++;
659 659
 				if ($j == 30) {
660 660
 					if ($globalDebug) echo ".";
661
-				    	try {
661
+						try {
662 662
 						
663 663
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
664 664
 						$sth->execute();
665 665
 					} catch(PDOException $e) {
666 666
 						return "error";
667 667
 					}
668
-                                	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
669
-                                	$j = 0;
668
+									$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
669
+									$j = 0;
670 670
 				}
671 671
 				$query_delete .= "'".$row['fammarine_id']."',";
672 672
 			}
673 673
 			if ($i > 0) {
674
-    				try {
674
+					try {
675 675
 					
676 676
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
677 677
 					$sth->execute();
@@ -682,9 +682,9 @@  discard block
 block discarded – undo
682 682
 			return "success";
683 683
 		} elseif ($globalDBdriver == 'pgsql') {
684 684
 			//$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0";
685
-    			//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
686
-    			$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
687
-    			try {
685
+				//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
686
+				$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
687
+				try {
688 688
 				
689 689
 				$sth = $this->db->prepare($query);
690 690
 				$sth->execute();
@@ -728,17 +728,17 @@  discard block
 block discarded – undo
728 728
 	}
729 729
 
730 730
 	/**
731
-	* Deletes all info in the table for an ident
732
-	*
733
-	* @return String success or false
734
-	*
735
-	*/
731
+	 * Deletes all info in the table for an ident
732
+	 *
733
+	 * @return String success or false
734
+	 *
735
+	 */
736 736
 	public function deleteLiveMarineDataByIdent($ident)
737 737
 	{
738 738
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
739 739
 		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
740 740
         
741
-    		try {
741
+			try {
742 742
 			
743 743
 			$sth = $this->db->prepare($query);
744 744
 			$sth->execute(array(':ident' => $ident));
@@ -750,17 +750,17 @@  discard block
 block discarded – undo
750 750
 	}
751 751
 
752 752
 	/**
753
-	* Deletes all info in the table for an id
754
-	*
755
-	* @return String success or false
756
-	*
757
-	*/
753
+	 * Deletes all info in the table for an id
754
+	 *
755
+	 * @return String success or false
756
+	 *
757
+	 */
758 758
 	public function deleteLiveMarineDataById($id)
759 759
 	{
760 760
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
761 761
 		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
762 762
         
763
-    		try {
763
+			try {
764 764
 			
765 765
 			$sth = $this->db->prepare($query);
766 766
 			$sth->execute(array(':id' => $id));
@@ -773,11 +773,11 @@  discard block
 block discarded – undo
773 773
 
774 774
 
775 775
 	/**
776
-	* Gets the marine races
777
-	*
778
-	* @return Array all races
779
-	*
780
-	*/
776
+	 * Gets the marine races
777
+	 *
778
+	 * @return Array all races
779
+	 *
780
+	 */
781 781
 	public function getAllRaces()
782 782
 	{
783 783
 		$query  = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name';
@@ -787,11 +787,11 @@  discard block
 block discarded – undo
787 787
 	}
788 788
 
789 789
 	/**
790
-	* Gets the aircraft ident within the last hour
791
-	*
792
-	* @return String the ident
793
-	*
794
-	*/
790
+	 * Gets the aircraft ident within the last hour
791
+	 *
792
+	 * @return String the ident
793
+	 *
794
+	 */
795 795
 	public function getIdentFromLastHour($ident)
796 796
 	{
797 797
 		global $globalDBdriver, $globalTimezone;
@@ -817,14 +817,14 @@  discard block
 block discarded – undo
817 817
 			$ident_result = $row['ident'];
818 818
 		}
819 819
 		return $ident_result;
820
-        }
820
+		}
821 821
 
822 822
 	/**
823
-	* Check recent aircraft
824
-	*
825
-	* @return String the ident
826
-	*
827
-	*/
823
+	 * Check recent aircraft
824
+	 *
825
+	 * @return String the ident
826
+	 *
827
+	 */
828 828
 	public function checkIdentRecent($ident)
829 829
 	{
830 830
 		global $globalDBdriver, $globalTimezone;
@@ -850,14 +850,14 @@  discard block
 block discarded – undo
850 850
 			$ident_result = $row['fammarine_id'];
851 851
 		}
852 852
 		return $ident_result;
853
-        }
853
+		}
854 854
 
855 855
 	/**
856
-	* Check recent aircraft by id
857
-	*
858
-	* @return String the ident
859
-	*
860
-	*/
856
+	 * Check recent aircraft by id
857
+	 *
858
+	 * @return String the ident
859
+	 *
860
+	 */
861 861
 	public function checkIdRecent($id)
862 862
 	{
863 863
 		global $globalDBdriver, $globalTimezone;
@@ -883,14 +883,14 @@  discard block
 block discarded – undo
883 883
 			$ident_result = $row['fammarine_id'];
884 884
 		}
885 885
 		return $ident_result;
886
-        }
886
+		}
887 887
 
888 888
 	/**
889
-	* Check recent aircraft by mmsi
890
-	*
891
-	* @return String the ident
892
-	*
893
-	*/
889
+	 * Check recent aircraft by mmsi
890
+	 *
891
+	 * @return String the ident
892
+	 *
893
+	 */
894 894
 	public function checkMMSIRecent($mmsi)
895 895
 	{
896 896
 		global $globalDBdriver, $globalTimezone;
@@ -916,19 +916,19 @@  discard block
 block discarded – undo
916 916
 			$ident_result = $row['fammarine_id'];
917 917
 		}
918 918
 		return $ident_result;
919
-        }
919
+		}
920 920
 
921 921
 	/**
922
-	* Adds a new spotter data
923
-	*
924
-	* @param String $fammarine_id the ID from flightaware
925
-	* @param String $ident the flight ident
926
-	* @param String $aircraft_icao the aircraft type
927
-	* @param String $departure_airport_icao the departure airport
928
-	* @param String $arrival_airport_icao the arrival airport
929
-	* @return String success or false
930
-	*
931
-	*/
922
+	 * Adds a new spotter data
923
+	 *
924
+	 * @param String $fammarine_id the ID from flightaware
925
+	 * @param String $ident the flight ident
926
+	 * @param String $aircraft_icao the aircraft type
927
+	 * @param String $departure_airport_icao the departure airport
928
+	 * @param String $arrival_airport_icao the arrival airport
929
+	 * @return String success or false
930
+	 *
931
+	 */
932 932
 	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 = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '')
933 933
 	{
934 934
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1006,10 +1006,10 @@  discard block
 block discarded – undo
1006 1006
 		if ($typeid == '') $typeid = NULL;
1007 1007
 		if ($statusid == '') $statusid = NULL;
1008 1008
 
1009
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1010
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1011
-            	if ($arrival_date == '') $arrival_date = NULL;
1012
-            	$query = '';
1009
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1010
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1011
+				if ($arrival_date == '') $arrival_date = NULL;
1012
+				$query = '';
1013 1013
 		if ($globalArchive) {
1014 1014
 			if ($globalDebug) echo '-- Delete previous data -- ';
1015 1015
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
Please login to merge, or discard this patch.
Spacing   +123 added lines, -123 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']."'";
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
 					$filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
82 82
 				}
83 83
 			}
84
-			$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";
84
+			$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";
85 85
 		}
86 86
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
87
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
87
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
88 88
 		}
89 89
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
90 90
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
91 91
 		if ($filter_query_where != '') {
92
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
92
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
93 93
 		}
94 94
 		$filter_query = $filter_query_join.$filter_query_where;
95 95
 		return $filter_query;
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 		if ($limit != '')
113 113
 		{
114 114
 			$limit_array = explode(',', $limit);
115
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
116
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
115
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
116
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
117 117
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
118 118
 			{
119 119
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
129 129
 			}
130 130
 		}
131
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
131
+		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
132 132
 
133 133
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
134 134
 		if ($globalDBdriver == 'mysql') {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		} else {
138 138
 			$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;
139 139
 		}
140
-		$spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true);
140
+		$spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true);
141 141
 
142 142
 		return $spotter_array;
143 143
 	}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		global $globalDBdriver, $globalLiveInterval;
154 154
 		date_default_timezone_set('UTC');
155 155
 
156
-		$filter_query = $this->getFilter($filter,true,true);
156
+		$filter_query = $this->getFilter($filter, true, true);
157 157
 
158 158
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
159 159
 		if ($globalDBdriver == 'mysql') {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		try {
168 168
 			$sth = $this->db->prepare($query);
169 169
 			$sth->execute();
170
-		} catch(PDOException $e) {
170
+		} catch (PDOException $e) {
171 171
 			echo $e->getMessage();
172 172
 			die;
173 173
 		}
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	* @return Array the spotter information
183 183
 	*
184 184
 	*/
185
-	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '')
185
+	public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false, $id = '')
186 186
 	{
187 187
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
188 188
 		date_default_timezone_set('UTC');
189 189
 		$usecoord = false;
190 190
 		if (is_array($coord) && !empty($coord)) {
191
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
192
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
193
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
194
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
191
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
192
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
193
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
194
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
195 195
 			$usecoord = true;
196 196
 		}
197
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
198
-		$filter_query = $this->getFilter($filter,true,true);
197
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
198
+		$filter_query = $this->getFilter($filter, true, true);
199 199
 
200 200
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
201 201
 		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
202 202
 		if ($globalDBdriver == 'mysql') {
203 203
 			if (isset($globalArchive) && $globalArchive === TRUE) {
204
-				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
204
+				$query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
205 205
 				    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 ";
206 206
 				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
207 207
 				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				    ORDER BY fammarine_id, date";
216 216
 				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
217 217
 			} else {
218
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
218
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
219 219
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
220 220
 				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
221 221
 				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			}
226 226
 		} else {
227 227
 			if (isset($globalArchive) && $globalArchive === TRUE) {
228
-				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
228
+				$query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
229 229
 				    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 ";
230 230
 				if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
231 231
 				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		try {
253 253
 			$sth = $this->db->prepare($query);
254 254
 			$sth->execute($query_values);
255
-		} catch(PDOException $e) {
255
+		} catch (PDOException $e) {
256 256
 			echo $e->getMessage();
257 257
 			die;
258 258
 		}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	public function getLiveMarineCount($filter = array())
270 270
 	{
271 271
 		global $globalDBdriver, $globalLiveInterval;
272
-		$filter_query = $this->getFilter($filter,true,true);
272
+		$filter_query = $this->getFilter($filter, true, true);
273 273
 
274 274
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
275 275
 		if ($globalDBdriver == 'mysql') {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		try {
281 281
 			$sth = $this->db->prepare($query);
282 282
 			$sth->execute();
283
-		} catch(PDOException $e) {
283
+		} catch (PDOException $e) {
284 284
 			echo $e->getMessage();
285 285
 			die;
286 286
 		}
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 		$filter_query = $this->getFilter($filter);
304 304
 
305 305
 		if (is_array($coord)) {
306
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
307
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
308
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
309
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
306
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
307
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
308
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
309
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
310 310
 		} else return array();
311 311
 		if ($globalDBdriver == 'mysql') {
312 312
 			$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;
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
329 329
 		$Marine = new Marine($this->db);
330 330
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
331
-		$filter_query = $this->getFilter($filter,true,true);
331
+		$filter_query = $this->getFilter($filter, true, true);
332 332
 
333 333
 		if (is_array($coord)) {
334
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
335
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
336
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
337
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
334
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
335
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
336
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
337
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
338 338
 		} else return array();
339 339
 		/*
340 340
 		if ($globalDBdriver == 'mysql') {
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
 		*/
350 350
 		if ($globalDBdriver == 'mysql') {
351 351
 			if (isset($globalArchive) && $globalArchive === TRUE) {
352
-				$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, marine_live.captain_name 
352
+				$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, marine_live.captain_name 
353 353
 				    FROM marine_live 
354 354
 				    '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date 
355 355
 				    AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
356 356
 				    AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY date DESC';
357 357
 			} else {
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, marine_live.captain_name 
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, marine_live.captain_name 
359 359
 				    FROM marine_live 
360 360
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
361 361
 				    FROM marine_live l 
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 			}
368 368
 		} else {
369 369
 			if (isset($globalArchive) && $globalArchive === TRUE) {
370
-				$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, marine_live.captain_name 
370
+				$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, marine_live.captain_name 
371 371
 				    FROM marine_live 
372 372
 				    ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date 
373 373
 				    AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
374 374
 				    AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
375 375
 				    AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY date DESC";
376 376
 			} else {
377
-				$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, marine_live.captain_name 
377
+				$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, marine_live.captain_name 
378 378
 				    FROM marine_live 
379 379
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
380 380
 				    FROM marine_live l 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
                 if ($interval == '1m')
432 432
                 {
433 433
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
434
-                } else if ($interval == '15m'){
434
+                } else if ($interval == '15m') {
435 435
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
436 436
                 } 
437 437
             }
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
440 440
         }
441 441
 
442
-                $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 
442
+                $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 
443 443
                    WHERE marine_live.latitude <> '' 
444 444
                                    AND marine_live.longitude <> '' 
445 445
                    ".$additional_query."
446 446
                    HAVING distance < :radius  
447 447
                                    ORDER BY distance";
448 448
 
449
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
449
+                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
450 450
 
451 451
                 return $spotter_array;
452 452
         }
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
 		date_default_timezone_set('UTC');
465 465
 
466 466
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
467
-                $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';
467
+                $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';
468 468
 
469
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
469
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true);
470 470
 
471 471
 		return $spotter_array;
472 472
 	}
@@ -477,14 +477,14 @@  discard block
 block discarded – undo
477 477
 	* @return Array the spotter information
478 478
 	*
479 479
 	*/
480
-	public function getDateLiveMarineDataByIdent($ident,$date)
480
+	public function getDateLiveMarineDataByIdent($ident, $date)
481 481
 	{
482 482
 		$Marine = new Marine($this->db);
483 483
 		date_default_timezone_set('UTC');
484 484
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
485 485
 		$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';
486
-		$date = date('c',$date);
487
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
486
+		$date = date('c', $date);
487
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
488 488
 		return $spotter_array;
489 489
 	}
490 490
 
@@ -494,14 +494,14 @@  discard block
 block discarded – undo
494 494
 	* @return Array the spotter information
495 495
 	*
496 496
 	*/
497
-	public function getDateLiveMarineDataByMMSI($mmsi,$date)
497
+	public function getDateLiveMarineDataByMMSI($mmsi, $date)
498 498
 	{
499 499
 		$Marine = new Marine($this->db);
500 500
 		date_default_timezone_set('UTC');
501 501
 		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
502 502
 		$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';
503
-		$date = date('c',$date);
504
-		$spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date));
503
+		$date = date('c', $date);
504
+		$spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date));
505 505
 		return $spotter_array;
506 506
 	}
507 507
 
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
 		date_default_timezone_set('UTC');
518 518
 
519 519
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
520
-                $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';
520
+                $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';
521 521
 
522
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
522
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true);
523 523
 
524 524
 		return $spotter_array;
525 525
 	}
@@ -530,15 +530,15 @@  discard block
 block discarded – undo
530 530
 	* @return Array the spotter information
531 531
 	*
532 532
 	*/
533
-	public function getDateLiveMarineDataById($id,$date)
533
+	public function getDateLiveMarineDataById($id, $date)
534 534
 	{
535 535
 		$Marine = new Marine($this->db);
536 536
 		date_default_timezone_set('UTC');
537 537
 
538 538
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
539
-                $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';
540
-                $date = date('c',$date);
541
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
539
+                $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';
540
+                $date = date('c', $date);
541
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
542 542
 
543 543
 		return $spotter_array;
544 544
 	}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 	* @return Array the spotter information
551 551
 	*
552 552
 	*/
553
-	public function getAllLiveMarineDataById($id,$liveinterval = false)
553
+	public function getAllLiveMarineDataById($id, $liveinterval = false)
554 554
 	{
555 555
 		global $globalDBdriver, $globalLiveInterval;
556 556
 		date_default_timezone_set('UTC');
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 		try {
570 570
 			$sth = $this->db->prepare($query);
571 571
 			$sth->execute(array(':id' => $id));
572
-		} catch(PDOException $e) {
572
+		} catch (PDOException $e) {
573 573
 			echo $e->getMessage();
574 574
 			die;
575 575
 		}
@@ -587,12 +587,12 @@  discard block
 block discarded – undo
587 587
 	{
588 588
 		date_default_timezone_set('UTC');
589 589
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
590
-		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
590
+		$query = self::$global_query.' WHERE marine_live.ident = :ident';
591 591
     		try {
592 592
 			
593 593
 			$sth = $this->db->prepare($query);
594 594
 			$sth->execute(array(':ident' => $ident));
595
-		} catch(PDOException $e) {
595
+		} catch (PDOException $e) {
596 596
 			echo $e->getMessage();
597 597
 			die;
598 598
 		}
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 			
623 623
 			$sth = $this->db->prepare($query);
624 624
 			$sth->execute();
625
-		} catch(PDOException $e) {
625
+		} catch (PDOException $e) {
626 626
 			return "error";
627 627
 		}
628 628
 
@@ -645,14 +645,14 @@  discard block
 block discarded – undo
645 645
 				
646 646
 				$sth = $this->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error";
650 650
 			}
651 651
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
652 652
                         $i = 0;
653
-                        $j =0;
653
+                        $j = 0;
654 654
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
655
-			foreach($all as $row)
655
+			foreach ($all as $row)
656 656
 			{
657 657
 				$i++;
658 658
 				$j++;
@@ -660,9 +660,9 @@  discard block
 block discarded – undo
660 660
 					if ($globalDebug) echo ".";
661 661
 				    	try {
662 662
 						
663
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
663
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
664 664
 						$sth->execute();
665
-					} catch(PDOException $e) {
665
+					} catch (PDOException $e) {
666 666
 						return "error";
667 667
 					}
668 668
                                 	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
 			if ($i > 0) {
674 674
     				try {
675 675
 					
676
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
676
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
677 677
 					$sth->execute();
678
-				} catch(PDOException $e) {
678
+				} catch (PDOException $e) {
679 679
 					return "error";
680 680
 				}
681 681
 			}
@@ -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
 /*			$query_delete = "DELETE FROM marine_live WHERE fammarine_id IN (";
@@ -736,13 +736,13 @@  discard block
 block discarded – undo
736 736
 	public function deleteLiveMarineDataByIdent($ident)
737 737
 	{
738 738
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
739
-		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
739
+		$query = 'DELETE FROM marine_live WHERE ident = :ident';
740 740
         
741 741
     		try {
742 742
 			
743 743
 			$sth = $this->db->prepare($query);
744 744
 			$sth->execute(array(':ident' => $ident));
745
-		} catch(PDOException $e) {
745
+		} catch (PDOException $e) {
746 746
 			return "error";
747 747
 		}
748 748
 
@@ -758,13 +758,13 @@  discard block
 block discarded – undo
758 758
 	public function deleteLiveMarineDataById($id)
759 759
 	{
760 760
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
761
-		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
761
+		$query = 'DELETE FROM marine_live WHERE fammarine_id = :id';
762 762
         
763 763
     		try {
764 764
 			
765 765
 			$sth = $this->db->prepare($query);
766 766
 			$sth->execute(array(':id' => $id));
767
-		} catch(PDOException $e) {
767
+		} catch (PDOException $e) {
768 768
 			return "error";
769 769
 		}
770 770
 
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	*/
781 781
 	public function getAllRaces()
782 782
 	{
783
-		$query  = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name';
783
+		$query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name';
784 784
 		$sth = $this->db->prepare($query);
785 785
 		$sth->execute();
786 786
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	{
797 797
 		global $globalDBdriver, $globalTimezone;
798 798
 		if ($globalDBdriver == 'mysql') {
799
-			$query  = 'SELECT marine_live.ident FROM marine_live 
799
+			$query = 'SELECT marine_live.ident FROM marine_live 
800 800
 				WHERE marine_live.ident = :ident 
801 801
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
802 802
 				AND marine_live.date < UTC_TIMESTAMP()';
803 803
 			$query_data = array(':ident' => $ident);
804 804
 		} else {
805
-			$query  = "SELECT marine_live.ident FROM marine_live 
805
+			$query = "SELECT marine_live.ident FROM marine_live 
806 806
 				WHERE marine_live.ident = :ident 
807 807
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
808 808
 				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
 		
812 812
 		$sth = $this->db->prepare($query);
813 813
 		$sth->execute($query_data);
814
-		$ident_result='';
815
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
814
+		$ident_result = '';
815
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
816 816
 		{
817 817
 			$ident_result = $row['ident'];
818 818
 		}
@@ -829,13 +829,13 @@  discard block
 block discarded – undo
829 829
 	{
830 830
 		global $globalDBdriver, $globalTimezone;
831 831
 		if ($globalDBdriver == 'mysql') {
832
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
832
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
833 833
 				WHERE marine_live.ident = :ident 
834 834
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
835 835
 //				AND marine_live.date < UTC_TIMESTAMP()";
836 836
 			$query_data = array(':ident' => $ident);
837 837
 		} else {
838
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
838
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
839 839
 				WHERE marine_live.ident = :ident 
840 840
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
841 841
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -844,8 +844,8 @@  discard block
 block discarded – undo
844 844
 		
845 845
 		$sth = $this->db->prepare($query);
846 846
 		$sth->execute($query_data);
847
-		$ident_result='';
848
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
847
+		$ident_result = '';
848
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
849 849
 		{
850 850
 			$ident_result = $row['fammarine_id'];
851 851
 		}
@@ -862,13 +862,13 @@  discard block
 block discarded – undo
862 862
 	{
863 863
 		global $globalDBdriver, $globalTimezone;
864 864
 		if ($globalDBdriver == 'mysql') {
865
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
865
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
866 866
 				WHERE marine_live.fammarine_id = :id 
867 867
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
868 868
 //				AND marine_live.date < UTC_TIMESTAMP()";
869 869
 			$query_data = array(':id' => $id);
870 870
 		} else {
871
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
871
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
872 872
 				WHERE marine_live.fammarine_id = :id 
873 873
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
874 874
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
 		
878 878
 		$sth = $this->db->prepare($query);
879 879
 		$sth->execute($query_data);
880
-		$ident_result='';
881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
880
+		$ident_result = '';
881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
882 882
 		{
883 883
 			$ident_result = $row['fammarine_id'];
884 884
 		}
@@ -895,13 +895,13 @@  discard block
 block discarded – undo
895 895
 	{
896 896
 		global $globalDBdriver, $globalTimezone;
897 897
 		if ($globalDBdriver == 'mysql') {
898
-			$query  = 'SELECT marine_live.fammarine_id FROM marine_live 
898
+			$query = 'SELECT marine_live.fammarine_id FROM marine_live 
899 899
 				WHERE marine_live.mmsi = :mmsi 
900 900
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
901 901
 //				AND marine_live.date < UTC_TIMESTAMP()";
902 902
 			$query_data = array(':mmsi' => $mmsi);
903 903
 		} else {
904
-			$query  = "SELECT marine_live.fammarine_id FROM marine_live 
904
+			$query = "SELECT marine_live.fammarine_id FROM marine_live 
905 905
 				WHERE marine_live.mmsi = :mmsi 
906 906
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
907 907
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 		
911 911
 		$sth = $this->db->prepare($query);
912 912
 		$sth->execute($query_data);
913
-		$ident_result='';
914
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
913
+		$ident_result = '';
914
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
915 915
 		{
916 916
 			$ident_result = $row['fammarine_id'];
917 917
 		}
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 	* @return String success or false
930 930
 	*
931 931
 	*/
932
-	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 = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '')
932
+	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 = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '')
933 933
 	{
934 934
 		global $globalURL, $globalArchive, $globalDebug;
935 935
 		$Common = new Common();
@@ -981,33 +981,33 @@  discard block
 block discarded – undo
981 981
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
982 982
 
983 983
         
984
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
985
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
986
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
987
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
988
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
989
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
990
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
991
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
992
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
993
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
994
-		$typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT);
995
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
996
-		$status = filter_var($status,FILTER_SANITIZE_STRING);
997
-		$statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT);
998
-		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
999
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
1000
-		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
1001
-		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
1002
-		$captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING);
1003
-		$captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING);
1004
-		$race_id = filter_var($race_id,FILTER_SANITIZE_STRING);
1005
-		$race_name = filter_var($race_name,FILTER_SANITIZE_STRING);
984
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
985
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
986
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
987
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
988
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
989
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
990
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
991
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
992
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
993
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
994
+		$typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT);
995
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
996
+		$status = filter_var($status, FILTER_SANITIZE_STRING);
997
+		$statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT);
998
+		$imo = filter_var($imo, FILTER_SANITIZE_STRING);
999
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
1000
+		$arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING);
1001
+		$arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING);
1002
+		$captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING);
1003
+		$captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING);
1004
+		$race_id = filter_var($race_id, FILTER_SANITIZE_STRING);
1005
+		$race_name = filter_var($race_name, FILTER_SANITIZE_STRING);
1006 1006
 		if ($typeid == '') $typeid = NULL;
1007 1007
 		if ($statusid == '') $statusid = NULL;
1008 1008
 
1009
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1010
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1009
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1010
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1011 1011
             	if ($arrival_date == '') $arrival_date = NULL;
1012 1012
             	$query = '';
1013 1013
 		if ($globalArchive) {
@@ -1016,19 +1016,19 @@  discard block
 block discarded – undo
1016 1016
 		}
1017 1017
 		$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,captain_id,captain_name,race_id,race_name) 
1018 1018
 		    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,:captain_id,:captain_name,:race_id,:race_name)';
1019
-		$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,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name);
1019
+		$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, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name);
1020 1020
 		try {
1021 1021
 			$sth = $this->db->prepare($query);
1022 1022
 			$sth->execute($query_values);
1023 1023
 			$sth->closeCursor();
1024
-		} catch(PDOException $e) {
1024
+		} catch (PDOException $e) {
1025 1025
 			return "error : ".$e->getMessage();
1026 1026
 		}
1027 1027
 		
1028 1028
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1029 1029
 			if ($globalDebug) echo '(Add to Marine archive : ';
1030 1030
 			$MarineArchive = new MarineArchive($this->db);
1031
-			$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,$captain_id,$captain_name,$race_id,$race_name);
1031
+			$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, $captain_id, $captain_name, $race_id, $race_name);
1032 1032
 			if ($globalDebug) echo $result.')';
1033 1033
 		}
1034 1034
 		return "success";
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 	public function getOrderBy()
1038 1038
 	{
1039
-		$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"));
1039
+		$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"));
1040 1040
 		return $orderby;
1041 1041
 	}
1042 1042
 
Please login to merge, or discard this patch.
Braces   +140 added lines, -47 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) {
@@ -86,8 +90,11 @@  discard block
 block discarded – undo
86 90
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
87 91
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
88 92
 		}
89
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
90
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
93
+		if ($filter_query_where == '' && $where) {
94
+			$filter_query_where = ' WHERE';
95
+		} elseif ($filter_query_where != '' && $and) {
96
+			$filter_query_where .= ' AND';
97
+		}
91 98
 		if ($filter_query_where != '') {
92 99
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
93 100
 		}
@@ -128,9 +135,13 @@  discard block
 block discarded – undo
128 135
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
129 136
 			}
130 137
 		}
131
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
138
+		if ($orderby_query == '') {
139
+			$orderby_query= ' ORDER BY date DESC';
140
+		}
132 141
 
133
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
142
+		if (!isset($globalLiveInterval)) {
143
+			$globalLiveInterval = '200';
144
+		}
134 145
 		if ($globalDBdriver == 'mysql') {
135 146
 			//$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";
136 147
 			$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;
@@ -155,7 +166,9 @@  discard block
 block discarded – undo
155 166
 
156 167
 		$filter_query = $this->getFilter($filter,true,true);
157 168
 
158
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
169
+		if (!isset($globalLiveInterval)) {
170
+			$globalLiveInterval = '200';
171
+		}
159 172
 		if ($globalDBdriver == 'mysql') {
160 173
 			$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, marine_live.captain_name 
161 174
 			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";
@@ -197,58 +210,96 @@  discard block
 block discarded – undo
197 210
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
198 211
 		$filter_query = $this->getFilter($filter,true,true);
199 212
 
200
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
201
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
213
+		if (!isset($globalLiveInterval)) {
214
+			$globalLiveInterval = '200';
215
+		}
216
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
217
+			$globalMap3DMarinesLimit = '300';
218
+		}
202 219
 		if ($globalDBdriver == 'mysql') {
203 220
 			if (isset($globalArchive) && $globalArchive === TRUE) {
204 221
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
205 222
 				    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 ";
206
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
207
-				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
223
+				if ($usecoord) {
224
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
225
+				}
226
+				if ($id != '') {
227
+					$query .= "OR marine_archive.fammarine_id = :id ";
228
+				}
208 229
 				$query .= "UNION
209 230
 				    SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
210 231
 				    FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date";
211
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
212
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
232
+				if ($usecoord) {
233
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
234
+				}
235
+				if ($id != '') {
236
+					$query .= "OR marine_live.fammarine_id = :id ";
237
+				}
213 238
 				$query .= ") AS marine 
214 239
 				    WHERE latitude <> '0' AND longitude <> '0' 
215 240
 				    ORDER BY fammarine_id, date";
216
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
241
+				if ($limit) {
242
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
243
+				}
217 244
 			} else {
218 245
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
219 246
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
220
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
221
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
247
+				if ($usecoord) {
248
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
249
+				}
250
+				if ($id != '') {
251
+					$query .= "OR marine_live.fammarine_id = :id ";
252
+				}
222 253
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
223 254
 				ORDER BY marine_live.fammarine_id, marine_live.date";
224
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
255
+				if ($limit) {
256
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
257
+				}
225 258
 			}
226 259
 		} else {
227 260
 			if (isset($globalArchive) && $globalArchive === TRUE) {
228 261
 				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
229 262
 				    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 ";
230
-				if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
231
-				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
263
+				if ($usecoord) {
264
+					$query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
265
+				}
266
+				if ($id != '') {
267
+					$query .= "OR marine_archive.fammarine_id = :id ";
268
+				}
232 269
 				$query .= "UNION
233 270
 				    SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
234 271
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date";
235
-				if ($usecoord) $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
236
-				if ($id != '') $query .= " OR marine_live.fammarine_id = :id";
272
+				if ($usecoord) {
273
+					$query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
274
+				}
275
+				if ($id != '') {
276
+					$query .= " OR marine_live.fammarine_id = :id";
277
+				}
237 278
 				$query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' ";
238 279
 				$query .= "ORDER BY fammarine_id, date";
239
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
280
+				if ($limit) {
281
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
282
+				}
240 283
 			} else {
241 284
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
242 285
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date ";
243
-				if ($usecoord) $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
244
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
286
+				if ($usecoord) {
287
+					$query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
288
+				}
289
+				if ($id != '') {
290
+					$query .= "OR marine_live.fammarine_id = :id ";
291
+				}
245 292
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
246 293
 				ORDER BY marine_live.fammarine_id, marine_live.date";
247
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
294
+				if ($limit) {
295
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
296
+				}
248 297
 			}
249 298
 		}
250 299
 		$query_values = array();
251
-		if ($id != '') $query_values = array(':id' => $id);
300
+		if ($id != '') {
301
+			$query_values = array(':id' => $id);
302
+		}
252 303
 		try {
253 304
 			$sth = $this->db->prepare($query);
254 305
 			$sth->execute($query_values);
@@ -271,7 +322,9 @@  discard block
 block discarded – undo
271 322
 		global $globalDBdriver, $globalLiveInterval;
272 323
 		$filter_query = $this->getFilter($filter,true,true);
273 324
 
274
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
325
+		if (!isset($globalLiveInterval)) {
326
+			$globalLiveInterval = '200';
327
+		}
275 328
 		if ($globalDBdriver == 'mysql') {
276 329
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
277 330
 		} else {
@@ -299,7 +352,9 @@  discard block
 block discarded – undo
299 352
 	{
300 353
 		global $globalDBdriver, $globalLiveInterval;
301 354
 		$Marine = new Marine($this->db);
302
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
355
+		if (!isset($globalLiveInterval)) {
356
+			$globalLiveInterval = '200';
357
+		}
303 358
 		$filter_query = $this->getFilter($filter);
304 359
 
305 360
 		if (is_array($coord)) {
@@ -307,7 +362,9 @@  discard block
 block discarded – undo
307 362
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
308 363
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
309 364
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
310
-		} else return array();
365
+		} else {
366
+			return array();
367
+		}
311 368
 		if ($globalDBdriver == 'mysql') {
312 369
 			$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;
313 370
 		} else {
@@ -327,7 +384,9 @@  discard block
 block discarded – undo
327 384
 	{
328 385
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
329 386
 		$Marine = new Marine($this->db);
330
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
387
+		if (!isset($globalLiveInterval)) {
388
+			$globalLiveInterval = '200';
389
+		}
331 390
 		$filter_query = $this->getFilter($filter,true,true);
332 391
 
333 392
 		if (is_array($coord)) {
@@ -335,7 +394,9 @@  discard block
 block discarded – undo
335 394
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
336 395
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
337 396
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
338
-		} else return array();
397
+		} else {
398
+			return array();
399
+		}
339 400
 		/*
340 401
 		if ($globalDBdriver == 'mysql') {
341 402
 			$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 
@@ -558,11 +619,15 @@  discard block
 block discarded – undo
558 619
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
559 620
 		if ($globalDBdriver == 'mysql') {
560 621
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
561
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
622
+			if ($liveinterval) {
623
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
624
+			}
562 625
 			$query .= ' ORDER BY date';
563 626
 		} else {
564 627
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
565
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
628
+			if ($liveinterval) {
629
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
630
+			}
566 631
 			$query .= ' ORDER BY date';
567 632
 		}
568 633
 
@@ -657,7 +722,9 @@  discard block
 block discarded – undo
657 722
 				$i++;
658 723
 				$j++;
659 724
 				if ($j == 30) {
660
-					if ($globalDebug) echo ".";
725
+					if ($globalDebug) {
726
+						echo ".";
727
+					}
661 728
 				    	try {
662 729
 						
663 730
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -951,7 +1018,9 @@  discard block
 block discarded – undo
951 1018
 			{
952 1019
 				return false;
953 1020
 			}
954
-		} else return '';
1021
+		} else {
1022
+			return '';
1023
+		}
955 1024
 
956 1025
 		if ($longitude != '')
957 1026
 		{
@@ -959,7 +1028,9 @@  discard block
 block discarded – undo
959 1028
 			{
960 1029
 				return false;
961 1030
 			}
962
-		} else return '';
1031
+		} else {
1032
+			return '';
1033
+		}
963 1034
 
964 1035
 
965 1036
 		if ($heading != '')
@@ -968,7 +1039,9 @@  discard block
 block discarded – undo
968 1039
 			{
969 1040
 				return false;
970 1041
 			}
971
-		} else $heading = 0;
1042
+		} else {
1043
+			$heading = 0;
1044
+		}
972 1045
 
973 1046
 		if ($groundspeed != '')
974 1047
 		{
@@ -976,9 +1049,13 @@  discard block
 block discarded – undo
976 1049
 			{
977 1050
 				return false;
978 1051
 			}
979
-		} else $groundspeed = 0;
1052
+		} else {
1053
+			$groundspeed = 0;
1054
+		}
980 1055
 		date_default_timezone_set('UTC');
981
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1056
+		if ($date == '') {
1057
+			$date = date("Y-m-d H:i:s", time());
1058
+		}
982 1059
 
983 1060
         
984 1061
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1003,15 +1080,27 @@  discard block
 block discarded – undo
1003 1080
 		$captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING);
1004 1081
 		$race_id = filter_var($race_id,FILTER_SANITIZE_STRING);
1005 1082
 		$race_name = filter_var($race_name,FILTER_SANITIZE_STRING);
1006
-		if ($typeid == '') $typeid = NULL;
1007
-		if ($statusid == '') $statusid = NULL;
1083
+		if ($typeid == '') {
1084
+			$typeid = NULL;
1085
+		}
1086
+		if ($statusid == '') {
1087
+			$statusid = NULL;
1088
+		}
1008 1089
 
1009
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1010
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1011
-            	if ($arrival_date == '') $arrival_date = NULL;
1090
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1091
+            		$groundspeed = 0;
1092
+            	}
1093
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1094
+            		$heading = 0;
1095
+            	}
1096
+            	if ($arrival_date == '') {
1097
+            		$arrival_date = NULL;
1098
+            	}
1012 1099
             	$query = '';
1013 1100
 		if ($globalArchive) {
1014
-			if ($globalDebug) echo '-- Delete previous data -- ';
1101
+			if ($globalDebug) {
1102
+				echo '-- Delete previous data -- ';
1103
+			}
1015 1104
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
1016 1105
 		}
1017 1106
 		$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,captain_id,captain_name,race_id,race_name) 
@@ -1026,10 +1115,14 @@  discard block
 block discarded – undo
1026 1115
 		}
1027 1116
 		
1028 1117
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1029
-			if ($globalDebug) echo '(Add to Marine archive : ';
1118
+			if ($globalDebug) {
1119
+				echo '(Add to Marine archive : ';
1120
+			}
1030 1121
 			$MarineArchive = new MarineArchive($this->db);
1031 1122
 			$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,$captain_id,$captain_name,$race_id,$race_name);
1032
-			if ($globalDebug) echo $result.')';
1123
+			if ($globalDebug) {
1124
+				echo $result.')';
1125
+			}
1033 1126
 		}
1034 1127
 		return "success";
1035 1128
 	}
Please login to merge, or discard this patch.