Completed
Push — master ( 30a9a2...cb785a )
by Yannick
08:46
created
location-data.php 1 patch
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,8 +17,11 @@  discard block
 block discarded – undo
17 17
 date_default_timezone_set('UTC');
18 18
 
19 19
 print '<div class="top">';
20
-if ($spotter_item['name'] != '') print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['name'].'</div>';
21
-else print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['location_id'].'</div>';
20
+if ($spotter_item['name'] != '') {
21
+	print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['name'].'</div>';
22
+} else {
23
+	print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['location_id'].'</div>';
24
+}
22 25
 print '</div>';
23 26
 
24 27
 print '</div></div>';
@@ -33,8 +36,12 @@  discard block
 block discarded – undo
33 36
 print $spotter_item['last_seen'];
34 37
 print '</div>';
35 38
 
36
-if ($spotter_item['city'] != '') print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>';
37
-if ($spotter_item['country'] !='') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
39
+if ($spotter_item['city'] != '') {
40
+	print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>';
41
+}
42
+if ($spotter_item['country'] !='') {
43
+	print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
44
+}
38 45
 print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>';
39 46
 /*
40 47
 if ($spotter_item['atc_range'] > 0) {
Please login to merge, or discard this patch.
header.php 1 patch
Braces   +70 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
6 6
 $current_page = $file_path['filename'];
7 7
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
8
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
9
+	$MapType = $_COOKIE['MapType'];
10
+} else {
11
+	$MapType = $globalMapProvider;
12
+}
10 13
 if (isset($_GET['3d'])) {
11 14
 	setcookie('MapFormat','3d');
12 15
 } else if (isset($_GET['2d'])) {
@@ -240,7 +243,13 @@  discard block
 block discarded – undo
240 243
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
241 244
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
242 245
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
243
-<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>
246
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
247
+	print '&latitude='.$latitude;
248
+}
249
+?><?php if(isset($longitude)) {
250
+	print '&longitude='.$longitude;
251
+}
252
+?>&<?php print time(); ?>"></script>
244 253
 <?php
245 254
 		if (!isset($type) || $type == 'aircraft') {
246 255
 ?>
@@ -310,7 +319,13 @@  discard block
 block discarded – undo
310 319
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
311 320
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
312 321
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
313
-<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>
322
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
323
+	print '&latitude='.$latitude;
324
+}
325
+?><?php if(isset($longitude)) {
326
+	print '&longitude='.$longitude;
327
+}
328
+?>&<?php print time(); ?>"></script>
314 329
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
315 330
 <?php
316 331
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -391,7 +406,12 @@  discard block
 block discarded – undo
391 406
         <span class="icon-bar"></span>
392 407
       </button>
393 408
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
394
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
409
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
410
+	print '/';
411
+} else {
412
+	print $globalURL;
413
+}
414
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
395 415
     </div>
396 416
     <div class="collapse navbar-collapse">
397 417
 
@@ -417,7 +437,10 @@  discard block
 block discarded – undo
417 437
 <?php
418 438
     }
419 439
 ?>
420
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
440
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
441
+	echo 'right-';
442
+}
443
+?>caret"></b></a>
421 444
           <ul class="dropdown-menu">
422 445
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
423 446
 <?php
@@ -488,8 +511,14 @@  discard block
 block discarded – undo
488 511
         </li>
489 512
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
490 513
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
491
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
492
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
514
+        <li class="dropdown<?php if ($sub) {
515
+	echo '-submenu';
516
+}
517
+?>">
518
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
519
+	echo 'right-';
520
+}
521
+?>caret"></b></a>
493 522
           <ul class="dropdown-menu">
494 523
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
495 524
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -518,7 +547,10 @@  discard block
 block discarded – undo
518 547
 <?php
519 548
 	}
520 549
 ?>
521
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
550
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
551
+	echo 'right-';
552
+}
553
+?>caret"></b></a>
522 554
 		<ul class="dropdown-menu">
523 555
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
524 556
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -550,7 +582,10 @@  discard block
 block discarded – undo
550 582
 <?php
551 583
 	}
552 584
 ?>
553
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
585
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
586
+	echo 'right-';
587
+}
588
+?>caret"></b></a>
554 589
 		<ul class="dropdown-menu">
555 590
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
556 591
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -606,7 +641,9 @@  discard block
 block discarded – undo
606 641
   		        $alllang = $Language->getLanguages();
607 642
   		        foreach ($alllang as $key => $lang) {
608 643
   		            print '<option value="'.$key.'"';
609
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
644
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
645
+  		            	print ' selected ';
646
+  		            }
610 647
   		            print '>'.$lang[0].'</option>';
611 648
   		        }
612 649
   		    ?>
@@ -746,9 +783,24 @@  discard block
 block discarded – undo
746 783
 	$customid = $globalMapProvider;
747 784
 ?>
748 785
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
749
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
750
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
751
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
786
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
787
+	print $globalMapCustomLayer[$customid]['maxZoom'];
788
+} else {
789
+	print '18';
790
+}
791
+?>,
792
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
793
+	print $globalMapCustomLayer[$customid]['minZoom'];
794
+} else {
795
+	print '0';
796
+}
797
+?>,
798
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
799
+	print 'false';
800
+} else {
801
+	print 'true';
802
+}
803
+?>,
752 804
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
753 805
     }).addTo(map);
754 806
 <?php
@@ -771,4 +823,7 @@  discard block
 block discarded – undo
771 823
 
772 824
 ?>
773 825
 
774
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
826
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
827
+	print 'index ';
828
+}
829
+?>clear">
Please login to merge, or discard this patch.
location-geojson.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,10 +35,11 @@
 block discarded – undo
35 35
 			$output .= '"city": "'.$spotter_item['city'].'",';
36 36
 			$output .= '"country": "'.$spotter_item['country'].'",';
37 37
 			$output .= '"altitude": "'.$spotter_item['altitude'].'",';
38
-			if ($spotter_item['name'] != '' && $spotter_item['city'] != '' && $spotter_item['country'] != '')
39
-				$output .= '"popupContent": "'.$spotter_item['name'].' : '.$spotter_item['city'].', '.$spotter_item['country'].'",';
40
-			elseif ($spotter_item['location_id'] != '')
41
-				$output .= '"popupContent": "'.$spotter_item['location_id'].'",';
38
+			if ($spotter_item['name'] != '' && $spotter_item['city'] != '' && $spotter_item['country'] != '') {
39
+							$output .= '"popupContent": "'.$spotter_item['name'].' : '.$spotter_item['city'].', '.$spotter_item['country'].'",';
40
+			} elseif ($spotter_item['location_id'] != '') {
41
+							$output .= '"popupContent": "'.$spotter_item['location_id'].'",';
42
+			}
42 43
 			$output .= '"icon": "'.$globalURL.'/images/'.$spotter_item['logo'].'",';
43 44
 			$output .= '"type": "'.$spotter_item['type'].'",';
44 45
 			$output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"';
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Braces   +158 added lines, -60 removed lines patch added patch discarded remove patch
@@ -107,17 +107,23 @@  discard block
 block discarded – undo
107 107
 	
108 108
 	/* Check that end was found and body has at least one byte. */
109 109
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
110
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
110
+	    if ($globalDebug) {
111
+	    	echo '!!! APRS invalid : '.$input."\n";
112
+	    }
111 113
 	    return false;
112 114
 	}
113 115
 	
114
-	if ($debug) echo 'input : '.$input."\n";
116
+	if ($debug) {
117
+		echo 'input : '.$input."\n";
118
+	}
115 119
 	/* Save header and body. */
116 120
 	$body = substr($input,$splitpos+1,$input_len);
117 121
 	$body_len = strlen($body);
118 122
 	$header = substr($input,0,$splitpos);
119 123
 	//$header_len = strlen($header);
120
-	if ($debug) echo 'header : '.$header."\n";
124
+	if ($debug) {
125
+		echo 'header : '.$header."\n";
126
+	}
121 127
 	
122 128
 	/* Parse source, target and path. */
123 129
 	//FLRDF0A52>APRS,qAS,LSTB
@@ -131,11 +137,15 @@  discard block
 block discarded – undo
131 137
 		$result['format_source'] = 'famaprs';
132 138
 		$result['source_type'] = 'ais';
133 139
 	    } else {
134
-		if ($debug) echo 'ident : '.$ident."\n";
140
+		if ($debug) {
141
+			echo 'ident : '.$ident."\n";
142
+		}
135 143
 		$result['ident'] = $ident;
136 144
 	    }
137 145
 	} else {
138
-	    if ($debug) 'No ident'."\n";
146
+	    if ($debug) {
147
+	    	'No ident'."\n";
148
+	    }
139 149
 	    return false;
140 150
 	}
141 151
 	$elements = explode(',',$all_elements);
@@ -146,7 +156,9 @@  discard block
 block discarded – undo
146 156
 	        //echo "ok";
147 157
 	        //if ($element == 'TCPIP*') return false;
148 158
 	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
149
-		if ($debug) echo 'element : '.$element."\n";
159
+		if ($debug) {
160
+			echo 'element : '.$element."\n";
161
+		}
150 162
 		return false;
151 163
 	    }
152 164
 	    /*
@@ -159,13 +171,17 @@  discard block
 block discarded – undo
159 171
 	}
160 172
 	
161 173
 	$type = substr($body,0,1);
162
-	if ($debug) echo 'type : '.$type."\n";
174
+	if ($debug) {
175
+		echo 'type : '.$type."\n";
176
+	}
163 177
 	if ($type == ';') {
164 178
 		if (isset($result['source_type']) && $result['source_type'] == 'modes') {
165 179
 			$result['address'] = trim(substr($body,1,9));
166 180
 		} elseif (isset($result['source_type']) && $result['source_type'] == 'ais') {
167 181
 			$result['mmsi'] = trim(substr($body,1,9));
168
-		} else $result['ident'] = trim(substr($body,1,9));
182
+		} else {
183
+			$result['ident'] = trim(substr($body,1,9));
184
+		}
169 185
 	} elseif ($type == ',') {
170 186
 		// Invalid data or test data
171 187
 		return false;
@@ -233,7 +249,9 @@  discard block
 block discarded – undo
233 249
 		//$symbol_table = $matches[4];
234 250
 		$lat = intval($lat_deg);
235 251
 		$lon = intval($lon_deg);
236
-		if ($lat > 89 || $lon > 179) return false;
252
+		if ($lat > 89 || $lon > 179) {
253
+			return false;
254
+		}
237 255
 	    
238 256
 	    /*
239 257
 	    $tmp_5b = str_replace('.','',$lat_min);
@@ -243,8 +261,12 @@  discard block
 block discarded – undo
243 261
 	    */
