Completed
Push — master ( 2c5525...528bd8 )
by Yannick
32:59
created
require/class.Common.php 1 patch
Braces   +110 added lines, -48 removed lines patch added patch discarded remove patch
@@ -37,8 +37,11 @@  discard block
 block discarded – undo
37 37
 		} else {
38 38
 			curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
39 39
 		}
40
-		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
41
-		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
40
+		if ($timeout == '') {
41
+			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
42
+		} else {
43
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
44
+		}
42 45
 		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
43 46
 		if ($type == 'post') {
44 47
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -51,7 +54,9 @@  discard block
 block discarded – undo
51 54
 			} else {
52 55
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
53 56
 			}
54
-		} elseif ($type != 'get' && $type != '') curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
57
+		} elseif ($type != 'get' && $type != '') {
58
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
59
+		}
55 60
 		if ($headers != '') {
56 61
 			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
57 62
 		}
@@ -95,8 +100,9 @@  discard block
 block discarded – undo
95 100
 	private function curlResponseHeaderCallback($ch, $headerLine) {
96 101
 		//global $cookies;
97 102
 		$cookies = array();
98
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
99
-			$cookies[] = $cookie;
103
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
104
+					$cookies[] = $cookie;
105
+		}
100 106
 		return strlen($headerLine); // Needed by curl
101 107
 	}
102 108
 
@@ -107,7 +113,9 @@  discard block
 block discarded – undo
107 113
 		curl_setopt($ch, CURLOPT_URL, $url);
108 114
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
109 115
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
110
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
116
+		if ($referer != '') {
117
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
118
+		}
111 119
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
112 120
 			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
113 121
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
@@ -119,7 +127,9 @@  discard block
 block discarded – undo
119 127
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
120 128
 		curl_setopt($ch, CURLOPT_FILE, $fp);
121 129
 		curl_exec($ch);
122
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
130
+		if (curl_errno($ch) && $globalDebug) {
131
+			echo 'Download error: '.curl_error($ch);
132
+		}
123 133
 		curl_close($ch);
124 134
 		fclose($fp);
125 135
 	}
@@ -127,12 +137,16 @@  discard block
 block discarded – undo
