Completed
Push — master ( e8aabf...bcd2cf )
by Yannick
07:24
created
header.php 1 patch
Braces   +32 added lines, -7 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
 ?>
11 14
 <!DOCTYPE html>
12 15
 <html>
@@ -181,7 +184,13 @@  discard block
 block discarded – undo
181 184
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
182 185
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
183 186
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
184
-<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
187
+<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
188
+	print '&latitude='.$latitude;
189
+}
190
+?><?php if(isset($longitude)) {
191
+	print '&longitude='.$longitude;
192
+}
193
+?>&<?php print time(); ?>"></script>
185 194
 <?php
186 195
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
187 196
 ?>
@@ -235,7 +244,13 @@  discard block
 block discarded – undo
235 244
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
236 245
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
237 246
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
238
-<script src="<?php print $globalURL; ?>/js/map.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>
247
+<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
248
+	print '&latitude='.$latitude;
249
+}
250
+?><?php if(isset($longitude)) {
251
+	print '&longitude='.$longitude;
252
+}
253
+?>&<?php print time(); ?>"></script>
239 254
 <?php
240 255
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
241 256
 ?>
@@ -308,7 +323,12 @@  discard block
 block discarded – undo
308 323
         <span class="icon-bar"></span>
309 324
       </button>
310 325
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
311
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
326
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
327
+	print '/';
328
+} else {
329
+	print $globalURL;
330
+}
331
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
312 332
     </div>
313 333
     <div class="collapse navbar-collapse">
314 334
       <ul class="nav navbar-nav">
@@ -386,7 +406,9 @@  discard block
 block discarded – undo
386 406
   		        $alllang = $Language->getLanguages();
387 407
   		        foreach ($alllang as $key => $lang) {
388 408
   		            print '<option value="'.$key.'"';
389
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
409
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
410
+  		            	print ' selected ';
411
+  		            }
390 412
   		            print '>'.$lang[0].'</option>';
391 413
   		        }
392 414
   		    ?>
@@ -533,4 +555,7 @@  discard block
 block discarded – undo
533 555
 
534 556
 ?>
535 557
 
536
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
558
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
559
+	print 'index ';
560
+}
561
+?>clear">
Please login to merge, or discard this patch.
aircraft.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 	print '<h1>'._("Aircrafts Types").'</h1>';
17 17
 
18 18
 	$aircraft_types = $Stats->getAllAircraftTypes();
19
-	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes();
19
+	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') {
20
+		$aircraft_types = $Spotter->getAllAircraftTypes();
21
+	}
20 22
 	$previous = null;
21 23
 	print '<div class="alphabet-legend">';
22 24
 	foreach($aircraft_types as $value) {
@@ -24,7 +26,9 @@  discard block
 block discarded – undo
24 26
 		$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
25 27
 		if($previous !== $firstLetter)
26 28
 		{
27
-			if ($previous !== null) print ' | ';
29
+			if ($previous !== null) {
30
+				print ' | ';
31
+			}
28 32
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
29 33
 		}
30 34
 		$previous = $firstLetter;
@@ -38,7 +42,9 @@  discard block
 block discarded – undo
38 42
 		{
39 43
 			if($previous !== $firstLetter)
40 44
 			{
41
-				if ($previous !== null) print '</div>';
45
+				if ($previous !== null) {
46
+					print '</div>';
47
+				}
42 48
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
43 49
 			}
44 50
 			$previous = $firstLetter;
Please login to merge, or discard this patch.
footer.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,10 @@
 block discarded – undo
9 9
 	<?php
10 10
 	    }
11 11
 	?>
12
-	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://github.com/Ysurac/FlightAirMap/issues" target="_blank">Report any issues</a></span>
12
+	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) {
13
+	print $globalURL;
14
+}
15
+?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://github.com/Ysurac/FlightAirMap/issues" target="_blank">Report any issues</a></span>
13 16
 </footer>
14 17
 
15 18
 <div class="notifications bottom-left"></div>
Please login to merge, or discard this patch.
require/class.NOTAM.php 1 patch
Braces   +208 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1015,8 +1015,11 @@  discard block
 block discarded – undo
1015 1015
 		$data = file_get_contents($filename);
1016 1016
 		preg_match_all("/%%(.+?)%%/is", $data, $matches);
1017 1017
 		//print_r($matches);
1018
-		if (isset($matches[1])) return $matches[1];
1019
-		else return array();
1018
+		if (isset($matches[1])) {
1019
+			return $matches[1];
1020
+		} else {
1021
+			return array();
1022
+		}
1020 1023
 	}
1021 1024
 	public function getAllNOTAMbyScope($scope) {
1022 1025
 		global $globalDBdriver;
@@ -1043,7 +1046,9 @@  discard block
 block discarded – undo
1043 1046
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1044 1047
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1045 1048
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1046
-		} else return array();
1049
+		} else {
1050
+			return array();
1051
+		}
1047 1052
 		if ($globalDBdriver == 'mysql') {
1048 1053
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
1049 1054
 		} else {
@@ -1067,7 +1072,9 @@  discard block
 block discarded – undo
1067 1072
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1068 1073
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1069 1074
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1070
-		} else return array();
1075
+		} else {
1076
+			return array();
1077
+		}
1071 1078
 		if ($globalDBdriver == 'mysql') {
1072 1079
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
1073 1080
 		} else {
@@ -1094,8 +1101,11 @@  discard block
 block discarded – undo
1094 1101
 			return "error : ".$e->getMessage();
1095 1102
 		}
1096 1103
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1097
-		if (isset($all[0])) return $all[0];
1098
-		else return array();
1104
+		if (isset($all[0])) {
1105
+			return $all[0];
1106
+		} else {
1107
+			return array();
1108
+		}
1099 1109
 	}
1100 1110
 
1101 1111
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
@@ -1173,7 +1183,9 @@  discard block
 block discarded – undo
1173 1183
 					foreach ($alldata as $initial_data) {
1174 1184
 						$data = $this->parse($initial_data);
1175 1185
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1176
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1186
+						if (count($notamref) == 0) {
1187
+							$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1188
+						}
1177 1189
 					}
1178 1190
 				}
1179 1191
 			}
@@ -1186,7 +1198,9 @@  discard block
 block discarded – undo
1186 1198
 			foreach ($alldata as $initial_data) {
1187 1199
 				$data = $this->parse($initial_data);
1188 1200
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1189
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1201
+				if (!isset($notamref['notam_id'])) {
1202
+					$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1203
+				}
1190 1204
 			}
1191 1205
 		}
1192 1206
 	}
@@ -1198,11 +1212,15 @@  discard block
 block discarded – undo