244 262
 		$latitude = $lat + floatval($lat_min)/60;
245 263
 		$longitude = $lon + floatval($lon_min)/60;
246
-		if ($sind == 'S') $latitude = 0-$latitude;
247
-		if ($wind == 'W') $longitude = 0-$longitude;
264
+		if ($sind == 'S') {
265
+			$latitude = 0-$latitude;
266
+		}
267
+		if ($wind == 'W') {
268
+			$longitude = 0-$longitude;
269
+		}
248 270
 		$result['latitude'] = $latitude;
249 271
 		$result['longitude'] = $longitude;
250 272
 		$body_parse = substr($body_parse,18);
@@ -278,7 +300,9 @@  discard block
 block discarded – undo
278 300
 			$body_parse = substr($body_parse,1);
279 301
 			$body_parse_len = strlen($body_parse);
280 302
 			$result['symbol_code'] = $symbol_code;
281
-			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
303
+			if (isset($this->symbols[$symbol_code])) {
304
+				$result['symbol'] = $this->symbols[$symbol_code];
305
+			}
282 306
 			if ($symbol_code != '_') {
283 307
 			}
284 308
 		    //$body_parse = substr($body_parse,1);
@@ -289,7 +313,9 @@  discard block
 block discarded – undo
289 313
 		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
290 314
 		    	    $course = substr($body_parse,0,3);
291 315
 		    	    $tmp_s = intval($course);
292
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
316
+		    	    if ($tmp_s >= 1 && $tmp_s <= 360) {
317
+		    	    	$result['heading'] = intval($course);
318
+		    	    }
293 319
 		    	    $speed = substr($body_parse,4,3);
294 320
 		    	    if ($speed != '...') {
295 321
 		    		//$result['speed'] = round($speed*1.852);
@@ -330,10 +356,16 @@  discard block
 block discarded – undo
330 356
 			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
331 357
 			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
332 358
 			    
333
-				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
334
-				else $result['latitude'] += $lat_off;
335
-				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
336
-				else $result['longitude'] += $lon_off;
359
+				if ($result['latitude'] < 0) {
360
+					$result['latitude'] -= $lat_off;
361
+				} else {
362
+					$result['latitude'] += $lat_off;
363
+				}
364
+				if ($result['longitude'] < 0) {
365
+					$result['longitude'] -= $lon_off;
366
+				} else {
367
+					$result['longitude'] += $lon_off;
368
+				}
337 369
 			    }
338 370
 			    
339 371
 		            $body_parse = substr($body_parse,6);
@@ -375,27 +407,48 @@  discard block
 block discarded – undo
375 407
 			$address = substr($id,2);
376 408
 			//print_r($matches);
377 409
 			$addressType = (intval(substr($id,0,2),16))&3;
378
-			if ($addressType == 0) $result['addresstype'] = "RANDOM";
379
-			elseif ($addressType == 1) $result['addresstype'] = "ICAO";
380
-			elseif ($addressType == 2) $result['addresstype'] = "FLARM";
381
-			elseif ($addressType == 3) $result['addresstype'] = "OGN";
410
+			if ($addressType == 0) {
411
+				$result['addresstype'] = "RANDOM";
412
+			} elseif ($addressType == 1) {
413
+				$result['addresstype'] = "ICAO";
414
+			} elseif ($addressType == 2) {
415
+				$result['addresstype'] = "FLARM";
416
+			} elseif ($addressType == 3) {
417
+				$result['addresstype'] = "OGN";
418
+			}
382 419
 			$aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2);
383 420
 			$result['aircrafttype_code'] = $aircraftType;
384
-			if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN";
385
-			elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER";
386
-			elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE";
387
-			elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
388
-			elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE";
389
-			elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE";
390
-			elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER";
391
-			elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER";
392
-			elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT";
393
-			elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT";
394
-			elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO";
395
-			elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON";
396
-			elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP";
397
-			elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV";
398
-			elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT";
421
+			if ($aircraftType == 0) {
422
+				$result['aircrafttype'] = "UNKNOWN";
423
+			} elseif ($aircraftType == 1) {
424
+				$result['aircrafttype'] = "GLIDER";
425
+			} elseif ($aircraftType == 2) {
426
+				$result['aircrafttype'] = "TOW_PLANE";
427
+			} elseif ($aircraftType == 3) {
428
+				$result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
429
+			} elseif ($aircraftType == 4) {
430
+				$result['aircrafttype'] = "PARACHUTE";
431
+			} elseif ($aircraftType == 5) {
432
+				$result['aircrafttype'] = "DROP_PLANE";
433
+			} elseif ($aircraftType == 6) {
434
+				$result['aircrafttype'] = "HANG_GLIDER";
435
+			} elseif ($aircraftType == 7) {
436
+				$result['aircrafttype'] = "PARA_GLIDER";
437
+			} elseif ($aircraftType == 8) {
438
+				$result['aircrafttype'] = "POWERED_AIRCRAFT";
439
+			} elseif ($aircraftType == 9) {
440
+				$result['aircrafttype'] = "JET_AIRCRAFT";
441
+			} elseif ($aircraftType == 10) {
442
+				$result['aircrafttype'] = "UFO";
443
+			} elseif ($aircraftType == 11) {
444
+				$result['aircrafttype'] = "BALLOON";
445
+			} elseif ($aircraftType == 12) {
446
+				$result['aircrafttype'] = "AIRSHIP";
447
+			} elseif ($aircraftType == 13) {
448
+				$result['aircrafttype'] = "UAV";
449
+			} elseif ($aircraftType == 15) {
450
+				$result['aircrafttype'] = "STATIC_OBJECT";
451
+			}
399 452
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
400 453
 			$result['stealth'] = $stealth;
401 454
 			$result['address'] = $address;
@@ -435,13 +488,21 @@  discard block
 block discarded – undo
435 488
 			$result['temp'] = round(5/9*(($matches[1])-32),1);
436 489
 		    }
437 490
 		}
438
-		} else $result['comment'] = trim($body_parse);
491
+		} else {
492
+			$result['comment'] = trim($body_parse);
493
+		}
439 494
 
440 495
 	    }
441 496
 	//}
442
-	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
443
-	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
444
-	if ($debug) print_r($result);
497
+	if (isset($result['latitude'])) {
498
+		$result['latitude'] = round($result['latitude'],4);
499
+	}
500
+	if (isset($result['longitude'])) {
501
+		$result['longitude'] = round($result['longitude'],4);
502
+	}
503
+	if ($debug) {
504
+		print_r($result);
505
+	}
445 506
 	return $result;
446 507
     }
447 508
     
@@ -450,12 +511,21 @@  discard block
 block discarded – undo
450 511
 	$aprs_connect = 0;
451 512
 	$aprs_keep = 120;
452 513
 	$aprs_last_tx = time();
453
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
454
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
455
-	if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid;
456
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
457
-	if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass;
458
-	else $aprs_pass = '-1';
514
+	if (isset($globalAPRSversion)) {
515
+		$aprs_version = $globalAPRSversion;
516
+	} else {
517
+		$aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
518
+	}
519
+	if (isset($globalServerAPRSssid)) {
520
+		$aprs_ssid = $globalServerAPRSssid;
521
+	} else {
522
+		$aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
523
+	}
524
+	if (isset($globalServerAPRSpass)) {
525
+		$aprs_pass = $globalServerAPRSpass;
526
+	} else {
527
+		$aprs_pass = '-1';
528
+	}
459 529
 	
460 530
 	$aprs_filter  = '';
461 531
 	$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
@@ -488,10 +558,14 @@  discard block
 block discarded – undo
488 558
     
489 559
     public function send($data) {
490 560
 	global $globalDebug;
491
-	if ($this->connected === false) $this->connect();
561
+	if ($this->connected === false) {
562
+		$this->connect();
563
+	}
492 564
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
493 565
 	if ($send === FALSE) {
494
-		if ($globalDebug) echo 'Reconnect...';
566
+		if ($globalDebug) {
567
+			echo 'Reconnect...';
568
+		}
495 569
 		socket_close($this->socket);
496 570
 		$this->connect();
497 571
 	}
@@ -511,22 +585,32 @@  discard block
 block discarded – undo
511 585
 			//$w = '00';
512 586
 			$custom = '';
513 587
 			if ($ident != '') {
514
-				if ($custom != '') $custom .= '/';
588
+				if ($custom != '') {
589
+					$custom .= '/';
590
+				}
515 591
 				$custom .= 'CS='.$ident;
516 592
 			}
517 593
 			if ($squawk != '') {
518
-				if ($custom != '') $custom .= '/';
594
+				if ($custom != '') {
595
+					$custom .= '/';
596
+				}
519 597
 				$custom .= 'SQ='.$squawk;
520 598
 			}
521 599
 			if ($verticalrate != '') {
522
-				if ($custom != '') $custom .= '/';
600
+				if ($custom != '') {
601
+					$custom .= '/';
602
+				}
523 603
 				$custom .= 'VR='.$verticalrate;
524 604
 			}
525 605
 			if ($aircraft_icao != '' && $aircraft_icao != 'NA') {
526
-				if ($custom != '') $custom .= '/';
606
+				if ($custom != '') {
607
+					$custom .= '/';
608
+				}
527 609
 				$custom .= 'AI='.$aircraft_icao;
528 610
 			}
529
-			if ($custom != '') $custom = ' '.$custom;
611
+			if ($custom != '') {
612
+				$custom = ' '.$custom;
613
+			}
530 614
 			$this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.'   *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
531 615
 		}
532 616
 	}
@@ -544,30 +628,44 @@  discard block
 block discarded – undo
544 628
 			//$w = '00';
545 629
 			$custom = '';
546 630
 			if ($ident != '') {
547
-				if ($custom != '') $custom .= '/';
631
+				if ($custom != '') {
632
+					$custom .= '/';
633
+				}
548 634
 				$custom .= 'CS='.str_replace(' ','_',$ident);
549 635
 			}
550 636
 			if ($typeid != '') {
551
-				if ($custom != '') $custom .= '/';
637
+				if ($custom != '') {
638
+					$custom .= '/';
639
+				}
552 640
 				$custom .= 'TI='.$typeid;
553 641
 			}
