Completed
Push — master ( c396ef...4342b6 )
by Yannick
34:34
created
require/class.TrackerLive.php 3 patches
Braces   +114 added lines, -39 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. (TrackerLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (TrackerLive)');
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) {
@@ -77,8 +81,11 @@  discard block
 block discarded – undo
77 81
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
78 82
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
79 83
 		}
80
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
81
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
84
+		if ($filter_query_where == '' && $where) {
85
+			$filter_query_where = ' WHERE';
86
+		} elseif ($filter_query_where != '' && $and) {
87
+			$filter_query_where .= ' AND';
88
+		}
82 89
 		if ($filter_query_where != '') {
83 90
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
84 91
 		}
@@ -120,7 +127,9 @@  discard block
 block discarded – undo
120 127
 			}
121 128
 		}
122 129
 
123
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
130
+		if (!isset($globalLiveInterval)) {
131
+			$globalLiveInterval = '200';
132
+		}
124 133
 		if ($globalDBdriver == 'mysql') {
125 134
 			//$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate";
126 135
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -145,7 +154,9 @@  discard block
 block discarded – undo
145 154
 
146 155
 		$filter_query = $this->getFilter($filter,true,true);
147 156
 
148
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
157
+		if (!isset($globalLiveInterval)) {
158
+			$globalLiveInterval = '200';
159
+		}
149 160
 		if ($globalDBdriver == 'mysql') {
150 161
 			$query  = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
151 162
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0";
@@ -190,50 +201,74 @@  discard block
 block discarded – undo
190 201
 		}
191 202
 		$filter_query = $this->getFilter($filter,true,true);
192 203
 
193
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194
-		if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300';
204
+		if (!isset($globalLiveInterval)) {
205
+			$globalLiveInterval = '200';
206
+		}
207
+		if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') {
208
+			$globalMap3DTrackersLimit = '300';
209
+		}
195 210
 		if ($globalDBdriver == 'mysql') {
196 211
 			if (isset($globalArchive) && $globalArchive) {
197 212
 				$query  = "SELECT * FROM (
198 213
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
199 214
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
200
-				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
215
+				if ($usecoord) {
216
+					$query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
217
+				}
201 218
 				$query .= "UNION
202 219
 					SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
203 220
 					FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date ";
204
-				if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
221
+				if ($usecoord) {
222
+					$query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
223
+				}
205 224
 				$query .= ") AS tracker
206 225
 				    WHERE latitude <> '0' AND longitude <> '0' 
207 226
 				    ORDER BY famtrackid, date";
208
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
227
+				if ($limit) {
228
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
229
+				}
209 230
 			} else {
210 231
 				$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
211 232
 				    FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date ";
212
-				if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
233
+				if ($usecoord) {
234
+					$query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
235
+				}
213 236
 				$query .= "AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
214 237
 				    ORDER BY tracker_live.famtrackid, tracker_live.date";
215
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
238
+				if ($limit) {
239
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
240
+				}
216 241
 			}
217 242
 		} else {
218 243
 			if (isset($globalArchive) && $globalArchive) {
219 244
 				$query  = "SELECT * FROM (
220 245
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
221 246
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
222
-				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
247
+				if ($usecoord) {
248
+					$query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
249
+				}
223 250
 				$query .= "UNION
224 251
 					SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
225 252
 					FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date";
226
-				if ($usecoord) $query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
253
+				if ($usecoord) {
254
+					$query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
255
+				}
227 256
 				$query .= ") AS tracker
228 257
 				    WHERE latitude <> '0' AND longitude <> '0' 
229 258
 				    ORDER BY famtrackid, date";
230
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
259
+				if ($limit) {
260
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
261
+				}
231 262
 			} else {
232 263
 				$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
233 264
 				    FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' ";
234
-				if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
265
+				if ($usecoord) {
266
+					$query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
267
+				}
235 268
 				$query .= "ORDER BY tracker_live.famtrackid, tracker_live.date";
236
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
269
+				if ($limit) {
270
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
271
+				}
237 272
 			}
238 273
 		}
239 274
 
@@ -259,7 +294,9 @@  discard block
 block discarded – undo
259 294
 		global $globalDBdriver, $globalLiveInterval;
260 295
 		$filter_query = $this->getFilter($filter,true,true);
261 296
 
262
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
297
+		if (!isset($globalLiveInterval)) {
298
+			$globalLiveInterval = '200';
299
+		}
263 300
 		if ($globalDBdriver == 'mysql') {
264 301
 			$query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
265 302
 		} else {
@@ -287,7 +324,9 @@  discard block
 block discarded – undo
287 324
 	{
288 325
 		global $globalDBdriver, $globalLiveInterval;
289 326
 		$Tracker = new Tracker($this->db);
290
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
327
+		if (!isset($globalLiveInterval)) {
328
+			$globalLiveInterval = '200';
329
+		}
291 330
 		$filter_query = $this->getFilter($filter);
292 331
 
293 332
 		if (is_array($coord)) {
@@ -295,7 +334,9 @@  discard block
 block discarded – undo
295 334
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
296 335
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
297 336
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
298
-		} else return array();
337
+		} else {
338
+			return array();
339
+		}
299 340
 		if ($globalDBdriver == 'mysql') {
300 341
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
301 342
 		} else {
@@ -315,7 +356,9 @@  discard block
 block discarded – undo
315 356
 	{
316 357
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
317 358
 		$Tracker = new Tracker($this->db);
318
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
359
+		if (!isset($globalLiveInterval)) {
360
+			$globalLiveInterval = '200';
361
+		}
319 362
 		$filter_query = $this->getFilter($filter,true,true);
320 363
 
321 364
 		if (is_array($coord)) {
@@ -323,7 +366,9 @@  discard block
 block discarded – undo
323 366
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324 367
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325 368
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
326
-		} else return array();
369
+		} else {
370
+			return array();
371
+		}
327 372
 		/*
328 373
 		if ($globalDBdriver == 'mysql') {
329 374
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
@@ -557,13 +602,19 @@  discard block
 block discarded – undo
557 602
 		//$query  = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date';
558 603
 		if ($globalDBdriver == 'mysql') {
559 604
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
560
-			if ($liveinterval === true) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
561
-			elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'";
605
+			if ($liveinterval === true) {
606
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
607
+			} elseif ($liveinterval !== false) {
608
+				$query .= " AND date <= '".date('c',$liveinterval)."'";
609
+			}
562 610
 			$query .= ' ORDER BY date';
563 611
 		} else {
564 612
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
565
-			if ($liveinterval === true) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
566
-			elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'";
613
+			if ($liveinterval === true) {
614
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
615
+			} elseif ($liveinterval !== false) {
616
+				$query .= " AND date <= '".date('c',$liveinterval)."'";
617
+			}
567 618
 			$query .= ' ORDER BY date';
568 619
 		}
569 620
 
@@ -658,7 +709,9 @@  discard block
 block discarded – undo
658 709
 				$i++;
659 710
 				$j++;
660 711
 				if ($j == 30) {
661
-					if ($globalDebug) echo ".";
712
+					if ($globalDebug) {
713
+						echo ".";
714
+					}
662 715
 				    	try {
663 716
 						
664 717
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -905,7 +958,9 @@  discard block
 block discarded – undo
905 958
 			{
906 959
 				return false;
907 960
 			}
908
-		} else return '';
961
+		} else {
962
+			return '';
963
+		}
909 964
 
910 965
 		if ($longitude != '')
911 966
 		{
@@ -913,7 +968,9 @@  discard block
 block discarded – undo
913 968
 			{
914 969
 				return false;
915 970
 			}
916
-		} else return '';
971
+		} else {
972
+			return '';
973
+		}
917 974
 
918 975
 		if ($altitude != '')
919 976
 		{
@@ -921,7 +978,9 @@  discard block
 block discarded – undo
921 978
 			{
922 979
 				return false;
923 980
 			}
924
-		} else $altitude = 0;
981
+		} else {
982
+			$altitude = 0;
983
+		}
925 984
 
926 985
 		if ($heading != '')
927 986
 		{
@@ -929,7 +988,9 @@  discard block
 block discarded – undo
929 988
 			{
930 989
 				return false;
931 990
 			}
932
-		} else $heading = 0;
991
+		} else {
992
+			$heading = 0;
993
+		}
933 994
 
934 995
 		if ($groundspeed != '')
935 996
 		{
@@ -937,9 +998,13 @@  discard block
 block discarded – undo
937 998
 			{
938 999
 				return false;
939 1000
 			}
940
-		} else $groundspeed = 0;
1001
+		} else {
1002
+			$groundspeed = 0;
1003
+		}
941 1004
 		date_default_timezone_set('UTC');
942
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1005
+		if ($date == '') {
1006
+			$date = date("Y-m-d H:i:s", time());
1007
+		}
943 1008
 
944 1009
         
945 1010
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -955,12 +1020,18 @@  discard block
 block discarded – undo
955 1020
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
956 1021
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
957 1022
 
958
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
959
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1023
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1024
+            		$groundspeed = 0;
1025
+            	}
1026
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1027
+            		$heading = 0;
1028
+            	}
960 1029
             	
961 1030
 		$query = '';
962 1031
 		if ($globalArchive) {
963
-			if ($globalDebug) echo '-- Delete previous data -- ';
1032
+			if ($globalDebug) {
1033
+				echo '-- Delete previous data -- ';
1034
+			}
964 1035
 			$query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;';
965 1036
 		}
966 1037
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
@@ -979,10 +1050,14 @@  discard block
 block discarded – undo
979 1050
                 echo 'noarchive : '.$noarchive."\n";
980 1051
                 */
981 1052
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
982
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
1053
+		    if ($globalDebug) {
1054
+		    	echo '(Add to Tracker archive '.$famtrackid.' : ';
1055
+		    }
983 1056
 		    $TrackerArchive = new TrackerArchive($this->db);
984 1057
 		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
985
-		    if ($globalDebug) echo $result.')';
1058
+		    if ($globalDebug) {
1059
+		    	echo $result.')';
1060
+		    }
986 1061
 		}
987 1062
 
988 1063
 		return "success";
Please login to merge, or discard this patch.
Indentation   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 	}
20 20
 
21 21
 
22
-    /**
23
-     * Get SQL query part for filter used
24
-     * @param array $filter the filter
25
-     * @param bool $where
26
-     * @param bool $and
27
-     * @return string the SQL part
28
-     */
22
+	/**
23
+	 * Get SQL query part for filter used
24
+	 * @param array $filter the filter
25
+	 * @param bool $where
26
+	 * @param bool $and
27
+	 * @return string the SQL part
28
+	 */
29 29
 	public function getFilter($filter = array(),$where = false,$and = false) {
30 30
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
31 31
 		$filters = array();
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
 		return $filter_query;
99 99
 	}
100 100
 
101
-    /**
102
-     * Gets all the spotter information based on the latest data entry
103
-     *
104
-     * @param string $limit
105
-     * @param string $sort
106
-     * @param array $filter
107
-     * @return array the spotter information
108
-     */
101
+	/**
102
+	 * Gets all the spotter information based on the latest data entry
103
+	 *
104
+	 * @param string $limit
105
+	 * @param string $sort
106
+	 * @param array $filter
107
+	 * @return array the spotter information
108
+	 */
109 109
 	public function getLiveTrackerData($limit = '', $sort = '', $filter = array())
110 110
 	{
111 111
 		global $globalDBdriver, $globalLiveInterval;
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
 		return $spotter_array;
147 147
 	}
148 148
 
149
-    /**
150
-     * Gets Minimal Live Spotter data
151
-     *
152
-     * @param array $filter
153
-     * @return array the spotter information
154
-     */
149
+	/**
150
+	 * Gets Minimal Live Spotter data
151
+	 *
152
+	 * @param array $filter
153
+	 * @return array the spotter information
154
+	 */
155 155
 	public function getMinLiveTrackerData($filter = array())
156 156
 	{
157 157
 		global $globalDBdriver, $globalLiveInterval;
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
 		return $spotter_array;
185 185
 	}
186 186
 
187
-    /**
188
-     * Gets Minimal Live Spotter data since xx seconds
189
-     *
190
-     * @param $coord
191
-     * @param array $filter
192
-     * @param bool $limit
193
-     * @return array the spotter information
194
-     */
187
+	/**
188
+	 * Gets Minimal Live Spotter data since xx seconds
189
+	 *
190
+	 * @param $coord
191
+	 * @param array $filter
192
+	 * @param bool $limit
193
+	 * @return array the spotter information
194
+	 */
195 195
 	public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false)
196 196
 	{
197 197
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit;
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 		return $spotter_array;
265 265
 	}
266 266
 
267
-    /**
268
-     * Gets number of latest data entry
269
-     *
270
-     * @param array $filter
271
-     * @return String number of entry
272
-     */
267
+	/**
268
+	 * Gets number of latest data entry
269
+	 *
270
+	 * @param array $filter
271
+	 * @return String number of entry
272
+	 */
273 273
 	public function getLiveTrackerCount($filter = array())
274 274
 	{
275 275
 		global $globalDBdriver, $globalLiveInterval;
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
 		return $result['nb'];
294 294
 	}
295 295
 
296
-    /**
297
-     * Gets all the spotter information based on the latest data entry and coord
298
-     *
299
-     * @param $coord
300
-     * @param array $filter
301
-     * @return array the spotter information
302
-     */
296
+	/**
297
+	 * Gets all the spotter information based on the latest data entry and coord
298
+	 *
299
+	 * @param $coord
300
+	 * @param array $filter
301
+	 * @return array the spotter information
302
+	 */
303 303
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
304 304
 	{
305 305
 		global $globalDBdriver, $globalLiveInterval;
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
 		return $spotter_array;
323 323
 	}
324 324
 
325
-    /**
326
-     * Gets all the spotter information based on the latest data entry and coord
327
-     *
328
-     * @param $coord
329
-     * @param array $filter
330
-     * @return array the spotter information
331
-     */
325
+	/**
326
+	 * Gets all the spotter information based on the latest data entry and coord
327
+	 *
328
+	 * @param $coord
329
+	 * @param array $filter
330
+	 * @return array the spotter information
331
+	 */
332 332
 	public function getMinLiveTrackerDatabyCoord($coord, $filter = array())
333 333
 	{
334 334
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
 		return $spotter_array;
396 396
 	}
397 397
 
398
-    /**
399
-     * Gets all the spotter information based on a user's latitude and longitude
400
-     *
401
-     * @param $lat
402
-     * @param $lng
403
-     * @param $radius
404
-     * @param $interval
405
-     * @return array the spotter information
406
-     */
398
+	/**
399
+	 * Gets all the spotter information based on a user's latitude and longitude
400
+	 *
401
+	 * @param $lat
402
+	 * @param $lng
403
+	 * @param $radius
404
+	 * @param $interval
405
+	 * @return array the spotter information
406
+	 */
407 407
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
408 408
 	{
409 409
 		$Tracker = new Tracker($this->db);
@@ -460,100 +460,100 @@  discard block
 block discarded – undo
460 460
 	}
461 461
 
462 462
 
463
-    /**
464
-     * Gets all the spotter information based on a particular callsign
465
-     *
466
-     * @param $ident
467
-     * @return array the spotter information
468
-     */
463
+	/**
464
+	 * Gets all the spotter information based on a particular callsign
465
+	 *
466
+	 * @param $ident
467
+	 * @return array the spotter information
468
+	 */
469 469
 	public function getLastLiveTrackerDataByIdent($ident)
470 470
 	{
471 471
 		$Tracker = new Tracker($this->db);
472 472
 		date_default_timezone_set('UTC');
473 473
 
474 474
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
475
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
475
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
476 476
 
477 477
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
478 478
 
479 479
 		return $spotter_array;
480 480
 	}
481 481
 
482
-    /**
483
-     * Gets all the spotter information based on a particular callsign
484
-     *
485
-     * @param $ident
486
-     * @param $date
487
-     * @return array the spotter information
488
-     */
482
+	/**
483
+	 * Gets all the spotter information based on a particular callsign
484
+	 *
485
+	 * @param $ident
486
+	 * @param $date
487
+	 * @return array the spotter information
488
+	 */
489 489
 	public function getDateLiveTrackerDataByIdent($ident,$date)
490 490
 	{
491 491
 		$Tracker = new Tracker($this->db);
492 492
 		date_default_timezone_set('UTC');
493 493
 
494 494
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
495
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
495
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
496 496
 
497
-                $date = date('c',$date);
497
+				$date = date('c',$date);
498 498
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
499 499
 
500 500
 		return $spotter_array;
501 501
 	}
502 502
 
503
-    /**
504
-     * Gets last spotter information based on a particular callsign
505
-     *
506
-     * @param $id
507
-     * @return array the spotter information
508
-     */
503
+	/**
504
+	 * Gets last spotter information based on a particular callsign
505
+	 *
506
+	 * @param $id
507
+	 * @return array the spotter information
508
+	 */
509 509
 	public function getLastLiveTrackerDataById($id)
510 510
 	{
511 511
 		$Tracker = new Tracker($this->db);
512 512
 		date_default_timezone_set('UTC');
513 513
 
514 514
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
515
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
515
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
516 516
 
517 517
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
518 518
 
519 519
 		return $spotter_array;
520 520
 	}
521 521
 
522
-    /**
523
-     * Gets last spotter information based on a particular callsign
524
-     *
525
-     * @param $id
526
-     * @param $date
527
-     * @return array the spotter information
528
-     */
522
+	/**
523
+	 * Gets last spotter information based on a particular callsign
524
+	 *
525
+	 * @param $id
526
+	 * @param $date
527
+	 * @return array the spotter information
528
+	 */
529 529
 	public function getDateLiveTrackerDataById($id,$date)
530 530
 	{
531 531
 		$Tracker = new Tracker($this->db);
532 532
 		date_default_timezone_set('UTC');
533 533
 
534 534
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
535
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
536
-                $date = date('c',$date);
535
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
536
+				$date = date('c',$date);
537 537
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
538 538
 
539 539
 		return $spotter_array;
540 540
 	}
541 541
 
542
-    /**
543
-     * Gets altitude information based on a particular callsign
544
-     *
545
-     * @param $ident
546
-     * @return array the spotter information
547
-     */
542
+	/**
543
+	 * Gets altitude information based on a particular callsign
544
+	 *
545
+	 * @param $ident
546
+	 * @return array the spotter information
547
+	 */
548 548
 	public function getAltitudeLiveTrackerDataByIdent($ident)