1198 1212
 		foreach (array_chunk($allairports,20) as $airport) {
1199 1213
 			$airports_icao = array();
1200 1214
 			foreach($airport as $icao) {
1201
-				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1215
+				if (isset($icao['icao'])) {
1216
+					$airports_icao[] = $icao['icao'];
1217
+				}
1202 1218
 			}
1203 1219
 			$airport_icao = implode(',',$airports_icao);
1204 1220
 			$alldata = $this->downloadNOTAM($airport_icao);
1205
-			if ($globalTransaction) $this->db->beginTransaction();
1221
+			if ($globalTransaction) {
1222
+				$this->db->beginTransaction();
1223
+			}
1206 1224
 			if (count($alldata) > 0) {
1207 1225
 				foreach ($alldata as $initial_data) {
1208 1226
 					//print_r($initial_data);
@@ -1211,14 +1229,23 @@  discard block
 block discarded – undo
1211 1229
 					if (isset($data['ref'])) {
1212 1230
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1213 1231
 						if (count($notamref) == 0) {
1214
-							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1215
-							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1216
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1232
+							if (isset($data['ref_replaced'])) {
1233
+								$this->deleteNOTAMbyRef($data['ref_replaced']);
1234
+							}
1235
+							if (isset($data['ref_cancelled'])) {
1236
+								$this->deleteNOTAMbyRef($data['ref_cancelled']);
1237
+							} elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) {
1238
+								echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1239
+							}
1217 1240
 						}
1218 1241
 					}
1219 1242
 				}
1220
-			} else echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1221
-			if ($globalTransaction) $this->db->commit();
1243
+			} else {
1244
+				echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1245
+			}
1246
+			if ($globalTransaction) {
1247
+				$this->db->commit();
1248
+			}
1222 1249
 			sleep(5);
1223 1250
 		}
1224 1251
 	}
@@ -1231,8 +1258,11 @@  discard block
 block discarded – undo
1231 1258
 		$data = $Common->getData($url);
1232 1259
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1233 1260
 		//print_r($matches);
1234
-		if (isset($matches[1])) return $matches[1];
1235
-		else return array();
1261
+		if (isset($matches[1])) {
1262
+			return $matches[1];
1263
+		} else {
1264
+			return array();
1265
+		}
1236 1266
 	}
1237 1267
 
1238 1268
 	public function parse($data) {
@@ -1255,89 +1285,145 @@  discard block
 block discarded – undo
1255 1285
 					$rules = str_split($matches[3]);
1256 1286
 					foreach ($rules as $rule) {
1257 1287
 						if ($rule == 'I') {
1258
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR';
1259
-							else $result['rules'] = 'IFR';
1288
+							if (isset($result['rules'])) {
1289
+								$result['rules'] = $result['rules'].'/IFR';
1290
+							} else {
1291
+								$result['rules'] = 'IFR';
1292
+							}
1260 1293
 						} elseif ($rule == 'V') {
1261
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR';
1262
-							else $result['rules'] = 'VFR';
1294
+							if (isset($result['rules'])) {
1295
+								$result['rules'] = $result['rules'].'/VFR';
1296
+							} else {
1297
+								$result['rules'] = 'VFR';
1298
+							}
1263 1299
 						} elseif ($rule == 'K') {
1264
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist';
1265
-							else $result['rules'] = 'Checklist';
1300
+							if (isset($result['rules'])) {
1301
+								$result['rules'] = $result['rules'].'/Checklist';
1302
+							} else {
1303
+								$result['rules'] = 'Checklist';
1304
+							}
1266 1305
 						}
1267 1306
 					}
1268 1307
 					$attentions = str_split($matches[4]);
1269 1308
 					foreach ($attentions as $attention) {
1270 1309
 						if ($attention == 'N') {
1271
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention';
1272
-							else $result['rules'] = 'Immediate attention';
1310
+							if (isset($result['attention'])) {
1311
+								$result['attention'] = $result['attention'].' / Immediate attention';
1312
+							} else {
1313
+								$result['rules'] = 'Immediate attention';
1314
+							}
1273 1315
 						} elseif ($attention == 'B') {
1274
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance';
1275
-							else $result['rules'] = 'Operational significance';
1316
+							if (isset($result['attention'])) {
1317
+								$result['attention'] = $result['attention'].' / Operational significance';
1318
+							} else {
1319
+								$result['rules'] = 'Operational significance';
1320
+							}
1276 1321
 						} elseif ($attention == 'O') {
1277
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations';
1278
-							else $result['rules'] = 'Flight operations';
1322
+							if (isset($result['attention'])) {
1323
+								$result['attention'] = $result['attention'].' / Flight operations';
1324
+							} else {
1325
+								$result['rules'] = 'Flight operations';
1326
+							}
1279 1327
 						} elseif ($attention == 'M') {
1280
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc';
1281
-							else $result['rules'] = 'Misc';
1328
+							if (isset($result['attention'])) {
1329
+								$result['attention'] = $result['attention'].' / Misc';
1330
+							} else {
1331
+								$result['rules'] = 'Misc';
1332
+							}
1282 1333
 						} elseif ($attention == 'K') {
1283
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist';
1284
-							else $result['rules'] = 'Checklist';
1334
+							if (isset($result['attention'])) {
1335
+								$result['attention'] = $result['attention'].' / Checklist';
1336
+							} else {
1337
+								$result['rules'] = 'Checklist';
1338
+							}
1285 1339
 						}
1286 1340
 					}
1287
-					if ($matches[5] == 'A') $result['scope'] = 'Airport warning';
1288
-					elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning';
1289
-					elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning';
1290
-					elseif ($matches[5] == 'K') $result['scope'] = 'Checklist';
1291
-					elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning';
1292
-					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1341
+					if ($matches[5] == 'A') {
1342
+						$result['scope'] = 'Airport warning';
1343
+					} elseif ($matches[5] == 'E') {
1344
+						$result['scope'] = 'Enroute warning';
1345
+					} elseif ($matches[5] == 'W') {
1346
+						$result['scope'] = 'Navigation warning';
1347
+					} elseif ($matches[5] == 'K') {
1348
+						$result['scope'] = 'Checklist';
1349
+					} elseif ($matches[5] == 'AE') {
1350
+						$result['scope'] = 'Airport/Enroute warning';
1351
+					} elseif ($matches[5] == 'AW') {
1352
+						$result['scope'] = 'Airport/Navigation warning';
1353
+					}
1293 1354
 					$result['lower_limit'] = $matches[6];
1294 1355
 					$result['upper_limit'] = $matches[7];
1295 1356
 					$latitude = $Common->convertDec($matches[8],'latitude');
1296
-					if ($matches[9] == 'S') $latitude = -$latitude;
1357
+					if ($matches[9] == 'S') {
1358
+						$latitude = -$latitude;
1359
+					}
1297 1360
 					$longitude = $Common->convertDec($matches[10],'longitude');
1298
-					if ($matches[11] == 'W') $longitude = -$longitude;
1361
+					if ($matches[11] == 'W') {
1362
+						$longitude = -$longitude;
1363
+					}
1299 1364
 					$result['latitude'] = $latitude;
1300 1365
 					$result['longitude'] = $longitude;
1301 1366
 					$result['radius'] = intval($matches[12]);
1302
-				} else echo 'ERROR : '.$line."\n";
1303
-			}
1304
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1367
+				} else {
1368
+					echo 'ERROR : '.$line."\n";
1369
+				}
1370
+			} elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1305 1371
 				$result['icao'] = $matches[1];
1306
-			}
1307
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1308
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1309
-				else $year = '20'.$matches[1];
1372
+			} elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1373
+				if ($matches[1] > 50) {
1374
+					$year = '19'.$matches[1];
1375
+				} else {
1376
+					$year = '20'.$matches[1];
1377
+				}
1310 1378
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1311
-			}
1312
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1313
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1314
-				else $year = '20'.$matches[1];
1379
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1380
+				if ($matches[1] > 50) {
1381
+					$year = '19'.$matches[1];
1382
+				} else {
1383
+					$year = '20'.$matches[1];
1384
+				}
1315 1385
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1316 1386
 				$result['permanent'] = 0;