127 137
 	public static function gunzip($in_file,$out_file_name = '') {
128 138
 		//echo $in_file.' -> '.$out_file_name."\n";
129 139
 		$buffer_size = 4096; // read 4kb at a time
130
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
140
+		if ($out_file_name == '') {
141
+			$out_file_name = str_replace('.gz', '', $in_file);
142
+		}
131 143
 		if ($in_file != '' && file_exists($in_file)) {
132 144
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
133
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
134
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
135
-			else {
145
+			if (function_exists('gzopen')) {
146
+				$file = gzopen($in_file,'rb');
147
+			} elseif (function_exists('gzopen64')) {
148
+				$file = gzopen64($in_file,'rb');
149
+			} else {
136 150
 				echo 'gzopen not available';
137 151
 				die;
138 152
 			}
@@ -148,11 +162,14 @@  discard block
 block discarded – undo
148 162
 	public static function bunzip2($in_file,$out_file_name = '') {
149 163
 		//echo $in_file.' -> '.$out_file_name."\n";
150 164
 		$buffer_size = 4096; // read 4kb at a time
151
-		if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); 
165
+		if ($out_file_name == '') {
166
+			$out_file_name = str_replace('.bz2', '', $in_file);
167
+		}
152 168
 		if ($in_file != '' && file_exists($in_file)) {
153 169
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
154
-			if (function_exists('bzopen')) $file = bzopen($in_file,'rb');
155
-			else {
170
+			if (function_exists('bzopen')) {
171
+				$file = bzopen($in_file,'rb');
172
+			} else {
156 173
 				echo 'bzopen not available';
157 174
 				die;
158 175
 			}
@@ -171,10 +188,16 @@  discard block
 block discarded – undo
171 188
 	* @return Array array of the tables in HTML page
172 189
 	*/
173 190
 	public function table2array($data) {
174
-		if (!is_string($data)) return array();
175
-		if ($data == '') return array();
191
+		if (!is_string($data)) {
192
+			return array();
193
+		}
194
+		if ($data == '') {
195
+			return array();
196
+		}
176 197
 		$html = str_get_html($data);
177
-		if ($html === false) return array();
198
+		if ($html === false) {
199
+			return array();
200
+		}
178 201
 		$tabledata=array();
179 202
 		foreach($html->find('tr') as $element)
180 203
 		{
@@ -209,7 +232,9 @@  discard block
 block discarded – undo
209 232
 	*/
210 233
 	public function text2array($data) {
211 234
 		$html = str_get_html($data);
212
-		if ($html === false) return array();
235
+		if ($html === false) {
236
+			return array();
237
+		}
213 238
 		$tabledata=array();
214 239
 		foreach($html->find('p') as $element)
215 240
 		{
@@ -230,7 +255,9 @@  discard block
 block discarded – undo
230 255
 	* @return Float Distance in $unit
231 256
 	*/
232 257
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
233
-		if ($lat == $latc && $lon == $lonc) return 0;
258
+		if ($lat == $latc && $lon == $lonc) {
259
+			return 0;
260
+		}
234 261
 		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
235 262
 		if ($unit == "km") {
236 263
 			return round($dist * 1.609344);
@@ -276,7 +303,9 @@  discard block
 block discarded – undo
276 303
 		$dX = $latc - $lat;
277 304
 		$dY = $lonc - $lon;
278 305
 		$azimuth = rad2deg(atan2($dY,$dX));
279
-		if ($azimuth < 0) return $azimuth+360;
306
+		if ($azimuth < 0) {
307
+			return $azimuth+360;
308
+		}
280 309
 		return $azimuth;
281 310
 	}
282 311
 	
@@ -290,10 +319,16 @@  discard block
 block discarded – undo
290 319
 	public function withinThreshold ($timeDifference, $distance) {
291 320
 		$x = abs($timeDifference);
292 321
 		$d = abs($distance);
293
-		if ($x == 0 || $d == 0) return true;
322
+		if ($x == 0 || $d == 0) {
323
+			return true;
324
+		}
294 325
 		// may be due to Internet jitter; distance is realistic
295
-		if ($x < 0.7 && $d < 2000) return true;
296
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
326
+		if ($x < 0.7 && $d < 2000) {
327
+			return true;
328
+		} else {
329
+			return $d/$x < 1500*0.27778;
330
+		}
331
+		// 1500 km/h max
297 332
 	}
298 333
 
299 334
 
@@ -322,11 +357,17 @@  discard block
 block discarded – undo
322 357
 	
323 358
 	public function convertDM($coord,$latlong) {
324 359
 		if ($latlong == 'latitude') {
325
-			if ($coord < 0) $NSEW = 'S';
326
-			else $NSEW = 'N';
360
+			if ($coord < 0) {
361
+				$NSEW = 'S';
362
+			} else {
363
+				$NSEW = 'N';
364
+			}
327 365
 		} else {
328
-			if ($coord < 0) $NSEW = 'W';
329
-			else $NSEW = 'E';
366
+			if ($coord < 0) {
367
+				$NSEW = 'W';
368
+			} else {
369
+				$NSEW = 'E';
370
+			}
330 371
 		}
331 372
 		$coord = abs($coord);
332 373
 		$deg = floor($coord);
@@ -369,7 +410,9 @@  discard block
 block discarded – undo
369 410
 	public function hex2str($hex) {
370 411
 		$str = '';
371 412
 		$hexln = strlen($hex);
372
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
413
+		for($i=0;$i<$hexln;$i+=2) {
414
+			$str .= chr(hexdec(substr($hex,$i,2)));
415
+		}
373 416
 		return $str;
374 417
 	}
375 418
 	
@@ -406,8 +449,11 @@  discard block
 block discarded – undo
406 449
 		$b = $lat2 - $lat1;
407 450
 		$c = -($a*$lat1+$b*$lon1);
408 451
 		$d = $a*$lat3+$b*$lon3+$c;
409
-		if ($d > -$approx && $d < $approx) return true;
410
-		else return false;
452
+		if ($d > -$approx && $d < $approx) {
453
+			return true;
454
+		} else {
455
+			return false;
456
+		}
411 457
 	}
412 458
 	
413 459
 	public function array_merge_noappend() {
@@ -466,7 +512,9 @@  discard block
 block discarded – undo
466 512
 			return $result;
467 513
 		}
468 514
 		$handle = @opendir('./locale');
469
-		if ($handle === false) return $result;
515
+		if ($handle === false) {
516
+			return $result;
517
+		}
470 518
 		while (false !== ($file = readdir($handle))) {
471 519
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
472 520
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -537,8 +585,9 @@  discard block
 block discarded – undo
537 585
 		$error = false; 
538 586
 		if ($fp_out = gzopen($dest, $mode)) { 
539 587
 			if ($fp_in = fopen($source,'rb')) { 
540
-				while (!feof($fp_in)) 
541
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
588
+				while (!feof($fp_in)) {
589
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
590
+				}
542 591
 				fclose($fp_in); 
543 592
 			} else {
544 593
 				$error = true; 
@@ -547,14 +596,17 @@  discard block
 block discarded – undo
547 596
 		} else {
548 597
 			$error = true; 
549 598
 		}
550
-		if ($error)
551
-			return false; 
552
-		else
553
-			return $dest; 
599
+		if ($error) {
600
+					return false;
601
+		} else {
602
+					return $dest;
603
+		}
554 604
 	} 
555 605
 	
556 606
 	public function remove_accents($string) {
557
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
607
+		if ( !preg_match('/[\x80-\xff]/', $string) ) {
608
+			return $string;
609
+		}
558 610
 		$chars = array(
559 611
 		    // Decompositions for Latin-1 Supplement
560 612
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -678,7 +730,9 @@  discard block
 block discarded – undo
678 730
 		$ip = gethostbyname($host);
679 731
 		$s = socket_create(AF_INET, SOCK_STREAM, 0);
680 732
 		$r = @socket_connect($s, $ip, $port);
681
-		if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
733
+		if (!socket_set_nonblock($s)) {
734
+			echo "Unable to set nonblock on socket\n";
735
+		}
682 736
 		if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
683 737
 			return $s;
684 738
 		}
@@ -723,18 +777,22 @@  discard block
 block discarded – undo
723 777
 		//NOTE: use a trailing slash for folders!!!
724 778
 		//see http://bugs.php.net/bug.php?id=27609
725 779
 		//see http://bugs.php.net/bug.php?id=30931
726
-		if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
780
+		if ($path{strlen($path)-1}=='/') {
781
+			// recursively return a temporary file path
727 782
 			return $this->is__writable($path.uniqid(mt_rand()).'.tmp');
728
-		else if (is_dir($path))
729
-			return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
783
+		} else if (is_dir($path)) {
784
+					return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
785
+		}
730 786
 		// check tmp file for read/write capabilities
731 787
 		$rm = file_exists($path);
732 788
 		$f = @fopen($path, 'a');
733
-		if ($f===false)
734
-			return false;
789
+		if ($f===false) {
790
+					return false;
791
+		}
735 792
 		fclose($f);
736
-		if (!$rm)
737
-			unlink($path);
793
+		if (!$rm) {
794
+					unlink($path);
795
+		}
738 796
 		return true;
739 797
 	}
740 798
 	
@@ -750,7 +808,9 @@  discard block
 block discarded – undo
750 808
 	 * @return Array Coordinate of the route
751 809
 	*/
752 810
 	public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) {
753
-		if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
811
+		if ($nbpts <= 2) {
812
+			return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
813
+		}
754 814
 		$sx = deg2rad($begin_lon);
755 815
 		$sy = deg2rad($begin_lat);
756 816
 		$ex = deg2rad($end_lon);
@@ -759,7 +819,9 @@  discard block
 block discarded – undo
759 819
 		$h = $sy - $ey;
760 820
 		$z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2);
761 821
 		$g = 2.0*asin(sqrt($z));
762
-		if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
822
+		if ($g == M_PI || is_nan($g)) {
823
+			return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
824
+		}
763 825
 		$first_pass = array();
764 826
 		$delta = 1.0/($nbpts-1);
765 827
 		for ($i =0; $i < $nbpts; ++$i) {
Please login to merge, or discard this patch.
statistics-sub-menu.php 1 patch
Braces   +110 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,7 +6,13 @@  discard block
 block discarded – undo
6 6
 	if (!isset($type) || $type != 'satellite') {
7 7
 ?>
8 8
 		<form id="changedate" method="post">
9
-			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
9
+			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
10
+	echo $year.'-';
11
+}
12
+?><?php if (isset($month) && $month != '') {
13
+	echo $month;
14
+}
15
+?>" />
10 16
 		</form>
11 17
 <?php
12 18
 	}
@@ -38,7 +44,9 @@  discard block
 block discarded – undo
38 44
 						print '<option disabled>──────────</option>';
39 45
 					}
40 46
 					$Stats = new Stats();
41
-					if (!isset($filter_name)) $filter_name = '';
47
+					if (!isset($filter_name)) {
48
+						$filter_name = '';
49
+					}
42 50
 					$airlines = $Stats->getAllAirlineNames($filter_name);
43 51
 					foreach($airlines as $airline) {
44 52
 						if ($airline['airline_icao'] != '') {
@@ -69,10 +77,22 @@  discard block
 block discarded – undo
69 77
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
70 78
 		    </a>
71 79
 		    <ul class="dropdown-menu">
72
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li>
73
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li>
74
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li>
75
-			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li>
80
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
81
+	echo '/'.$airline_icao;
82
+}
83
+?>"><?php echo _("Aircraft"); ?></a></li>
84
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
85
+	echo '/'.$airline_icao;
86
+}
87
+?>"><?php echo _("Registration"); ?></a></li>
88
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
89
+	echo '/'.$airline_icao;
90
+}
91
+?>"><?php echo _("Manufacturer"); ?></a></li>
92
+			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
93
+	echo '/'.$airline_icao;
94
+}
95
+?>"><?php echo _("Country"); ?></a></li>
76 96
 		    </ul>
77 97
 		</li>
78 98
 		<li class="dropdown">
@@ -83,12 +103,21 @@  discard block
 block discarded – undo
83 103
 <?php
84 104
 		if (!isset($airline_icao) || $airline_icao == 'all') {
85 105
 ?>
86
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li>
87
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li>
106
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
107
+	echo '/'.$airline_icao;
108
+}
109
+?>"><?php echo _("Airline"); ?></a></li>
110
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
111
+	echo '/'.$airline_icao;
112
+}
113
+?>"><?php echo _("Airline by Country"); ?></a></li>
88 114
 <?php
89 115
 		}
90 116
 ?>
91
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li>
117
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
118
+	echo '/'.$airline_icao;
119
+}
120
+?>"><?php echo _("Callsign"); ?></a></li>
92 121
 		    </ul>
93 122
 		</li>
94 123
 		<li class="dropdown">
@@ -96,10 +125,22 @@  discard block
 block discarded – undo
96 125
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
97 126
 		    </a>
98 127
 		    <ul class="dropdown-menu" role="menu">
99
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li>
100
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
101
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li>
102
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
128
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
129
+	echo '/'.$airline_icao;
130
+}
131
+?>"><?php echo _("Departure Airport"); ?></a></li>
132
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
133
+	echo '/'.$airline_icao;
134
+}
135
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
136
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
137
+	echo '/'.$airline_icao;
138
+}
139
+?>"><?php echo _("Arrival Airport"); ?></a></li>
140
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
141
+	echo '/'.$airline_icao;
142
+}
143
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
103 144
 		    </ul>