549 549
 	{
550 550
 
551 551
 		date_default_timezone_set('UTC');
552 552
 
553 553
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
554
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
554
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
555 555
 
556
-    		try {
556
+			try {
557 557
 			
558 558
 			$sth = $this->db->prepare($query);
559 559
 			$sth->execute(array(':ident' => $ident));
@@ -566,13 +566,13 @@  discard block
 block discarded – undo
566 566
 		return $spotter_array;
567 567
 	}
568 568
 
569
-    /**
570
-     * Gets all the spotter information based on a particular id
571
-     *
572
-     * @param $id
573
-     * @param bool $liveinterval
574
-     * @return array the spotter information
575
-     */
569
+	/**
570
+	 * Gets all the spotter information based on a particular id
571
+	 *
572
+	 * @param $id
573
+	 * @param bool $liveinterval
574
+	 * @return array the spotter information
575
+	 */
576 576
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
577 577
 	{
578 578
 		global $globalDBdriver, $globalLiveInterval;
@@ -602,18 +602,18 @@  discard block
 block discarded – undo
602 602
 		return $spotter_array;
603 603
 	}
604 604
 
605
-    /**
606
-     * Gets all the spotter information based on a particular ident
607
-     *
608
-     * @param $ident
609
-     * @return array the spotter information
610
-     */
605
+	/**
606
+	 * Gets all the spotter information based on a particular ident
607
+	 *
608
+	 * @param $ident
609
+	 * @return array the spotter information
610
+	 */
611 611
 	public function getAllLiveTrackerDataByIdent($ident)
612 612
 	{
613 613
 		date_default_timezone_set('UTC');
614 614
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
615 615
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
616
-    		try {
616
+			try {
617 617
 			
618 618
 			$sth = $this->db->prepare($query);
619 619
 			$sth->execute(array(':ident' => $ident));
@@ -627,23 +627,23 @@  discard block
 block discarded – undo
627 627
 
628 628
 
629 629
 	/**
630
-	* Deletes all info in the table
631
-	*
632
-	* @return String success or false
633
-	*
634
-	*/
630
+	 * Deletes all info in the table
631
+	 *
632
+	 * @return String success or false
633
+	 *
634
+	 */
635 635
 	public function deleteLiveTrackerData()
636 636
 	{
637 637
 		global $globalDBdriver;
638 638
 		if ($globalDBdriver == 'mysql') {
639 639
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
640 640
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
641
-            		//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
641
+					//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
642 642
 		} else {
643 643
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
644 644
 		}
645 645
         
646
-    		try {
646
+			try {
647 647
 			
648 648
 			$sth = $this->db->prepare($query);
649 649
 			$sth->execute();
@@ -655,18 +655,18 @@  discard block
 block discarded – undo
655 655
 	}
656 656
 
657 657
 	/**
658
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
659
-	*
660
-	* @return String success or false
661
-	*
662
-	*/
658
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
659
+	 *
660
+	 * @return String success or false
661
+	 *
662
+	 */
663 663
 	public function deleteLiveTrackerDataNotUpdated()
664 664
 	{
665 665
 		global $globalDBdriver, $globalDebug;
666 666
 		if ($globalDBdriver == 'mysql') {
667 667
 			//$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0';
668
-    			$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
669
-    			try {
668
+				$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
669
+				try {
670 670
 				
671 671
 				$sth = $this->db->prepare($query);
672 672
 				$sth->execute();
@@ -674,8 +674,8 @@  discard block
 block discarded – undo
674 674
 				return "error";
675 675
 			}
676 676
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
677
-                        $i = 0;
678
-                        $j =0;
677
+						$i = 0;
678
+						$j =0;
679 679
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
680 680
 			foreach($all as $row)
681 681
 			{
@@ -683,20 +683,20 @@  discard block
 block discarded – undo
683 683
 				$j++;
684 684
 				if ($j == 30) {
685 685
 					if ($globalDebug) echo ".";
686
-				    	try {
686
+						try {
687 687
 						
688 688
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
689 689
 						$sth->execute();
690 690
 					} catch(PDOException $e) {
691 691
 						return "error";
692 692
 					}
693
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
694
-                                	$j = 0;
693
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
694
+									$j = 0;
695 695
 				}
696 696
 				$query_delete .= "'".$row['famtrackid']."',";
697 697
 			}
698 698
 			if ($i > 0) {
699
-    				try {
699
+					try {
700 700
 					
701 701
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
702 702
 					$sth->execute();
@@ -707,9 +707,9 @@  discard block
 block discarded – undo
707 707
 			return "success";
708 708
 		} elseif ($globalDBdriver == 'pgsql') {
709 709
 			//$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0";
710
-    			//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
711
-    			$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
712
-    			try {
710
+				//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
711
+				$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
712
+				try {
713 713
 				
714 714
 				$sth = $this->db->prepare($query);
715 715
 				$sth->execute();
@@ -752,18 +752,18 @@  discard block
 block discarded – undo
752 752
 		}
753 753
 	}
754 754
 
755
-    /**
756
-     * Deletes all info in the table for an ident
757
-     *
758
-     * @param $ident
759
-     * @return String success or false
760
-     */
755
+	/**
756
+	 * Deletes all info in the table for an ident
757
+	 *
758
+	 * @param $ident
759
+	 * @return String success or false
760
+	 */
761 761
 	public function deleteLiveTrackerDataByIdent($ident)
762 762
 	{
763 763
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
764 764
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
765 765
         
766
-    		try {
766
+			try {
767 767
 			
768 768
 			$sth = $this->db->prepare($query);
769 769
 			$sth->execute(array(':ident' => $ident));
@@ -774,18 +774,18 @@  discard block
 block discarded – undo
774 774
 		return "success";
775 775
 	}
776 776
 
777
-    /**
778
-     * Deletes all info in the table for an id
779
-     *
780
-     * @param $id
781
-     * @return String success or false
782
-     */
777
+	/**
778
+	 * Deletes all info in the table for an id
779
+	 *
780
+	 * @param $id
781
+	 * @return String success or false
782
+	 */
783 783
 	public function deleteLiveTrackerDataById($id)
784 784
 	{
785 785
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
786 786
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
787 787
         
788
-    		try {
788
+			try {
789 789
 			
790 790
 			$sth = $this->db->prepare($query);
791 791
 			$sth->execute(array(':id' => $id));
@@ -797,12 +797,12 @@  discard block
 block discarded – undo
797 797
 	}
798 798
 
799 799
 
800
-    /**
801
-     * Gets the aircraft ident within the last hour
802
-     *
803
-     * @param $ident
804
-     * @return String the ident
805
-     */
800
+	/**
801
+	 * Gets the aircraft ident within the last hour
802
+	 *
803
+	 * @param $ident
804
+	 * @return String the ident
805
+	 */
806 806
 	public function getIdentFromLastHour($ident)
807 807
 	{
808 808
 		global $globalDBdriver, $globalTimezone;
@@ -828,14 +828,14 @@  discard block
 block discarded – undo
828 828
 			$ident_result = $row['ident'];
829 829
 		}
830 830
 		return $ident_result;
831
-        }
832
-
833
-    /**
834
-     * Check recent aircraft
835
-     *
836
-     * @param $ident
837
-     * @return String the ident
838
-     */
831
+		}
832
+
833
+	/**
834
+	 * Check recent aircraft
835
+	 *
836
+	 * @param $ident
837
+	 * @return String the ident
838
+	 */
839 839
 	public function checkIdentRecent($ident)
840 840
 	{
841 841
 		global $globalDBdriver, $globalTimezone;
@@ -861,14 +861,14 @@  discard block
 block discarded – undo
861 861
 			$ident_result = $row['famtrackid'];
862 862
 		}
863 863
 		return $ident_result;
864
-        }
865
-
866
-    /**
867
-     * Check recent aircraft by id
868
-     *
869
-     * @param $id
870
-     * @return String the ident
871
-     */
864
+		}
865
+
866
+	/**
867
+	 * Check recent aircraft by id
868
+	 *
869
+	 * @param $id
870
+	 * @return String the ident
871
+	 */
872 872
 	public function checkIdRecent($id)
873 873
 	{
874 874
 		global $globalDBdriver, $globalTimezone;
@@ -894,28 +894,28 @@  discard block
 block discarded – undo
894 894
 			$ident_result = $row['famtrackid'];
895 895
 		}
896 896
 		return $ident_result;
897
-        }
898
-
899
-    /**
900
-     * Adds a new spotter data
901
-     *
902
-     * @param String $famtrackid the ID from flightaware
903
-     * @param String $ident the flight ident
904
-     * @param string $latitude
905
-     * @param string $longitude
906
-     * @param string $altitude
907
-     * @param string $heading
908
-     * @param string $groundspeed
909
-     * @param string $date
910
-     * @param bool $putinarchive
911
-     * @param string $comment
912
-     * @param string $type
913
-     * @param bool $noarchive
914
-     * @param string $format_source
915
-     * @param string $source_name
916
-     * @param string $over_country
917
-     * @return String success or false
918
-     */
897
+		}
898
+
899
+	/**
900
+	 * Adds a new spotter data
901
+	 *
902
+	 * @param String $famtrackid the ID from flightaware
903
+	 * @param String $ident the flight ident
904
+	 * @param string $latitude
905
+	 * @param string $longitude
906
+	 * @param string $altitude
907
+	 * @param string $heading
908
+	 * @param string $groundspeed
909
+	 * @param string $date
910
+	 * @param bool $putinarchive
911
+	 * @param string $comment
912
+	 * @param string $type
913
+	 * @param bool $noarchive
914
+	 * @param string $format_source
915
+	 * @param string $source_name
916
+	 * @param string $over_country
917
+	 * @return String success or false
918
+	 */
919 919
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
920 920
 	{
921 921
 		global $globalURL, $globalArchive, $globalDebug;
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
989 989
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
990 990
 
991
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
992
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
991
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
992
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
993 993
             	
994 994
 		$query = '';
995 995
 		if ($globalArchive) {
@@ -1007,15 +1007,15 @@  discard block
 block discarded – undo
1007 1007
 		} catch(PDOException $e) {
1008 1008
 			return "error : ".$e->getMessage();
1009 1009
 		}
1010
-                /*
1010
+				/*
1011 1011
                 echo 'putinarchive : '.$putinarchive."\n";
1012 1012
                 echo 'noarchive : '.$noarchive."\n";
1013 1013
                 */
1014 1014
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1015
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
1016
-		    $TrackerArchive = new TrackerArchive($this->db);
1017
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
1018
-		    if ($globalDebug) echo $result.')';
1015
+			if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
1016
+			$TrackerArchive = new TrackerArchive($this->db);
1017
+			$result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
1018
+			if ($globalDebug) echo $result.')';
1019 1019
 		}
1020 1020
 
1021 1021
 		return "success";
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -26,33 +26,33 @@  discard block
 block discarded – undo
26 26
      * @param bool $and
27 27
      * @return string the SQL part
28 28
      */
29
-	public function getFilter($filter = array(),$where = false,$and = false) {
29
+	public function getFilter($filter = array(), $where = false, $and = false) {
30 30
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
31 31
 		$filters = array();
32 32
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
33 33
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
34 34
 				$filters = $globalStatsFilters[$globalFilterName];
35 35
 			} else {
36
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
36
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
37 37
 			}
38 38
 		}
39 39
 		if (isset($filter[0]['source'])) {
40
-			$filters = array_merge($filters,$filter);
40
+			$filters = array_merge($filters, $filter);
41 41
 		}
42
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
42
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
43 43
 		$filter_query_join = '';
44 44
 		$filter_query_where = '';
45
-		foreach($filters as $flt) {
45
+		foreach ($filters as $flt) {
46 46
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
47 47
 				if (isset($flt['source'])) {
48
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
48
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
49 49
 				} else {
50
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
50
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
51 51
 				}
52 52
 			}
53 53
 		}
54 54
 		if (isset($filter['source']) && !empty($filter['source'])) {
55
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
55
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
56 56
 		}
57 57
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
58 58
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -84,15 +84,15 @@  discard block
 block discarded – undo
84 84
 					$filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'";
85 85
 				}
86 86
 			}
87
-			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
87
+			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
88 88
 		}
89 89
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
90
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
90
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
91 91
 		}
92 92
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
93 93
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
94 94
 		if ($filter_query_where != '') {
95
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
95
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
96 96
 		}
97 97
 		$filter_query = $filter_query_join.$filter_query_where;
98 98
 		return $filter_query;
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 		if ($limit != '')
118 118
 		{
119 119
 			$limit_array = explode(',', $limit);
120
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
121
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
120
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
121
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
122 122
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
123 123
 			{
124 124
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		} else {
142 142
 			$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query;
143 143
 		}
144
-		$spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true);
144
+		$spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true);
145 145
 
146 146
 		return $spotter_array;
147 147
 	}
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		global $globalDBdriver, $globalLiveInterval;
158 158
 		date_default_timezone_set('UTC');
159 159
 
160
-		$filter_query = $this->getFilter($filter,true,true);
160
+		$filter_query = $this->getFilter($filter, true, true);
161 161
 
162 162
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
163 163
 		if ($globalDBdriver == 'mysql') {
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		try {
176 176
 			$sth = $this->db->prepare($query);
177 177
 			$sth->execute();
178
-		} catch(PDOException $e) {
178
+		} catch (PDOException $e) {
179 179
 			echo $e->getMessage();
180 180
 			die;
181 181
 		}
@@ -192,25 +192,25 @@  discard block
 block discarded – undo
192 192
      * @param bool $limit
193 193
      * @return array the spotter information
194 194
      */
195
-	public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false)
195
+	public function getMinLastLiveTrackerData($coord, $filter = array(), $limit = false)
196 196
 	{
197 197
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit;
198 198
 		date_default_timezone_set('UTC');
199 199
 		$usecoord = false;
200 200
 		if (is_array($coord) && !empty($coord)) {
201
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
202
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
203
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
204
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
201
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
202
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
203
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
204
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
205 205
 			$usecoord = true;
206 206
 		}
207
-		$filter_query = $this->getFilter($filter,true,true);
207
+		$filter_query = $this->getFilter($filter, true, true);
208 208
 
209 209
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
210 210
 		if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300';
211 211
 		if ($globalDBdriver == 'mysql') {
212 212
 			if (isset($globalArchive) && $globalArchive) {
213
-				$query  = "SELECT * FROM (
213
+				$query = "SELECT * FROM (
214 214
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
215 215
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
216 216
 				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			}
233 233
 		} else {
234 234
 			if (isset($globalArchive) && $globalArchive) {
235
-				$query  = "SELECT * FROM (
235
+				$query = "SELECT * FROM (
236 236
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
237 237
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
238 238
 				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		try {
257 257
 			$sth = $this->db->prepare($query);
258 258
 			$sth->execute();
259
-		} catch(PDOException $e) {
259
+		} catch (PDOException $e) {
260 260
 			echo $e->getMessage();
261 261
 			die;
262 262
 		}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	public function getLiveTrackerCount($filter = array())
274 274
 	{
275 275
 		global $globalDBdriver, $globalLiveInterval;
276
-		$filter_query = $this->getFilter($filter,true,true);
276
+		$filter_query = $this->getFilter($filter, true, true);
277 277
 
278 278
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
279 279
 		if ($globalDBdriver == 'mysql') {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		try {
285 285
 			$sth = $this->db->prepare($query);
286 286
 			$sth->execute();
287
-		} catch(PDOException $e) {
287
+		} catch (PDOException $e) {
288 288
 			echo $e->getMessage();
289 289
 			die;
290 290
 		}
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 		$filter_query = $this->getFilter($filter);
309 309
 
310 310
 		if (is_array($coord)) {
311
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
312
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
313
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
314
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
311
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
312
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
313
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
314
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
315 315
 		} else return array();
316 316
 		if ($globalDBdriver == 'mysql') {
317 317
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
335 335
 		$Tracker = new Tracker($this->db);
336 336
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
337
-		$filter_query = $this->getFilter($filter,true,true);
337
+		$filter_query = $this->getFilter($filter, true, true);
338 338
 
339 339
 		if (is_array($coord)) {
340
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
341
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
342
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
343
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
340
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
341
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
342
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
343
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
344 344
 		} else return array();
345 345
 		/*
346 346
 		if ($globalDBdriver == 'mysql') {
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
 		*/
355 355
 		if ($globalDBdriver == 'mysql') {
356 356
 			if (isset($globalArchive) && $globalArchive === TRUE) {
357
-				$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
357
+				$query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
358 358
 				    FROM tracker_live 
359 359
 				    '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= tracker_live.date 
360 360
 				    AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
361 361
 				    AND tracker_live.latitude <> 0 AND tracker_live.longitude <> 0 ORDER BY date DESC';
362 362
 			} else {
363
-				$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
363
+				$query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
364 364
 				    FROM tracker_live 
365 365
 				    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate 
366 366
 					FROM tracker_live l 
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 			}
373 373
 		} else {
374 374
 			if (isset($globalArchive) && $globalArchive === TRUE) {
375
-				$query  = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
375
+				$query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
376 376
 				    FROM tracker_live 
377 377
 				    ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date 
378 378
 				    AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
379 379
 				    AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
380 380
 				    AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' ORDER BY date DESC";
381 381
 			} else {
382
-				$query  = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
382
+				$query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
383 383
 				    FROM tracker_live 
384 384
 				    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate 
385 385
 					FROM tracker_live l 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 				if ($interval == '1m')
440 440
 				{
441 441
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
442
-				} else if ($interval == '15m'){
442
+				} else if ($interval == '15m') {
443 443
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
444 444
 				}
445 445
 			}
@@ -447,14 +447,14 @@  discard block
 block discarded – undo
447 447
 			$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
448 448
 		}
449 449
 
450
-		$query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
450
+		$query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
451 451
                    WHERE tracker_live.latitude <> '' 
452 452
                                    AND tracker_live.longitude <> '' 
453 453
                    ".$additional_query."
454 454
                    HAVING distance < :radius  
455 455
                                    ORDER BY distance";
456 456
 
457
-		$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
457
+		$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
458 458
 
459 459
 		return $spotter_array;
460 460
 	}
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
 		date_default_timezone_set('UTC');
473 473
 
474 474
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
475
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
475
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
476 476
 
477
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
477
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true);
478 478
 
479 479
 		return $spotter_array;
480 480
 	}
@@ -486,16 +486,16 @@  discard block
 block discarded – undo
486 486
      * @param $date
487 487
      * @return array the spotter information
488 488
      */
489
-	public function getDateLiveTrackerDataByIdent($ident,$date)
489
+	public function getDateLiveTrackerDataByIdent($ident, $date)
490 490
 	{
491 491
 		$Tracker = new Tracker($this->db);
492 492
 		date_default_timezone_set('UTC');
493 493
 
494 494
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
495
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
495
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
496 496
 
497
-                $date = date('c',$date);
498
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
497
+                $date = date('c', $date);
498
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
499 499
 
500 500
 		return $spotter_array;
501 501
 	}
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 		date_default_timezone_set('UTC');
513 513
 
514 514
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
515
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
515
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
516 516
 
517
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
517
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true);
518 518
 
519 519
 		return $spotter_array;
520 520
 	}
@@ -526,15 +526,15 @@  discard block
 block discarded – undo
526 526
      * @param $date
527 527
      * @return array the spotter information
528 528
      */
529
-	public function getDateLiveTrackerDataById($id,$date)
529
+	public function getDateLiveTrackerDataById($id, $date)
530 530
 	{
531 531
 		$Tracker = new Tracker($this->db);
532 532
 		date_default_timezone_set('UTC');
533 533
 
534 534
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
535
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
536
-                $date = date('c',$date);
537
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
535
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
536
+                $date = date('c', $date);
537
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
538 538
 
539 539
 		return $spotter_array;
540 540
 	}
@@ -551,13 +551,13 @@  discard block
 block discarded – undo
551 551
 		date_default_timezone_set('UTC');
552 552
 
553 553
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
554
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
554
+                $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
555 555
 
556 556
     		try {
557 557
 			
558 558
 			$sth = $this->db->prepare($query);
559 559
 			$sth->execute(array(':ident' => $ident));
560
-		} catch(PDOException $e) {
560
+		} catch (PDOException $e) {
561 561
 			echo $e->getMessage();
562 562
 			die;
563 563
 		}
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
      * @param bool $liveinterval
574 574
      * @return array the spotter information
575 575
      */
576
-	public function getAllLiveTrackerDataById($id,$liveinterval = false)
576
+	public function getAllLiveTrackerDataById($id, $liveinterval = false)
577 577
 	{
578 578
 		global $globalDBdriver, $globalLiveInterval;
579 579
 		date_default_timezone_set('UTC');
@@ -582,19 +582,19 @@  discard block
 block discarded – undo
582 582
 		if ($globalDBdriver == 'mysql') {
583 583
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
584 584
 			if ($liveinterval === true) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
585
-			elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'";
585
+			elseif ($liveinterval !== false) $query .= " AND date <= '".date('c', $liveinterval)."'";
586 586
 			$query .= ' ORDER BY date';
587 587
 		} else {
588 588
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
589 589
 			if ($liveinterval === true) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
590
-			elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'";
590
+			elseif ($liveinterval !== false) $query .= " AND date <= '".date('c', $liveinterval)."'";
591 591
 			$query .= ' ORDER BY date';
592 592
 		}
593 593
 
594 594
 		try {
595 595
 			$sth = $this->db->prepare($query);
596 596
 			$sth->execute(array(':id' => $id));
597
-		} catch(PDOException $e) {
597
+		} catch (PDOException $e) {
598 598
 			echo $e->getMessage();
599 599
 			die;
600 600
 		}
@@ -612,12 +612,12 @@  discard block
 block discarded – undo
612 612
 	{
613 613
 		date_default_timezone_set('UTC');
614 614
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
615
-		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
615
+		$query = self::$global_query.' WHERE tracker_live.ident = :ident';
616 616
     		try {
617 617
 			
618 618
 			$sth = $this->db->prepare($query);
619 619
 			$sth->execute(array(':ident' => $ident));
620
-		} catch(PDOException $e) {
620
+		} catch (PDOException $e) {
621 621
 			echo $e->getMessage();
622 622
 			die;
623 623
 		}
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 			
648 648
 			$sth = $this->db->prepare($query);
649 649
 			$sth->execute();
650
-		} catch(PDOException $e) {
650
+		} catch (PDOException $e) {
651 651
 			return "error";
652 652
 		}
653 653
 
@@ -670,14 +670,14 @@  discard block
 block discarded – undo
670 670
 				
671 671
 				$sth = $this->db->prepare($query);
672 672
 				$sth->execute();
673
-			} catch(PDOException $e) {
673
+			} catch (PDOException $e) {
674 674
 				return "error";
675 675
 			}
676 676
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
677 677
                         $i = 0;
678
-                        $j =0;
678
+                        $j = 0;
679 679
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
680
-			foreach($all as $row)
680
+			foreach ($all as $row)
681 681
 			{
682 682
 				$i++;
683 683
 				$j++;
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
 					if ($globalDebug) echo ".";
686 686
 				    	try {
687 687
 						
688
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
688
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
689 689
 						$sth->execute();
690
-					} catch(PDOException $e) {
690
+					} catch (PDOException $e) {
691 691
 						return "error";
692 692
 					}
693 693
                                 	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
 			if ($i > 0) {
699 699
     				try {
700 700
 					
701
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
701
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
702 702
 					$sth->execute();
703
-				} catch(PDOException $e) {
703
+				} catch (PDOException $e) {
704 704
 					return "error";
705 705
 				}
706 706
 			}
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 				
714 714
 				$sth = $this->db->prepare($query);
715 715
 				$sth->execute();
716
-			} catch(PDOException $e) {
716
+			} catch (PDOException $e) {
717 717
 				return "error";
718 718
 			}
719 719
 /*			$query_delete = "DELETE FROM tracker_live WHERE famtrackid IN (";
@@ -761,13 +761,13 @@  discard block
 block discarded – undo
761 761
 	public function deleteLiveTrackerDataByIdent($ident)
762 762
 	{
763 763
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
764
-		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
764
+		$query = 'DELETE FROM tracker_live WHERE ident = :ident';
765 765
         
766 766
     		try {
767 767
 			
768 768
 			$sth = $this->db->prepare($query);
769 769
 			$sth->execute(array(':ident' => $ident));
770
-		} catch(PDOException $e) {
770
+		} catch (PDOException $e) {
771 771
 			return "error";
772 772
 		}
773 773
 
@@ -783,13 +783,13 @@  discard block
 block discarded – undo
783 783
 	public function deleteLiveTrackerDataById($id)
784 784
 	{
785 785
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
786
-		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
786
+		$query = 'DELETE FROM tracker_live WHERE famtrackid = :id';
787 787
         
788 788
     		try {
789 789
 			
790 790
 			$sth = $this->db->prepare($query);
791 791
 			$sth->execute(array(':id' => $id));
792
-		} catch(PDOException $e) {
792
+		} catch (PDOException $e) {
793 793
 			return "error";
794 794
 		}
795 795
 
@@ -807,13 +807,13 @@  discard block
 block discarded – undo
807 807
 	{
808 808
 		global $globalDBdriver, $globalTimezone;
809 809
 		if ($globalDBdriver == 'mysql') {
810
-			$query  = 'SELECT tracker_live.ident FROM tracker_live 
810
+			$query = 'SELECT tracker_live.ident FROM tracker_live 
811 811
 				WHERE tracker_live.ident = :ident 
812 812
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
813 813
 				AND tracker_live.date < UTC_TIMESTAMP()';
814 814
 			$query_data = array(':ident' => $ident);
815 815
 		} else {
816
-			$query  = "SELECT tracker_live.ident FROM tracker_live 
816
+			$query = "SELECT tracker_live.ident FROM tracker_live 
817 817
 				WHERE tracker_live.ident = :ident 
818 818
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
819 819
 				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 		
823 823
 		$sth = $this->db->prepare($query);
824 824
 		$sth->execute($query_data);
825
-		$ident_result='';
826
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
825
+		$ident_result = '';
826
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
827 827
 		{
828 828
 			$ident_result = $row['ident'];
829 829
 		}
@@ -840,13 +840,13 @@  discard block
 block discarded – undo
840 840
 	{
841 841
 		global $globalDBdriver, $globalTimezone;
842 842
 		if ($globalDBdriver == 'mysql') {
843
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
843
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
844 844
 				WHERE tracker_live.ident = :ident 
845 845
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
846 846
 //				AND tracker_live.date < UTC_TIMESTAMP()";
847 847
 			$query_data = array(':ident' => $ident);
848 848
 		} else {
849
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
849
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
850 850
 				WHERE tracker_live.ident = :ident 
851 851
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
852 852
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -855,8 +855,8 @@  discard block
 block discarded – undo
855 855
 		
856 856
 		$sth = $this->db->prepare($query);
857 857
 		$sth->execute($query_data);
858
-		$ident_result='';
859
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
858
+		$ident_result = '';
859
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
860 860
 		{
861 861
 			$ident_result = $row['famtrackid'];
862 862
 		}
@@ -873,13 +873,13 @@  discard block
 block discarded – undo
873 873
 	{
874 874
 		global $globalDBdriver, $globalTimezone;
875 875
 		if ($globalDBdriver == 'mysql') {
876
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
876
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
877 877
 				WHERE tracker_live.famtrackid = :id 
878 878
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
879 879
 //				AND tracker_live.date < UTC_TIMESTAMP()";
880 880
 			$query_data = array(':id' => $id);
881 881
 		} else {
882
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
882
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
883 883
 				WHERE tracker_live.famtrackid = :id 
884 884
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
885 885
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -888,8 +888,8 @@  discard block
 block discarded – undo
888 888
 		
889 889
 		$sth = $this->db->prepare($query);
890 890
 		$sth->execute($query_data);
891
-		$ident_result='';
892
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
891
+		$ident_result = '';
892
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
893 893
 		{
894 894
 			$ident_result = $row['famtrackid'];
895 895
 		}
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
      * @param string $over_country
917 917
      * @return String success or false
918 918
      */
919
-	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
919
+	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
920 920
 	{
921 921
 		global $globalURL, $globalArchive, $globalDebug;
922 922
 		$Common = new Common();
@@ -975,21 +975,21 @@  discard block
 block discarded – undo
975 975
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
976 976
 
977 977
         
978
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
979
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
980
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
981
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
982
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
983
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
984
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
985
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
986
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
987
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
988
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
989
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
990
-
991
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
992
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
978
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
979
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
980
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
981
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
982
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
983
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
984
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
985
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
986
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
987
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
988
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
989
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
990
+
991
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
992
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
993 993
             	
994 994
 		$query = '';
995 995
 		if ($globalArchive) {
@@ -999,12 +999,12 @@  discard block
 block discarded – undo
999 999
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
1000 1000
 		VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
1001 1001
 
1002
-		$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type);
1002
+		$query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type);
1003 1003
 		try {
1004 1004
 			$sth = $this->db->prepare($query);
1005 1005
 			$sth->execute($query_values);
1006 1006
 			$sth->closeCursor();
1007
-		} catch(PDOException $e) {
1007
+		} catch (PDOException $e) {
1008 1008
 			return "error : ".$e->getMessage();
1009 1009
 		}
1010 1010
                 /*
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1015 1015
 		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
1016 1016
 		    $TrackerArchive = new TrackerArchive($this->db);
1017
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
1017
+		    $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country);
1018 1018
 		    if ($globalDebug) echo $result.')';
1019 1019
 		}
1020 1020
 
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 
1025 1025
 	public function getOrderBy()
1026 1026
 	{
1027
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
1027
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
1028 1028
 		return $orderby;
1029 1029
 	}
1030 1030
 
Please login to merge, or discard this patch.
header.php 3 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -14,35 +14,35 @@  discard block
 block discarded – undo
14 14
 if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline';
15 15
 
16 16
 if (isset($_GET['3d'])) {
17
-	setcookie('MapFormat','3d');
17
+	setcookie('MapFormat', '3d');
18 18
 } else if (isset($_GET['2d'])) {
19
-	setcookie('MapFormat','2d');
19
+	setcookie('MapFormat', '2d');
20 20
 }
21 21
 
22 22
 if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) {
23
-	$tsk = filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL);
23
+	$tsk = filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL);
24 24
 }
25 25
 
26 26
 if (isset($_POST['archive'])) {
27
-	setcookie('archive','true');
28
-	setcookie('archive_begin',strtotime($_POST['start_date']));
29
-	setcookie('archive_end',strtotime($_POST['end_date']));
30
-	setcookie('archive_speed',$_POST['archivespeed']);
27
+	setcookie('archive', 'true');
28
+	setcookie('archive_begin', strtotime($_POST['start_date']));
29
+	setcookie('archive_end', strtotime($_POST['end_date']));
30
+	setcookie('archive_speed', $_POST['archivespeed']);
31 31
 }
32 32
 if (isset($_POST['noarchive'])) {
33
-	setcookie('archive','false',-1);
34
-	setcookie('archive_begin','',-1);
35
-	setcookie('archive_end','',-1);
36
-	setcookie('archive_speed','',-1);
33
+	setcookie('archive', 'false', -1);
34
+	setcookie('archive_begin', '', -1);
35
+	setcookie('archive_end', '', -1);
36
+	setcookie('archive_speed', '', -1);
37 37
 }
38 38
 // When button "Remove all filters" is clicked
39 39
 if (isset($_POST['removefilters'])) {
40
-	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
41
-	    return strpos($key,'filter_') === 0;
40
+	$allfilters = array_filter(array_keys($_COOKIE), function($key) {
41
+	    return strpos($key, 'filter_') === 0;
42 42
 	});
43 43
 	foreach ($allfilters as $filt) {
44 44
 		unset($_COOKIE[$filt]);
45
-		setcookie($filt,null,-1);
45
+		setcookie($filt, null, -1);
46 46
 	}
47 47
 }
48 48
 ?>
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
265 265
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
266 266
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
267
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
267
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
268 268
 <?php
269 269
 		if (!isset($type) || $type == 'aircraft') {
270 270
 ?>
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
338 338
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
339 339
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
340
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
340
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
341 341
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
342 342
 <?php
343 343
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
 ?>
743 743
       <div class="search">
744 744
 	<form action="<?php print $globalURL; ?>/search" method="get">
745
-		<!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>-->
746
-		<input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != ""){ print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
745
+		<!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>-->
746
+		<input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != "") { print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
747 747
 	</form>
748 748
 	</div>
749 749
   	<div class="social">
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	print '</div>';
762 762
 }
763 763
 
764
-if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') {
764
+if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') {
765 765
 ?>
766 766
     <div class="top-header clear" role="main">
767 767
 <?php
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
     </div>
775 775
 <?php
776 776
 }
777
-if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
777
+if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false))
778 778
 {
779 779
     ?>
780 780
     <div class="top-header clear" role="main">
@@ -787,15 +787,15 @@  discard block
 block discarded – undo
787 787
         var zoom = 13;
788 788
 //create the map
789 789
 <?php
790
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
790
+    if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) {
791 791
 ?>
792 792
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
793 793
 <?php
794
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
794
+    } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) {
795 795
 ?>
796 796
   map = L.map('map', { zoomControl:true });
797 797
 <?php
798
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
798
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
799 799
 ?>
800 800
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
801 801
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
804 804
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
805 805
 <?php
806
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
806
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
807 807
 ?>
808 808
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
809 809
 <?php
Please login to merge, or discard this patch.
Braces   +95 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,12 +6,19 @@  discard block
 block discarded – undo
6 6
 //gets the page file and stores it in a variable
7 7
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
8 8
 $current_page = $file_path['filename'];
9
-if ($globalTimezone == '') $globalTimezone = 'UTC';
9
+if ($globalTimezone == '') {
10
+	$globalTimezone = 'UTC';
11
+}
10 12
 date_default_timezone_set($globalTimezone);
11
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
12
-else $MapType = $globalMapProvider;
13
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
14
+	$MapType = $_COOKIE['MapType'];
15
+} else {
16
+	$MapType = $globalMapProvider;
17
+}
13 18
 
14
-if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline';
19
+if (isset($globalMapOffline) && $globalMapOffline) {
20
+	$MapType = 'offline';
21
+}
15 22
 
16 23
 if (isset($_GET['3d'])) {
17 24
 	setcookie('MapFormat','3d');
@@ -209,7 +216,10 @@  discard block
 block discarded – undo
209 216
 <?php
210 217
 		} else {
211 218
 ?>
212
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script>
219
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) {
220
+	print '&tsk='.$tsk;
221
+}
222
+?>"></script>
213 223
 <?php
214 224
 		}
215 225
 		if (!isset($globalAircraft) || $globalAircraft) {
@@ -249,7 +259,13 @@  discard block
 block discarded – undo
249 259
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
250 260
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
251 261
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
252
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
262
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
263
+	print '&latitude='.$latitude;
264
+}
265
+?><?php if(isset($longitude)) {
266
+	print '&longitude='.$longitude;
267
+}
268
+?>&<?php print time(); ?>"></script>
253 269
 <?php
254 270
 		if (!isset($type) || $type == 'aircraft') {
255 271
 ?>
@@ -322,7 +338,13 @@  discard block
 block discarded – undo
322 338
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
323 339
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
324 340
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
325
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
341
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
342
+	print '&latitude='.$latitude;
343
+}
344
+?><?php if(isset($longitude)) {
345
+	print '&longitude='.$longitude;
346
+}
347
+?>&<?php print time(); ?>"></script>
326 348
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
327 349
 <?php
328 350
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -403,7 +425,12 @@  discard block
 block discarded – undo
403 425
         <span class="icon-bar"></span>
404 426
       </button>
405 427
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a>
406
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
428
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
429
+	print '/';
430
+} else {
431
+	print $globalURL;
432
+}
433
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
407 434
     </div>
408 435
     <div class="collapse navbar-collapse">
409 436
 
@@ -458,7 +485,10 @@  discard block
 block discarded – undo
458 485
 	}
459 486
 ?>
460 487
 
461
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
488
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
489
+	echo 'right-';
490
+}
491
+?>caret"></b></a>
462 492
           <ul class="dropdown-menu">
463 493
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li>
464 494
 <?php
@@ -529,8 +559,14 @@  discard block
 block discarded – undo
529 559
         </li>
530 560
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
531 561
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
532
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
533
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
562
+        <li class="dropdown<?php if ($sub) {
563
+	echo '-submenu';
564
+}
565
+?>">
566
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
567
+	echo 'right-';
568
+}
569
+?>caret"></b></a>
534 570
           <ul class="dropdown-menu">
535 571
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
536 572
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -574,7 +610,10 @@  discard block
 block discarded – undo
574 610
 <?php
575 611
 	}
576 612
 ?>
577
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
613
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
614
+	echo 'right-';
615
+}
616
+?>caret"></b></a>
578 617
 		<ul class="dropdown-menu">
579 618
 <?php
580 619
 	if (isset($globalVM) && $globalVM) {
@@ -624,7 +663,10 @@  discard block
 block discarded – undo
624 663
 <?php
625 664
 	}
626 665
 ?>
627
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
666
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
667
+	echo 'right-';
668
+}
669
+?>caret"></b></a>
628 670
 		<ul class="dropdown-menu">
629 671
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
630 672
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -667,7 +709,10 @@  discard block
 block discarded – undo
667 709
 ?>
668 710
 
669 711
 <!--
670
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
712
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
713
+	echo 'right-';
714
+}
715
+?>caret"></b></a>
671 716
 		<ul class="dropdown-menu">
672 717
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
673 718
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -725,9 +770,14 @@  discard block
 block discarded – undo
725 770
   		    <?php
726 771
   		        foreach ($alllang as $key => $lang) {
727 772
   		            print '<option value="'.$key.'"';
728
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
729
-  		            if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (&beta;eta)</option>';
730
-  		            else print '>'.$lang[0].'</option>';
773
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
774
+  		            	print ' selected ';
775
+  		            }
776
+  		            if ($lang[0] == 'Deutsch') {
777
+  		            	print '>'.$lang[0].' (&beta;eta)</option>';
778
+  		            } else {
779
+  		            	print '>'.$lang[0].'</option>';
780
+  		            }
731 781
   		        }
732 782
   		    ?>
733 783
   		</select>
@@ -875,9 +925,24 @@  discard block
 block discarded – undo
875 925
 	$customid = $globalMapProvider;
876 926
 ?>
877 927
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
878
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
879
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
880
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
928
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
929
+	print $globalMapCustomLayer[$customid]['maxZoom'];
930
+} else {
931
+	print '18';
932
+}
933
+?>,
934
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
935
+	print $globalMapCustomLayer[$customid]['minZoom'];
936
+} else {
937
+	print '0';
938
+}
939
+?>,
940
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
941
+	print 'false';
942
+} else {
943
+	print 'true';
944
+}
945
+?>,
881 946
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
882 947
     }).addTo(map);
883 948
 <?php
@@ -892,7 +957,12 @@  discard block
 block discarded – undo
892 957
         maxZoom: 5,
893 958
         tms : true,
894 959
         zindex : 3,
895
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
960
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
961
+	print 'false';
962
+} else {
963
+	print 'true';
964
+}
965
+?>,
896 966
         attribution: 'Natural Earth'
897 967
     }).addTo(map);
898 968
 <?php
@@ -915,4 +985,7 @@  discard block
 block discarded – undo
915 985
 
916 986
 ?>
917 987
 
918
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
988
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
989
+	print 'index ';
990
+}
991
+?>clear">
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 // When button "Remove all filters" is clicked
39 39
 if (isset($_POST['removefilters'])) {
40 40
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
41
-	    return strpos($key,'filter_') === 0;
41
+		return strpos($key,'filter_') === 0;
42 42
 	});
43 43
 	foreach ($allfilters as $filt) {
44 44
 		unset($_COOKIE[$filt]);
@@ -409,34 +409,34 @@  discard block
 block discarded – undo
409 409
 
410 410
       <ul class="nav navbar-nav">
411 411
 <?php
412
-    if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) {
412
+	if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) {
413 413
 ?>
414 414
     <li><a href="<?php print $globalURL; ?>/news"><?php echo _("News"); ?></a></li>
415 415
 <?php
416
-    }
416
+	}
417 417
 ?>
418 418
 
419 419
 <?php 
420
-    $sub = false;
421
-    if (
420
+	$sub = false;
421
+	if (
422 422
 	(
423
-	    (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
423
+		(!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
424 424
 	) || 
425 425
 	(
426
-	    isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
426
+		isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
427 427
 	) || 
428 428
 	(
429
-	    isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
429
+		isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
430 430
 	) || 
431 431
 	(
432
-	    isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
432
+		isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
433 433
 	)
434
-    ) {
434
+	) {
435 435
 	$sub = true;
436
-    }
436
+	}
437 437
 ?>
438 438
 <?php
439
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
439
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
440 440
 ?>
441 441
     <li class="dropdown">
442 442
 <?php
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	<ul class="dropdown-menu multi-level">
448 448
       	<li class="dropdown-submenu">
449 449
 <?php
450
-        }
450
+		}
451 451
 ?>
452 452
 <?php
453 453
 	if (isset($globalNewsFeeds['aircraft']) && !empty($globalNewsFeeds['aircraft'])) {
@@ -462,25 +462,25 @@  discard block
 block discarded – undo
462 462
           <ul class="dropdown-menu">
463 463
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li>
464 464
 <?php
465
-    if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
465
+	if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
466 466
 ?>
467 467
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
468 468
 <?php
469
-    }
469
+	}
470 470
 ?>
471 471
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
472 472
 <?php
473
-    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
473
+	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
474 474
 ?>
475 475
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
476 476
 <?php
477
-    } 
478
-    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
477
+	} 
478
+	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
479 479
 
480 480
 ?>
481 481
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
482 482
 <?php
483
-    }
483
+	}
484 484
 ?>
485 485
 			<li><hr /></li>
486 486
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -488,43 +488,43 @@  discard block
 block discarded – undo
488 488
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
489 489
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
490 490
             <?php
491
-        	if ($globalACARS) {
492
-        	    if (isset($globalDemo) && $globalDemo) {
493
-    	    ?>
491
+			if ($globalACARS) {
492
+				if (isset($globalDemo) && $globalDemo) {
493
+			?>
494 494
             <li><hr /></li>
495 495
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
496 496
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
497 497
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
498 498
             <?php
499
-        	    } else {
500
-    	    ?>
499
+				} else {
500
+			?>
501 501
             <li><hr /></li>
502 502
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
503 503
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
504 504
             <?php
505
-        	    }
506
-        	}
507
-    	    ?>
505
+				}
506
+			}
507
+			?>
508 508
     	    <?php
509
-    	        if (isset($globalAccidents) && $globalAccidents) {
510
-    	    ?>
509
+				if (isset($globalAccidents) && $globalAccidents) {
510
+			?>
511 511
             <li><hr /></li>
512 512
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
513 513
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
514 514
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
515 515
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
516 516
             <?php
517
-        	}
518
-    	    ?>
517
+			}
518
+			?>
519 519
             <li><hr /></li>
520 520
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
521 521
             <?php
522 522
 		if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) {
523
-	    ?>
523
+		?>
524 524
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
525 525
 	    <?php
526 526
 		}
527
-	    ?>
527
+		?>
528 528
           </ul>
529 529
         </li>
530 530
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
     </ul>
552 552
 <?php
553 553
 	}
554
-    }
554
+	}
555 555
 ?>
556 556
 <?php
557
-    if (isset($globalMarine) && $globalMarine) {
557
+	if (isset($globalMarine) && $globalMarine) {
558 558
 ?>
559 559
     <li class="dropdown">
560 560
 <?php
561
-        if ($sub) {
561
+		if ($sub) {
562 562
 ?>
563 563
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Marines"); ?> <b class="caret"></b></a>
564 564
 	<ul class="dropdown-menu multi-level">
@@ -601,14 +601,14 @@  discard block
 block discarded – undo
601 601
 	}
602 602
 ?>
603 603
 <?php
604
-    }
604
+	}
605 605
 ?>
606 606
 <?php
607
-    if (isset($globalTracker) && $globalTracker) {
607
+	if (isset($globalTracker) && $globalTracker) {
608 608
 ?>
609 609
     <li class="dropdown">
610 610
 <?php
611
-        if ($sub) {
611
+		if ($sub) {
612 612
 ?>
613 613
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a>
614 614
 	<ul class="dropdown-menu multi-level">
@@ -642,14 +642,14 @@  discard block
 block discarded – undo
642 642
 	}
643 643
 ?>
644 644
 <?php
645
-    }
645
+	}
646 646
 ?>
647 647
 <?php
648
-    if (isset($globalSatellite) && $globalSatellite) {
648
+	if (isset($globalSatellite) && $globalSatellite) {
649 649
 ?>
650 650
     <li class="dropdown">
651 651
 <?php
652
-        if ($sub) {
652
+		if ($sub) {
653 653
 ?>
654 654
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellites"); ?> <b class="caret"></b></a>
655 655
 	<ul class="dropdown-menu multi-level">
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	}
686 686
 ?>
687 687
 <?php
688
-    }
688
+	}
689 689
 ?>
690 690
 
691 691
         <li class="dropdown">
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
           <ul class="dropdown-menu">
694 694
           	<li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li>
695 695
 <?php
696
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
696
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
697 697
 ?>
698 698
           	<li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li>
699 699
 		<li><hr /></li>
700 700
 		<li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li>
701 701
 <?php
702
-    }
702
+	}
703 703
 ?>
704 704
 	    <?php if (isset($globalContribute) && $globalContribute) { ?>
705 705
                 <li><hr /></li>
@@ -723,13 +723,13 @@  discard block
 block discarded – undo
723 723
   	    <form>
724 724
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
725 725
   		    <?php
726
-  		        foreach ($alllang as $key => $lang) {
727
-  		            print '<option value="'.$key.'"';
728
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
729
-  		            if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (&beta;eta)</option>';
730
-  		            else print '>'.$lang[0].'</option>';
731
-  		        }
732
-  		    ?>
726
+  				foreach ($alllang as $key => $lang) {
727
+  					print '<option value="'.$key.'"';
728
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
729
+  					if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (&beta;eta)</option>';
730
+  					else print '>'.$lang[0].'</option>';
731
+  				}
732
+  			?>
733 733
   		</select>
734 734
   	    </form>
735 735
   	</div>
@@ -762,18 +762,18 @@  discard block
 block discarded – undo
762 762
 ?>
763 763
     <div class="top-header clear" role="main">
764 764
 <?php
765
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
765
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
766 766
 ?>
767 767
     <div id="archive-map"></div>
768 768
 <?php
769
-    }
769
+	}
770 770
 ?>
771 771
     </div>
772 772
 <?php
773 773
 }
774 774
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
775 775
 {
776
-    ?>
776
+	?>
777 777
     <div class="top-header clear" role="main">
778 778
         <div id="map"></div>
779 779
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -784,15 +784,15 @@  discard block
 block discarded – undo
784 784
         var zoom = 13;
785 785
 //create the map
786 786
 <?php
787
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
787
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
788 788
 ?>
789 789
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
790 790
 <?php
791
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
791
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
792 792
 ?>
793 793
   map = L.map('map', { zoomControl:true });
794 794
 <?php
795
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
795
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
796 796
 ?>
797 797
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
798 798
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -800,22 +800,22 @@  discard block
 block discarded – undo
800 800
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
801 801
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
802 802
 <?php
803
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
803
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
804 804
 ?>
805 805
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
806 806
 <?php
807
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
807
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
808 808
 ?>
809 809
   map = L.map('map', { zoomControl:true });
810 810
 <?php
811
-    }
811
+	}
812 812
 ?>
813 813
   //initialize the layer group for the aircrft markers
814 814
   var layer_data = L.layerGroup();
815 815
 
816 816
   //a few title layers
817 817
 <?php
818
-    if ($globalMapProvider == 'Mapbox') {
818
+	if ($globalMapProvider == 'Mapbox') {
819 819
 ?>
820 820
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
821 821
     maxZoom: 18,
@@ -826,14 +826,14 @@  discard block
 block discarded – undo
826 826
     token : '<?php print $globalMapboxToken; ?>'
827 827
   }).addTo(map);
828 828
 <?php
829
-    } elseif ($globalMapProvider == 'Mapbox-GL') {
829
+	} elseif ($globalMapProvider == 'Mapbox-GL') {
830 830
 ?>
831 831
     L.mapboxGL({
832 832
 	accessToken: '<?php print $globalMapboxToken; ?>',
833 833
 	style: 'mapbox://styles/mapbox/bright-v8'
834 834
   }).addTo(map);
835 835
 <?php
836
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
836
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
837 837
 ?>
838 838
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
839 839
     maxZoom: 18,
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
843 843
   }).addTo(map);
844 844
 <?php
845
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
845
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
846 846
 ?>
847 847
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
848 848
     maxZoom: 18,
@@ -851,27 +851,27 @@  discard block
 block discarded – undo
851 851
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
852 852
   }).addTo(map);
853 853
 <?php
854
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
854
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
855 855
 ?>
856 856
     var googleLayer = new L.Google('ROADMAP');
857 857
     map.addLayer(googleLayer);
858 858
 <?php
859
-    } elseif ($globalMapProvider == 'Google-Satellite') {
859
+	} elseif ($globalMapProvider == 'Google-Satellite') {
860 860
 ?>
861 861
     var googleLayer = new L.Google('SATELLITE');
862 862
     map.addLayer(googleLayer);
863 863
 <?php
864
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
864
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
865 865
 ?>
866 866
     var googleLayer = new L.Google('HYBRID');
867 867
     map.addLayer(googleLayer);
868 868
 <?php
869
-    } elseif ($globalMapProvider == 'Google-Terrain') {
869
+	} elseif ($globalMapProvider == 'Google-Terrain') {
870 870
 ?>
871 871
     var googleLayer = new L.Google('Terrain');
872 872
     map.addLayer(googleLayer);
873 873
 <?php
874
-    } elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
874
+	} elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
875 875
 	$customid = $globalMapProvider;
876 876
 ?>
877 877
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
882 882
     }).addTo(map);
883 883
 <?php
884
-    } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) {
884
+	} elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) {
885 885
 ?>
886 886
     var center = map.getCenter();
887 887
     map.options.crs = L.CRS.EPSG4326;
@@ -896,8 +896,8 @@  discard block
 block discarded – undo
896 896
         attribution: 'Natural Earth'
897 897
     }).addTo(map);
898 898
 <?php
899
-    //} elseif ($globalMapProvider == 'OpenStreetMap') {
900
-    } else {
899
+	//} elseif ($globalMapProvider == 'OpenStreetMap') {
900
+	} else {
901 901
 ?>
902 902
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
903 903
     maxZoom: 18,
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
   }).addTo(map);
907 907
 
908 908
 <?php
909
-    }
909
+	}
910 910
 ?>
911 911
         </script>
912 912
     </div>
Please login to merge, or discard this patch.
require/class.MapMatching.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 		$gpx .= '<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpsies="http://www.gpsies.com/GPX/1/0" creator="GPSies http://www.gpsies.com - Sendl.-O&amp;apos;sch-heim" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.gpsies.com/GPX/1/0 http://www.gpsies.com/gpsies.xsd">';
45 45
 		$gpx .= '<trk>';
46 46
 		$gpx .= '<trkseg>';
47
-		foreach($spotter_history_array as $spotter_data) {
48
-			$gpx .= '<trkpt lat="'.sprintf("%.8f",$spotter_data['latitude']).'" lon="'.sprintf("%.8f",$spotter_data['longitude']).'">';
49
-			if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>';
50
-			$gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>';
47
+		foreach ($spotter_history_array as $spotter_data) {
48
+			$gpx .= '<trkpt lat="'.sprintf("%.8f", $spotter_data['latitude']).'" lon="'.sprintf("%.8f", $spotter_data['longitude']).'">';
49
+			if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f", $spotter_data['altitude']).'</ele>';
50
+			$gpx .= '<time>'.date("Y-m-d\TH:i:s\Z", strtotime($spotter_data['date'])).'</time>';
51 51
 			$gpx .= '</trkpt>';
52 52
 		}
53 53
 		$gpx .= '</trkseg>';
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
 		global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId;
85 85
 		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
86 86
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
87
-		if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
87
+		if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
88 88
 		$data = $this->create_gpx($spotter_history_array);
89 89
 		$url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true';
90 90
 		$Common = new Common();
91
-		$matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml','Accept: application/json'));
92
-		$matching = json_decode($matching,true);
91
+		$matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml', 'Accept: application/json'));
92
+		$matching = json_decode($matching, true);
93 93
 		if (isset($matching['diary']['entries'][0]['route']['links'])) {
94 94
 			$spotter_history_array = array();
95 95
 			foreach ($matching['diary']['entries'][0]['route']['links'] as $match) {
96 96
 				if (isset($match['wpts'])) {
97 97
 					foreach ($match['wpts'] as $coord) {
98
-						$spotter_history_array[] = array('longitude' => $coord['x'],'latitude' => $coord['y']);
98
+						$spotter_history_array[] = array('longitude' => $coord['x'], 'latitude' => $coord['y']);
99 99
 					}
100 100
 				}
101 101
 			}
@@ -115,22 +115,22 @@  discard block
 block discarded – undo
115 115
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
116 116
 		$spotter_history_initial_array = array();
117 117
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
118
-			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
119
-			$spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts);
118
+			$spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
119
+			$spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts);
120 120
 		}
121 121
 		$data = $this->create_gpx($spotter_history_array);
122 122
 		$url = 'https://graphhopper.com/api/1/match?vehicle=car&points_encoded=0&instructions=false&key='.$globalGraphHopperKey;
123 123
 		$Common = new Common();
124
-		$matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml'));
125
-		$matching = json_decode($matching,true);
124
+		$matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml'));
125
+		$matching = json_decode($matching, true);
126 126
 		if (isset($matching['paths'][0]['points']['coordinates'])) {
127 127
 			$spotter_history_array = array();
128 128
 			foreach ($matching['paths'][0]['points']['coordinates'] as $match) {
129 129
 				$coord = $match;
130
-				$spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]);
130
+				$spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]);
131 131
 			}
132 132
 		}
133
-		$spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array);
133
+		$spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array);
134 134
 		$spotter_history_array[0]['mapmatching_engine'] = 'graphhopper';
135 135
 		return $spotter_history_array;
136 136
 	}
@@ -146,23 +146,23 @@  discard block
 block discarded – undo
146 146
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
147 147
 		$spotter_history_initial_array = array();
148 148
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
149
-			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
150
-			$spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts);
149
+			$spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
150
+			$spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts);
151 151
 		}
152 152
 		$data = $this->create_gpx($spotter_history_array);
153 153
 		$url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0&instructions=false';
154 154
 		//$url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0';
155 155
 		$Common = new Common();
156
-		$matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml'));
157
-		$matching = json_decode($matching,true);
156
+		$matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml'));
157
+		$matching = json_decode($matching, true);
158 158
 		if (isset($matching['paths'][0]['points']['coordinates'])) {
159 159
 			$spotter_history_array = array();
160 160
 			foreach ($matching['paths'][0]['points']['coordinates'] as $match) {
161 161
 				$coord = $match;
162
-				$spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]);
162
+				$spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]);
163 163
 			}
164 164
 		}
165
-		$spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array);
165
+		$spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array);
166 166
 		$spotter_history_array[0]['mapmatching_engine'] = 'fam';
167 167
 		return $spotter_history_array;
168 168
 	}
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
179 179
 		$spotter_history_initial_array = array();
180 180
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
181
-			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
182
-			$spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts);
181
+			$spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
182
+			$spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts);
183 183
 		}
184 184
 		$coord = '';
185 185
 		$ts = '';
@@ -195,15 +195,15 @@  discard block
 block discarded – undo
195 195
 		$url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore';
196 196
 		$Common = new Common();
197 197
 		$matching = $Common->getData($url);
198
-		$matching  = json_decode($matching,true);
198
+		$matching = json_decode($matching, true);
199 199
 		if (isset($matching['matchings'][0]['geometry']['coordinates'])) {
200 200
 			$spotter_history_array = array();
201 201
 			foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) {
202 202
 				$coord = $match;
203
-				$spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]);
203
+				$spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]);
204 204
 			}
205 205
 		}
206
-		$spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array);
206
+		$spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array);
207 207
 		$spotter_history_array[0]['mapmatching_engine'] = 'osmr';
208 208
 		return $spotter_history_array;
209 209
 	}
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
220 220
 		$spotter_history_initial_array = array();
221 221
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
222
-			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
223
-			$spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts);
222
+			$spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
223
+			$spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts);
224 224
 		}
225 225
 		$coord = '';
226 226
 		$ts = '';
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 		$url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'&timestamps='.$ts.'&overview=full&tidy=true&geometries=geojson';
238 238
 		$Common = new Common();
239 239
 		$matching = $Common->getData($url);
240
-		$matching  = json_decode($matching,true);
240
+		$matching = json_decode($matching, true);
241 241
 		if (isset($matching['matchings'][0]['geometry']['coordinates'])) {
242 242
 			$spotter_history_array = array();
243 243
 			foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) {
244 244
 				$coord = $match;
245
-				$spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]);
245
+				$spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]);
246 246
 			}
247 247
 		}
248
-		$spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array);
248
+		$spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array);
249 249
 		$spotter_history_array[0]['mapmatching_engine'] = 'mapbox';
250 250
 		return $spotter_history_array;
251 251
 	}
Please login to merge, or discard this patch.
Braces   +54 added lines, -18 removed lines patch added patch discarded remove patch
@@ -46,7 +46,9 @@  discard block
 block discarded – undo
46 46
 		$gpx .= '<trkseg>';
47 47
 		foreach($spotter_history_array as $spotter_data) {
48 48
 			$gpx .= '<trkpt lat="'.sprintf("%.8f",$spotter_data['latitude']).'" lon="'.sprintf("%.8f",$spotter_data['longitude']).'">';
49
-			if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>';
49
+			if (isset($spotter_data['altitude'])) {
50
+				$gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>';
51
+			}
50 52
 			$gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>';
51 53
 			$gpx .= '</trkpt>';
52 54
 		}
@@ -82,9 +84,15 @@  discard block
 block discarded – undo
82 84
 
83 85
 	public function TrackMatching($spotter_history_array) {
84 86
 		global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId;
85
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
86
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
87
-		if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
87
+		if (!isset($globalMapMatchingMaxPts)) {
88
+			$globalMapMatchingMaxPts = 100;
89
+		}
90
+		if (count($spotter_history_array) < 2) {
91
+			return $spotter_history_array;
92
+		}
93
+		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
94
+			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
95
+		}
88 96
 		$data = $this->create_gpx($spotter_history_array);
89 97
 		$url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true';
90 98
 		$Common = new Common();
@@ -111,8 +119,12 @@  discard block
 block discarded – undo
111 119
 	*/
112 120
 	public function GraphHopper($spotter_history_array) {
113 121
 		global $globalMapMatchingMaxPts, $globalGraphHopperKey;
114
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
115
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
122
+		if (!isset($globalMapMatchingMaxPts)) {
123
+			$globalMapMatchingMaxPts = 100;
124
+		}
125
+		if (count($spotter_history_array) < 2) {
126
+			return $spotter_history_array;
127
+		}
116 128
 		$spotter_history_initial_array = array();
117 129
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
118 130
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -142,8 +154,12 @@  discard block
 block discarded – undo
142 154
 	*/
143 155
 	public function FAMMapMatching($spotter_history_array) {
144 156
 		global $globalMapMatchingMaxPts;
145
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
146
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
157
+		if (!isset($globalMapMatchingMaxPts)) {
158
+			$globalMapMatchingMaxPts = 100;
159
+		}
160
+		if (count($spotter_history_array) < 2) {
161
+			return $spotter_history_array;
162
+		}
147 163
 		$spotter_history_initial_array = array();
148 164
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
149 165
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -174,8 +190,12 @@  discard block
 block discarded – undo
174 190
 	*/
175 191
 	public function osmr($spotter_history_array) {
176 192
 		global $globalMapMatchingMaxPts;
177
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 50;
178
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
193
+		if (!isset($globalMapMatchingMaxPts)) {
194
+			$globalMapMatchingMaxPts = 50;
195
+		}
196
+		if (count($spotter_history_array) < 2) {
197
+			return $spotter_history_array;
198
+		}
179 199
 		$spotter_history_initial_array = array();
180 200
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
181 201
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -185,11 +205,17 @@  discard block
 block discarded – undo
185 205
 		$ts = '';
186 206
 		$rd = '';
187 207
 		foreach ($spotter_history_array as $spotter_data) {
188
-			if ($coord != '') $coord .= ';';
208
+			if ($coord != '') {
209
+				$coord .= ';';
210
+			}
189 211
 			$coord .= $spotter_data['longitude'].','.$spotter_data['latitude'];
190
-			if ($ts != '') $ts .= ';';
212
+			if ($ts != '') {
213
+				$ts .= ';';
214
+			}
191 215
 			$ts .= strtotime($spotter_data['date']);
192
-			if ($rd != '') $rd .= ';';
216
+			if ($rd != '') {
217
+				$rd .= ';';
218
+			}
193 219
 			$rd .= '20';
194 220
 		}
195 221
 		$url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore';
@@ -215,8 +241,12 @@  discard block
 block discarded – undo
215 241
 	*/
216 242
 	public function mapbox($spotter_history_array) {
217 243
 		global $globalMapMatchingMaxPts, $globalMapboxToken;
218
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 60;
219
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
244
+		if (!isset($globalMapMatchingMaxPts)) {
245
+			$globalMapMatchingMaxPts = 60;
246
+		}
247
+		if (count($spotter_history_array) < 2) {
248
+			return $spotter_history_array;
249
+		}
220 250
 		$spotter_history_initial_array = array();
221 251
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
222 252
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -226,11 +256,17 @@  discard block
 block discarded – undo
226 256
 		$ts = '';
227 257
 		$rd = '';
228 258
 		foreach ($spotter_history_array as $spotter_data) {
229
-			if ($coord != '') $coord .= ';';
259
+			if ($coord != '') {
260
+				$coord .= ';';
261
+			}
230 262
 			$coord .= $spotter_data['longitude'].','.$spotter_data['latitude'];
231
-			if ($ts != '') $ts .= ';';
263
+			if ($ts != '') {
264
+				$ts .= ';';
265
+			}
232 266
 			$ts .= strtotime($spotter_data['date']);
233
-			if ($rd != '') $rd .= ';';
267
+			if ($rd != '') {
268
+				$rd .= ';';
269
+			}
234 270
 			$rd .= '20';
235 271
 		}
236 272
 		//$url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'&timestamps='.$ts.'&overview=full&tidy=true&geometries=geojson&radiuses='.$rd;
Please login to merge, or discard this patch.
highlights-display.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 require_once('header.php');
8 8
 
9 9
 //calculuation for the pagination
10
-if(!isset($_GET['limit']))
10
+if (!isset($_GET['limit']))
11 11
 {
12 12
 	$limit_start = 0;
13 13
 	$limit_end = 28;
14 14
 	$absolute_difference = 28;
15 15
 } else {
16 16
 	$limit_explode = explode(",", $_GET['limit']);
17
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
18
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
17
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
18
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
19 19
 	if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) {
20 20
 		$limit_start = 0;
21 21
 		$limit_end = 25;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 print '<div class="column">';	
40 40
 print '<p>'._("The view below shows all aircraft that have been selected to have some sort of special characteristic about them, such as unique liveries, destinations etc.").'</p>';
41 41
 
42
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
42
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
43 43
 if ($sort != '') {
44 44
 	$spotter_array = $Spotter->getSpotterDataByHighlight($limit_start.",".$absolute_difference, $sort);
45 45
 } else {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 if (!empty($spotter_array))
49 49
 {
50 50
 	print '<div class="dispay-view">';
51
-	foreach($spotter_array as $spotter_item)
51
+	foreach ($spotter_array as $spotter_item)
52 52
 	{
53 53
 		if (isset($spotter_item['image']) && $spotter_item['image'] != "")
54 54
 		{
Please login to merge, or discard this patch.
pilot-detailed.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 require_once('require/class.Language.php');
6 6
 require_once('require/class.SpotterArchive.php');
7 7
 
8
-if (!isset($_GET['pilot'])){
8
+if (!isset($_GET['pilot'])) {
9 9
 	header('Location: '.$globalURL.'/');
10 10
 } else {
11 11
 	$Spotter = new Spotter();
12 12
 	$SpotterArchive = new SpotterArchive();
13 13
 	//calculuation for the pagination
14
-	if(!isset($_GET['limit']))
14
+	if (!isset($_GET['limit']))
15 15
 	{
16 16
 		$limit_start = 0;
17 17
 		$limit_end = 25;
@@ -32,29 +32,29 @@  discard block
 block discarded – undo
32 32
 	
33 33
 	$page_url = $globalURL.'/pilot/'.$_GET['pilot'];
34 34
 	
35
-	$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
36
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
37
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
35
+	$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
36
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
37
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
38
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
41
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
42 42
 	if ($sort != '') 
43 43
 	{
44
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
44
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
45 45
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
46
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
46
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
47 47
 		}
48 48
 	} else {
49
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
49
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
50 50
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
51
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
51
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
52 52
 		}
53 53
 	}
54 54
 
55 55
 	if (!empty($spotter_array))
56 56
 	{
57
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
57
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']);
58 58
 		$ident = $spotter_array[0]['ident'];
59 59
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60 60
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -115,23 +115,23 @@  discard block
 block discarded – undo
115 115
 			$Stats = new Stats();
116 116
 			$flights = $Stats->getStatsPilot($pilot);
117 117
 		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
118
+		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot, $filter);
119 119
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120
-		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
120
+		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot, $filter));
121 121
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
122
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot,$filter));
122
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot, $filter));
123 123
 		print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>';
124
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot,$filter));
124
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot, $filter));
125 125
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
126
-		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
126
+		$airlines = count($Spotter->countAllAirlinesByPilot($pilot, $filter));
127 127
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128
-		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
128
+		$duration = $Spotter->getFlightDurationByPilot($pilot, $filter);
129 129
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
130 130
 		print '</div>';
131 131
 	
132 132
 		include('pilot-sub-menu.php');
133 133
 		print '<div class="table column">';
134
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
134
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
135 135
 
136 136
 		include('table-output.php'); 
137 137
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,8 +37,12 @@  discard block
 block discarded – undo
37 37
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38 38
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') {
41
+		$filter = array_merge($filter,array('year' => $year));
42
+	}
43
+	if ($month != '') {
44
+		$filter = array_merge($filter,array('month' => $month));
45
+	}
42 46
 	if ($sort != '') 
43 47
 	{
44 48
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -56,8 +60,12 @@  discard block
 block discarded – undo
56 60
 	{
57 61
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
58 62
 		$ident = $spotter_array[0]['ident'];
59
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
63
+		if (isset($spotter_array[0]['latitude'])) {
64
+			$latitude = $spotter_array[0]['latitude'];
65
+		}
66
+		if (isset($spotter_array[0]['longitude'])) {
67
+			$longitude = $spotter_array[0]['longitude'];
68
+		}
61 69
 		require_once('header.php');
62 70
 		/*
63 71
 		if (isset($globalArchive) && $globalArchive) {
@@ -110,12 +118,18 @@  discard block
 block discarded – undo
110 118
 		*/
111 119
 		print '<div class="info column">';
112 120
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
113
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
121
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
122
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		}
114 124
 		if ($year == '' && $month == '') {
115 125
 			$Stats = new Stats();
116 126
 			$flights = $Stats->getStatsPilot($pilot);
117
-		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
127
+		} else {
128
+			$flights = 0;
129
+		}
130
+		if ($flights == 0) {
131
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
132
+		}
119 133
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120 134
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
121 135
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
@@ -126,7 +140,9 @@  discard block
 block discarded – undo
126 140
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
127 141
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128 142
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
129
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
143
+		if ($duration != '0') {
144
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
145
+		}
130 146
 		print '</div>';
131 147
 	
132 148
 		include('pilot-sub-menu.php');
Please login to merge, or discard this patch.
route-statistics-aircraft.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 require_once('require/class.Connection.php');
8 8
 require_once('require/class.Spotter.php');
9 9
 require_once('require/class.Language.php');
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING);
12
-$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING);
12
+$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING);
13 13
 $Spotter = new Spotter();
14 14
 $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort);
15 15
   
16 16
 if (!empty($spotter_array))
17 17
 {
18
-	$title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']);
18
+	$title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']);
19 19
 	require_once('header.php');
20 20
 	print '<div class="info column">';
21 21
 	print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>';
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	include('route-sub-menu.php');
27 27
 	print '<div class="column">';
28 28
 	print '<h2>'._("Most Common Aircraft").'</h2>';
29
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>';
29
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>';
30 30
 
31 31
 	$aircraft_array = $Spotter->countAllAircraftTypesByRoute($departure_airport, $arrival_airport);
32 32
 	if (!empty($aircraft_array))
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		print '</thead>';
42 42
 		print '<tbody>';
43 43
 		$i = 1;
44
-		foreach($aircraft_array as $aircraft_item)
44
+		foreach ($aircraft_array as $aircraft_item)
45 45
 		{
46 46
 			print '<tr>';
47 47
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
live-geojson.php 3 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
 $usecoord = false;
15 15
 if (isset($_GET['test'])) exit();
16 16
 if (isset($_GET['tracker'])) {
17
-    $tracker = true;
17
+	$tracker = true;
18 18
 }
19 19
 if (isset($_GET['marine'])) {
20
-    $marine = true;
20
+	$marine = true;
21 21
 }
22 22
 if ($tracker) {
23
-    require_once('require/class.Tracker.php');
24
-    require_once('require/class.TrackerLive.php');
25
-    require_once('require/class.TrackerArchive.php');
23
+	require_once('require/class.Tracker.php');
24
+	require_once('require/class.TrackerLive.php');
25
+	require_once('require/class.TrackerArchive.php');
26 26
 } elseif ($marine) {
27
-    require_once('require/class.Marine.php');
28
-    require_once('require/class.MarineLive.php');
29
-    require_once('require/class.MarineArchive.php');
27
+	require_once('require/class.Marine.php');
28
+	require_once('require/class.MarineLive.php');
29
+	require_once('require/class.MarineArchive.php');
30 30
 } else {
31
-    require_once('require/class.Spotter.php');
32
-    require_once('require/class.SpotterLive.php');
33
-    require_once('require/class.SpotterArchive.php');
31
+	require_once('require/class.Spotter.php');
32
+	require_once('require/class.SpotterLive.php');
33
+	require_once('require/class.SpotterArchive.php');
34 34
 }
35 35
 
36 36
 $begintime = microtime(true);
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 $Common = new Common();
51 51
 
52 52
 if (isset($_GET['download'])) {
53
-    if ($_GET['download'] == "true")
54
-    {
53
+	if ($_GET['download'] == "true")
54
+	{
55 55
 	header('Content-disposition: attachment; filename="flightairmap.json"');
56
-    }
56
+	}
57 57
 }
58 58
 header('Content-Type: text/javascript');
59 59
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	$usecoord = true;
132 132
 	$coord = explode(',',$_GET['coord']);
133 133
 	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) 
134
-	    && $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) {
134
+		&& $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) {
135 135
 		if ($tracker) {
136 136
 			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
137 137
 		} elseif ($marine) {
@@ -635,17 +635,17 @@  discard block
 block discarded – undo
635 635
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
636 636
 				
637 637
 				if (
638
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
639
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
638
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
639
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
640 640
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
641 641
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
642
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
643
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
644
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
645
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
646
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
647
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
648
-				    ) {
642
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
643
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
644
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
645
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
646
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
647
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
648
+					) {
649 649
 					if ($tracker) {
650 650
 						if ($from_archive || $globalArchive) {
651 651
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
 							$spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']);
654 654
 						}
655 655
 						if (((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') ||
656
-						    (!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && 
657
-						    isset($_GET['zoom']) && $_GET['zoom'] > 12 && 
658
-						    isset($spotter_item['type']) && (
656
+							(!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && 
657
+							isset($_GET['zoom']) && $_GET['zoom'] > 12 && 
658
+							isset($spotter_item['type']) && (
659 659
 							$spotter_item['type'] == 'Firetruck' ||
660 660
 							$spotter_item['type'] == 'Ambulance' ||
661 661
 							$spotter_item['type'] == 'Truck (18 Wheeler)' ||
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 							$spotter_item['type'] == 'Jeep' ||
668 668
 							$spotter_item['type'] == 'Motorcycle' ||
669 669
 							$spotter_item['type'] == 'Car'
670
-						    )
670
+							)
671 671
 						) {
672 672
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
673 673
 							$MapMatching = new MapMatching();
@@ -770,75 +770,75 @@  discard block
 block discarded – undo
770 770
 				}
771 771
 				
772 772
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
773
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
774
-				     && (isset($spotter_item['departure_airport']) 
775
-				        && $spotter_item['departure_airport'] != 'NA' 
776
-				        && isset($spotter_item['arrival_airport']) 
777
-				        && $spotter_item['arrival_airport'] != 'NA' 
778
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
779
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
780
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
781
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
782
-				    if (isset($spotter_item['departure_airport_latitude'])) {
773
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
774
+					 && (isset($spotter_item['departure_airport']) 
775
+						&& $spotter_item['departure_airport'] != 'NA' 
776
+						&& isset($spotter_item['arrival_airport']) 
777
+						&& $spotter_item['arrival_airport'] != 'NA' 
778
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
779
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
780
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
781
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
782
+					if (isset($spotter_item['departure_airport_latitude'])) {
783 783
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
784
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
784
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
785 785
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
786 786
 					if (isset($dairport[0]['latitude'])) {
787
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
787
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
788 788
 					}
789
-				    }
790
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
789
+					}
790
+					if (isset($spotter_item['arrival_airport_latitude'])) {
791 791
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
792
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
792
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
793 793
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
794 794
 					if (isset($aairport[0]['latitude'])) {
795
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
795
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
796 796
 					}
797
-				    }
798
-				    $output_air  = substr($output_air, 0, -1);
799
-				    $output_air .= ']}},';
800
-				    $output .= $output_air;
801
-				    unset($output_air);
797
+					}
798
+					$output_air  = substr($output_air, 0, -1);
799
+					$output_air .= ']}},';
800
+					$output .= $output_air;
801
+					unset($output_air);
802 802
 				}
803 803
 
804 804
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
805 805
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
806 806
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
807
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
808
-				     && (isset($spotter_item['arrival_airport']) 
809
-				        && $spotter_item['arrival_airport'] != 'NA' 
810
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
811
-				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
812
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
813
-				    $havedata = false;
814
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
807
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
808
+					 && (isset($spotter_item['arrival_airport']) 
809
+						&& $spotter_item['arrival_airport'] != 'NA' 
810
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
811
+							|| (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
812
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
813
+					$havedata = false;
814
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
816 816
 				    
817
-				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
818
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
817
+					//$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
818
+					if (isset($spotter_item['arrival_airport_latitude'])) {
819 819
 					//$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
820 820
 					$end_lon = $spotter_item['arrival_airport_longitude'];
821 821
 					$end_lat = $spotter_item['arrival_airport_latitude'];
822 822
 					$havedata = true;
823
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
823
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
824 824
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
825 825
 					if (isset($aairport[0]['latitude'])) {
826
-					    //$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
827
-					    $end_lon = $aairport[0]['longitude'];
828
-					    $end_lat = $aairport[0]['latitude'];
829
-					    $havedata = true;
826
+						//$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
827
+						$end_lon = $aairport[0]['longitude'];
828
+						$end_lat = $aairport[0]['latitude'];
829
+						$havedata = true;
830 830
 					}
831
-				    }
832
-				    if ($havedata) {
831
+					}
832
+					if ($havedata) {
833 833
 					$line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon);
834 834
 					foreach ($line[0] as $coord) {
835 835
 						$output_dest .= '['.$coord[0].','.$coord[1].'],';
836 836
 					}
837 837
 					$output_dest  = substr($output_dest, 0, -1);
838
-				    }
839
-				    $output_dest .= ']}},';
840
-				    if ($havedata) $output .= $output_dest;
841
-				    unset($output_dest);
838
+					}
839
+					$output_dest .= ']}},';
840
+					if ($havedata) $output .= $output_dest;
841
+					unset($output_dest);
842 842
 				}
843 843
 			}
844 844
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
 $min = true;
66 66
 $allhistory = false;
67 67
 $filter['source'] = array();
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
70
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
73
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
79
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
69
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
70
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
71
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
72
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
73
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
74
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
75
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
76
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
77
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
78
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
79
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT);
80 80
 if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true;
81 81
 
82 82
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 
86 86
 
87 87
 if (isset($_COOKIE['map_2d_limit'])) {
88
-	$limit = filter_var($_COOKIE['map_2d_limit'],FILTER_SANITIZE_NUMBER_INT);
88
+	$limit = filter_var($_COOKIE['map_2d_limit'], FILTER_SANITIZE_NUMBER_INT);
89 89
 }
90 90
 
91 91
 $spotter_array = array();
92 92
 
93 93
 if (isset($_GET['ident'])) {
94
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
94
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
95 95
 	if ($tracker) {
96 96
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
97 97
 	} elseif ($marine) {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 	$allhistory = true;
107 107
 } elseif (isset($_GET['flightaware_id'])) {
108
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
108
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
109 109
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
110 110
 	if (empty($spotter_array)) {
111 111
 		$from_archive = true;
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 	$allhistory = true;
115 115
 } elseif (isset($_GET['famtrack_id'])) {
116
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
116
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
117 117
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
118 118
 	$allhistory = true;
119 119
 } elseif (isset($_GET['fammarine_id'])) {
120
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
120
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
121 121
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
122 122
 	$allhistory = true;
123 123
 /*
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 */
138 138
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min && !isset($_GET['archive'])) {
139 139
 	$usecoord = true;
140
-	$coord = explode(',',$_GET['coord']);
141
-	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) 
140
+	$coord = explode(',', $_GET['coord']);
141
+	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) 
142 142
 	    && $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) {
143 143
 		if ($tracker) {
144
-			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
144
+			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
145 145
 		} elseif ($marine) {
146
-			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
146
+			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
147 147
 		} else {
148
-			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$limit,$filter);
148
+			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $limit, $filter);
149 149
 		}
150 150
 	} else {
151 151
 		if ($tracker) {
@@ -153,41 +153,41 @@  discard block
 block discarded – undo
153 153
 		} elseif ($marine) {
154 154
 			$spotter_array = $MarineLive->getMinLiveMarineData($filter);
155 155
 		} else {
156
-			$spotter_array = $SpotterLive->getMinLiveSpotterData($limit,$filter);
156
+			$spotter_array = $SpotterLive->getMinLiveSpotterData($limit, $filter);
157 157
 		}
158 158
 	}
159 159
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) {
160 160
 	$from_archive = true;
161 161
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
162 162
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
163
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
164
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
165
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
166
-	$begindate = date('Y-m-d H:i:s',$begindate);
167
-	$enddate = date('Y-m-d H:i:s',$enddate);
168
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
163
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
164
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
165
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
166
+	$begindate = date('Y-m-d H:i:s', $begindate);
167
+	$enddate = date('Y-m-d H:i:s', $enddate);
168
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
169 169
 } elseif ($min) {
170 170
 	if ($tracker) {
171 171
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
172 172
 	} elseif ($marine) {
173 173
 		$spotter_array = $MarineLive->getMinLiveMarineData($filter);
174 174
 	} else {
175
-		$spotter_array = $SpotterLive->getMinLiveSpotterData($limit,$filter);
175
+		$spotter_array = $SpotterLive->getMinLiveSpotterData($limit, $filter);
176 176
 	}
177 177
 #	$min = true;
178 178
 } else {
179 179
 	if ($tracker) {
180
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
180
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
181 181
 	} elseif ($marine) {
182
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
182
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
183 183
 	} else {
184
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
184
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
185 185
 	}
186 186
 }
187 187
 
188 188
 if ($usecoord) {
189 189
 	if (isset($_GET['archive'])) {
190
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
190
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
191 191
 	} else {
192 192
 		if ($tracker) {
193 193
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	if ($flightcnt == '') $flightcnt = 0;
201 201
 } else $flightcnt = 0;
202 202
 
203
-$sqltime = round(microtime(true)-$begintime,2);
203
+$sqltime = round(microtime(true) - $begintime, 2);
204 204
 
205
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
205
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
206 206
 if ($currenttime != '') $currenttime = round($currenttime/1000);
207 207
 
208 208
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		if (!empty($spotter_array) && is_array($spotter_array))
222 222
 		{
223 223
 			$output .= '"features": [';
224
-			foreach($spotter_array as $spotter_item)
224
+			foreach ($spotter_array as $spotter_item)
225 225
 			{
226 226
 				$j++;
227 227
 				unset($idistance);
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 */
279 279
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
280 280
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
281
-							if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
282
-							else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
281
+							if ($compress) $output .= '"c": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).',';
282
+							else $output .= '"callsign": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).',';
283 283
 							//'
284 284
 						} else {
285 285
 							if ($compress) $output .= '"c": "NA",';
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 						}
292 292
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
293 293
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
294
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
294
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
295 295
 						} elseif (isset($spotter_item['aircraft_type'])) {
296 296
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
297 297
 						} elseif (!$min) {
@@ -377,19 +377,19 @@  discard block
 block discarded – undo
377 377
 									else $output .= '"aircraft_shadow": "car.png",';
378 378
 								}
379 379
 							} elseif ($marine) {
380
-								if (isset($spotter_item['type']) && ($spotter_item['type']  == '50&#39; Performance Cruiser' || $spotter_item['type']  == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
380
+								if (isset($spotter_item['type']) && ($spotter_item['type'] == '50&#39; Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
381 381
 									if ($compress) $output .= '"as": "50perfcruiser.png",';
382 382
 									else $output .= '"aircraft_shadow": "50perfcruiser.png",';
383
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Sailaway Cruiser 38') {
383
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') {
384 384
 									if ($compress) $output .= '"as": "cruiser38.png",';
385 385
 									else $output .= '"aircraft_shadow": "cruiser38.png",';
386
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Mini Transat') {
386
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') {
387 387
 									if ($compress) $output .= '"as": "transat.png",';
388 388
 									else $output .= '"aircraft_shadow": "transat.png",';
389
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == '52&#39; Cruising Cat') {
389
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52&#39; Cruising Cat') {
390 390
 									if ($compress) $output .= '"as": "catamaran.png",';
391 391
 									else $output .= '"aircraft_shadow": "catamaran.png",';
392
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Caribbean Rose') {
392
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') {
393 393
 									if ($compress) $output .= '"as": "carib.png",';
394 394
 									else $output .= '"aircraft_shadow": "carib.png",';
395 395
 								} else {
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 						if (isset($archivespeed) || $usenextlatlon) {
456 456
 							if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
457 457
 								if (isset($spotter_item['arrival_airport_latitude'])) {
458
-									$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
459
-									$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
458
+									$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
459
+									$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
460 460
 									$farr_lat = $spotter_item['arrival_airport_latitude'];
461 461
 									$farr_lon = $spotter_item['arrival_airport_longitude'];
462 462
 								} else {
463 463
 									$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
464 464
 									if (isset($aairport[0]['latitude'])) {
465
-										$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
466
-										$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
465
+										$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
466
+										$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
467 467
 										$farr_lat = $aairport[0]['latitude'];
468 468
 										$farr_lon = $aairport[0]['longitude'];
469 469
 									}
@@ -476,59 +476,59 @@  discard block
 block discarded – undo
476 476
 						if ($currenttime != '') {
477 477
 							if (strtotime($spotter_item['date']) < $currenttime) {
478 478
 								if (isset($archivespeed)) {
479
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
480
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
479
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
480
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
481 481
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
482 482
 									else {
483
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
484
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
483
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
484
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
485 485
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
486 486
 										else {
487
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
487
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
488 488
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
489 489
 										}
490 490
 									}
491 491
 								} elseif ($usenextlatlon) {
492
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
493
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
492
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
493
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
494 494
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
495 495
 									else {
496
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
497
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
496
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
497
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
498 498
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
499 499
 										else {
500
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
500
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
501 501
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
502 502
 										}
503 503
 									}
504 504
 								}
505 505
 							} else {
506 506
 								if (isset($archivespeed)) {
507
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
507
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
508 508
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
509 509
 								} elseif ($usenextlatlon) {
510
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
510
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
511 511
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
512 512
 								}
513 513
 							}
514 514
 						} else {
515 515
 							if (isset($archivespeed)) {
516
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
517
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
516
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
517
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
518 518
 								if (!isset($idistance) || $fdistance < $idistance) {
519 519
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
520 520
 								} else {
521
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed);
521
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed);
522 522
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
523 523
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
524 524
 								}
525 525
 							} elseif ($usenextlatlon) {
526
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
527
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
526
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
527
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
528 528
 								if (!isset($idistance) || $fdistance < $idistance) {
529 529
 										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
530 530
 								} else {
531
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading);
531
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading);
532 532
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
533 533
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
534 534
 								}
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 
538 538
 						if (!$min) $output .= '"image": "'.$image.'",';
539 539
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
540
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
540
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
541 541
 						}
542 542
 						if (isset($spotter_item['image_source_website'])) {
543 543
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
572 572
 						}
573 573
 						if (isset($spotter_item['acars'])) {
574
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
574
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
575 575
 						}
576 576
 						// type when not aircraft ?
577 577
 						if (isset($spotter_item['type'])) {
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
 								if ($currenttime != '') {
592 592
 									if (strtotime($spotter_item['date']) < $currenttime) {
593 593
 										if (!isset($archivespeed)) $archivespeed = 1;
594
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
595
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
594
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
595
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
596 596
 										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
597 597
 										else {
598
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
599
-											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
598
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
599
+											$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
600 600
 											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
601 601
 											else {
602 602
 												$output .= $spotter_item['longitude'].', ';
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
                 
676 676
 			}
677 677
 */
678
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
678
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
679 679
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
680 680
 				
681 681
 				if (
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
684 684
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
685 685
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
686
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
686
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
687 687
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
688
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
688
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
689 689
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
690
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
690
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
691 691
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
692 692
 				    ) {
693 693
 					if ($tracker) {
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
717 717
 							$MapMatching = new MapMatching();
718 718
 							if (isset($spotter_item['date_iso_8601'])) {
719
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601'])))));
719
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601'])))));
720 720
 							} else {
721
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date'])))));
721
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date'])))));
722 722
 							}
723 723
 							$spotter_history_array = $MapMatching->match($spotter_history_array_mm);
724 724
 						}
@@ -750,9 +750,9 @@  discard block
 block discarded – undo
750 750
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
751 751
 							}
752 752
 							$output_history .= '[';
753
-							$output_history .=  $spotter_history['longitude'].', ';
754
-							$output_history .=  $spotter_history['latitude'].', ';
755
-							$output_history .=  $spotter_history['altitude']*30.48;
753
+							$output_history .= $spotter_history['longitude'].', ';
754
+							$output_history .= $spotter_history['latitude'].', ';
755
+							$output_history .= $spotter_history['altitude']*30.48;
756 756
 							$output_history .= '],';
757 757
 							/*
758 758
 							if ($from_archive === false) {
@@ -775,8 +775,8 @@  discard block
 block discarded – undo
775 775
 								$d = true;
776 776
 							}
777 777
 							$output_history .= '[';
778
-							$output_history .=  $spotter_history['longitude'].', ';
779
-							$output_history .=  $spotter_history['latitude'];
778
+							$output_history .= $spotter_history['longitude'].', ';
779
+							$output_history .= $spotter_history['latitude'];
780 780
 							$output_history .= '],';
781 781
 							/*
782 782
 							if ($from_archive === false) {
@@ -792,9 +792,9 @@  discard block
 block discarded – undo
792 792
 						//echo $output_history;
793 793
 						if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) {
794 794
 							$output_historyd = '[';
795
-							$output_historyd .=  $spotter_item['longitude'].', ';
796
-							$output_historyd .=  $spotter_item['latitude'];
797
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
795
+							$output_historyd .= $spotter_item['longitude'].', ';
796
+							$output_historyd .= $spotter_item['latitude'];
797
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
798 798
 							$output_historyd .= '],';
799 799
 							//$output_history = $output_historyd.$output_history;
800 800
 							$output_history = $output_history.$output_historyd;
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 							$last = array_pop($spotter_history_array);
803 803
 							$latitude = $last['latitude'];
804 804
 							$longitude = $last['longitude'];
805
-							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output);
805
+							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output);
806 806
 						}
807 807
 						
808 808
 						$output_history  = substr($output_history, 0, -1);
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 					
815 815
 				}
816 816
 				
817
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
817
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
818 818
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
819 819
 				     && (isset($spotter_item['departure_airport']) 
820 820
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 
849 849
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
850 850
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
851
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
851
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
852 852
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
853 853
 				     && (isset($spotter_item['arrival_airport']) 
854 854
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -875,11 +875,11 @@  discard block
 block discarded – undo
875 875
 					}
876 876
 				    }
877 877
 				    if ($havedata) {
878
-					$line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon);
878
+					$line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon);
879 879
 					foreach ($line[0] as $coord) {
880 880
 						$output_dest .= '['.$coord[0].','.$coord[1].'],';
881 881
 					}
882
-					$output_dest  = substr($output_dest, 0, -1);
882
+					$output_dest = substr($output_dest, 0, -1);
883 883
 				    }
884 884
 				    $output_dest .= ']}},';
885 885
 				    if ($havedata) $output .= $output_dest;
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 			$output  = substr($output, 0, -1);
890 890
 			$output .= ']';
891 891
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
892
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
892
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
893 893
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
894 894
 			$output .= '"fc": "'.$j.'"';
895 895
 		} else {
Please login to merge, or discard this patch.
Braces   +364 added lines, -147 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 $tracker = false;
13 13
 $marine = false;
14 14
 $usecoord = false;
15
-if (isset($_GET['test'])) exit();
15
+if (isset($_GET['test'])) {
16
+	exit();
17
+}
16 18
 if (isset($_GET['tracker'])) {
17 19
     $tracker = true;
18 20
 }
@@ -57,31 +59,62 @@  discard block
 block discarded – undo
57 59
 }
58 60
 header('Content-Type: text/javascript');
59 61
 
60
-if (!isset($globalJsonCompress)) $compress = true;
61
-else $compress = $globalJsonCompress;
62
+if (!isset($globalJsonCompress)) {
63
+	$compress = true;
64
+} else {
65
+	$compress = $globalJsonCompress;
66
+}
62 67
 
63 68
 $limit = 0;
64 69
 $from_archive = false;
65 70
 $min = true;
66 71
 $allhistory = false;
67 72
 $filter['source'] = array();
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
70
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
73
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
79
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
80
-if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true;
73
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
75
+}
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
77
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
78
+}
79
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
80
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
81
+}
82
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
83
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
84
+}
85
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
86
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
87
+}
88
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
89
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
90
+}
91
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
92
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
93
+}
94
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
95
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
96
+}
97
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
98
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
99
+}
100
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
101
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
102
+}
103
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
104
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
105
+}
106
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') {
107
+	$filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
108
+}
109
+if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
110
+	$filter['blocked'] = true;
111
+}
81 112
 
82 113
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
83 114
 	$min = true;
84
-} else $min = false;
115
+} else {
116
+	$min = false;
117
+}
85 118
 
86 119
 
87 120
 if (isset($_COOKIE['map_2d_limit'])) {
@@ -197,24 +230,38 @@  discard block
 block discarded – undo
197 230
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
198 231
 		}
199 232
 	}
200
-	if ($flightcnt == '') $flightcnt = 0;
201
-} else $flightcnt = 0;
233
+	if ($flightcnt == '') {
234
+		$flightcnt = 0;
235
+	}
236
+	} else {
237
+	$flightcnt = 0;
238
+}
202 239
 
203 240
 $sqltime = round(microtime(true)-$begintime,2);
204 241
 
205 242
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
206
-if ($currenttime != '') $currenttime = round($currenttime/1000);
243
+if ($currenttime != '') {
244
+	$currenttime = round($currenttime/1000);
245
+}
207 246
 
208
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
209
-else $usenextlatlon = true;
210
-if ($usenextlatlon === false) $currenttime = '';
247
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
248
+	$usenextlatlon = false;
249
+} else {
250
+	$usenextlatlon = true;
251
+}
252
+if ($usenextlatlon === false) {
253
+	$currenttime = '';
254
+}
211 255
 $j = 0;
212 256
 $prev_flightaware_id = '';
213 257
 $aircrafts_shadow = array();
214 258
 $output = '{';
215 259
 	$output .= '"type": "FeatureCollection",';
216
-		if ($min) $output .= '"minimal": "true",';
217
-		else $output .= '"minimal": "false",';
260
+		if ($min) {
261
+			$output .= '"minimal": "true",';
262
+		} else {
263
+			$output .= '"minimal": "false",';
264
+		}
218 265
 		//$output .= '"fc": "'.$flightcnt.'",';
219 266
 		$output .= '"sqt": "'.$sqltime.'",';
220 267
 
@@ -259,18 +306,29 @@  discard block
 block discarded – undo
259 306
 						}
260 307
 						$output .= '"properties": {';
261 308
 						if (isset($spotter_item['flightaware_id'])) {
262
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
263
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
309
+							if ($compress) {
310
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
311
+							} else {
312
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
313
+							}
264 314
 						} elseif (isset($spotter_item['famtrackid'])) {
265
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
266
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
315
+							if ($compress) {
316
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
317
+							} else {
318
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
319
+							}
267 320
 						} elseif (isset($spotter_item['fammarine_id'])) {
268
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
269
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
321
+							if ($compress) {
322
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
323
+							} else {
324
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
325
+							}
270 326
 						}
271 327
 						$output .= '"fc": "'.$flightcnt.'",';
272 328
 						$output .= '"sqt": "'.$sqltime.'",';
273
-						if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
329
+						if (isset($begindate)) {
330
+							$output .= '"archive_date": "'.$begindate.'",';
331
+						}
274 332
 
275 333
 /*
276 334
 							if ($min) $output .= '"minimal": "true",';
@@ -278,16 +336,25 @@  discard block
 block discarded – undo
278 336
 */
279 337
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
280 338
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
281
-							if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
282
-							else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
339
+							if ($compress) {
340
+								$output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
341
+							} else {
342
+								$output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
343
+							}
283 344
 							//'
284 345
 						} else {
285
-							if ($compress) $output .= '"c": "NA",';
286
-							else $output .= '"callsign": "NA",';
346
+							if ($compress) {
347
+								$output .= '"c": "NA",';
348
+							} else {
349
+								$output .= '"callsign": "NA",';
350
+							}
287 351
 						}
288 352
 						if (isset($spotter_item['registration'])) {
289
-							if ($compress) $output .= '"reg": '.json_encode($spotter_item['registration']).',';
290
-							else $output .= '"registration": '.json_encode($spotter_item['registration']).',';
353
+							if ($compress) {
354
+								$output .= '"reg": '.json_encode($spotter_item['registration']).',';
355
+							} else {
356
+								$output .= '"registration": '.json_encode($spotter_item['registration']).',';
357
+							}
291 358
 						}
292 359
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
293 360
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
@@ -298,20 +365,30 @@  discard block
 block discarded – undo
298 365
 							$output .= '"aircraft_name": "NA",';
299 366
 						}
300 367
 						if (isset($spotter_item['aircraft_icao'])) {
301
-							if ($compress) $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
302
-							else $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
368
+							if ($compress) {
369
+								$output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
370
+							} else {
371
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
372
+							}
303 373
 						}
304 374
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
305
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
306
-							else {
375
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
376
+								$spotter_item['aircraft_shadow'] = '';
377
+							} else {
307 378
 								$aircraft_icao = $spotter_item['aircraft_icao'];
308
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
309
-								else {
379
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
380
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
381
+								} else {
310 382
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
311
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
312
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
313
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
314
-									else $spotter_item['aircraft_shadow'] = '';
383
+									if (count($aircraft_info) > 0) {
384
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
385
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
386
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
387
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
388
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
389
+									} else {
390
+										$spotter_item['aircraft_shadow'] = '';
391
+									}
315 392
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
316 393
 								}
317 394
 							}
@@ -319,90 +396,171 @@  discard block
 block discarded – undo
319 396
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
320 397
 							if ($tracker) {
321 398
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
322
-									if ($compress) $output .= '"as": "ambulance.png",';
323
-									else $output .= '"aircraft_shadow": "ambulance.png",';
399
+									if ($compress) {
400
+										$output .= '"as": "ambulance.png",';
401
+									} else {
402
+										$output .= '"aircraft_shadow": "ambulance.png",';
403
+									}
324 404
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
325
-									if ($compress) $output .= '"as": "police.png",';
326
-									else $output .= '"aircraft_shadow": "police.png",';
405
+									if ($compress) {
406
+										$output .= '"as": "police.png",';
407
+									} else {
408
+										$output .= '"aircraft_shadow": "police.png",';
409
+									}
327 410
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
328
-									if ($compress) $output .= '"as": "ship.png",';
329
-									else $output .= '"aircraft_shadow": "ship.png",';
411
+									if ($compress) {
412
+										$output .= '"as": "ship.png",';
413
+									} else {
414
+										$output .= '"aircraft_shadow": "ship.png",';
415
+									}
330 416
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
331
-									if ($compress) $output .= '"as": "ship.png",';
332
-									else $output .= '"aircraft_shadow": "ship.png",';
417
+									if ($compress) {
418
+										$output .= '"as": "ship.png",';
419
+									} else {
420
+										$output .= '"aircraft_shadow": "ship.png",';
421
+									}
333 422
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
334
-									if ($compress) $output .= '"as": "ship.png",';
335
-									else $output .= '"aircraft_shadow": "ship.png",';
423
+									if ($compress) {
424
+										$output .= '"as": "ship.png",';
425
+									} else {
426
+										$output .= '"aircraft_shadow": "ship.png",';
427
+									}
336 428
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
337
-									if ($compress) $output .= '"as": "truck.png",';
338
-									else $output .= '"aircraft_shadow": "truck.png",';
429
+									if ($compress) {
430
+										$output .= '"as": "truck.png",';
431
+									} else {
432
+										$output .= '"aircraft_shadow": "truck.png",';
433
+									}
339 434
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
340
-									if ($compress) $output .= '"as": "truck.png",';
341
-									else $output .= '"aircraft_shadow": "truck.png",';
435
+									if ($compress) {
436
+										$output .= '"as": "truck.png",';
437
+									} else {
438
+										$output .= '"aircraft_shadow": "truck.png",';
439
+									}
342 440
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
343
-									if ($compress) $output .= '"as": "aircraft.png",';
344
-									else $output .= '"aircraft_shadow": "aircraft.png",';
441
+									if ($compress) {
442
+										$output .= '"as": "aircraft.png",';
443
+									} else {
444
+										$output .= '"aircraft_shadow": "aircraft.png",';
445
+									}
345 446
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
346
-									if ($compress) $output .= '"as": "aircraft.png",';
347
-									else $output .= '"aircraft_shadow": "aircraft.png",';
447
+									if ($compress) {
448
+										$output .= '"as": "aircraft.png",';
449
+									} else {
450
+										$output .= '"aircraft_shadow": "aircraft.png",';
451
+									}
348 452
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
349
-									if ($compress) $output .= '"as": "helico.png",';
350
-									else $output .= '"aircraft_shadow": "helico.png",';
453
+									if ($compress) {
454
+										$output .= '"as": "helico.png",';
455
+									} else {
456
+										$output .= '"aircraft_shadow": "helico.png",';
457
+									}
351 458
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
352
-									if ($compress) $output .= '"as": "rail.png",';
353
-									else $output .= '"aircraft_shadow": "rail.png",';
459
+									if ($compress) {
460
+										$output .= '"as": "rail.png",';
461
+									} else {
462
+										$output .= '"aircraft_shadow": "rail.png",';
463
+									}
354 464
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
355
-									if ($compress) $output .= '"as": "firetruck.png",';
356
-									else $output .= '"aircraft_shadow": "firetruck.png",';
465
+									if ($compress) {
466
+										$output .= '"as": "firetruck.png",';
467
+									} else {
468
+										$output .= '"aircraft_shadow": "firetruck.png",';
469
+									}
357 470
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
358
-									if ($compress) $output .= '"as": "bus.png",';
359
-									else $output .= '"aircraft_shadow": "bus.png",';
471
+									if ($compress) {
472
+										$output .= '"as": "bus.png",';
473
+									} else {
474
+										$output .= '"aircraft_shadow": "bus.png",';
475
+									}
360 476
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
361
-									if ($compress) $output .= '"as": "phone.png",';
362
-									else $output .= '"aircraft_shadow": "phone.png",';
477
+									if ($compress) {
478
+										$output .= '"as": "phone.png",';
479
+									} else {
480
+										$output .= '"aircraft_shadow": "phone.png",';
481
+									}
363 482
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
364
-									if ($compress) $output .= '"as": "jogger.png",';
365
-									else $output .= '"aircraft_shadow": "jogger.png",';
483
+									if ($compress) {
484
+										$output .= '"as": "jogger.png",';
485
+									} else {
486
+										$output .= '"aircraft_shadow": "jogger.png",';
487
+									}
366 488
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
367
-									if ($compress) $output .= '"as": "bike.png",';
368
-									else $output .= '"aircraft_shadow": "bike.png",';
489
+									if ($compress) {
490
+										$output .= '"as": "bike.png",';
491
+									} else {
492
+										$output .= '"aircraft_shadow": "bike.png",';
493
+									}
369 494
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
370
-									if ($compress) $output .= '"as": "motorcycle.png",';
371
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
495
+									if ($compress) {
496
+										$output .= '"as": "motorcycle.png",';
497
+									} else {
498
+										$output .= '"aircraft_shadow": "motorcycle.png",';
499
+									}
372 500
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
373
-									if ($compress) $output .= '"as": "balloon.png",';
374
-									else $output .= '"aircraft_shadow": "balloon.png",';
501
+									if ($compress) {
502
+										$output .= '"as": "balloon.png",';
503
+									} else {
504
+										$output .= '"aircraft_shadow": "balloon.png",';
505
+									}
375 506
 								} else {
376
-									if ($compress) $output .= '"as": "car.png",';
377
-									else $output .= '"aircraft_shadow": "car.png",';
507
+									if ($compress) {
508
+										$output .= '"as": "car.png",';
509
+									} else {
510
+										$output .= '"aircraft_shadow": "car.png",';
511
+									}
378 512
 								}
379 513
 							} elseif ($marine) {
380 514
 								if (isset($spotter_item['type']) && ($spotter_item['type']  == '50&#39; Performance Cruiser' || $spotter_item['type']  == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
381
-									if ($compress) $output .= '"as": "50perfcruiser.png",';
382
-									else $output .= '"aircraft_shadow": "50perfcruiser.png",';
515
+									if ($compress) {
516
+										$output .= '"as": "50perfcruiser.png",';
517
+									} else {
518
+										$output .= '"aircraft_shadow": "50perfcruiser.png",';
519
+									}
383 520
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Sailaway Cruiser 38') {
384
-									if ($compress) $output .= '"as": "cruiser38.png",';
385
-									else $output .= '"aircraft_shadow": "cruiser38.png",';
521
+									if ($compress) {
522
+										$output .= '"as": "cruiser38.png",';
523
+									} else {
524
+										$output .= '"aircraft_shadow": "cruiser38.png",';
525
+									}
386 526
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Mini Transat') {
387
-									if ($compress) $output .= '"as": "transat.png",';
388
-									else $output .= '"aircraft_shadow": "transat.png",';
527
+									if ($compress) {
528
+										$output .= '"as": "transat.png",';
529
+									} else {
530
+										$output .= '"aircraft_shadow": "transat.png",';
531
+									}
389 532
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == '52&#39; Cruising Cat') {
390
-									if ($compress) $output .= '"as": "catamaran.png",';
391
-									else $output .= '"aircraft_shadow": "catamaran.png",';
533
+									if ($compress) {
534
+										$output .= '"as": "catamaran.png",';
535
+									} else {
536
+										$output .= '"aircraft_shadow": "catamaran.png",';
537
+									}
392 538
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Caribbean Rose') {
393
-									if ($compress) $output .= '"as": "carib.png",';
394
-									else $output .= '"aircraft_shadow": "carib.png",';
539
+									if ($compress) {
540
+										$output .= '"as": "carib.png",';
541
+									} else {
542
+										$output .= '"aircraft_shadow": "carib.png",';
543
+									}
395 544
 								} else {
396
-									if ($compress) $output .= '"as": "ship.png",';
397
-									else $output .= '"aircraft_shadow": "ship.png",';
545
+									if ($compress) {
546
+										$output .= '"as": "ship.png",';
547
+									} else {
548
+										$output .= '"aircraft_shadow": "ship.png",';
549
+									}
398 550
 								}
399 551
 							} else {
400
-								if ($compress) $output .= '"as": "default.png",';
401
-								else $output .= '"aircraft_shadow": "default.png",';
552
+								if ($compress) {
553
+									$output .= '"as": "default.png",';
554
+								} else {
555
+									$output .= '"aircraft_shadow": "default.png",';
556
+								}
402 557
 							}
403 558
 						} else {
404
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
405
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
559
+							if ($compress) {
560
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
561
+							} else {
562
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
563
+							}
406 564
 						}
407 565
 						if (isset($spotter_item['airline_name'])) {
408 566
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -410,8 +568,11 @@  discard block
 block discarded – undo
410 568
 							$output .= '"airline_name": "NA",';
411 569
 						}
412 570
 						if (isset($spotter_item['departure_airport'])) {
413
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
414
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
571
+							if ($compress) {
572
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
573
+							} else {
574
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
575
+							}
415 576
 						}
416 577
 						if (isset($spotter_item['departure_airport_city'])) {
417 578
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -423,8 +584,11 @@  discard block
 block discarded – undo
423 584
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
424 585
 						}
425 586
 						if (isset($spotter_item['arrival_airport'])) {
426
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
427
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
587
+							if ($compress) {
588
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
589
+							} else {
590
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
591
+							}
428 592
 						}
429 593
 						if (isset($spotter_item['arrival_airport_city'])) {
430 594
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -443,11 +607,17 @@  discard block
 block discarded – undo
443 607
 						}
444 608
 						
445 609
 						if (isset($spotter_item['real_altitude'])) {
446
-							if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
447
-							else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
610
+							if ($compress) {
611
+								$output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
612
+							} else {
613
+								$output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
614
+							}
448 615
 						} elseif (isset($spotter_item['altitude'])) {
449
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
450
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
616
+							if ($compress) {
617
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
618
+							} else {
619
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
620
+							}
451 621
 						}
452 622
 						
453 623
 						$heading = $spotter_item['heading'];
@@ -471,19 +641,24 @@  discard block
 block discarded – undo
471 641
 							}
472 642
 						}
473 643
 						
474
-						if ($compress)$output .= '"h": "'.$heading.'",';
475
-						else $output .= '"heading": "'.$heading.'",';
644
+						if ($compress) {
645
+							$output .= '"h": "'.$heading.'",';
646
+						} else {
647
+							$output .= '"heading": "'.$heading.'",';
648
+						}
476 649
 						if ($currenttime != '') {
477 650
 							if (strtotime($spotter_item['date']) < $currenttime) {
478 651
 								if (isset($archivespeed)) {
479 652
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
480 653
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
481
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
482
-									else {
654
+									if (!isset($idistance) || $fdistance < $idistance) {
655
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
656
+									} else {
483 657
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
484 658
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
485
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
486
-										else {
659
+										if (!isset($idistance) || $fdistance < $idistance) {
660
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
661
+										} else {
487 662
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
488 663
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
489 664
 										}
@@ -491,12 +666,14 @@  discard block
 block discarded – undo
491 666
 								} elseif ($usenextlatlon) {
492 667
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
493 668
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
494
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
495
-									else {
669
+									if (!isset($idistance) || $fdistance < $idistance) {
670
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
671
+									} else {
496 672
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
497 673
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
498
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
499
-										else {
674
+										if (!isset($idistance) || $fdistance < $idistance) {
675
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
676
+										} else {
500 677
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
501 678
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
502 679
 										}
@@ -535,7 +712,9 @@  discard block
 block discarded – undo
535 712
 							}
536 713
 						}
537 714
 
538
-						if (!$min) $output .= '"image": "'.$image.'",';
715
+						if (!$min) {
716
+							$output .= '"image": "'.$image.'",';
717
+						}
539 718
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
540 719
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
541 720
 						}
@@ -543,8 +722,11 @@  discard block
 block discarded – undo
543 722
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
544 723
 						}
545 724
 						if (isset($spotter_item['squawk'])) {
546
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
547
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
725
+							if ($compress) {
726
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
727
+							} else {
728
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
729
+							}
548 730
 						}
549 731
 						if (isset($spotter_item['squawk_usage'])) {
550 732
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -575,14 +757,23 @@  discard block
 block discarded – undo
575 757
 						}
576 758
 						// type when not aircraft ?
577 759
 						if (isset($spotter_item['type'])) {
578
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
579
-							else $output .= '"type": "'.$spotter_item['type'].'"';
760
+							if ($compress) {
761
+								$output .= '"t": "'.$spotter_item['type'].'"';
762
+							} else {
763
+								$output .= '"type": "'.$spotter_item['type'].'"';
764
+							}
580 765
 						} elseif ($marine) {
581
-							if ($compress) $output .= '"t": "ship"';
582
-							else $output .= '"type": "ship"';
766
+							if ($compress) {
767
+								$output .= '"t": "ship"';
768
+							} else {
769
+								$output .= '"type": "ship"';
770
+							}
583 771
 						} else {
584
-							if ($compress) $output .= '"t": "aircraft"';
585
-							else $output .= '"type": "aircraft"';
772
+							if ($compress) {
773
+								$output .= '"t": "aircraft"';
774
+							} else {
775
+								$output .= '"type": "aircraft"';
776
+							}
586 777
 						}
587 778
 						$output .= '},';
588 779
 						$output .= '"geometry": {';
@@ -590,15 +781,19 @@  discard block
 block discarded – undo
590 781
 								$output .= '"coordinates": [';
591 782
 								if ($currenttime != '') {
592 783
 									if (strtotime($spotter_item['date']) < $currenttime) {
593
-										if (!isset($archivespeed)) $archivespeed = 1;
784
+										if (!isset($archivespeed)) {
785
+											$archivespeed = 1;
786
+										}
594 787
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
595 788
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
596
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
597
-										else {
789
+										if (!isset($idistance) || $fdistance < $idistance) {
790
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
791
+										} else {
598 792
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
599 793
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
600
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
601
-											else {
794
+											if (!isset($idistance) || $fdistance < $idistance) {
795
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
796
+											} else {
602 797
 												$output .= $spotter_item['longitude'].', ';
603 798
 												$output .= $spotter_item['latitude'];
604 799
 											}
@@ -676,7 +871,9 @@  discard block
 block discarded – undo
676 871
 			}
677 872
 */
678 873
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
679
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
874
+				if ($history == '' && isset($_COOKIE['history'])) {
875
+					$history = $_COOKIE['history'];
876
+				}
680 877
 				
681 878
 				if (
682 879
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -746,8 +943,11 @@  discard block
 block discarded – undo
746 943
 									$output_history .= ']}},';
747 944
 									$output .= $output_history;
748 945
 								}
749
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
750
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
946
+								if ($compress) {
947
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
948
+								} else {
949
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
950
+								}
751 951
 							}
752 952
 							$output_history .= '[';
753 953
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -768,10 +968,15 @@  discard block
 block discarded – undo
768 968
 							if ($d === false) {
769 969
 								if ($compress) {
770 970
 									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",';
771
-									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
772
-									elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
971
+									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') {
972
+										$output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
973
+									} elseif (isset($spotter_history_array[0]['mapmatching_engine'])) {
974
+										$output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
975
+									}
773 976
 									$output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": [';
774
-								} else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
977
+								} else {
978
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
979
+								}
775 980
 								$d = true;
776 981
 							}
777 982
 							$output_history .= '[';
@@ -794,7 +999,9 @@  discard block
 block discarded – undo
794 999
 							$output_historyd = '[';
795 1000
 							$output_historyd .=  $spotter_item['longitude'].', ';
796 1001
 							$output_historyd .=  $spotter_item['latitude'];
797
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
1002
+							if (isset($spotter_history['altitude'])) {
1003
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
1004
+							}
798 1005
 							$output_historyd .= '],';
799 1006
 							//$output_history = $output_historyd.$output_history;
800 1007
 							$output_history = $output_history.$output_historyd;
@@ -822,8 +1029,11 @@  discard block
 block discarded – undo
822 1029
 				        && $spotter_item['arrival_airport'] != 'NA' 
823 1030
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
824 1031
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
825
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
826
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1032
+				    if ($compress) {
1033
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
1034
+				    } else {
1035
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1036
+				    }
827 1037
 				    if (isset($spotter_item['departure_airport_latitude'])) {
828 1038
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
829 1039
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -856,8 +1066,11 @@  discard block
 block discarded – undo
856 1066
 				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
857 1067
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
858 1068
 				    $havedata = false;
859
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
860
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1069
+				    if ($compress) {
1070
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1071
+				    } else {
1072
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1073
+				    }
861 1074
 				    
862 1075
 				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
863 1076
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -882,7 +1095,9 @@  discard block
 block discarded – undo
882 1095
 					$output_dest  = substr($output_dest, 0, -1);
883 1096
 				    }
884 1097
 				    $output_dest .= ']}},';
885
-				    if ($havedata) $output .= $output_dest;
1098
+				    if ($havedata) {
1099
+				    	$output .= $output_dest;
1100
+				    }
886 1101
 				    unset($output_dest);
887 1102
 				}
888 1103
 			}
@@ -890,7 +1105,9 @@  discard block
 block discarded – undo
890 1105
 			$output .= ']';
891 1106
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
892 1107
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
893
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
1108
+			if (isset($begindate)) {
1109
+				$output .= '"archive_date": "'.$begindate.'",';
1110
+			}
894 1111
 			$output .= '"fc": "'.$j.'"';
895 1112
 		} else {
896 1113
 			$output .= '"features": ';
Please login to merge, or discard this patch.
js/map.3d.js.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 			break;
315 315
 		}
316 316
 	}
317
-	var tsk_geojson = Cesium.loadJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); ?>");
317
+	var tsk_geojson = Cesium.loadJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); ?>");
318 318
 	tsk_geojson.then(function(geojsondata) {
319 319
 		tsk = new Cesium.CustomDataSource('tsk');
320 320
 		for (var i =0;i < geojsondata.features.length; i++) {
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 <?php
390 390
 	if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) {
391 391
 		if (isset($_COOKIE['lastcentercoord'])) {
392
-			$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
392
+			$lastcentercoord = explode(',', $_COOKIE['lastcentercoord']);
393 393
 			if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0;
394 394
 			else $zoom = $lastcentercoord[3];
395 395
 			$viewcenterlatitude = $lastcentercoord[0];
Please login to merge, or discard this patch.
Braces   +53 added lines, -16 removed lines patch added patch discarded remove patch
@@ -57,21 +57,30 @@  discard block
 block discarded – undo
57 57
 
58 58
 document.cookie =  'MapFormat=3d; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
59 59
 <?php
60
-	if (isset($_COOKIE['MapType3D'])) $MapType = $_COOKIE['MapType3D'];
61
-	else $MapType = $globalMapProvider;
62
-//	unset($_COOKIE['MapType']);
60
+	if (isset($_COOKIE['MapType3D'])) {
61
+		$MapType = $_COOKIE['MapType3D'];
62
+	} else {
63
+		$MapType = $globalMapProvider;
64
+	}
65
+	//	unset($_COOKIE['MapType']);
63 66
 
64 67
 	if ($MapType != 'Mapbox' && $MapType != 'OpenStreetMap' && $MapType != 'Bing-Aerial' && $MapType != 'Bing-Hybrid' && $MapType != 'Bing-Road' && $MapType != 'offline' && $MapType != 'ArcGIS-Streetmap' && $MapType != 'ArcGIS-Satellite' && $MapType != 'NatGeo-Street') {
65
-		if (isset($globalBingMapKey) && $globalBingMapKey != '') $MapType = 'Bing-Aerial';
66
-		else $MapType = 'OpenStreetMap';
68
+		if (isset($globalBingMapKey) && $globalBingMapKey != '') {
69
+			$MapType = 'Bing-Aerial';
70
+		} else {
71
+			$MapType = 'OpenStreetMap';
72
+		}
67 73
 	}
68 74
 	if (($MapType == 'Bing-Aerial' || $MapType == 'Bing-Hybrid' || $MapType == 'Bing-Road') && (!isset($globalBingMapKey) || $globalBingMapKey == '')) {
69 75
 		$MapType = 'OpenStreetMap';
70 76
 	}
71 77
 	if ($MapType == 'Mapbox') {
72
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
73
-		else $MapBoxId = $_COOKIE['MapType3DId'];
74
-?>
78
+		if ($_COOKIE['MapTypeId'] == 'default') {
79
+			$MapBoxId = $globalMapboxId;
80
+		} else {
81
+			$MapBoxId = $_COOKIE['MapType3DId'];
82
+		}
83
+		?>
75 84
 	var imProv = Cesium.MapboxImageryProvider({
76 85
 		credit: 'Map data © OpenStreetMap contributors, ' +
77 86
 	      'CC-BY-SA, ' +
@@ -153,13 +162,23 @@  discard block
 block discarded – undo
153 162
 		credit : 'Imagery courtesy Natural Earth'
154 163
 	});
155 164
 <?php
156
-	}  elseif (isset($globalMapCustomLayer[$MapType])) {
165
+	} elseif (isset($globalMapCustomLayer[$MapType])) {
157 166
 		$customid = $MapType;
158 167
 ?>
159 168
 	var imProv = Cesium.createOpenStreetMapImageryProvider({
160 169
 		url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>',
161
-		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>,
162
-		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
170
+		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
171
+	print $globalMapCustomLayer[$customid]['maxZoom'];
172
+} else {
173
+	print '99';
174
+}
175
+?>,
176
+		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
177
+	print $globalMapCustomLayer[$customid]['minZoom'];
178
+} else {
179
+	print '0';
180
+}
181
+?>,
163 182
 		credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
164 183
 	});
165 184
 <?php
@@ -449,7 +468,12 @@  discard block
 block discarded – undo
449 468
 	imageryProvider : imProv,
450 469
 	timeline : archive,
451 470
 	animation : false,
452
-	shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) print 'false'; else print 'true'; ?>,
471
+	shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) {
472
+	print 'false';
473
+} else {
474
+	print 'true';
475
+}
476
+?>,
453 477
 	infoBox : false,
454 478
 	navigationHelpButton : false,
455 479
 	geocoder : false,
@@ -464,8 +488,11 @@  discard block
 block discarded – undo
464 488
 	if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) {
465 489
 		if (isset($_COOKIE['lastcentercoord'])) {
466 490
 			$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
467
-			if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0;
468
-			else $zoom = $lastcentercoord[3];
491
+			if (!isset($lastcentercoord[3])) {
492
+				$zoom = $lastcentercoord[2]*1000000.0;
493
+			} else {
494
+				$zoom = $lastcentercoord[3];
495
+			}
469 496
 			$viewcenterlatitude = $lastcentercoord[0];
470 497
 			$viewcenterlongitude = $lastcentercoord[1];
471 498
 		} else {
@@ -597,7 +624,12 @@  discard block
 block discarded – undo
597 624
 ?>
598 625
 
599 626
 update_locationsLayer();
600
-setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
627
+setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
628
+	print $globalMapRefresh*1000*2;
629
+} else {
630
+	print '60000';
631
+}
632
+?>);
601 633
 
602 634
 var currentposition;
603 635
 viewer.camera.moveEnd.addEventListener(function() { 
@@ -755,5 +787,10 @@  discard block
 block discarded – undo
755 787
 			}
756 788
 		}
757 789
 	}
758
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
790
+	,<?php if (isset($globalMapRefresh)) {
791
+	print $globalMapRefresh*1000;
792
+} else {
793
+	print '30000';
794
+}
795
+?>);
759 796
 }
Please login to merge, or discard this patch.
airspace-geojson.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 $Connection = new Connection();
12 12
 
13 13
 if (!$Connection->tableExists('airspace')) {
14
-    die;
14
+	die;
15 15
 }
16 16
 
17 17
 if (isset($_GET['coord'])) 
18 18
 {
19 19
 	$coords = explode(',',$_GET['coord']);
20
-        if ($globalDBdriver == 'mysql') {
20
+		if ($globalDBdriver == 'mysql') {
21 21
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, ST_Envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
22 22
 		try {
23 23
 			$sth = $Connection->db->prepare($query);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 	}
39 39
 } else {
40
-        if ($globalDBdriver == 'mysql') {
40
+		if ($globalDBdriver == 'mysql') {
41 41
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace";
42 42
 	} else {
43 43
 		$query = "SELECT *, ST_AsBinary(wkb_geometry,'NDR') AS wkb FROM airspace";
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 }
52 52
 
53 53
 $geojson = array(
54
-    'type' => 'FeatureCollection',
55
-    'features' => array()
54
+	'type' => 'FeatureCollection',
55
+	'features' => array()
56 56
 );
57 57
 
58 58
 while ($row = $sth->fetch(PDO::FETCH_ASSOC))
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		}
116 116
 		if (isset($properties['type']) && $properties['type'] != '') {
117 117
 			$feature = array(
118
-			    'type' => 'Feature',
119
-			    'geometry' => json_decode($geom->out('json')),
120
-			    'properties' => $properties
118
+				'type' => 'Feature',
119
+				'geometry' => json_decode($geom->out('json')),
120
+				'properties' => $properties
121 121
 			);
122 122
 			array_push($geojson['features'], $feature);
123 123
 		}
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 
17 17
 if (isset($_GET['coord'])) 
18 18
 {
19
-	$coords = explode(',',$_GET['coord']);
19
+	$coords = explode(',', $_GET['coord']);
20 20
         if ($globalDBdriver == 'mysql') {
21 21
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, ST_Envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
22 22
 		try {
23 23
 			$sth = $Connection->db->prepare($query);
24
-			$sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3]));
24
+			$sth->execute(array(':minlon' => $coords[0], ':minlat' => $coords[1], ':maxlon' => $coords[2], ':maxlat' => $coords[3]));
25 25
 			//$sth->execute();
26
-		} catch(PDOException $e) {
26
+		} catch (PDOException $e) {
27 27
 			echo "error";
28 28
 		}
29 29
 	} else {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 			$sth = $Connection->db->prepare($query);
33 33
 			//$sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3]));
34 34
 			$sth->execute();
35
-		} catch(PDOException $e) {
35
+		} catch (PDOException $e) {
36 36
 			echo "error";
37 37
 		}
38 38
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	try {
46 46
 		$sth = $Connection->db->prepare($query);
47 47
 		$sth->execute();
48
-	} catch(PDOException $e) {
48
+	} catch (PDOException $e) {
49 49
 		echo "error";
50 50
 	}
51 51
 }
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 		if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling'];
76 76
 		if (isset($properties['floor'])) $properties['base'] = $properties['floor'];
77 77
 		if (isset($properties['tops'])) {
78
-			if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) {
78
+			if (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['tops']), $matches)) {
79 79
 				$properties['upper_limit'] = round($matches['alt']*100*0.38048);
80
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['tops']),$matches)) {
80
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['tops']), $matches)) {
81 81
 				$properties['upper_limit'] = round($matches['alt']*0.38048);
82
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['tops']),$matches)) {
82
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['tops']), $matches)) {
83 83
 				$properties['upper_limit'] = $matches['alt'];
84 84
 			}