1317
-			}
1318
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1319
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1320
-				else $year = '20'.$matches[1];
1387
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1388
+				if ($matches[1] > 50) {
1389
+					$year = '19'.$matches[1];
1390
+				} else {
1391
+					$year = '20'.$matches[1];
1392
+				}
1321 1393
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1322
-				if ($matches[6] == 'EST') $result['estimated'] = 1;
1323
-				else $result['estimated'] = 0;
1324
-				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1325
-				else $result['permanent'] = 0;
1326
-			}
1327
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1394
+				if ($matches[6] == 'EST') {
1395
+					$result['estimated'] = 1;
1396
+				} else {
1397
+					$result['estimated'] = 0;
1398
+				}
1399
+				if ($matches[6] == 'PERM') {
1400
+					$result['permanent'] = 1;
1401
+				} else {
1402
+					$result['permanent'] = 0;
1403
+				}
1404
+			} elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1328 1405
 				$result['date_end'] = '2030/12/20 12:00';
1329
-				if ($matches[1] == 'EST') $result['estimated'] = 1;
1330
-				else $result['estimated'] = 0;
1331
-				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1332
-				else $result['permanent'] = 0;
1333
-			}
1334
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1406
+				if ($matches[1] == 'EST') {
1407
+					$result['estimated'] = 1;
1408
+				} else {
1409
+					$result['estimated'] = 0;
1410
+				}
1411
+				if ($matches[1] == 'PERM') {
1412
+					$result['permanent'] = 1;
1413
+				} else {
1414
+					$result['permanent'] = 0;
1415
+				}
1416
+			} elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1335 1417
 				$rtext = array();
1336 1418
 				$text = explode(' ',$matches[1]);
1337 1419
 				foreach ($text as $word) {
1338
-					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1339
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1340
-					else $rtext[] = $word;
1420
+					if (isset($this->abbr[$word])) {
1421
+						$rtext[] = strtoupper($this->abbr[$word]);
1422
+					} elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) {
1423
+						$rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1424
+					} else {
1425
+						$rtext[] = $word;
1426
+					}
1341 1427
 				}
1342 1428
 				$result['text'] = implode(' ',$rtext);
1343 1429
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
@@ -1345,7 +1431,9 @@  discard block
 block discarded – undo
1345 1431
 			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1346 1432
 				$text = explode(' ',$line);
1347 1433
 				$result['ref'] = $text[0];
1348
-				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1434
+				if ($matches[1] == 'NOTAMN') {
1435
+					$result['type'] = 'new';
1436
+				}
1349 1437
 				if ($matches[1] == 'NOTAMC') {
1350 1438
 					$result['type'] = 'cancel';
1351 1439
 					$result['ref_cancelled'] = $text[2];
@@ -1367,69 +1455,101 @@  discard block
 block discarded – undo
1367 1455
 		switch ($code[1]) {
1368 1456
 			case 'A':
1369 1457
 				$result = 'Airspace organization ';
1370
-				if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp];
1458
+				if (isset($this->code_airspace[$code_fp])) {
1459
+					$result .= $this->code_airspace[$code_fp];
1460
+				}
1371 1461
 				break;
1372 1462
 			case 'C':
1373 1463
 				$result = 'Communications and radar facilities ';
1374
-				if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp];
1464
+				if (isset($this->code_comradar[$code_fp])) {
1465
+					$result .= $this->code_comradar[$code_fp];
1466
+				}
1375 1467
 				break;
1376 1468
 			case 'F':
1377 1469
 				$result = 'Facilities and services ';
1378
-				if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp];
1470
+				if (isset($this->code_facilities[$code_fp])) {
1471
+					$result .= $this->code_facilities[$code_fp];
1472
+				}
1379 1473
 				break;
1380 1474
 			case 'I':
1381 1475
 				$result = 'Instrument and Microwave Landing System ';
1382
-				if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp];
1476
+				if (isset($this->code_instrumentlanding[$code_fp])) {
1477
+					$result .= $this->code_instrumentlanding[$code_fp];
1478
+				}
1383 1479
 				break;
1384 1480
 			case 'L':
1385 1481
 				$result = 'Lighting facilities ';
1386
-				if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp];
1482
+				if (isset($this->code_lightingfacilities[$code_fp])) {
1483
+					$result .= $this->code_lightingfacilities[$code_fp];
1484
+				}
1387 1485
 				break;
1388 1486
 			case 'M':
1389 1487
 				$result = 'Movement and landing areas ';
1390
-				if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp];
1488
+				if (isset($this->code_movementareas[$code_fp])) {
1489
+					$result .= $this->code_movementareas[$code_fp];
1490
+				}
1391 1491
 				break;
1392 1492
 			case 'N':
1393 1493
 				$result = 'Terminal and En Route Navigation Facilities ';
1394
-				if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp];
1494
+				if (isset($this->code_terminalfacilities[$code_fp])) {
1495
+					$result .= $this->code_terminalfacilities[$code_fp];
1496
+				}
1395 1497
 				break;
1396 1498
 			case 'O':
1397 1499
 				$result = 'Other information ';
1398
-				if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp];
1500
+				if (isset($this->code_information[$code_fp])) {
1501
+					$result .= $this->code_information[$code_fp];
1502
+				}
1399 1503
 				break;
1400 1504
 			case 'P':
1401 1505
 				$result = 'Air Traffic procedures ';
1402
-				if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp];
1506
+				if (isset($this->code_airtraffic[$code_fp])) {
1507
+					$result .= $this->code_airtraffic[$code_fp];
1508
+				}
1403 1509
 				break;
1404 1510
 			case 'R':
1405 1511
 				$result = 'Navigation Warnings: Airspace Restrictions ';
1406
-				if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp];
1512
+				if (isset($this->code_navigationw[$code_fp])) {
1513
+					$result .= $this->code_navigationw[$code_fp];
1514
+				}
1407 1515
 				break;
1408 1516
 			case 'S':
1409 1517
 				$result = 'Air Traffic and VOLMET Services ';
1410
-				if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp];
1518
+				if (isset($this->code_volmet[$code_fp])) {
1519
+					$result .= $this->code_volmet[$code_fp];
1520
+				}
1411 1521
 				break;
1412 1522
 			case 'W':
1413 1523
 				$result = 'Navigation Warnings: Warnings ';
1414
-				if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp];
1524
+				if (isset($this->code_warnings[$code_fp])) {
1525
+					$result .= $this->code_warnings[$code_fp];
1526
+				}
1415 1527
 				break;
1416 1528
 		}
1417 1529
 		switch ($code[3]) {
1418 1530
 			case 'A':
1419 1531
 				// Availability
1420
-				if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp];
1532
+				if (isset($this->code_sp_availabity[$code_sp])) {
1533
+					$result .= ' '.$this->code_sp_availabity[$code_sp];
1534
+				}
1421 1535
 				break;
1422 1536
 			case 'C':
1423 1537
 				// Changes