554 642
 			if ($statusid != '') {
555
-				if ($custom != '') $custom .= '/';
643
+				if ($custom != '') {
644
+					$custom .= '/';
645
+				}
556 646
 				$custom .= 'SI='.$statusid;
557 647
 			}
558 648
 			if ($imo != '') {
559
-				if ($custom != '') $custom .= '/';
649
+				if ($custom != '') {
650
+					$custom .= '/';
651
+				}
560 652
 				$custom .= 'IMO='.$imo;
561 653
 			}
562 654
 			if ($arrival_date != '') {
563
-				if ($custom != '') $custom .= '/';
655
+				if ($custom != '') {
656
+					$custom .= '/';
657
+				}
564 658
 				$custom .= 'AD='.strtotime($arrival_date);
565 659
 			}
566 660
 			if ($arrival_code != '') {
567
-				if ($custom != '') $custom .= '/';
661
+				if ($custom != '') {
662
+					$custom .= '/';
663
+				}
568 664
 				$custom .= 'AC='.str_replace(' ','_',$arrival_code);
569 665
 			}
570
-			if ($custom != '') $custom = ' '.$custom;
666
+			if ($custom != '') {
667
+				$custom = ' '.$custom;
668
+			}
571 669
 			$altitude = 0;
572 670
 			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
573 671
 		}
Please login to merge, or discard this patch.
require/class.Source.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,7 +88,9 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 
90 90
 	public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') {
91
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
91
+		if ($last_seen == '') {
92
+			$last_seen = date('Y-m-d H:i:s');
93
+		}
92 94
 		$query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)";
93 95
 		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
94 96
 		try {
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
 	}
101 103
 
102 104
 	public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') {
103
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
105
+		if ($last_seen == '') {
106
+			$last_seen = date('Y-m-d H:i:s');
107
+		}
104 108
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source";
105 109
 		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
106 110
 		try {
@@ -123,7 +127,9 @@  discard block
 block discarded – undo
123 127
 	}
124 128
 
125 129
 	public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') {
126
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
130
+		if ($last_seen == '') {
131
+			$last_seen = date('Y-m-d H:i:s');
132
+		}
127 133
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id";
128 134
 		$query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
129 135
 		try {
Please login to merge, or discard this patch.
install/class.update_schema.php 1 patch
Braces   +383 added lines, -142 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1332,20 +1390,28 @@  discard block
 block discarded – undo
1332 1390
 		}
1333 1391
 		if ($globalDBdriver == 'mysql') {
1334 1392
 			$error .= create_db::import_file('../db/airlines.sql');
1335
-			if ($error != '') return $error;
1393
+			if ($error != '') {
1394
+				return $error;
1395
+			}
1336 1396
 		} else {
1337 1397
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
1338
-			if ($error != '') return $error;
1398
+			if ($error != '') {
1399
+				return $error;
1400
+			}
1339 1401
 		}
1340 1402
 		if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) {
1341 1403
 			include_once(dirname(__FILE__).'/class.update_db.php');
1342 1404
 			if (isset($globalVATSIM) && $globalVATSIM) {
1343 1405
 				$error .= update_db::update_vatsim();
1344
-				if ($error != '') return $error;
1406
+				if ($error != '') {
1407
+					return $error;
1408
+				}
1345 1409
 			}
1346 1410
 			if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) {
1347 1411
 				$error .= update_db::update_IVAO();
1348
-				if ($error != '') return $error;
1412
+				if ($error != '') {
1413
+					return $error;
1414
+				}
1349 1415
 			}
1350 1416
 		}
1351 1417
 
@@ -1608,41 +1674,65 @@  discard block
 block discarded – undo
1608 1674
 		if ($globalDBdriver == 'mysql') {
1609 1675
 			if (!$Connection->tableExists('tracker_output')) {
1610 1676
 				$error .= create_db::import_file('../db/tracker_output.sql');
1611
-				if ($error != '') return $error;
1677
+				if ($error != '') {
1678
+					return $error;
1679
+				}
1612 1680
 			}
1613 1681
 			if (!$Connection->tableExists('tracker_live')) {
1614 1682
 				$error .= create_db::import_file('../db/tracker_live.sql');
1615
-				if ($error != '') return $error;
1683
+				if ($error != '') {
1684
+					return $error;
1685
+				}
1616 1686
 			}
1617 1687
 			if (!$Connection->tableExists('marine_output')) {
1618 1688
 				$error .= create_db::import_file('../db/marine_output.sql');
1619
-				if ($error != '') return $error;
1689
+				if ($error != '') {
1690
+					return $error;
1691
+				}
1620 1692
 			}
1621 1693
 			if (!$Connection->tableExists('marine_live')) {
1622 1694
 				$error .= create_db::import_file('../db/marine_live.sql');
1623
-				if ($error != '') return $error;
1695
+				if ($error != '') {
1696
+					return $error;
1697
+				}
1624 1698
 			}
1625 1699
 			if (!$Connection->tableExists('marine_identity')) {
1626 1700
 				$error .= create_db::import_file('../db/marine_identity.sql');
1627
-				if ($error != '') return $error;
1701
+				if ($error != '') {
1702
+					return $error;
1703
+				}
1628 1704
 			}
1629 1705
 			if (!$Connection->tableExists('marine_mid')) {
1630 1706
 				$error .= create_db::import_file('../db/marine_mid.sql');
1631
-				if ($error != '') return $error;
1707
+				if ($error != '') {
1708
+					return $error;
1709
+				}
1632 1710
 			}
1633 1711
 		} else {
1634 1712
 			$error .= create_db::import_file('../db/pgsql/tracker_output.sql');
1635
-			if ($error != '') return $error;
1713
+			if ($error != '') {
1714
+				return $error;
1715
+			}
1636 1716
 			$error .= create_db::import_file('../db/pgsql/tracker_live.sql');
1637
-			if ($error != '') return $error;
1717
+			if ($error != '') {
1718
+				return $error;
1719
+			}
1638 1720
 			$error .= create_db::import_file('../db/pgsql/marine_output.sql');
1639
-			if ($error != '') return $error;
1721
+			if ($error != '') {
1722
+				return $error;
1723
+			}
1640 1724
 			$error .= create_db::import_file('../db/pgsql/marine_live.sql');
1641
-			if ($error != '') return $error;
1725
+			if ($error != '') {
1726
+				return $error;
1727
+			}
1642 1728
 			$error .= create_db::import_file('../db/pgsql/marine_identity.sql');
1643
-			if ($error != '') return $error;
1729
+			if ($error != '') {
1730
+				return $error;
1731
+			}
1644 1732
 			$error .= create_db::import_file('../db/pgsql/marine_mid.sql');
1645
-			if ($error != '') return $error;
1733
+			if ($error != '') {
1734
+				return $error;
1735
+			}
1646 1736
 		}
1647 1737
 		$query = "UPDATE config SET value = '37' WHERE name = 'schema_version'";