104 145
 		</li>
105 146
 		<li class="dropdown">
@@ -107,8 +148,14 @@  discard block
 block discarded – undo
107 148
 		      <?php echo _("Route"); ?> <span class="caret"></span>
108 149
 		    </a>
109 150
 		    <ul class="dropdown-menu" role="menu">
110
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li>
111
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li>
151
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
152
+	echo '/'.$airline_icao;
153
+}
154
+?>"><?php echo _("Route by Airport"); ?></a></li>
155
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
156
+	echo '/'.$airline_icao;
157
+}
158
+?>"><?php echo _("Route by Waypoint"); ?></a></li>
112 159
 		    </ul>
113 160
 		</li>
114 161
 		<li class="dropdown">
@@ -116,8 +163,14 @@  discard block
 block discarded – undo
116 163
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
117 164
 		    </a>
118 165
 		    <ul class="dropdown-menu" role="menu">
119
-		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li>
120
-			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li>
166
+		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
167
+	echo '/'.$airline_icao;
168
+}
169
+?>"><?php echo _("Date"); ?></a></li>
170
+			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
171
+	echo '/'.$airline_icao;
172
+}
173
+?>"><?php echo _("Time"); ?></a></li>
121 174
 		    </ul>
122 175
 		</li>
123 176
 		<?php
@@ -173,9 +226,18 @@  discard block
 block discarded – undo
173 226
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
174 227
 		    </a>
175 228
 		    <ul class="dropdown-menu">
176
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
177
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
178
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
229
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
230
+	echo '/'.$airline_icao;
231
+}
232
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
233
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
234
+	echo '/'.$airline_icao;
235
+}
236
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
237
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
238
+	echo '/'.$airline_icao;
239
+}
240
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
179 241
 			<!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> -->
180 242
 		    </ul>
181 243
 		</li>
@@ -187,12 +249,21 @@  discard block
 block discarded – undo
187 249
 <?php
188 250
 		if (!isset($airline_icao) || $airline_icao == 'all') {
189 251
 ?>
190
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
191
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
252
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
253
+	echo '/'.$airline_icao;
254
+}
255
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
256
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
257
+	echo '/'.$airline_icao;
258
+}
259
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
192 260
 <?php
193 261
 		}
194 262
 ?>
195
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
263
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
264
+	echo '/'.$airline_icao;
265
+}
266
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
196 267
 		    </ul>
197 268
 		</li>
198 269
 		<li class="dropdown">
@@ -200,10 +271,22 @@  discard block
 block discarded – undo
200 271
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
201 272
 		    </a>
202 273
 		    <ul class="dropdown-menu" role="menu">