1424
-				if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp];
1538
+				if (isset($this->code_sp_changes[$code_sp])) {
1539
+					$result .= ' '.$this->code_sp_changes[$code_sp];
1540
+				}
1425 1541
 				break;
1426 1542
 			case 'H':
1427 1543
 				// Hazardous conditions
1428
-				if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp];
1544
+				if (isset($this->code_sp_hazardous[$code_sp])) {
1545
+					$result .= ' '.$this->code_sp_hazardous[$code_sp];
1546
+				}
1429 1547
 				break;
1430 1548
 			case 'L':
1431 1549
 				// Limitations
1432
-				if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp];
1550
+				if (isset($this->code_sp_limitations[$code_sp])) {
1551
+					$result .= ' '.$this->code_sp_limitations[$code_sp];
1552
+				}
1433 1553
 				break;
1434 1554
 			case 'X':
1435 1555
 				// Other Information
Please login to merge, or discard this patch.
airspace-data.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 $airspace = $result[0];
26 26
 date_default_timezone_set('UTC');
27 27
 print '<div class="top">';
28
-if (isset($airspace['name'])) $airspace['title'] = $airspace['name']; 
28
+if (isset($airspace['name'])) {
29
+	$airspace['title'] = $airspace['name'];
30
+}
29 31
 print '<div class="right"><div class="callsign-details"><div class="callsign">'.$airspace['title'].'</a></div>';
30 32
 print '</div>';
31 33
 print '<div class="details">';
@@ -44,13 +46,17 @@  discard block
 block discarded – undo
44 46
 	print '</div>';
45 47
 }
46 48
 
47
-if (isset($airspace['ceiling'])) $airspace['tops'] = $airspace['ceiling'];
49
+if (isset($airspace['ceiling'])) {
50
+	$airspace['tops'] = $airspace['ceiling'];
51
+}
48 52
 print '<div>';
49 53
 print '<span>'._("Tops").'</span>';
50 54
 print $airspace['tops'];
51 55
 print '</div>';
52 56
 
53
-if (isset($airspace['floor'])) $airspace['base'] = $airspace['floor'];
57
+if (isset($airspace['floor'])) {
58
+	$airspace['base'] = $airspace['floor'];
59
+}
54 60
 print '<div>';
55 61
 print '<span>'._("Base").'</span>';
56 62
 print $airspace['base'];
Please login to merge, or discard this patch.
airspace-geojson.php 1 patch
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,12 +67,22 @@
 block discarded – undo
67 67
 		} else {
68 68
 			$geom = geoPHP::load(stream_get_contents($row['wkb']));
69 69
 		}
70
-		if (isset($properties['type'])) $properties['type'] = trim($properties['type']);
71
-		elseif (isset($properties['class'])) $properties['type'] = trim($properties['class']);
72
-		if (isset($properties['ogr_fid'])) $properties['id'] = $properties['ogr_fid'];
73
-		elseif (isset($properties['ogc_fid'])) $properties['id'] = $properties['ogc_fid'];
74
-		if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling'];
75
-		if (isset($properties['floor'])) $properties['base'] = $properties['floor'];
70
+		if (isset($properties['type'])) {
71
+			$properties['type'] = trim($properties['type']);
72
+		} elseif (isset($properties['class'])) {
73
+			$properties['type'] = trim($properties['class']);
74
+		}
75
+		if (isset($properties['ogr_fid'])) {
76
+			$properties['id'] = $properties['ogr_fid'];
77
+		} elseif (isset($properties['ogc_fid'])) {
78
+			$properties['id'] = $properties['ogc_fid'];
79
+		}
80
+		if (isset($properties['ceiling'])) {
81
+			$properties['tops'] = $properties['ceiling'];
82
+		}
83
+		if (isset($properties['floor'])) {
84
+			$properties['base'] = $properties['floor'];
85
+		}
76 86
 		if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) {
77 87
 			$properties['upper_limit'] = round($matches['alt']*100*0.38048);
78 88
 		} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['tops']),$matches)) {
Please login to merge, or discard this patch.
install/class.create_db.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 			//foreach ($lines as $line)
15 15
 			while (($line = fgets($handle,4096)) !== false)
16 16
 			{
17
-				if (substr($line,0,2) == '--' || $line == '') continue;
17
+				if (substr($line,0,2) == '--' || $line == '') {
18
+					continue;
19
+				}
18 20
 				$templine .= $line;
19 21
 				if (substr(trim($line), -1,1) == ';')
20 22
 				{
@@ -40,7 +42,9 @@  discard block
 block discarded – undo
40 42
 		//foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename)
41 43
 		while(false !== ($filename = readdir($dh)))
42 44
 		{
43
-		    if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename);
45
+		    if (preg_match('/\.sql$/',$filename)) {
46
+		    	$error .= create_db::import_file($directory.$filename);
47
+		    }
44 48
 		}
45 49
 		return $error;
46 50
 	}
@@ -56,13 +60,17 @@  discard block
 block discarded – undo
56 60
 		// Dirty hack
57 61
 		if ($host != 'localhost' && $host != '127.0.0.1') {
58 62
 		    $grantright = $_SERVER['SERVER_ADDR'];
59
-		} else $grantright = 'localhost';
63
+		} else {
64
+			$grantright = 'localhost';
65
+		}
60 66
 		try {
61 67
 			$dbh = new PDO($db_type.':host='.$host,$root,$root_pass);
62 68
 			$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
63 69
 			if ($db_type == 'mysql') {
64 70
 				$dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
65
-				if ($grantright == 'localhost') $dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
71
+				if ($grantright == 'localhost') {
72
+					$dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
73
+				}
66 74
 			} else if ($db_type == 'pgsql') {
67 75
 				$dbh->exec("CREATE DATABASE ".$db.";");
68 76
 				$dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."';
Please login to merge, or discard this patch.
require/class.Connection.php 1 patch
Braces   +77 added lines, -30 removed lines patch added patch discarded remove patch
@@ -64,8 +64,11 @@  discard block
 block discarded – undo
64 64
 				$globalDBSname = $globalDBname;
65 65
 				$globalDBSuser = $globalDBuser;
66 66
 				$globalDBSpass = $globalDBpass;
67
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
68
-				else $globalDBSport = $globalDBport;
67
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
68
+					$globalDBSport = 3306;
69
+				} else {
70
+					$globalDBSport = $globalDBport;
71
+				}
69 72
 			} else {
70 73
 				$DBname = 'default';
71 74
 				$globalDBSdriver = $globalDBdriver;
@@ -73,8 +76,11 @@  discard block
 block discarded – undo
73 76
 				$globalDBSname = $globalDBname;
74 77
 				$globalDBSuser = $user;
75 78
 				$globalDBSpass = $pass;
76
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
77
-				else $globalDBSport = $globalDBport;
79
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
80
+					$globalDBSport = 3306;
81
+				} else {
82
+					$globalDBSport = $globalDBport;
83
+				}
78 84
 			}
79 85
 		} else {
80 86
 			$globalDBSdriver = $globalDB[$DBname]['driver'];
@@ -82,11 +88,16 @@  discard block
 block discarded – undo
82 88
 			$globalDBSname = $globalDB[$DBname]['name'];
83 89
 			$globalDBSuser = $globalDB[$DBname]['user'];
84 90
 			$globalDBSpass = $globalDB[$DBname]['pass'];
85
-			if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port'];
86
-			else $globalDBSport = 3306;
91
+			if (isset($globalDB[$DBname]['port'])) {
92
+				$globalDBSport = $globalDB[$DBname]['port'];
93
+			} else {
94
+				$globalDBSport = 3306;
95
+			}
87 96
 		}