1648 1738
 		try {
@@ -1661,35 +1751,55 @@  discard block
 block discarded – undo
1661 1751
 		if ($globalDBdriver == 'mysql') {
1662 1752
 			if (!$Connection->tableExists('marine_image')) {
1663 1753
 				$error .= create_db::import_file('../db/marine_image.sql');
1664
-				if ($error != '') return $error;
1754
+				if ($error != '') {
1755
+					return $error;
1756
+				}
1665 1757
 			}
1666 1758
 			if (!$Connection->tableExists('marine_archive')) {
1667 1759
 				$error .= create_db::import_file('../db/marine_archive.sql');
1668
-				if ($error != '') return $error;
1760
+				if ($error != '') {
1761
+					return $error;
1762
+				}
1669 1763
 			}
1670 1764
 			if (!$Connection->tableExists('marine_archive_output')) {
1671 1765
 				$error .= create_db::import_file('../db/marine_archive_output.sql');
1672
-				if ($error != '') return $error;
1766
+				if ($error != '') {
1767
+					return $error;
1768
+				}
1673 1769
 			}
1674 1770
 			if (!$Connection->tableExists('tracker_archive')) {
1675 1771
 				$error .= create_db::import_file('../db/tracker_archive.sql');
1676
-				if ($error != '') return $error;
1772
+				if ($error != '') {
1773
+					return $error;
1774
+				}
1677 1775
 			}
1678 1776
 			if (!$Connection->tableExists('marine_archive_output')) {
1679 1777
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
1680
-				if ($error != '') return $error;
1778
+				if ($error != '') {
1779
+					return $error;
1780
+				}
1681 1781
 			}
1682 1782
 		} else {
1683 1783
 			$error .= create_db::import_file('../db/pgsql/marine_image.sql');
1684
-			if ($error != '') return $error;
1784
+			if ($error != '') {
1785
+				return $error;
1786
+			}
1685 1787
 			$error .= create_db::import_file('../db/pgsql/marine_archive.sql');
1686
-			if ($error != '') return $error;
1788
+			if ($error != '') {
1789
+				return $error;
1790
+			}
1687 1791
 			$error .= create_db::import_file('../db/pgsql/marine_archive_output.sql');
1688
-			if ($error != '') return $error;
1792
+			if ($error != '') {
1793
+				return $error;
1794
+			}
1689 1795
 			$error .= create_db::import_file('../db/pgsql/tracker_archive.sql');
1690
-			if ($error != '') return $error;
1796
+			if ($error != '') {
1797
+				return $error;
1798
+			}
1691 1799
 			$error .= create_db::import_file('../db/pgsql/tracker_archive_output.sql');
1692
-			if ($error != '') return $error;
1800
+			if ($error != '') {
1801
+				return $error;
1802
+			}
1693 1803
 		}
1694 1804
 		if ($globalDBdriver == 'mysql') {
1695 1805
 			$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
@@ -2062,8 +2172,11 @@  discard block
 block discarded – undo
2062 2172
     	    if ($Connection->tableExists('aircraft')) {
2063 2173
     		if (!$Connection->tableExists('config')) {
2064 2174
     		    $version = '1';
2065
-    		    if ($update) return self::update_from_1();
2066
-    		    else return $version;
2175
+    		    if ($update) {
2176
+    		    	return self::update_from_1();
2177
+    		    } else {
2178
+    		    	return $version;
2179
+    		    }
2067 2180
 		} else {
2068 2181
     		    $Connection = new Connection();
2069 2182
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -2077,174 +2190,302 @@  discard block
 block discarded – undo
2077 2190
     		    if ($update) {
2078 2191
     			if ($result['value'] == '2') {
2079 2192
     			    $error = self::update_from_2();
2080
-    			    if ($error != '') return $error;
2081
-    			    else return self::check_version(true);
2193
+    			    if ($error != '') {
2194
+    			    	return $error;
2195
+    			    } else {
2196
+    			    	return self::check_version(true);
2197
+    			    }
2082 2198
     			} elseif ($result['value'] == '3') {
2083 2199
     			    $error = self::update_from_3();
2084
-    			    if ($error != '') return $error;
2085
-    			    else return self::check_version(true);
2200
+    			    if ($error != '') {
2201
+    			    	return $error;
2202
+    			    } else {
2203
+    			    	return self::check_version(true);
2204
+    			    }
2086 2205
     			} elseif ($result['value'] == '4') {
2087 2206
     			    $error = self::update_from_4();
2088
-    			    if ($error != '') return $error;
2089
-    			    else return self::check_version(true);
2207
+    			    if ($error != '') {
2208
+    			    	return $error;
2209
+    			    } else {
2210
+    			    	return self::check_version(true);
2211
+    			    }
2090 2212
     			} elseif ($result['value'] == '5') {
2091 2213
     			    $error = self::update_from_5();
2092
-    			    if ($error != '') return $error;
2093
-    			    else return self::check_version(true);
2214
+    			    if ($error != '') {
2215
+    			    	return $error;
2216
+    			    } else {
2217
+    			    	return self::check_version(true);
2218
+    			    }
2094 2219
     			} elseif ($result['value'] == '6') {
2095 2220
     			    $error = self::update_from_6();
2096
-    			    if ($error != '') return $error;
2097
-    			    else return self::check_version(true);
2221
+    			    if ($error != '') {
2222
+    			    	return $error;
2223
+    			    } else {
2224
+    			    	return self::check_version(true);
2225
+    			    }
2098 2226
     			} elseif ($result['value'] == '7') {
2099 2227
     			    $error = self::update_from_7();
2100
-    			    if ($error != '') return $error;
2101
-    			    else return self::check_version(true);
2228
+    			    if ($error != '') {
2229
+    			    	return $error;
2230
+    			    } else {
2231
+    			    	return self::check_version(true);
2232
+    			    }
2102 2233
     			} elseif ($result['value'] == '8') {
2103 2234
     			    $error = self::update_from_8();
2104
-    			    if ($error != '') return $error;
2105
-    			    else return self::check_version(true);
2235
+    			    if ($error != '') {
2236
+    			    	return $error;
2237
+    			    } else {
2238
+    			    	return self::check_version(true);
2239
+    			    }
2106 2240
     			} elseif ($result['value'] == '9') {
2107 2241
     			    $error = self::update_from_9();
2108
-    			    if ($error != '') return $error;
2109
-    			    else return self::check_version(true);
2242
+    			    if ($error != '') {
2243
+    			    	return $error;
2244
+    			    } else {
2245
+    			    	return self::check_version(true);
2246
+    			    }
2110 2247
     			} elseif ($result['value'] == '10') {
2111 2248
     			    $error = self::update_from_10();
2112
-    			    if ($error != '') return $error;
2113
-    			    else return self::check_version(true);
2249
+    			    if ($error != '') {
2250
+    			    	return $error;
2251
+    			    } else {
2252
+    			    	return self::check_version(true);
2253
+    			    }
2114 2254
     			} elseif ($result['value'] == '11') {
2115 2255
     			    $error = self::update_from_11();
2116
-    			    if ($error != '') return $error;
2117
-    			    else return self::check_version(true);
2256
+    			    if ($error != '') {
2257
+    			    	return $error;
2258
+    			    } else {
2259
+    			    	return self::check_version(true);
2260
+    			    }
2118 2261
     			} elseif ($result['value'] == '12') {
2119 2262
     			    $error = self::update_from_12();
2120
-    			    if ($error != '') return $error;
2121
-    			    else return self::check_version(true);
2263
+    			    if ($error != '') {
2264
+    			    	return $error;
2265
+    			    } else {
2266
+    			    	return self::check_version(true);
2267
+    			    }
2122 2268
     			} elseif ($result['value'] == '13') {
2123 2269
     			    $error = self::update_from_13();
2124
-    			    if ($error != '') return $error;
2125
-    			    else return self::check_version(true);
2270
+    			    if ($error != '') {
2271
+    			    	return $error;
2272
+    			    } else {
2273
+    			    	return self::check_version(true);
2274
+    			    }
2126 2275
     			} elseif ($result['value'] == '14') {
2127 2276
     			    $error = self::update_from_14();
2128
-    			    if ($error != '') return $error;
2129
-    			    else return self::check_version(true);
2277
+    			    if ($error != '') {
2278
+    			    	return $error;
2279
+    			    } else {
2280
+    			    	return self::check_version(true);
2281
+    			    }
2130 2282
     			} elseif ($result['value'] == '15') {
2131 2283
     			    $error = self::update_from_15();
2132
-    			    if ($error != '') return $error;
2133
-    			    else return self::check_version(true);
2284
+    			    if ($error != '') {
2285
+    			    	return $error;
2286
+    			    } else {
2287
+    			    	return self::check_version(true);
2288
+    			    }
2134 2289
     			} elseif ($result['value'] == '16') {
2135 2290
     			    $error = self::update_from_16();
2136
-    			    if ($error != '') return $error;
2137
-    			    else return self::check_version(true);
2291
+    			    if ($error != '') {
2292
+    			    	return $error;
2293
+    			    } else {
2294
+    			    	return self::check_version(true);
2295
+    			    }
2138 2296
     			} elseif ($result['value'] == '17') {
2139 2297
     			    $error = self::update_from_17();
2140
-    			    if ($error != '') return $error;
2141
-    			    else return self::check_version(true);
2298
+    			    if ($error != '') {
2299
+    			    	return $error;
2300
+    			    } else {
2301
+    			    	return self::check_version(true);
2302
+    			    }
2142 2303
     			} elseif ($result['value'] == '18') {
2143 2304
     			    $error = self::update_from_18();
2144
-    			    if ($error != '') return $error;
2145
-    			    else return self::check_version(true);
2305
+    			    if ($error != '') {
2306
+    			    	return $error;
2307
+    			    } else {
2308
+    			    	return self::check_version(true);
2309
+    			    }
2146 2310
     			} elseif ($result['value'] == '19') {
2147 2311
     			    $error = self::update_from_19();
2148
-    			    if ($error != '') return $error;
2149
-    			    else return self::check_version(true);
2312
+    			    if ($error != '') {
2313
+    			    	return $error;
2314
+    			    } else {
2315
+    			    	return self::check_version(true);
2316
+    			    }
2150 2317
     			} elseif ($result['value'] == '20') {
2151 2318
     			    $error = self::update_from_20();
2152
-    			    if ($error != '') return $error;
2153
-    			    else return self::check_version(true);
2319
+    			    if ($error != '') {
2320
+    			    	return $error;
2321
+    			    } else {
2322
+    			    	return self::check_version(true);
2323
+    			    }
2154 2324
     			} elseif ($result['value'] == '21') {
2155 2325
     			    $error = self::update_from_21();
2156
-    			    if ($error != '') return $error;
2157
-    			    else return self::check_version(true);
2326
+    			    if ($error != '') {
2327
+    			    	return $error;
2328
+    			    } else {
2329
+    			    	return self::check_version(true);
2330
+    			    }
2158 2331
     			} elseif ($result['value'] == '22') {
2159 2332
     			    $error = self::update_from_22();
2160
-    			    if ($error != '') return $error;
2161
-    			    else return self::check_version(true);
2333
+    			    if ($error != '') {
2334
+    			    	return $error;
2335
+    			    } else {
2336
+    			    	return self::check_version(true);
2337
+    			    }
2162 2338
     			} elseif ($result['value'] == '23') {
2163 2339
     			    $error = self::update_from_23();
2164
-    			    if ($error != '') return $error;
2165
-    			    else return self::check_version(true);
2340
+    			    if ($error != '') {
2341
+    			    	return $error;
2342
+    			    } else {
2343
+    			    	return self::check_version(true);
2344
+    			    }
2166 2345
     			} elseif ($result['value'] == '24') {
2167 2346
     			    $error = self::update_from_24();
2168
-    			    if ($error != '') return $error;
2169
-    			    else return self::check_version(true);
2347
+    			    if ($error != '') {
2348
+    			    	return $error;
2349
+    			    } else {
2350
+    			    	return self::check_version(true);
2351
+    			    }
2170 2352
     			} elseif ($result['value'] == '25') {
2171 2353
     			    $error = self::update_from_25();
2172
-    			    if ($error != '') return $error;
2173
-    			    else return self::check_version(true);
2354
+    			    if ($error != '') {
2355
+    			    	return $error;
2356
+    			    } else {
2357
+    			    	return self::check_version(true);
2358
+    			    }
2174 2359
     			} elseif ($result['value'] == '26') {
2175 2360
     			    $error = self::update_from_26();
2176
-    			    if ($error != '') return $error;
2177
-    			    else return self::check_version(true);
2361
+    			    if ($error != '') {
2362
+    			    	return $error;
2363
+    			    } else {
2364
+    			    	return self::check_version(true);
2365
+    			    }
2178 2366
     			} elseif ($result['value'] == '27') {
2179 2367
     			    $error = self::update_from_27();
2180
-    			    if ($error != '') return $error;
2181
-    			    else return self::check_version(true);
2368
+    			    if ($error != '') {
2369
+    			    	return $error;
2370
+    			    } else {
2371
+    			    	return self::check_version(true);
2372
+    			    }
2182 2373
     			} elseif ($result['value'] == '28') {
2183 2374
     			    $error = self::update_from_28();
2184
-    			    if ($error != '') return $error;
2185
-    			    else return self::check_version(true);
2375
+    			    if ($error != '') {
2376
+    			    	return $error;
2377
+    			    } else {
2378
+    			    	return self::check_version(true);
2379
+    			    }
2186 2380
     			} elseif ($result['value'] == '29') {
2187 2381
     			    $error = self::update_from_29();
2188
-    			    if ($error != '') return $error;
2189
-    			    else return self::check_version(true);
2382
+    			    if ($error != '') {
2383
+    			    	return $error;
2384
+    			    } else {
2385
+    			    	return self::check_version(true);
2386
+    			    }
2190 2387
     			} elseif ($result['value'] == '30') {
2191 2388
     			    $error = self::update_from_30();
2192
-    			    if ($error != '') return $error;
2193
-    			    else return self::check_version(true);
2389
+    			    if ($error != '') {
2390
+    			    	return $error;
2391
+    			    } else {
2392
+    			    	return self::check_version(true);
2393
+    			    }
2194 2394
     			} elseif ($result['value'] == '31') {
2195 2395
     			    $error = self::update_from_31();
2196
-    			    if ($error != '') return $error;
2197
-    			    else return self::check_version(true);
2396
+    			    if ($error != '') {
2397
+    			    	return $error;
2398
+    			    } else {
2399
+    			    	return self::check_version(true);
2400
+    			    }
2198 2401
     			} elseif ($result['value'] == '32') {
2199 2402
     			    $error = self::update_from_32();
2200
-    			    if ($error != '') return $error;
2201
-    			    else return self::check_version(true);
2403
+    			    if ($error != '') {
2404
+    			    	return $error;
2405
+    			    } else {
2406
+    			    	return self::check_version(true);
2407
+    			    }
2202 2408
     			} elseif ($result['value'] == '33') {
2203 2409
     			    $error = self::update_from_33();
2204
-    			    if ($error != '') return $error;
2205
-    			    else return self::check_version(true);
2410
+    			    if ($error != '') {
2411
+    			    	return $error;
2412
+    			    } else {
2413
+    			    	return self::check_version(true);
2414
+    			    }
2206 2415
     			} elseif ($result['value'] == '34') {
2207 2416
     			    $error = self::update_from_34();
2208
-    			    if ($error != '') return $error;
2209
-    			    else return self::check_version(true);
2417
+    			    if ($error != '') {
2418
+    			    	return $error;
2419
+    			    } else {
2420
+    			    	return self::check_version(true);
2421
+    			    }
2210 2422
     			} elseif ($result['value'] == '35') {
2211 2423
     			    $error = self::update_from_35();
2212
-    			    if ($error != '') return $error;
2213
-    			    else return self::check_version(true);
2424
+    			    if ($error != '') {
2425
+    			    	return $error;
2426
+    			    } else {
2427
+    			    	return self::check_version(true);
2428
+    			    }
2214 2429
     			} elseif ($result['value'] == '36') {
2215 2430
     			    $error = self::update_from_36();
2216
-    			    if ($error != '') return $error;
2217
-    			    else return self::check_version(true);
2431
+    			    if ($error != '') {
2432
+    			    	return $error;
2433
+    			    } else {
2434
+    			    	return self::check_version(true);
2435
+    			    }
2218 2436
     			} elseif ($result['value'] == '37') {
2219 2437
     			    $error = self::update_from_37();
2220
-    			    if ($error != '') return $error;
2221
-    			    else return self::check_version(true);
2438
+    			    if ($error != '') {
2439
+    			    	return $error;
2440
+    			    } else {
2441
+    			    	return self::check_version(true);
2442
+    			    }
2222 2443
     			} elseif ($result['value'] == '38') {
2223 2444
     			    $error = self::update_from_38();
2224
-    			    if ($error != '') return $error;
2225
-    			    else return self::check_version(true);
2445
+    			    if ($error != '') {
2446
+    			    	return $error;
2447
+    			    } else {
2448
+    			    	return self::check_version(true);
2449
+    			    }
2226 2450
     			} elseif ($result['value'] == '39') {
2227 2451
     			    $error = self::update_from_39();
2228
-    			    if ($error != '') return $error;
2229
-    			    else return self::check_version(true);
2452
+    			    if ($error != '') {
2453
+    			    	return $error;
2454
+    			    } else {
2455
+    			    	return self::check_version(true);
2456
+    			    }
2230 2457
     			} elseif ($result['value'] == '40') {
2231 2458
     			    $error = self::update_from_40();
2232
-    			    if ($error != '') return $error;
2233
-    			    else return self::check_version(true);
2459
+    			    if ($error != '') {
2460
+    			    	return $error;
2461
+    			    } else {
2462
+    			    	return self::check_version(true);
2463
+    			    }
2234 2464
     			} elseif ($result['value'] == '41') {
2235 2465
     			    $error = self::update_from_41();
2236
-    			    if ($error != '') return $error;
2237
-    			    else return self::check_version(true);
2466
+    			    if ($error != '') {
2467
+    			    	return $error;
2468
+    			    } else {
2469
+    			    	return self::check_version(true);
2470
+    			    }
2238 2471
     			} elseif ($result['value'] == '42') {
2239 2472
     			    $error = self::update_from_42();
2240
-    			    if ($error != '') return $error;
2241
-    			    else return self::check_version(true);
2242
-    			} else return '';
2473
+    			    if ($error != '') {
2474
+    			    	return $error;
2475
+    			    } else {
2476
+    			    	return self::check_version(true);
2477
+    			    }
2478
+    			} else {
2479
+    				return '';
2480
+    			}
2481
+    		    } else {
2482
+    		    	return $result['value'];
2243 2483
     		    }
2244
-    		    else return $result['value'];
2245 2484
 		}
2246 2485
 		
2247
-	    } else return $version;
2486
+	    } else {
2487
+	    	return $version;
2488
+	    }
2248 2489
     	}