85 85
 		}
86 86
 		if (isset($properties['base'])) {
87 87
 			if ($properties['base'] == 'SFC' || $properties['base'] == 'MSL' || $properties['base'] == 'GROUND' || $properties['base'] == 'GND') {
88 88
 				$properties['lower_limit'] = 0;
89
-			} elseif (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['base']),$matches)) {
89
+			} elseif (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['base']), $matches)) {
90 90
 				$properties['lower_limit'] = round($matches['alt']*100*0.38048);
91
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['base']),$matches)) {
91
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['base']), $matches)) {
92 92
 				$properties['lower_limit'] = round($matches['alt']*0.38048);
93
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['base']),$matches)) {
93
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['base']), $matches)) {
94 94
 				$properties['lower_limit'] = $matches['alt'];
95 95
 			}
96 96
 		}
Please login to merge, or discard this patch.
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,12 +68,22 @@
 block discarded – undo
68 68
 		} else {
69 69
 			$geom = geoPHP::load(stream_get_contents($row['wkb']));
70 70
 		}
71
-		if (isset($properties['type'])) $properties['type'] = trim($properties['type']);
72
-		elseif (isset($properties['class'])) $properties['type'] = trim($properties['class']);
73
-		if (isset($properties['ogr_fid'])) $properties['id'] = $properties['ogr_fid'];
74
-		elseif (isset($properties['ogc_fid'])) $properties['id'] = $properties['ogc_fid'];
75
-		if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling'];
76
-		if (isset($properties['floor'])) $properties['base'] = $properties['floor'];
71
+		if (isset($properties['type'])) {
72
+			$properties['type'] = trim($properties['type']);
73
+		} elseif (isset($properties['class'])) {
74
+			$properties['type'] = trim($properties['class']);
75
+		}
76
+		if (isset($properties['ogr_fid'])) {
77
+			$properties['id'] = $properties['ogr_fid'];
78
+		} elseif (isset($properties['ogc_fid'])) {
79
+			$properties['id'] = $properties['ogc_fid'];
80
+		}
81
+		if (isset($properties['ceiling'])) {
82
+			$properties['tops'] = $properties['ceiling'];
83
+		}
84
+		if (isset($properties['floor'])) {
85
+			$properties['base'] = $properties['floor'];
86
+		}
77 87
 		if (isset($properties['tops'])) {
78 88
 			if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) {
79 89
 				$properties['upper_limit'] = round($matches['alt']*100*0.38048);
Please login to merge, or discard this patch.