88 97
 		// Set number of try to connect to DB
89
-		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5;
98
+		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) {
99
+			$globalDBretry = 5;
100
+		}
90 101
 		$i = 0;
91 102
 		while (true) {
92 103
 			try {
@@ -95,10 +106,16 @@  discard block
 block discarded – undo
95 106
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
96 107
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
97 108
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
98
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
99
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
100
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
101
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
109
+					if (!isset($globalDBTimeOut)) {
110
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
111
+					} else {
112
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
113
+					}
114
+					if (!isset($globalDBPersistent)) {
115
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
116
+					} else {
117
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
118
+					}
102 119
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
103 120
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
104 121
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -112,22 +129,34 @@  discard block
 block discarded – undo
112 129
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
113 130
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
114 131
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
115
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
116
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
117
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
118
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
132
+					if (!isset($globalDBTimeOut)) {
133
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
134
+					} else {
135
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
136
+					}
137
+					if (!isset($globalDBPersistent)) {
138
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
139
+					} else {
140
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
141
+					}
119 142
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
120 143
 				}
121 144
 				break;
122 145
 			} catch(PDOException $e) {
123 146
 				$i++;
124
-				if (isset($globalDebug) && $globalDebug) echo $e->getMessage()."\n";
147
+				if (isset($globalDebug) && $globalDebug) {
148
+					echo $e->getMessage()."\n";
149
+				}
125 150
 				//exit;
126
-				if ($i > $globalDBretry) return false;
151
+				if ($i > $globalDBretry) {
152
+					return false;
153
+				}
127 154
 				//return false;
128 155
 			}
129 156
 		}
130
-		if ($DBname === 'default') $this->db = $this->dbs['default'];
157
+		if ($DBname === 'default') {
158
+			$this->db = $this->dbs['default'];
159
+		}
131 160
 		return true;
132 161
 	}
133 162
 
@@ -139,7 +168,9 @@  discard block
 block discarded – undo
139 168
 		} else {
140 169
 			$query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'";
141 170
 		}
142
-		if ($this->db == NULL) return false;
171
+		if ($this->db == NULL) {
172
+			return false;
173
+		}
143 174
 		try {
144 175
 			//$Connection = new Connection();
145 176
 			$results = $this->db->query($query);
@@ -148,21 +179,28 @@  discard block
 block discarded – undo
148 179
 		}
149 180
 		if($results->rowCount()>0) {
150 181
 		    return true; 
182
+		} else {
183
+			return false;
151 184
 		}
152
-		else return false;
153 185
 	}
154 186
 
155 187
 	public function connectionExists()
156 188
 	{
157 189
 		global $globalDBdriver, $globalDBCheckConnection;
158
-		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true;
190
+		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) {
191
+			return true;
192
+		}
159 193
 		$query = "SELECT 1 + 1";
160
-		if ($this->db === null) return false;
194
+		if ($this->db === null) {
195
+			return false;
196
+		}
161 197
 		try {
162 198
 			$sum = @$this->db->query($query);
163 199
 			if ($sum instanceof \PDOStatement) {
164 200
 				$sum = $sum->fetchColumn(0);
165
-			} else $sum = 0;
201
+			} else {
202
+				$sum = 0;
203
+			}
166 204
 			if (intval($sum) !== 2) {
167 205
 			     return false;
168 206
 			}
@@ -196,8 +234,9 @@  discard block
 block discarded – undo
196 234
 		}
197 235
 		if($results->rowCount()>0) {
198 236
 		    return true; 
237
+		} else {
238
+			return false;
199 239
 		}
200
-		else return false;
201 240
 	}
202 241
 
203 242
 	/*
@@ -240,9 +279,12 @@  discard block
 block discarded – undo
240 279
 				echo "error : ".$e->getMessage()."\n";
241 280
 			}
242 281
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
243
-			if ($result['nb'] > 0) return true;
244
-			else return false;
245
-/*		} else {
282
+			if ($result['nb'] > 0) {
283
+				return true;
284
+			} else {
285
+				return false;
286
+			}
287
+			/*		} else {
246 288
 			$query = "SELECT * FROM ".$table." LIMIT 0";
247 289
 			try {
248 290
 				$results = $this->db->query($query);
@@ -280,7 +322,9 @@  discard block
 block discarded – undo
280 322
 				$result = $sth->fetch(PDO::FETCH_ASSOC);
281 323
 				return $result['value'];
282 324
 			}
283
-		} else return $version;
325
+		} else {
326
+			return $version;
327
+		}
284 328
 	}
285 329
 	
286 330
 	/*
@@ -288,8 +332,11 @@  discard block
 block discarded – undo
288 332
 	* @return Boolean if latest version or not
289 333
 	*/
290 334
 	public function latest() {
291
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
292
-	    else return false;
335
+	    if ($this->check_schema_version() == $this->latest_schema) {
336
+	    	return true;
337
+	    } else {
338
+	    	return false;
339
+	    }
293 340
 	}
294 341
 
295 342
 }
Please login to merge, or discard this patch.
install/index.php 1 patch
Braces   +409 added lines, -106 removed lines patch added patch discarded remove patch
@@ -124,45 +124,72 @@  discard block
 block discarded – undo
124 124
 			</div>
125 125
 			<p>
126 126
 				<label for="dbhost">Database hostname</label>
127
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
127
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
128
+	print $globalDBhost;
129
+}
130
+?>" />
128 131
 			</p>
129 132
 			<p>
130 133
 				<label for="dbport">Database port</label>
131
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
134
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
135
+	print $globalDBport;
136
+}
137
+?>" />
132 138
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
133 139
 			</p>
134 140
 			<p>
135 141
 				<label for="dbname">Database name</label>
136
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
142
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
143
+	print $globalDBname;
144
+}
145
+?>" />
137 146
 			</p>
138 147
 			<p>
139 148
 				<label for="dbuser">Database user</label>
140
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
149
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
150
+	print $globalDBuser;
151
+}
152
+?>" />
141 153
 			</p>
142 154
 			<p>
143 155
 				<label for="dbuserpass">Database user password</label>
144
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
156
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
157
+	print $globalDBpass;
158
+}
159
+?>" />
145 160
 			</p>
146 161
 		</fieldset>
147 162
 		<fieldset id="site">
148 163
 			<legend>Site configuration</legend>
149 164
 			<p>
150 165
 				<label for="sitename">Site name</label>
151
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
166
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
167
+	print $globalName;
168
+}
169
+?>" />
152 170
 			</p>
153 171
 			<p>
154 172
 				<label for="siteurl">Site directory</label>
155
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
173
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
174
+	print $globalURL;
175
+}
176
+?>" />
156 177
 				<p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
157 178
 			</p>
158 179
 			<p>
159 180
 				<label for="timezone">Timezone</label>
160
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
181
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
182
+	print $globalTimezone;
183
+}
184
+?>" />
161 185
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
162 186
 			</p>
163 187
 			<p>