2249 2490
     	
2250 2491
 }
Please login to merge, or discard this patch.
require/class.Accident.php 1 patch
Braces   +81 added lines, -29 removed lines patch added patch discarded remove patch
@@ -113,8 +113,11 @@  discard block
 block discarded – undo
113 113
 				$data = array();
114 114
 				if ($row['registration'] != '') {
115 115
 					$image_array = $Image->getSpotterImage($row['registration']);
116
-					if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
117
-					else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
116
+					if (count($image_array) > 0) {
117
+						$data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
118
+					} else {
119
+						$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
120
+					}
118 121
 					$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
119 122
 					$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
120 123
 					if (!empty($aircraft_info)) {
@@ -130,17 +133,30 @@  discard block
 block discarded – undo
130 133
 						$data['aircraft_base'] = $owner_data['base'];
131 134
 						$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
132 135
 					}
133
-				} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
134
-				if ($row['registration'] == '') $row['registration'] = 'NA';
135
-				if ($row['ident'] == '') $row['ident'] = 'NA';
136
+				} else {
137
+					$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
138
+				}
139
+				if ($row['registration'] == '') {
140
+					$row['registration'] = 'NA';
141
+				}
142
+				if ($row['ident'] == '') {
143
+					$row['ident'] = 'NA';
144
+				}
136 145
 				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
137 146
 				if (isset($identicao[0])) {
138 147
 					if (substr($row['ident'],0,2) == 'AF') {
139
-						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
140
-						else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
141
-					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
148
+						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
149
+							$icao = $row['ident'];
150
+						} else {
151
+							$icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
152
+						}
153
+					} else {
154
+						$icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
155
+					}
142 156
 					$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
143
-				} else $icao = $row['ident'];
157
+				} else {
158
+					$icao = $row['ident'];
159
+				}
144 160
 				$icao = $Translation->checkTranslation($icao,false);
145 161
 				//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
146 162
 				if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
@@ -155,10 +171,14 @@  discard block
 block discarded – undo
155 171
 					//else echo 'No data...'."\n";
156 172
 				}
157 173
 				$data = array_merge($row,$data);
158
-				if ($data['ident'] == null) $data['ident'] = $icao;
174
+				if ($data['ident'] == null) {
175
+					$data['ident'] = $icao;
176
+				}
159 177
 				if ($data['title'] == null) {
160 178
 					$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
161
-				} else $data['message'] = strtolower($data['title']);
179
+				} else {
180
+					$data['message'] = strtolower($data['title']);
181
+				}
162 182
 				$ids = $Spotter->getAllIDByRegistration($data['registration']);
163 183
 				$date = $data['date'];
164 184
 				if (isset($ids[$date])) {
@@ -177,8 +197,9 @@  discard block
 block discarded – undo
177 197
 		if (isset($result)) {
178 198
 			$result[0]['query_number_rows'] = $i;
179 199
 			return $result;
200
+		} else {
201
+			return array();
180 202
 		}
181
-		else return array();
182 203
 	}
183 204
 	
184 205
 	/*
@@ -222,7 +243,9 @@  discard block
 block discarded – undo
222 243
 	*/
223 244
 	public function import($file) {
224 245
 		global $globalTransaction, $globalDebug;
225
-		if ($globalDebug) echo 'Import '.$file."\n";
246
+		if ($globalDebug) {
247
+			echo 'Import '.$file."\n";
248
+		}
226 249
 		$result = array();
227 250
 		if (file_exists($file)) {
228 251
 			if (($handle = fopen($file,'r')) !== FALSE) {
@@ -233,8 +256,11 @@  discard block
 block discarded – undo
233 256
 				}
234 257
 				fclose($handle);
235 258
 			}
236
-			if (!empty($result)) $this->add($result,true);
237
-			elseif ($globalDebug) echo 'Nothing to import';
259
+			if (!empty($result)) {
260
+				$this->add($result,true);
261
+			} elseif ($globalDebug) {
262
+				echo 'Nothing to import';
263
+			}
238 264
 		}
239 265
 	}
240 266
 
@@ -270,14 +296,23 @@  discard block
 block discarded – undo
270 296
 					}
271 297
 				}
272 298
 				fclose($handle);
273
-			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
274
-		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
299
+			} elseif ($globalDebug) {
300
+				echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
301
+			}
302
+		} elseif ($globalDebug) {
303
+			echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
304
+		}
275 305
 		$result = $Common->arr_diff($all_md5_new,$all_md5);
276
-		if (empty($result) && $globalDebug) echo 'Nothing to update';
306
+		if (empty($result) && $globalDebug) {
307
+			echo 'Nothing to update';
308
+		}
277 309
 		foreach ($result as $file => $md5) {
278 310
 			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
279
-			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
280
-			elseif ($globalDebug) echo 'Download '.$file.' failed';
311
+			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) {
312
+				$this->import(dirname(__FILE__).'/../install/tmp/'.$file);
313
+			} elseif ($globalDebug) {
314
+				echo 'Download '.$file.' failed';
315
+			}
281 316
 		}
282 317
 	}
283 318
 
@@ -294,13 +329,17 @@  discard block
 block discarded – undo
294 329
 		$Image = new Image();
295 330
 		$Spotter = new Spotter();