203
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
204
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
205
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
206
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
274
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
275
+	echo '/'.$airline_icao;
276
+}
277
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
278
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
279
+	echo '/'.$airline_icao;
280
+}
281
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
282
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
283
+	echo '/'.$airline_icao;
284
+}
285
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
286
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
287
+	echo '/'.$airline_icao;
288
+}
289
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
207 290
 		    </ul>
208 291
 		</li>
209 292
 		<!--
Please login to merge, or discard this patch.
airspace-geojson.php 1 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.
require/class.Language.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
 			return $result;
87 87
 		}
88 88
 		$handle = @opendir(dirname(__FILE__).'/../locale');
89
-		if ($handle === false) return $result;
89
+		if ($handle === false) {
90
+			return $result;
91
+		}
90 92
 		while (false !== ($file = readdir($handle))) {
91 93
 			$path = dirname(__FILE__).'/../locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
92 94
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -113,7 +115,9 @@  discard block
 block discarded – undo
113 115
 		$allAvailableLanguages = array();
114 116
 		$currentLocal = setlocale(LC_ALL, 0);
115 117
 		foreach ($available as $lang) {
116
-			if (isset($this->all_languages[$lang]) && (setlocale(LC_ALL,$this->getLocale($lang)) || $lang = 'en_GB')) $allAvailableLanguages[$lang] = $this->all_languages[$lang];
118
+			if (isset($this->all_languages[$lang]) && (setlocale(LC_ALL,$this->getLocale($lang)) || $lang = 'en_GB')) {
119
+				$allAvailableLanguages[$lang] = $this->all_languages[$lang];
120
+			}
117 121
 		}
118 122
 		setlocale(LC_ALL,$currentLocal);
119 123
 		return $allAvailableLanguages;
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Braces   +40 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 	public function __construct($dbc = null) {
7 7
 		$Connection = new Connection($dbc);
8 8
 		$this->db = $Connection->db;
9
-		if ($this->db === null) die('Error: No DB connection. (SpotterArchive)');
9
+		if ($this->db === null) {
10
+			die('Error: No DB connection. (SpotterArchive)');
11
+		}
10 12
 	}
11 13
 
12 14
 	/**
@@ -27,7 +29,9 @@  discard block
 block discarded – undo
27 29
 		if (isset($filter[0]['source'])) {
28 30
 			$filters = array_merge($filters,$filter);
29 31
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
31 35
 		$filter_query_join = '';
32 36
 		$filter_query_where = '';
33 37
 		foreach($filters as $flt) {
@@ -119,8 +123,11 @@  discard block
 block discarded – undo
119 123
 			}
120 124
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
121 125
 		}
122
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
123
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
126
+		if ($filter_query_where == '' && $where) {
127
+			$filter_query_where = ' WHERE';
128
+		} elseif ($filter_query_where != '' && $and) {
129
+			$filter_query_where .= ' AND';
130
+		}
124 131
 		if ($filter_query_where != '') {
125 132
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
126 133
 		}
@@ -134,10 +141,17 @@  discard block
 block discarded – undo
134 141
 		if ($over_country == '') {
135 142
 			$Spotter = new Spotter($this->db);
136 143
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
137
-			if (!empty($data_country)) $country = $data_country['iso2'];
138
-			else $country = '';
139
-		} else $country = $over_country;
140
-		if ($airline_type === NULL) $airline_type ='';
144
+			if (!empty($data_country)) {
145
+				$country = $data_country['iso2'];
146
+			} else {
147
+				$country = '';
148
+			}
149
+		} else {
150
+			$country = $over_country;
151
+		}
152
+		if ($airline_type === NULL) {
153
+			$airline_type ='';
154
+		}
141 155
 
142 156
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
143 157
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -598,7 +612,9 @@  discard block
 block discarded – undo
598 612
 					$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
599 613
 					$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
600 614
 					$translate = $Translation->ident2icao($q_item);
601
-					if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
615
+					if ($translate != $q_item) {
616
+						$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
617
+					}
602 618
 					$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
603 619
 					$additional_query .= ")";
604 620
 				}
@@ -778,7 +794,9 @@  discard block
 block discarded – undo
778 794
 				date_default_timezone_set($globalTimezone);
779 795
 				$datetime = new DateTime();
780 796
 				$offset = $datetime->format('P');
781
-			} else $offset = '+00:00';
797
+			} else {
798
+				$offset = '+00:00';
799
+			}
782 800
 			if ($date_array[1] != "") {
783 801
 				$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
784 802
 				$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
@@ -1021,9 +1039,13 @@  discard block
 block discarded – undo
1021 1039
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1022 1040
 			}
1023 1041
 		}
1024
-		if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1042
+		if ($sincedate != '') {
1043
+			$query .= "AND date > '".$sincedate."' ";
1044
+		}
1025 1045
 		$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1026
-		if ($limit) $query .= " LIMIT 0,10";
1046
+		if ($limit) {
1047
+			$query .= " LIMIT 0,10";
1048
+		}
1027 1049
 
1028 1050
 
1029 1051
 		$sth = $this->db->prepare($query);
@@ -1065,9 +1087,13 @@  discard block
 block discarded – undo
1065 1087
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1066 1088
 			}
1067 1089
 		}
1068
-		if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1090
+		if ($sincedate != '') {
1091
+			$query .= "AND s.date > '".$sincedate."' ";
1092
+		}
1069 1093
 		$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1070
-		if ($limit) $query .= " LIMIT 0,10";
1094
+		if ($limit) {
1095
+			$query .= " LIMIT 0,10";
1096
+		}
1071 1097
 
1072 1098
 
1073 1099
 		$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 1 patch
Braces   +24 added lines, -4 removed lines patch added patch discarded remove patch
@@ -275,7 +275,12 @@  discard block
 block discarded – undo
275 275
 			<?php
276 276
 			    } else {
277 277
 			?>
278
-			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
278
+			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
279
+	print $globalMapRefresh*2000;
280
+} else {
281
+	print '60000';
282
+}
283
+?>)) {
279 284
 				viewer.dataSources.get(dsn).entities.remove(entity);
280 285
 				czmlds.entities.removeById(entityid);
281 286
 			}
@@ -564,7 +569,12 @@  discard block
 block discarded – undo
564 569
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
565 570
 ?>
566 571
 update_polarLayer();
567
-setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
572
+setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) {
573
+	print $globalMapRefresh*1000*2;
574
+} else {
575
+	print '60000';
576
+}
577
+?>);
568 578
 <?php
569 579
 		}
570 580
 ?>
@@ -695,7 +705,12 @@  discard block
 block discarded – undo
695 705
 				}
696 706
 			}
697 707
 		}
698
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
708
+	,<?php if (isset($globalMapRefresh)) {
709
+	print $globalMapRefresh*1000;
710
+} else {
711
+	print '30000';
712
+}
713
+?>);
699 714
 } else {
700 715
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
701 716
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
@@ -724,7 +739,12 @@  discard block
 block discarded – undo
724 739
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
725 740
 ?>
726 741
 update_atcLayer();
727
-setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
742
+setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) {
743
+	print $globalMapRefresh*1000*2;
744
+} else {
745
+	print '60000';
746
+}
747
+?>);
728 748
 <?php
729 749
     }
730 750
 ?>
Please login to merge, or discard this patch.
archive-geojson.php 1 patch
Braces   +229 added lines, -142 removed lines patch added patch discarded remove patch
@@ -25,12 +25,10 @@  discard block
 block discarded – undo
25 25
 if ($tracker) {
26 26
 	require_once('require/class.Tracker.php');
27 27
 	require_once('require/class.TrackerArchive.php');
28
-}
29
-elseif ($marine) {
28
+} elseif ($marine) {
30 29
 	require_once('require/class.Marine.php');
31 30
 	require_once('require/class.MarineArchive.php');
32
-}
33
-else {
31
+} else {
34 32
 	require_once('require/class.Spotter.php');
35 33
 	require_once('require/class.SpotterArchive.php');
36 34
 }
@@ -38,12 +36,10 @@  discard block
 block discarded – undo
38 36
 if ($tracker) {
39 37
 	$Tracker = new Tracker();
40 38
 	$TrackerArchive = new TrackerArchive();
41
-}
42
-elseif ($marine) {
39
+} elseif ($marine) {
43 40
 	$Marine = new Marine();
44 41
 	$MarineArchive = new MarineArchive();
45
-}
46
-else {
42
+} else {
47 43
 	$Spotter = new Spotter();
48 44
 	$SpotterArchive = new SpotterArchive();
49 45
 }
@@ -56,66 +52,92 @@  discard block
 block discarded – undo
56 52
 }
57 53
 header('Content-Type: text/javascript');
58 54
 
59
-if (!isset($globalJsonCompress)) $compress = true;
60
-else $compress = $globalJsonCompress;
55
+if (!isset($globalJsonCompress)) {
56
+	$compress = true;
57
+} else {
58
+	$compress = $globalJsonCompress;
59
+}
61 60
 
62 61
 $from_archive = false;
63 62
 $min = false;
64 63
 $allhistory = false;
65 64
 $filter['source'] = array();
66
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
71
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
72
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
65
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
66
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
67
+}
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
69
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
70
+}
71
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
72
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
73
+}
74
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
75
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
76
+}
77
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
78
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
79
+}
80
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
81
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
+}
83
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
84
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
85
+}
86
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
87
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
88
+}
89
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
90
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
91
+}
92
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
93
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
94
+}
95
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
96
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
97
+}
77 98
 
78 99
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
79 100
 	$min = true;
80
-} else $min = false;
101
+} else {
102
+	$min = false;
103
+}
81 104
 
82 105
 if (isset($_GET['ident'])) {
83 106
 	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
84 107
 	$from_archive = true;
85 108
 	if ($tracker) {
86 109
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident);
87
-	}
88
-	elseif ($marine) {
110
+	} elseif ($marine) {
89 111
 		$spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident);
90
-	}
91
-	else {
112
+	} else {
92 113
 		$spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident);
93 114
 	}
94 115
 	$allhistory = true;
95
-}
96
-elseif (isset($_GET['flightaware_id'])) {
116
+} elseif (isset($_GET['flightaware_id'])) {
97 117
 	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
98 118
 	$from_archive = true;
99 119
 	if ($tracker) {
100 120
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id);
101
-	}
102
-	elseif ($marine) {
121
+	} elseif ($marine) {
103 122
 		$spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id);
104
-	}
105
-	else {
123
+	} else {
106 124
 		$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
107 125
 	}
108 126
 	$allhistory = true;
109
-}
110
-elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
127
+} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
111 128
 	$from_archive = true;
112 129
 	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
113
-	if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate;
114
-	else $begindate = $begindate - 3000;
130
+	if (isset($globalAircraftMaxUpdate)) {
131
+		$begindate = $begindate - $globalAircraftMaxUpdate;
132
+	} else {
133
+		$begindate = $begindate - 3000;
134
+	}
115 135
 	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
116 136
 	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
117 137
 	$part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT);
118
-	if ($part == '') $part = 0;
138
+	if ($part == '') {
139
+		$part = 0;
140
+	}
119 141
 	
120 142
 	if ($begindate != '' && $enddate != '') {
121 143
 		$begindate = date('Y-m-d H:i:s',$begindate);
@@ -123,11 +145,9 @@  discard block
 block discarded – undo
123 145
 		//$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
124 146
 		if ($tracker) {
125 147
 			$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
126
-		}
127
-		elseif ($marine) {
148
+		} elseif ($marine) {
128 149
 			$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
129
-		}
130
-		else {
150
+		} else {
131 151
 			$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part);
132 152
 		}
133 153
 	}
@@ -136,8 +156,12 @@  discard block
 block discarded – undo
136 156
 if (!empty($spotter_array)) {
137 157
 	//$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
138 158
 	$flightcnt = 0;
139
-	if ($flightcnt == '') $flightcnt = 0;
140
-} else $flightcnt = 0;
159
+	if ($flightcnt == '') {
160
+		$flightcnt = 0;
161
+	}
162
+	} else {
163
+	$flightcnt = 0;
164
+}
141 165
 
142 166
 $sqltime = round(microtime(true)-$begintime,2);
143 167
 
@@ -147,8 +171,11 @@  discard block
 block discarded – undo
147 171
 $aircrafts_shadow = array();
148 172
 $output = '{';
149 173
 $output .= '"type": "FeatureCollection",';
150
-if ($min) $output .= '"minimal": "true",';
151
-else $output .= '"minimal": "false",';
174
+if ($min) {
175
+	$output .= '"minimal": "true",';
176
+} else {
177
+	$output .= '"minimal": "false",';
178
+}
152 179
 $output .= '"fc": "'.$flightcnt.'",';
153 180
 $output .= '"sqt": "'.$sqltime.'",';
154 181
 $begin = true;
@@ -161,15 +188,17 @@  discard block
 block discarded – undo
161 188
 			if ($pfi != $spotter_item['famtrackid']) {
162 189
 				$pfi = $spotter_item['famtrackid'];
163 190
 				$begin = true;
164
-			} else $spotter_history_array = 0;
165
-		}
166
-		elseif ($marine) {
191
+			} else {
192
+				$spotter_history_array = 0;
193
+			}
194
+		} elseif ($marine) {
167 195
 			if ($pfi != $spotter_item['fammarine_d']) {
168 196
 				$pfi = $spotter_item['fammarine_id'];
169 197
 				$begin = true;
170
-			} else $spotter_history_array = 0;
171
-		}
172
-		else {
198
+			} else {
199
+				$spotter_history_array = 0;
200
+			}
201
+		} else {
173 202
 			if ($pfi != $spotter_item['flightaware_id']) {
174 203
 				$pfi = $spotter_item['flightaware_id'];
175 204
 				$begin = true;
@@ -206,7 +235,9 @@  discard block
 block discarded – undo
206 235
 			$output_history .= '['.$spotter_item['longitude'].', '.$spotter_item['latitude'].'],';
207 236
 			$output_time .= (strtotime($spotter_item['date'])*1000).',';
208 237
 			$previousts = strtotime($spotter_item['date']);
209
-			if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) $end = true;
238
+			if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) {
239
+				$end = true;
240
+			}
210 241
 		}
211 242
 
212 243
 		if ($begin) {
@@ -216,7 +247,9 @@  discard block
 block discarded – undo
216 247
 			$output .= '"type": "Feature",';
217 248
 			$output .= '"properties": {';
218 249
 			$output .= '"fi": "'.$pfi.'",';
219
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
250
+			if (isset($begindate)) {
251
+				$output .= '"archive_date": "'.$begindate.'",';
252
+			}
220 253
 			if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
221 254
 				$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
222 255
 				//"
@@ -224,14 +257,20 @@  discard block
 block discarded – undo
224 257
 				$output .= '"c": "NA",';
225 258
 			}
226 259
 			if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
227
-				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
228
-				else {
260
+				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
261
+					$spotter_item['aircraft_shadow'] = '';
262
+				} else {
229 263
 					$aircraft_icao = $spotter_item['aircraft_icao'];
230 264
 					$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
231
-					if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
232
-					elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
233
-					elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
234
-					else $spotter_item['aircraft_shadow'] = '';
265
+					if (count($aircraft_info) > 0) {
266
+						$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
267
+					} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
268
+						$spotter_item['aircraft_shadow'] = 'PA18.png';
269
+					} elseif ($aircraft_icao == 'PARAGLIDER') {
270
+						$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
271
+					} else {
272
+						$spotter_item['aircraft_shadow'] = '';
273
+					}
235 274
 					$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
236 275
 				}
237 276
 			}
@@ -239,93 +278,139 @@  discard block
 block discarded – undo
239 278
 			if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
240 279
 				if ($tracker) {
241 280
 					if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
242
-						if ($compress) $output .= '"as": "ambulance.png",';
243
-						else $output .= '"aircraft_shadow": "ambulance.png",';
244
-					}
245
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
246
-						if ($compress) $output .= '"as": "police.png",';
247
-						else $output .= '"aircraft_shadow": "police.png",';
248
-					}
249
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
250
-						if ($compress) $output .= '"as": "ship.png",';
251
-						else $output .= '"aircraft_shadow": "ship.png",';
252
-					}
253
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
254
-						if ($compress) $output .= '"as": "ship.png",';
255
-						else $output .= '"aircraft_shadow": "ship.png",';
256
-					}
257
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
258
-						if ($compress) $output .= '"as": "ship.png",';
259
-						else $output .= '"aircraft_shadow": "ship.png",';
281
+						if ($compress) {
282
+							$output .= '"as": "ambulance.png",';
283
+						} else {
284
+							$output .= '"aircraft_shadow": "ambulance.png",';
285
+						}
286
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
287
+						if ($compress) {
288
+							$output .= '"as": "police.png",';
289
+						} else {
290
+							$output .= '"aircraft_shadow": "police.png",';
291
+						}
292
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
293
+						if ($compress) {
294
+							$output .= '"as": "ship.png",';
295
+						} else {
296
+							$output .= '"aircraft_shadow": "ship.png",';
297
+						}
298
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
299
+						if ($compress) {
300
+							$output .= '"as": "ship.png",';
301
+						} else {
302
+							$output .= '"aircraft_shadow": "ship.png",';
303
+						}
304
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
305
+						if ($compress) {
306
+							$output .= '"as": "ship.png",';
307
+						} else {
308
+							$output .= '"aircraft_shadow": "ship.png",';
309
+						}
310
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
311
+						if ($compress) {
312
+							$output .= '"as": "truck.png",';
313
+						} else {
314
+							$output .= '"aircraft_shadow": "truck.png",';
315
+						}
316
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
317
+						if ($compress) {
318
+							$output .= '"as": "truck.png",';
319
+						} else {
320
+							$output .= '"aircraft_shadow": "truck.png",';
321
+						}
322
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
323
+						if ($compress) {
324
+							$output .= '"as": "aircraft.png",';
325
+						} else {
326
+							$output .= '"aircraft_shadow": "aircraft.png",';
327
+						}
328
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
329
+						if ($compress) {
330
+							$output .= '"as": "aircraft.png",';
331
+						} else {
332
+							$output .= '"aircraft_shadow": "aircraft.png",';
333
+						}
334
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
335
+						if ($compress) {
336
+							$output .= '"as": "helico.png",';
337
+						} else {
338
+							$output .= '"aircraft_shadow": "helico.png",';
339
+						}
340
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
341
+						if ($compress) {
342
+							$output .= '"as": "rail.png",';
343
+						} else {
344
+							$output .= '"aircraft_shadow": "rail.png",';
345
+						}
346
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
347
+						if ($compress) {
348
+							$output .= '"as": "firetruck.png",';
349
+						} else {
350
+							$output .= '"aircraft_shadow": "firetruck.png",';
351
+						}
352
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
353
+						if ($compress) {
354
+							$output .= '"as": "bus.png",';
355
+						} else {
356
+							$output .= '"aircraft_shadow": "bus.png",';
357
+						}
358
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
359
+						if ($compress) {
360
+							$output .= '"as": "phone.png",';
361
+						} else {
362
+							$output .= '"aircraft_shadow": "phone.png",';
363
+						}
364
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
365
+						if ($compress) {
366
+							$output .= '"as": "jogger.png",';
367
+						} else {
368
+							$output .= '"aircraft_shadow": "jogger.png",';
369
+						}
370
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
371
+						if ($compress) {
372
+							$output .= '"as": "bike.png",';
373
+						} else {
374
+							$output .= '"aircraft_shadow": "bike.png",';
375
+						}
376
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
377
+						if ($compress) {
378
+							$output .= '"as": "motorcycle.png",';
379
+						} else {
380
+							$output .= '"aircraft_shadow": "motorcycle.png",';
381
+						}
382
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
383
+						if ($compress) {
384
+							$output .= '"as": "balloon.png",';
385
+						} else {
386
+							$output .= '"aircraft_shadow": "balloon.png",';
387
+						}
388
+					} else {
389
+						if ($compress) {
390
+							$output .= '"as": "car.png",';
391
+						} else {
392
+							$output .= '"aircraft_shadow": "car.png",';
393
+						}
260 394
 					}
261
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
262
-						if ($compress) $output .= '"as": "truck.png",';
263
-						else $output .= '"aircraft_shadow": "truck.png",';
395
+				} elseif ($marine) {
396
+					if ($compress) {
397
+						$output .= '"as": "ship.png",';
398
+					} else {
399
+						$output .= '"aircraft_shadow": "ship.png",';
264 400
 					}
265
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
266
-						if ($compress) $output .= '"as": "truck.png",';
267
-						else $output .= '"aircraft_shadow": "truck.png",';
268
-					}
269
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
270
-						if ($compress) $output .= '"as": "aircraft.png",';
271
-						else $output .= '"aircraft_shadow": "aircraft.png",';
272
-					}
273
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
274
-						if ($compress) $output .= '"as": "aircraft.png",';
275
-						else $output .= '"aircraft_shadow": "aircraft.png",';
276
-					}
277
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
278
-						if ($compress) $output .= '"as": "helico.png",';
279
-						else $output .= '"aircraft_shadow": "helico.png",';
280
-					}
281
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
282
-						if ($compress) $output .= '"as": "rail.png",';
283
-						else $output .= '"aircraft_shadow": "rail.png",';
284
-					}
285
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
286
-						if ($compress) $output .= '"as": "firetruck.png",';
287
-						else $output .= '"aircraft_shadow": "firetruck.png",';
288
-					}
289
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
290
-						if ($compress) $output .= '"as": "bus.png",';
291
-						else $output .= '"aircraft_shadow": "bus.png",';
292
-					}
293
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
294
-						if ($compress) $output .= '"as": "phone.png",';
295
-						else $output .= '"aircraft_shadow": "phone.png",';
296
-					}
297
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
298
-						if ($compress) $output .= '"as": "jogger.png",';
299
-						else $output .= '"aircraft_shadow": "jogger.png",';
300
-					}
301
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
302
-						if ($compress) $output .= '"as": "bike.png",';
303
-						else $output .= '"aircraft_shadow": "bike.png",';
304
-					}
305
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
306
-						if ($compress) $output .= '"as": "motorcycle.png",';
307
-						else $output .= '"aircraft_shadow": "motorcycle.png",';
308
-					}
309
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
310
-						if ($compress) $output .= '"as": "balloon.png",';
311
-						else $output .= '"aircraft_shadow": "balloon.png",';
312
-					}
313
-					else {
314
-						if ($compress) $output .= '"as": "car.png",';
315
-						else $output .= '"aircraft_shadow": "car.png",';
401
+				} else {
402
+					if ($compress) {
403
+						$output .= '"as": "default.png",';
404
+					} else {
405
+						$output .= '"aircraft_shadow": "default.png",';
316 406
 					}
317 407
 				}
318
-				elseif ($marine) {
319
-					if ($compress) $output .= '"as": "ship.png",';
320
-					else $output .= '"aircraft_shadow": "ship.png",';
321
-				}
322
-				else {
323
-					if ($compress) $output .= '"as": "default.png",';
324
-					else $output .= '"aircraft_shadow": "default.png",';
325
-				}
326 408
 			} else {
327
-				if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
328
-				else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
409
+				if ($compress) {
410
+					$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
411
+				} else {
412
+					$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
413
+				}
329 414
 			}
330 415
 
331 416
 			if (isset($spotter_item['date_iso_8601'])) {
@@ -373,7 +458,9 @@  discard block
 block discarded – undo
373 458
 	$output .= ']';
374 459
 	$output .= ',"initial_sqltime": "'.$sqltime.'",';
375 460
 	$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
376
-	if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
461
+	if (isset($begindate)) {
462
+		$output .= '"archive_date": "'.$begindate.'",';
463
+	}
377 464
 	$output .= '"fc": "'.$flightcnt.'"';
378 465
 } else {
379 466
 	$output .= '"features": ';
Please login to merge, or discard this patch.
ident-detailed.php 1 patch
Braces   +25 added lines, -9 removed lines patch added patch discarded remove patch
@@ -123,15 +123,21 @@  discard block
 block discarded – undo
123 123
 	{
124 124
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']);
125 125
 		$ident = $spotter_array[0]['ident'];
126
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
127
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
126
+		if (isset($spotter_array[0]['latitude'])) {
127
+			$latitude = $spotter_array[0]['latitude'];
128
+		}
129
+		if (isset($spotter_array[0]['longitude'])) {
130
+			$longitude = $spotter_array[0]['longitude'];
131
+		}
128 132
 		require_once('header.php');
129 133
 		if (isset($globalArchive) && $globalArchive && $type == 'aircraft') {
130 134
 			// Requirement for altitude graph
131 135
 			$all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']);
132 136
 			if (isset($globalTimezone)) {
133 137
 				date_default_timezone_set($globalTimezone);
134
-			} else date_default_timezone_set('UTC');
138
+			} else {
139
+				date_default_timezone_set('UTC');
140
+			}
135 141
 			if (is_array($all_data) && count($all_data) > 1) {
136 142
 				print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
137 143
 				print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
@@ -205,18 +211,28 @@  discard block
 block discarded – undo
205 211
 		print '<br/><br/><br/>';
206 212
 		print '<h1>'.$spotter_array[0]['ident'].'</h1>';
207 213
 		print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>';
208
-		if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) print '<div>'._("Callsign is in blocked FAA list").'</div>';
214
+		if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) {
215
+			print '<div>'._("Callsign is in blocked FAA list").'</div>';
216
+		}
209 217
 		if (isset($spotter_array[0]['airline_icao'])) {
210 218
 			print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; 
211 219
 		}
212
-		if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
220
+		if ($type == 'aircraft') {
221
+			print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
222
+		}
213 223
 		print '</div>';
214 224
 	
215
-		if ($type == 'aircraft') include('ident-sub-menu.php');
225
+		if ($type == 'aircraft') {
226
+			include('ident-sub-menu.php');
227
+		}
216 228
 		print '<div class="table column">';
217
-		if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
218
-		elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
219
-		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
229
+		if ($type == 'aircraft') {
230
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
231
+		} elseif ($type == 'marine') {
232
+			print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
233
+		} elseif ($type == 'tracker') {
234
+			print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
235
+		}
220 236
 
221 237
 		include('table-output.php'); 
222 238
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 1 patch
Braces   +60 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,16 +3,27 @@  discard block
 block discarded – undo
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5 5
 // Compressed GeoJson is used if true
6
-if (!isset($globalJsonCompress)) $compress = true;
7
-else $compress = $globalJsonCompress;
6
+if (!isset($globalJsonCompress)) {
7
+	$compress = true;
8
+} else {
9
+	$compress = $globalJsonCompress;
10
+}
8 11
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
12
+if (isset($_GET['ident'])) {
13
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+}
15
+if (isset($_GET['flightaware_id'])) {
16
+	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
17
+}
11 18
 ?>
12 19
 <?php
13
-if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
14
-elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
15
-else $IconColor = '1a3151';
20
+if (isset($_COOKIE['IconColor'])) {
21
+	$IconColor = $_COOKIE['IconColor'];
22
+} elseif (isset($globalAircraftIconColor)) {
23
+	$IconColor = $globalAircraftIconColor;
24
+} else {
25
+	$IconColor = '1a3151';
26
+}
16 27
 ?>
17 28
 <?php
18 29
 if (isset($globalDebug) && $globalDebug === TRUE) {
@@ -90,9 +101,12 @@  discard block
 block discarded – undo
90 101
 
91 102
 function update_airportsLayer() {
92 103
 <?php
93
-	if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
94
-	else $getZoom = '7';
95
-?>
104
+	if (isset($_COOKIE['AirportZoom'])) {
105
+		$getZoom = $_COOKIE['AirportZoom'];
106
+	} else {
107
+		$getZoom = '7';
108
+	}
109
+	?>
96 110
 	if (typeof airportsLayer != 'undefined') {
97 111
 		if (map.hasLayer(airportsLayer) == true) {
98 112
 			map.removeLayer(airportsLayer);
@@ -373,7 +387,12 @@  discard block
 block discarded – undo
373 387
 <?php
374 388
 		} else {
375 389
 ?>
376
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
390
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
391
+	print $archiveupdatetime*1000;
392
+} else {
393
+	print $globalMapRefresh*1000+20000;
394
+}
395
+?>+feature.properties.sqt*1000);
377 396
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
378 397
 <?php
379 398
 		}
@@ -424,7 +443,12 @@  discard block
 block discarded – undo
424 443
 <?php
425 444
 		} else {
426 445
 ?>
427
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
446
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
447
+	print $archiveupdatetime*1000;
448
+} else {
449
+	print $globalMapRefresh*1000+20000;
450
+}
451
+?>+feature.properties.sqt*1000);
428 452
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
429 453
 <?php
430 454
 		}
@@ -472,7 +496,12 @@  discard block
 block discarded – undo
472 496
 <?php
473 497
 		} else {
474 498
 ?>
475
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
499
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
500
+	print $archiveupdatetime*1000;
501
+} else {
502
+	print $globalMapRefresh*1000+20000;
503
+}
504
+?>+feature.properties.sqt*1000);
476 505
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
477 506
 <?php
478 507
 		}
@@ -975,7 +1004,12 @@  discard block
 block discarded – undo
975 1004
 		update_archiveLayer(0);
976 1005
 	} else {
977 1006
 		//then load it again every 30 seconds
978
-		reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
1007
+		reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
1008
+	print $globalMapRefresh*1000;
1009
+} else {
1010
+	print '30000';
1011
+}
1012
+?>);
979 1013
 		var currentdate = new Date();
980 1014
 		var currentyear = new Date().getFullYear();
981 1015
 		var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -987,7 +1021,12 @@  discard block
 block discarded – undo
987 1021
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
988 1022
 ?>
989 1023
 		update_polarLayer();
990
-		setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1024
+		setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
1025
+	print $globalMapRefresh*1000*2;
1026
+} else {
1027
+	print '60000';
1028
+}
1029
+?>);
991 1030
 <?php
992 1031
 		}
993 1032
 ?>
@@ -1000,7 +1039,12 @@  discard block
 block discarded – undo
1000 1039
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
1001 1040
 ?>
1002 1041
 	update_atcLayer();
1003
-	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1042
+	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
1043
+	print $globalMapRefresh*1000*2;
1044
+} else {
1045
+	print '60000';
1046
+}
1047
+?>);
1004 1048
 <?php
1005 1049
 	}
1006 1050
 ?>
Please login to merge, or discard this patch.