164 188
 				<label for="language">Language</label>
165
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
189
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
190
+	print $globalLanguage;
191
+}
192
+?>" />
166 193
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
167 194
 			</p>
168 195
 		</fieldset>
@@ -183,11 +210,17 @@  discard block
 block discarded – undo
183 210
 			<div id="mapbox_data">
184 211
 				<p>
185 212
 					<label for="mapboxid">Mapbox id</label>
186
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
213
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
214
+	print $globalMapboxId;
215
+}
216
+?>" />
187 217
 				</p>
188 218
 				<p>
189 219
 					<label for="mapboxtoken">Mapbox token</label>
190
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
220
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
221
+	print $globalMapboxToken;
222
+}
223
+?>" />
191 224
 				</p>
192 225
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
193 226
 			</div>
@@ -195,7 +228,10 @@  discard block
 block discarded – undo
195 228
 			<div id="google_data">
196 229
 				<p>
197 230
 					<label for="googlekey">Google API key</label>
198
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
231
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
232
+	print $globalGoogleAPIKey;
233
+}
234
+?>" />
199 235
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
200 236
 				</p>
201 237
 			</div>
@@ -203,7 +239,10 @@  discard block
 block discarded – undo
203 239
 			<div id="bing_data">
204 240
 				<p>
205 241
 					<label for="bingkey">Bing Map key</label>
206
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
242
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
243
+	print $globalBingMapKey;
244
+}
245
+?>" />
207 246
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
208 247
 				</p>
209 248
 			</div>
@@ -211,7 +250,10 @@  discard block
 block discarded – undo
211 250
 			<div id="mapquest_data">
212 251
 				<p>
213 252
 					<label for="mapquestkey">MapQuest key</label>
214
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
253
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
254
+	print $globalMapQuestKey;
255
+}
256
+?>" />
215 257
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
216 258
 				</p>
217 259
 			</div>
@@ -219,11 +261,17 @@  discard block
 block discarded – undo
219 261
 			<div id="here_data">
220 262
 				<p>
221 263
 					<label for="hereappid">Here App_Id</label>
222
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
264
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
265
+	print $globalHereappId;
266
+}
267
+?>" />
223 268
 				</p>
224 269
 				<p>
225 270
 					<label for="hereappcode">Here App_Code</label>
226
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
271
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
272
+	print $globalHereappCode;
273
+}
274
+?>" />
227 275
 				</p>
228 276
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
229 277
 			</div>
@@ -232,42 +280,86 @@  discard block
 block discarded – undo
232 280
 			<legend>Coverage area</legend>
233 281
 			<p>
234 282
 				<label for="latitudemax">The maximum latitude (north)</label>
235
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
283
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
284
+	print $globalLatitudeMax;
285
+}
286
+?>" />
236 287
 			</p>
237 288
 			<p>
238 289
 				<label for="latitudemin">The minimum latitude (south)</label>
239
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
290
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
291
+	print $globalLatitudeMin;
292
+}
293
+?>" />
240 294
 			</p>
241 295
 			<p>
242 296
 				<label for="longitudemax">The maximum longitude (west)</label>
243
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
297
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
298
+	print $globalLongitudeMax;
299
+}
300
+?>" />
244 301
 			</p>
245 302
 			<p>
246 303
 				<label for="longitudemin">The minimum longitude (east)</label>
247
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
304
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
305
+	print $globalLongitudeMin;
306
+}
307
+?>" />
248 308
 			</p>
249 309
 			<p>
250 310
 				<label for="latitudecenter">The latitude center</label>
251
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
311
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
312
+	print $globalCenterLatitude;
313
+}
314
+?>" />
252 315
 			</p>
253 316
 			<p>
254 317
 				<label for="longitudecenter">The longitude center</label>
255
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
318
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
319
+	print $globalCenterLongitude;
320
+}
321
+?>" />
256 322
 			</p>
257 323
 			<p>
258 324
 				<label for="livezoom">Default Zoom on live map</label>
259
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
325
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
326
+	print $globalLiveZoom;
327
+} else {
328
+	print '9';
329
+}
330
+?>" />
260 331
 			</p>
261 332
 			<p>
262 333
 				<label for="squawk_country">Country for squawk usage</label>
263 334
 				<select name="squawk_country" id="squawk_country">
264
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
265
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
266
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
267
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
268
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
269
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
270
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
335
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
336
+	print ' selected ';
337
+}
338
+?>>UK</option>
339
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
340
+	print ' selected ';
341
+}
342
+?>>NZ</option>
343
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
344
+	print ' selected ';
345
+}
346
+?>>US</option>
347
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
348
+	print ' selected ';
349
+}
350
+?>>AU</option>
351
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
352
+	print ' selected ';
353
+}
354
+?>>NL</option>
355
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
356
+	print ' selected ';
357
+}
358
+?>>FR</option>
359
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
360
+	print ' selected ';
361
+}
362
+?>>TR</option>
271 363
 				</select>
272 364
 			</p>
273 365
 		</fieldset>
@@ -276,15 +368,24 @@  discard block
 block discarded – undo
276 368
 			<p><i>Only put in DB flights that are inside a circle</i></p>
277 369
 			<p>
278 370
 				<label for="latitude">Center latitude</label>
279
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
371
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
372
+	echo $globalDistanceIgnore['latitude'];
373
+}
374
+?>" />
280 375
 			</p>
281 376
 			<p>
282 377
 				<label for="longitude">Center longitude</label>
283
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
378
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
379
+	echo $globalDistanceIgnore['longitude'];
380
+}
381
+?>" />
284 382
 			</p>
285 383
 			<p>
286 384
 				<label for="Distance">Distance (in km)</label>
287
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
385
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
386
+	echo $globalDistanceIgnore['distance'];
387
+}
388
+?>" />
288 389
 			</p>
289 390
 		</fieldset>
290 391
 		<fieldset id="sourceloc">
@@ -379,11 +480,17 @@  discard block
 block discarded – undo
379 480
 			<div id="flightaware_data">
380 481
 				<p>
381 482
 					<label for="flightawareusername">FlightAware username</label>
382
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
483
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
484
+	print $globalFlightAwareUsername;
485
+}
486
+?>" />
383 487
 				</p>
384 488
 				<p>
385 489
 					<label for="flightawarepassword">FlightAware password/API key</label>
386
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
490
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
491
+	print $globalFlightAwarePassword;
492
+}
493
+?>" />
387 494
 				</p>
388 495
 			</div>
389 496
 -->
@@ -442,25 +549,76 @@  discard block
 block discarded – undo
442 549
 								?>
443 550
 								<td>
444 551
 									<select name="format[]" id="format">