296 331
 
297
-		if (empty($crash)) return false;
332
+		if (empty($crash)) {
333
+			return false;
334
+		}
298 335
 		if (!$new) {
299 336
 			$query_delete = 'DELETE FROM accidents WHERE source = :source';
300 337
 			$sthd = $Connection->db->prepare($query_delete);
301 338
 			$sthd->execute(array(':source' => $crash[0]['source']));
302 339
 		}
303
-		if ($globalTransaction) $Connection->db->beginTransaction();
340
+		if ($globalTransaction) {
341
+			$Connection->db->beginTransaction();
342
+		}
304 343
 		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
305 344
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
306 345
 		$sth_check = $Connection->db->prepare($query_check);
@@ -315,7 +354,9 @@  discard block
 block discarded – undo
315 354
 					return $value === "" ? NULL : $value;
316 355
 				}, $cr);
317 356
 				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
318
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
357
+					if (strpos($cr['registration'],'-') === FALSE) {
358
+						$cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
359
+					}
319 360
 					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
320 361
 					$sth_check->execute($query_check_values);
321 362
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
@@ -324,9 +365,13 @@  discard block
 block discarded – undo
324 365
 						$sth->execute($query_values);
325 366
 						if ($cr['date'] > time()-(30*86400)) {
326 367
 							if (empty($Image->getSpotterImage($cr['registration']))) {
327
-								if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...';
368
+								if ($globalDebug) {
369
+									echo "\t".'Get image for '.$cr['registration'].'...';
370
+								}
328 371
 								$Image->addSpotterImage($cr['registration']);
329
-								if ($globalDebug) echo "\t".'Done'."\n";
372
+								if ($globalDebug) {
373
+									echo "\t".'Done'."\n";
374
+								}
330 375
 							}
331 376
 							// elseif ($globalDebug) echo 'Image already in DB'."\n";
332 377
 						}
@@ -338,9 +383,13 @@  discard block
 block discarded – undo
338 383
 					$Connection->db->beginTransaction();
339 384
 				}
340 385
 			}
341
-			if ($globalTransaction) $Connection->db->commit();
386
+			if ($globalTransaction) {
387
+				$Connection->db->commit();
388
+			}
342 389
 		} catch(PDOException $e) {
343
-			if ($globalTransaction) $Connection->db->rollBack();
390
+			if ($globalTransaction) {
391
+				$Connection->db->rollBack();
392
+			}
344 393
 			echo $e->getMessage();
345 394
 		}
346 395
 		$sth_check->closeCursor();
@@ -379,8 +428,11 @@  discard block
 block discarded – undo
379 428
 			return "error : ".$e->getMessage();
380 429
 		}
381 430
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
382
-		if ($row['nb'] > 0) return false;
383
-		else return true;
431
+		if ($row['nb'] > 0) {
432
+			return false;
433
+		} else {
434
+			return true;
435
+		}
384 436
 	}
385 437
 
386 438
 	public static function insert_last_accidents_update() {
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +401 added lines, -103 removed lines patch added patch discarded remove patch
@@ -154,11 +154,26 @@  discard block
 block discarded – undo
154 154
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
155 155
 				<li><?php echo _("NOTAM scope:"); ?>
156 156
 					<select class="selectpicker" onchange="notamscope(this);">
157
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
158
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
159
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
160
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
161
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
157
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
158
+	print ' selected';
159
+}
160
+?>>All</option>
161
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
162
+	print ' selected';
163
+}
164
+?>>Airport/Enroute warning</option>
165
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
166
+	print ' selected';
167
+}
168
+?>>Airport warning</option>
169
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
170
+	print ' selected';
171
+}
172
+?>>Navigation warning</option>
173
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
174
+	print ' selected';
175
+}
176
+?>>Enroute warning</option>
162 177
 					</select
163 178
 				</li>
164 179
 			</ul>
@@ -186,7 +201,12 @@  discard block
 block discarded – undo
186 201
 		        <div class="form-group">
187 202
 			    <label>From (UTC):</label>
188 203
 		            <div class='input-group date' id='datetimepicker1'>
189
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
204
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
205
+	print $_POST['start_date'];
206
+} elseif (isset($_COOKIE['archive_begin'])) {
207
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
208
+}
209
+?>" required />
190 210
 		                <span class="input-group-addon">
191 211
             			    <span class="glyphicon glyphicon-calendar"></span>
192 212
 		                </span>
@@ -195,7 +215,12 @@  discard block
 block discarded – undo
195 215
 		        <div class="form-group">
196 216
 			    <label>To (UTC):</label>
197 217
 		            <div class='input-group date' id='datetimepicker2'>
198
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
218
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
219
+	print $_POST['end_date'];
220
+} elseif (isset($_COOKIE['archive_end'])) {
221
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
222
+}
223
+?>" />
199 224
             			<span class="input-group-addon">
200 225
 		                    <span class="glyphicon glyphicon-calendar"></span>
201 226
             			</span>
@@ -221,8 +246,20 @@  discard block
 block discarded – undo
221 246
 
222 247
 		    <li><?php echo _("Playback speed:"); ?>
223 248
 			<div class="range">
224
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
225
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
249
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
250
+	print $_POST['archivespeed'];
251
+} elseif (isset($_COOKIE['archive_speed'])) {
252
+	print $_COOKIE['archive_speed'];
253
+} else {
254
+	print '1';
255
+}
256
+?>">
257
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
258
+	print $_COOKIE['archive_speed'];
259
+} else {
260
+	print '1';
261
+}
262
+?></output>
226 263
 			</div>
227 264
 		    </li>
228 265
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -244,15 +281,27 @@  discard block
 block discarded – undo
244 281
 		    <li><?php echo _("Type of Map:"); ?>
245 282
 			<select  class="selectpicker" onchange="mapType(this);">
246 283
 			    <?php
247
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
248
-				else $MapType = $_COOKIE['MapType'];
284
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
285
+					$MapType = $globalMapProvider;
286
+				} else {
287
+					$MapType = $_COOKIE['MapType'];
288
+				}
249 289
 			    ?>
250 290
 			    <?php
251 291
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
252 292
 			    ?>
253
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
254
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
255
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
293
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
294
+	print ' selected';
295
+}
296
+?>>Bing-Aerial</option>
297
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
298
+	print ' selected';
299
+}
300
+?>>Bing-Hybrid</option>
301
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
302
+	print ' selected';
303
+}
304
+?>>Bing-Road</option>
256 305
 			    <?php
257 306
 				}
258 307
 			    ?>
@@ -262,56 +311,131 @@  discard block
 block discarded – undo
262 311
 			    <?php
263 312
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
264 313
 			    ?>
265
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
266
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
267
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
314
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
315
+	print ' selected';
316
+}
317
+?>>Here-Aerial</option>
318
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
319
+	print ' selected';
320
+}
321
+?>>Here-Hybrid</option>
322
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
323
+	print ' selected';
324
+}
325
+?>>Here-Road</option>
268 326
 			    <?php
269 327
 				    }
270 328
 			    ?>
271 329
 			    <?php
272 330
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
273 331
 			    ?>
274
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
275
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
276
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
277
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
332
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
333
+	print ' selected';
334
+}
335
+?>>Google Roadmap</option>
336
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
337
+	print ' selected';
338
+}
339
+?>>Google Satellite</option>
340
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
341
+	print ' selected';
342
+}
343
+?>>Google Hybrid</option>
344
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
345
+	print ' selected';
346
+}
347
+?>>Google Terrain</option>
278 348
 			    <?php
279 349
 				    }
280 350
 			    ?>
281 351
 			    <?php
282 352
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
283 353
 			    ?>
284
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
285
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
286
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
354
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
355
+	print ' selected';
356
+}
357
+?>>MapQuest-OSM</option>
358
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
359
+	print ' selected';
360
+}
361
+?>>MapQuest-Aerial</option>
362
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
363
+	print ' selected';
364
+}
365
+?>>MapQuest-Hybrid</option>
287 366
 			    <?php
288 367
 				    }
289 368
 			    ?>
290
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
369
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
370
+	print ' selected';
371
+}
372
+?>>Yandex</option>
291 373
 			    <?php
292 374
 				}
293 375
 			    ?>
294 376
 			    <?php
295 377
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
296
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
297
-					else $MapBoxId = $_COOKIE['MapTypeId'];
378
+					if (!isset($_COOKIE['MapTypeId'])) {
379
+						$MapBoxId = 'default';
380
+					} else {
381
+						$MapBoxId = $_COOKIE['MapTypeId'];
382
+					}
298 383
 			    ?>
299
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
300
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
301
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
302
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
303
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
304
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
305
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
306
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
307
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
308
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
309
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
310
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
384
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
385
+	print ' selected';
386
+}
387
+?>>Mapbox default</option>
388
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
389
+	print ' selected';
390
+}
391
+?>>Mapbox streets</option>
392
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
393
+	print ' selected';
394
+}
395
+?>>Mapbox light</option>
396
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
397
+	print ' selected';
398
+}
399
+?>>Mapbox dark</option>
400
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
401
+	print ' selected';
402
+}
403
+?>>Mapbox satellite</option>
404
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
405
+	print ' selected';
406
+}
407
+?>>Mapbox streets-satellite</option>
408
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
409
+	print ' selected';
410
+}
411
+?>>Mapbox streets-basic</option>
412
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
413
+	print ' selected';
414
+}
415
+?>>Mapbox comic</option>
416
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
417
+	print ' selected';
418
+}
419
+?>>Mapbox outdoors</option>
420
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
421
+	print ' selected';
422
+}
423
+?>>Mapbox pencil</option>
424
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
425
+	print ' selected';
426
+}
427
+?>>Mapbox pirates</option>
428
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
429
+	print ' selected';
430
+}
431
+?>>Mapbox emerald</option>
311 432
 			    <?php
312 433
 				    }
313 434
 			    ?>
314
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
435
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
436
+	print ' selected';
437
+}
438
+?>>OpenStreetMap</option>
315 439
 			</select>
316 440
 		    </li>
317 441
 <?php
@@ -319,9 +443,18 @@  discard block
 block discarded – undo
319 443
 ?>
320 444
 		    <li><?php echo _("Type of Terrain:"); ?>
321 445
 			<select  class="selectpicker" onchange="terrainType(this);">