445
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
446
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
447
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
448
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
449
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
450
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
451
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
452
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server</option>
453
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
454
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
455
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
456
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
457
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
458
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
459
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS over SBS-3 TCP</option>
552
+										<option value="auto" <?php if (!isset($source['format'])) {
553
+	print 'selected';
554
+}
555
+?>>Auto</option>
556
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
557
+	print 'selected';
558
+}
559
+?>>SBS</option>
560
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
561
+	print 'selected';
562
+}
563
+?>>TSV</option>
564
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
565
+	print 'selected';
566
+}
567
+?>>Raw</option>
568
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
569
+	print 'selected';
570
+}
571
+?>>APRS</option>
572
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
573
+	print 'selected';
574
+}
575
+?>>Radarcape deltadb.txt</option>
576
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
577
+	print 'selected';
578
+}
579
+?>>Vatsim</option>
580
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
581
+	print 'selected';
582
+}
583
+?>>Virtual Radar Server</option>
584
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
585
+	print 'selected';
586
+}
587
+?>>phpVMS</option>
588
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
589
+	print 'selected';
590
+}
591
+?>>Virtual Airlines Manager</option>
592
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
593
+	print 'selected';
594
+}
595
+?>>IVAO</option>
596
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
597
+	print 'selected';
598
+}
599
+?>>FlightGear Multiplayer</option>
600
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
601
+	print 'selected';
602
+}
603
+?>>FlightGear Singleplayer</option>
604
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
605
+	print 'selected';
606
+}
607
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
608
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
609
+	print 'selected';
610
+}
611
+?>>ACARS over SBS-3 TCP</option>
460 612
 									</select>
461 613
 								</td>
462
-								<td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /></td>
463
-								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
614
+								<td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
615
+	print $source['name'];
616
+}
617
+?>" /></td>
618
+								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) {
619
+	print 'checked';
620
+}
621
+?> /></td>
464 622
 								<td><input type="button" id="delhost" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhost" value="Add" onclick="insRow()" /></td>
465 623
 							</tr>
466 624
 <?php
@@ -506,11 +664,17 @@  discard block
 block discarded – undo
506 664
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
507 665
 					<p>
508 666
 						<label for="acarshost">ACARS UDP host</label>
509
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
667
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
668
+	print $globalACARSHost;
669
+}
670
+?>" />
510 671
 					</p>
511 672
 					<p>
512 673
 						<label for="acarsport">ACARS UDP port</label>
513
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
674
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
675
+	print $globalACARSPort;
676
+}
677
+?>" />
514 678
 					</p>
515 679
 				</fieldset>
516 680
 			</div>
@@ -585,13 +749,19 @@  discard block
 block discarded – undo
585 749
 			<div id="schedules_options">
586 750
 				<p>
587 751
 					<label for="britishairways">British Airways API Key</label>
588
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
752
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
753
+	print $globalBritishAirwaysKey;
754
+}
755
+?>" />
589 756
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
590 757
 				</p>
591 758
 				<!--
592 759
 				<p>
593 760
 					<label for="transavia">Transavia Test API Consumer Key</label>
594
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
761
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
762
+	print $globalTransaviaKey;
763
+}
764
+?>" />
595 765
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
596 766
 				</p>
597 767
 				-->
@@ -600,10 +770,16 @@  discard block
 block discarded – undo
600 770
 						<b>Lufthansa API Key</b>
601 771
 						<p>
602 772
 							<label for="lufthansakey">Key</label>
603
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
773
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
774
+	print $globalLufthansaKey['key'];
775
+}
776
+?>" />
604 777
 						</p><p>
605 778
 							<label for="lufthansasecret">Secret</label>
606
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
779
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
780
+	print $globalLufthansaKey['secret'];
781
+}
782
+?>" />
607 783
 						</p>
608 784
 					</div>
609 785
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -623,7 +799,10 @@  discard block
 block discarded – undo
623 799
 			</p>
624 800
 			<p>
625 801
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
626
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
802
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
803
+	print $globalNOTAMSource;
804
+}
805
+?>" />
627 806
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
628 807
 			</p>
629 808
 			<br />
@@ -639,14 +818,20 @@  discard block
 block discarded – undo
639 818
 			<div id="metarsrc">
640 819
 				<p>
641 820
 					<label for="metarsource">URL of your METAR source</label>
642
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
821
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
822
+	print $globalMETARurl;
823
+}
824
+?>" />
643 825
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
644 826
 				</p>
645 827
 			</div>
646 828
 			<br />
647 829
 			<p>
648 830
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
649
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
831
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
832
+	print $globalBitlyAccessToken;
833
+}
834
+?>" />
650 835
 			</p>
651 836
 			<br />
652 837
 			<p>
@@ -660,7 +845,12 @@  discard block
 block discarded – undo
660 845
 			</p>
661 846
 			<p>
662 847
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
663
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" />
848
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
849
+	print $globalArchiveMonths;
850
+} else {
851
+	echo '0';
852
+}
853
+?>" />
664 854
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
665 855
 			</p>
666 856
 			<p>
@@ -670,12 +860,22 @@  discard block
 block discarded – undo
670 860
 			</p>
671 861
 			<p>
672 862
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
673
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" />
863
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
864
+	print $globalArchiveKeepMonths;
865
+} else {
866
+	echo '0';
867
+}
868
+?>" />
674 869
 				<p class="help-block">0 to disable</p>
675 870
 			</p>
676 871
 			<p>
677 872
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
678
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" />
873
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
874
+	print $globalArchiveKeepTrackMonths;
875
+} else {
876
+	echo '0';
877
+}
878
+?>" />
679 879
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
680 880
 			</p>
681 881
 			<br />
@@ -685,7 +885,12 @@  discard block
 block discarded – undo
685 885
 				<p class="help-block">Uncheck if the script is running as cron job</p>
686 886
 				<div id="cronends"> 
687 887
 					<label for="cronend">Run script for xx seconds</label>
688
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
888
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
889
+	print $globalCronEnd;
890
+} else {
891
+	print '0';
892
+}
893
+?>" />
689 894
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
690 895
 				</div>
691 896
 			</p>
@@ -725,26 +930,49 @@  discard block
 block discarded – undo
725 930
 			<br />
726 931
 			<p>
727 932
 				<label for="refresh">Show flights detected since xxx seconds</label>
728
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
933
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
934
+	echo $globalLiveInterval;
935
+} else {
936
+	echo '200';
937
+}
938
+?>" />
729 939
 			</p>
730 940
 			<p>
731 941
 				<label for="maprefresh">Live map refresh (in seconds)</label>
732
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
942
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
943
+	echo $globalMapRefresh;
944
+} else {
945
+	echo '30';
946
+}
947
+?>" />
733 948
 			</p>
734 949
 			<p>
735 950
 				<label for="mapidle">Map idle timeout (in minutes)</label>
736
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
951
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
952
+	echo $globalMapIdleTimeout;
953
+} else {
954
+	echo '30';
955
+}
956
+?>" />
737 957
 				<p class="help-block">0 to disable</p>
738 958
 			</p>
739 959
 			<br />
740 960
 			<p>
741 961
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
742
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
962
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
963
+	echo $globalClosestMinDist;
964
+} else {
965
+	echo '50';
966
+}
967
+?>" />
743 968
 			</p>
744 969
 			<br />
745 970
 			<p>
746 971
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
747
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
972
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
973
+	echo $globalAircraftSize;
974
+}
975
+?>" />
748 976
 			</p>
749 977
 			<br />
750 978
 			<p>
@@ -752,7 +980,12 @@  discard block
 block discarded – undo
752 980
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
753 981
 			?>
754 982
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
755
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
983
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
984
+	echo $globalAircraftIconColor;
985
+} else {
986
+	echo '1a3151';
987
+}
988
+?>" />
756 989
 			<?php