322
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
323
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
324
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
446
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
447
+	print ' selected';
448
+}
449
+?>>stk terrain</option>
450
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
451
+	print ' selected';
452
+}
453
+?>>ellipsoid</option>
454
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
455
+	print ' selected';
456
+}
457
+?>>vr terrain</option>
325 458
 			</select>
326 459
 		    </li>
327 460
 <?php
@@ -331,20 +464,44 @@  discard block
 block discarded – undo
331 464
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
332 465
 ?>
333 466
 		    
334
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
335
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
336
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
337
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
338
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
471
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
472
+	print 'checked';
473
+}
474
+?> ><?php echo _("Display flight path"); ?></label></div></li>
475
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) {
476
+	print 'checked';
477
+}
478
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
479
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
480
+	print 'checked';
481
+}
482
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
483
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
484
+	print 'checked';
485
+}
486
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
339 487
 <?php
340 488
     }
341 489
 ?>
342
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
343
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
490
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
491
+	print 'checked';
492
+}
493
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
494
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
495
+	print 'checked';
496
+}
497
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
344 498
 <?php
345 499
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
346 500
 ?>
347
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
501
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
502
+	print 'checked';
503
+}
504
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
348 505
 <?php
349 506
     }
350 507
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -358,17 +515,25 @@  discard block
 block discarded – undo
358 515
 			if (function_exists('array_column')) {
359 516
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
360 517
 		    ?>
361
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
518
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
519
+	print 'checked';
520
+}
521
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
362 522
 		    <?php
363 523
 			    }
364 524
 			} elseif (isset($globalSources)) {
365 525
 			    $dispolar = false;
366 526
 			    foreach ($globalSources as $testsource) {
367
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
527
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
528
+			        	$dispolar = true;
529
+			        }
368 530
 			    }
369 531
 			    if ($dispolar) {
370 532
 		    ?>
371
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
533
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
534
+	print 'checked';
535
+}
536
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
372 537
 		    <?php
373 538
 			    }
374 539
 		        }
@@ -381,12 +546,22 @@  discard block
 block discarded – undo
381 546
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
382 547
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
383 548
 		    ?>
384
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
549
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
550
+	print 'checked';
551
+}
552
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
385 553
 		    <?php 
386 554
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
387 555
 		    ?>
388 556
 		    <li><?php echo _("Aircraft icon color:"); ?>
389
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
557
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
558
+	print $_COOKIE['IconColor'];
559
+} elseif (isset($globalAircraftIconColor)) {
560
+	print $globalAircraftIconColor;
561
+} else {
562
+	print '1a3151';
563
+}
564
+?>">
390 565
 		    </li>
391 566
 		    <?php
392 567
 				}
@@ -398,7 +573,14 @@  discard block
 block discarded – undo
398 573
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
399 574
 		    ?>
400 575
 		    <li><?php echo _("Marine icon color:"); ?>
401
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
576
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
577
+	print $_COOKIE['MarineIconColor'];
578
+} elseif (isset($globalMarineIconColor)) {
579
+	print $globalMarineIconColor;
580
+} else {
581
+	print '1a3151';
582
+}
583
+?>">
402 584
 		    </li>
403 585
 		    <?php
404 586
 			    }
@@ -409,8 +591,22 @@  discard block
 block discarded – undo
409 591
 		    ?>
410 592
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
411 593
 			<div class="range">
412
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
413
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
594
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
595
+	print $_COOKIE['AirportZoom'];
596
+} elseif (isset($globalAirportZoom)) {
597
+	print $globalAirportZoom;
598
+} else {
599
+	print '7';
600
+}
601
+?>">
602
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
603
+	print $_COOKIE['AirportZoom'];
604
+} elseif (isset($globalAirportZoom)) {
605
+	print $globalAirportZoom;
606
+} else {
607
+	print '7';
608
+}
609
+?></output>
414 610
 			</div>
415 611
 		    </li>
416 612
 		    <?php
@@ -422,9 +618,19 @@  discard block
 block discarded – undo
422 618
 <?php
423 619
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
424 620
 ?>
425
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li>
621
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
622
+	print 'checked';
623
+}
624
+?> ><?php echo _("Force Aircraft color"); ?></li>
426 625
 		    <li><?php echo _("Aircraft icon color:"); ?>
427
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
626
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
627
+	print $_COOKIE['IconColor'];
628
+} elseif (isset($globalAircraftIconColor)) {
629
+	print $globalAircraftIconColor;
630
+} else {
631
+	print 'ff0000';
632
+}
633
+?>">
428 634
 		    </li>
429 635
 <?php
430 636
 	}
@@ -432,9 +638,19 @@  discard block
 block discarded – undo
432 638
 <?php
433 639
 	if (isset($globalMarine) && $globalMarine === TRUE) {
434 640
 ?>
435
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li>
641
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
642
+	print 'checked';
643
+}
644
+?> ><?php echo _("Force Marine color"); ?></li>
436 645
 		    <li><?php echo _("Marine icon color:"); ?>
437
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
646
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
647
+	print $_COOKIE['MarineIconColor'];
648
+} elseif (isset($globalMarineIconColor)) {
649
+	print $globalMarineIconColor;
650
+} else {
651
+	print 'ff0000';
652
+}
653
+?>">
438 654
 		    </li>
439 655
 <?php
440 656
 	}
@@ -442,22 +658,46 @@  discard block
 block discarded – undo
442 658
 ?>
443 659
 		    <li><?php echo _("Distance unit:"); ?>
444 660
 			<select class="selectpicker" onchange="unitdistance(this);">
445
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
446
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
447
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
661
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
662
+	echo ' selected';
663
+}
664
+?>>km</option>
665
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
666
+	echo ' selected';
667
+}
668
+?>>nm</option>
669
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
670
+	echo ' selected';
671
+}
672
+?>>mi</option>
448 673
 		        </select>
449 674
 		    </li>
450 675
 		    <li><?php echo _("Altitude unit:"); ?>
451 676
 			<select class="selectpicker" onchange="unitaltitude(this);">
452
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
453
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
677
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
678
+	echo ' selected';
679
+}
680
+?>>m</option>
681
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
682
+	echo ' selected';
683
+}
684
+?>>feet</option>
454 685
 		        </select>
455 686
 		    </li>
456 687
 		    <li><?php echo _("Speed unit:"); ?>
457 688
 			<select class="selectpicker" onchange="unitspeed(this);">
458
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
459
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
460
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
689
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
690
+	echo ' selected';
691
+}
692
+?>>km/h</option>
693
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
694
+	echo ' selected';
695
+}
696
+?>>mph</option>
697
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
698
+	echo ' selected';
699
+}
700
+?>>knots</option>
461 701
 		        </select>
462 702
 		    </li>
463 703
 
@@ -475,9 +715,18 @@  discard block
 block discarded – undo
475 715
 		    <?php
476 716
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
477 717
 		    ?>
478
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
479
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
480
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
718
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
719
+	print 'checked';
720
+}
721
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
722
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
723
+	print 'checked';
724
+}
725
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
726
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
727
+	print 'checked';
728
+}
729
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
481 730
 		    <?php
482 731
 			}
483 732
 		    ?>
@@ -485,10 +734,16 @@  discard block
 block discarded – undo
485 734
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
486 735
 		    ?>
487 736
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
488
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
737
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
738
+	print 'checked';
739
+}
740
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
489 741
 			<?php } ?>
490 742
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
491
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
743
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
744
+	print 'checked';
745
+}
746
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
492 747
 			<?php } ?>
493 748
 		    <?php
494 749
 			}
@@ -505,7 +760,9 @@  discard block
 block discarded – undo
505 760
 				}
506 761
 				foreach($allairlinenames as $airline) {
507 762
 					$airline_name = $airline['airline_name'];
508
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
763
+					if (strlen($airline_name) > 30) {
764
+						$airline_name = substr($airline_name,0,30).'...';
765
+					}
509 766
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
510 767
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
511 768
 					} else {
@@ -523,7 +780,10 @@  discard block
 block discarded – undo
523 780
 		    <li><?php echo _("Display alliance:"); ?>
524 781
 		    <br/>
525 782
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
526
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
783
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
784
+	echo ' selected';
785
+}
786
+?>><?php echo _("All"); ?></option>
527 787
 			    <?php
528 788
 				foreach($allalliancenames as $alliance) {
529 789
 					$alliance_name = $alliance['alliance'];
@@ -570,10 +830,22 @@  discard block
 block discarded – undo
570 830
 		    ?>
571 831
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
572 832
 			<select class="selectpicker" onchange="airlinestype(this);">
573
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
574
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
575
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
576
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
833
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
834
+	echo ' selected';
835
+}
836
+?>><?php echo _("All"); ?></option>
837
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
838
+	echo ' selected';
839
+}
840
+?>><?php echo _("Passenger"); ?></option>
841
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
842
+	echo ' selected';
843
+}
844
+?>><?php echo _("Cargo"); ?></option>
845
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
846
+	echo ' selected';
847
+}
848
+?>><?php echo _("Military"); ?></option>
577 849
 			</select>
578 850
 		    </li>
579 851
 		    <?php
@@ -581,7 +853,10 @@  discard block
 block discarded – undo
581 853
 		    ?>
582 854
 		    <li>
583 855
 			<?php echo _("Display flight with ident:"); ?>
584
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
856
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
857
+	print $_COOKIE['filter_ident'];
858
+}
859
+?>" />
585 860
 		    </li>
586 861
 		    <?php
587 862
 			}
@@ -600,7 +875,10 @@  discard block
 block discarded – undo
600 875
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
601 876
 	    <form>
602 877
 		<ul>
603
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
878
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
879
+	print 'checked';
880
+}
881
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
604 882
 		    <li><?php echo _("Type:"); ?>
605 883
 			<select class="selectpicker" multiple onchange="sattypes(this);">
606 884
 			    <?php
@@ -608,25 +886,45 @@  discard block
 block discarded – undo
608 886
 				$types = $Satellite->get_tle_types();
609 887
 				foreach ($types as $type) {
610 888
 					$type_name = $type['tle_type'];
611
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
612
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
613
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
614
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
615
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
616
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
617
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
618
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
619
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
620
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
621
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
622
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
623
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
624
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
625
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
626
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
627
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
628
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
629
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
889
+					if ($type_name == 'musson') {
890
+						$type_name = 'Russian LEO Navigation';
891
+					} else if ($type_name == 'nnss') {
892
+						$type_name = 'Navi Navigation Satellite System';
893
+					} else if ($type_name == 'sbas') {
894
+						$type_name = 'Satellite-Based Augmentation System';
895
+					} else if ($type_name == 'glo-ops') {
896
+						$type_name = 'Glonass Operational';
897
+					} else if ($type_name == 'gps-ops') {
898
+						$type_name = 'GPS Operational';
899
+					} else if ($type_name == 'argos') {
900
+						$type_name = 'ARGOS Data Collection System';
901
+					} else if ($type_name == 'tdrss') {
902
+						$type_name = 'Tracking and Data Relay Satellite System';
903
+					} else if ($type_name == 'sarsat') {
904
+						$type_name = 'Search & Rescue';
905
+					} else if ($type_name == 'dmc') {
906
+						$type_name = 'Disaster Monitoring';
907
+					} else if ($type_name == 'resource') {
908
+						$type_name = 'Earth Resources';
909
+					} else if ($type_name == 'stations') {
910
+						$type_name = 'Space Stations';
911
+					} else if ($type_name == 'geo') {
912
+						$type_name = 'Geostationary';
913
+					} else if ($type_name == 'amateur') {
914
+						$type_name = 'Amateur Radio';
915
+					} else if ($type_name == 'x-comm') {
916
+						$type_name = 'Experimental';
917
+					} else if ($type_name == 'other-comm') {
918
+						$type_name = 'Other Comm';
919
+					} else if ($type_name == 'science') {
920
+						$type_name = 'Space & Earth Science';
921
+					} else if ($type_name == 'military') {
922
+						$type_name = 'Miscellaneous Military';
923
+					} else if ($type_name == 'radar') {
924
+						$type_name = 'Radar Calibration';
925
+					} else if ($type_name == 'tle-new') {
926
+						$type_name = 'Last 30 days launches';
927
+					}
630 928
 					
631 929
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
632 930
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Braces   +86 added lines, -29 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 		if (isset($filter[0]['source'])) {
30 30
 			$filters = array_merge($filters,$filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
33 35
 		$filter_query_join = '';
34 36
 		$filter_query_where = '';
35 37
 		foreach($filters as $flt) {
@@ -118,8 +120,11 @@  discard block
 block discarded – undo
118 120
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119 121
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
120 122
 		}
121
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
122
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
123
+		if ($filter_query_where == '' && $where) {
124
+			$filter_query_where = ' WHERE';
125
+		} elseif ($filter_query_where != '' && $and) {
126
+			$filter_query_where .= ' AND';
127
+		}
123 128
 		if ($filter_query_where != '') {
124 129
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
125 130
 		}
@@ -160,9 +165,13 @@  discard block
 block discarded – undo
160 165
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
161 166
 			}
162 167
 		}
163
-		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
168
+		if ($orderby_query == '') {
169
+			$orderby_query = ' ORDER BY date DESC';
170
+		}
164 171
 
165
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
172
+		if (!isset($globalLiveInterval)) {
173
+			$globalLiveInterval = '200';
174
+		}
166 175
 		if ($globalDBdriver == 'mysql') {
167 176
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
168 177
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -185,7 +194,9 @@  discard block
 block discarded – undo
185 194
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
186 195
 		date_default_timezone_set('UTC');
187 196
 		$filter_query = $this->getFilter($filter,true,true);
188
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
197
+		if (!isset($globalLiveInterval)) {
198
+			$globalLiveInterval = '200';
199
+		}
189 200
 		if ($globalDBdriver == 'mysql') {
190 201
 			if (isset($globalArchive) && $globalArchive === TRUE) {
191 202
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -228,7 +239,9 @@  discard block
 block discarded – undo
228 239
 
229 240
 		$filter_query = $this->getFilter($filter,true,true);
230 241
 
231
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
242
+		if (!isset($globalLiveInterval)) {
243
+			$globalLiveInterval = '200';
244
+		}
232 245
 		if ($globalDBdriver == 'mysql') {
233 246
 			if (isset($globalArchive) && $globalArchive === TRUE) {
234 247
 				/*
@@ -296,7 +309,9 @@  discard block
 block discarded – undo
296 309
 		global $globalDBdriver, $globalLiveInterval;
297 310
 		$filter_query = $this->getFilter($filter,true,true);
298 311
 
299
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
312
+		if (!isset($globalLiveInterval)) {
313
+			$globalLiveInterval = '200';
314
+		}
300 315
 		if ($globalDBdriver == 'mysql') {
301 316
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
302 317
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -326,7 +341,9 @@  discard block
 block discarded – undo
326 341
 	{
327 342
 		global $globalDBdriver, $globalLiveInterval;
328 343
 		$Spotter = new Spotter($this->db);
329
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
344
+		if (!isset($globalLiveInterval)) {
345
+			$globalLiveInterval = '200';
346
+		}
330 347
 		$filter_query = $this->getFilter($filter);
331 348
 
332 349
 		if (is_array($coord)) {
@@ -334,7 +351,9 @@  discard block
 block discarded – undo
334 351
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
335 352
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
336 353
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
337
-		} else return array();
354
+		} else {
355
+			return array();
356
+		}
338 357
 		if ($globalDBdriver == 'mysql') {
339 358
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
340 359
 		} else {
@@ -355,7 +374,9 @@  discard block
 block discarded – undo
355 374
 	{
356 375
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
357 376
 		$Spotter = new Spotter($this->db);
358
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
377
+		if (!isset($globalLiveInterval)) {
378
+			$globalLiveInterval = '200';
379
+		}
359 380
 		$filter_query = $this->getFilter($filter,true,true);
360 381
 
361 382
 		if (is_array($coord)) {
@@ -363,7 +384,9 @@  discard block
 block discarded – undo
363 384
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
364 385
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
365 386
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
366
-		} else return array();
387
+		} else {
388
+			return array();
389
+		}
367 390
 		if ($globalDBdriver == 'mysql') {
368 391
 			if (isset($globalArchive) && $globalArchive === TRUE) {
369 392
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -593,11 +616,15 @@  discard block
 block discarded – undo
593 616
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
594 617
 		if ($globalDBdriver == 'mysql') {
595 618
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
596
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
619
+			if ($liveinterval) {
620
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
621
+			}
597 622
 			$query .= ' ORDER BY date';
598 623
 		} else {
599 624
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
600
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
625
+			if ($liveinterval) {
626
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
627
+			}
601 628
 			$query .= ' ORDER BY date';
602 629
 		}
603 630
 
@@ -692,7 +719,9 @@  discard block
 block discarded – undo
692 719
 				$i++;
693 720
 				$j++;
694 721
 				if ($j == 30) {
695
-					if ($globalDebug) echo ".";
722
+					if ($globalDebug) {
723
+						echo ".";
724
+					}
696 725
 				    	try {
697 726
 						
698 727
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -999,7 +1028,9 @@  discard block
 block discarded – undo
999 1028
 			{
1000 1029
 				return false;
1001 1030
 			}
1002
-		} else return '';
1031
+		} else {
1032
+			return '';
1033
+		}
1003 1034
 
1004 1035
 		if ($longitude != '')
1005 1036
 		{
@@ -1007,7 +1038,9 @@  discard block
 block discarded – undo
1007 1038
 			{
1008 1039
 				return false;
1009 1040
 			}
1010
-		} else return '';
1041
+		} else {
1042
+			return '';
1043
+		}
1011 1044
 
1012 1045
 		if ($waypoints != '')
1013 1046
 		{
@@ -1023,14 +1056,18 @@  discard block
 block discarded – undo
1023 1056
 			{
1024 1057
 				return false;
1025 1058
 			}
1026
-		} else $altitude = 0;
1059
+		} else {
1060
+			$altitude = 0;
1061
+		}
1027 1062
 		if ($altitude_real != '')
1028 1063
 		{
1029 1064
 			if (!is_numeric($altitude_real))
1030 1065
 			{
1031 1066
 				return false;
1032 1067
 			}
1033
-		} else $altitude_real = 0;
1068
+		} else {
1069
+			$altitude_real = 0;
1070
+		}
1034 1071
 
1035 1072
 		if ($heading != '')
1036 1073
 		{
@@ -1038,7 +1075,9 @@  discard block
 block discarded – undo
1038 1075
 			{
1039 1076
 				return false;
1040 1077
 			}
1041
-		} else $heading = 0;
1078
+		} else {
1079
+			$heading = 0;
1080
+		}
1042 1081
 
1043 1082
 		if ($groundspeed != '')
1044 1083
 		{
@@ -1046,9 +1085,13 @@  discard block
 block discarded – undo
1046 1085
 			{
1047 1086
 				return false;
1048 1087
 			}
1049
-		} else $groundspeed = 0;
1088
+		} else {
1089
+			$groundspeed = 0;
1090
+		}
1050 1091
 		date_default_timezone_set('UTC');
1051
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1092
+		if ($date == '') {
1093
+			$date = date("Y-m-d H:i:s", time());
1094
+		}
1052 1095
 
1053 1096
         
1054 1097
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -1093,14 +1136,24 @@  discard block
 block discarded – undo
1093 1136
 		$arrival_airport_country = '';
1094 1137
 		
1095 1138
             	
1096
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1097
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1098
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1099
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1139
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1140
+            		$squawk = NULL;
1141
+            	}
1142
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1143
+            		$verticalrate = NULL;
1144
+            	}
1145
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1146
+            		$groundspeed = 0;
1147
+            	}
1148
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1149
+            		$heading = 0;
1150
+            	}
1100 1151
 		
1101 1152
 		$query = '';
1102 1153
 		if ($globalArchive) {
1103
-			if ($globalDebug) echo '-- Delete previous data -- ';
1154
+			if ($globalDebug) {
1155
+				echo '-- Delete previous data -- ';
1156
+			}
1104 1157
 			$query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;';
1105 1158
 		}
1106 1159
 
@@ -1117,10 +1170,14 @@  discard block
 block discarded – undo
1117 1170
 			return "error : ".$e->getMessage();
1118 1171
 		}
1119 1172
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1120
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1173
+		    if ($globalDebug) {
1174
+		    	echo '(Add to SBS archive : ';
1175
+		    }
1121 1176
 		    $SpotterArchive = new SpotterArchive($this->db);
1122 1177
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1123
-		    if ($globalDebug) echo $result.')';
1178
+		    if ($globalDebug) {
1179
+		    	echo $result.')';
1180
+		    }
1124 1181
 		} elseif ($globalDebug && $putinarchive !== true) {
1125 1182
 			echo '(Not adding to archive)';
1126 1183
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.