757 990
 				if (!is_writable('../cache')) {
758 991
 			?>
@@ -770,8 +1003,18 @@  discard block
 block discarded – undo
770 1003
 			<p>
771 1004
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
772 1005
 				<div class="range">
773
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
774
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1006
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1007
+	echo $globalAirportZoom;
1008
+} else {
1009
+	echo '7';
1010
+}
1011
+?>" />
1012
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1013
+	echo $globalAirportZoom;
1014
+} else {
1015
+	echo '7';
1016
+}
1017
+?></output>
775 1018
 				</div>
776 1019
 			</p>
777 1020
 		</fieldset>
@@ -799,8 +1042,12 @@  discard block
 block discarded – undo
799 1042
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
800 1043
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
801 1044
 
802
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
803
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1045
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1046
+		$error .= 'Mysql driver for PDO must be loaded';
1047
+	}
1048
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1049
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1050
+	}
804 1051
 	
805 1052
 	$_SESSION['database_root'] = $dbroot;
806 1053
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -867,15 +1114,23 @@  discard block
 block discarded – undo
867 1114
 	$source_city = $_POST['source_city'];
868 1115
 	$source_country = $_POST['source_country'];
869 1116
 	$source_ref = $_POST['source_ref'];
870
-	if (isset($source_id)) $source_id = $_POST['source_id'];
871
-	else $source_id = array();
1117
+	if (isset($source_id)) {
1118
+		$source_id = $_POST['source_id'];
1119
+	} else {
1120
+		$source_id = array();
1121
+	}
872 1122
 	
873 1123
 	$sources = array();
874 1124
 	foreach ($source_name as $keys => $name) {
875
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
876
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1125
+	    if (isset($source_id[$keys])) {
1126
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1127
+	    } else {
1128
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1129
+	    }
1130
+	}
1131
+	if (count($sources) > 0) {
1132
+		$_SESSION['sources'] = $sources;
877 1133
 	}
878
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
879 1134
 
880 1135
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
881 1136
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -913,13 +1168,21 @@  discard block
 block discarded – undo
913 1168
 	$port = $_POST['port'];
914 1169
 	$name = $_POST['name'];
915 1170
 	$format = $_POST['format'];
916
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
917
-	else $sourcestats = array();
1171
+	if (isset($_POST['sourcestats'])) {
1172
+		$sourcestats = $_POST['sourcestats'];
1173
+	} else {
1174
+		$sourcestats = array();
1175
+	}
918 1176
 	$gSources = array();
919 1177
 	foreach ($host as $key => $h) {
920
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
921
-		else $cov = 'FALSE';
922
-		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov);
1178
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1179
+			$cov = 'TRUE';
1180
+		} else {
1181
+			$cov = 'FALSE';
1182
+		}
1183
+		if ($h != '') {
1184
+			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov);
1185
+		}
923 1186
 	}
924 1187
 	$settings = array_merge($settings,array('globalSources' => $gSources));
925 1188
 
@@ -943,7 +1206,9 @@  discard block
 block discarded – undo
943 1206
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
944 1207
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
945 1208
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
946
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1209
+	} else {
1210
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1211
+	}
947 1212
 
948 1213
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
949 1214
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -982,7 +1247,9 @@  discard block
 block discarded – undo
982 1247
 
983 1248
 	// Create in settings.php keys not yet configurable if not already here
984 1249
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
985
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1250
+	if (!isset($globalDebug)) {
1251
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1252
+	}
986 1253
 
987 1254
 	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
988 1255
 	if ($archive == 'archive') {
@@ -1012,27 +1279,43 @@  discard block
 block discarded – undo
1012 1279
 	}
1013 1280
 */
1014 1281
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1015
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1016
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1017
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1018
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1282
+	if ($globalsbs == 'sbs') {
1283
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1284
+	} else {
1285
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1286
+	}
1287
+	if ($globalaprs == 'aprs') {
1288
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1289
+	} else {
1290
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1291
+	}
1019 1292
 	if ($globalivao == 'ivao') {
1020 1293
 		//$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE'));
1021 1294
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1022
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1295
+	} else {
1296
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1297
+	}
1023 1298
 	if ($globalvatsim == 'vatsim') {
1024 1299
 		//$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE'));
1025 1300
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1026
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1301
+	} else {
1302
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1303
+	}
1027 1304
 	if ($globalphpvms == 'phpvms') {
1028 1305
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1029
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1306
+	} else {
1307
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1308
+	}
1030 1309
 	if ($globalvam == 'vam') {
1031 1310
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1032
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1311
+	} else {
1312
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1313
+	}
1033 1314
 	if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') {
1034 1315
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1035
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1316
+	} else {
1317
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1318
+	}
1036 1319
 	
1037 1320
 
1038 1321
 
@@ -1156,7 +1439,9 @@  discard block
 block discarded – undo
1156 1439
 		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1157 1440
 	}
1158 1441
 
1159
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1442
+	if (!isset($globalTransaction)) {
1443
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1444
+	}
1160 1445
 
1161 1446
 	// Set some defaults values...
1162 1447
 	if (!isset($globalAircraftImageSources)) {
@@ -1171,15 +1456,23 @@  discard block
 block discarded – undo
1171 1456
 
1172 1457
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1173 1458
 
1174
-	if ($error == '') settings::modify_settings($settings);
1175
-	if ($error == '') settings::comment_settings($settings_comment);
1459
+	if ($error == '') {
1460
+		settings::modify_settings($settings);
1461
+	}
1462
+	if ($error == '') {
1463
+		settings::comment_settings($settings_comment);
1464
+	}
1176 1465
 	if ($error != '') {
1177 1466
 		print '<div class="info column">'.$error.'</div>';
1178 1467
 		require('../footer.php');
1179 1468
 		exit;
1180 1469
 	} else {
1181
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1182
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
1470
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
1471
+			$_SESSION['waypoints'] = 1;
1472
+		}
1473
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
1474
+			$_SESSION['owner'] = 1;
1475
+		}
1183 1476
 		if (isset($_POST['createdb'])) {
1184 1477
 			$_SESSION['install'] = 'database_create';
1185 1478
 		} else {
@@ -1220,10 +1513,18 @@  discard block
 block discarded – undo
1220 1513
 	$popw = false;
1221 1514
 	foreach ($_SESSION['done'] as $done) {
1222 1515
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1223
-	    if ($done == 'Create database') $pop = true;
1224
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1225
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1226
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1516
+	    if ($done == 'Create database') {
1517
+	    	$pop = true;
1518
+	    }
1519
+	    if ($_SESSION['install'] == 'database_create') {
1520
+	    	$pop = true;
1521
+	    }
1522
+	    if ($_SESSION['install'] == 'database_import') {
1523
+	    	$popi = true;
1524
+	    }
1525
+	    if ($_SESSION['install'] == 'waypoints') {
1526
+	    	$popw = true;
1527
+	    }
1227 1528
 	}
1228 1529
 	if ($pop) {
1229 1530
 	    sleep(5);
@@ -1234,7 +1535,9 @@  discard block
 block discarded – undo
1234 1535
 	} else if ($popw) {
1235 1536
 	    sleep(5);
1236 1537
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1237
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1538
+	} else {
1539
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1540
+	}
1238 1541
 	print '</div></ul>';
1239 1542
 	print '<div id="error"></div>';
1240 1543
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.