Completed
Push — master ( 0179ab...235564 )
by Yannick
26:03
created
require/class.NOTAM.php 1 patch
Braces   +210 added lines, -89 removed lines patch added patch discarded remove patch
@@ -1033,8 +1033,11 @@  discard block
 block discarded – undo
1033 1033
 		$data = file_get_contents($filename);
1034 1034
 		preg_match_all("/%%(.+?)%%/is", $data, $matches);
1035 1035
 		//print_r($matches);
1036
-		if (isset($matches[1])) return $matches[1];
1037
-		else return array();
1036
+		if (isset($matches[1])) {
1037
+			return $matches[1];
1038
+		} else {
1039
+			return array();
1040
+		}
1038 1041
 	}
1039 1042
 	public function getAllNOTAMbyScope($scope) {
1040 1043
 		global $globalDBdriver;
@@ -1071,7 +1074,9 @@  discard block
 block discarded – undo
1071 1074
 				$minlong = $maxlong;
1072 1075
 				$maxlong = $tmplong;
1073 1076
 			}
1074
-		} else return array();
1077
+		} else {
1078
+			return array();
1079
+		}
1075 1080
 		if ($globalDBdriver == 'mysql') {
1076 1081
 			$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()';
1077 1082
 		} else {
@@ -1095,7 +1100,9 @@  discard block
 block discarded – undo
1095 1100
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1096 1101
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1097 1102
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1098
-		} else return array();
1103
+		} else {
1104
+			return array();
1105
+		}
1099 1106
 		if ($globalDBdriver == 'mysql') {
1100 1107
 			$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';
1101 1108
 		} else {
@@ -1122,8 +1129,11 @@  discard block
 block discarded – undo
1122 1129
 			return "error : ".$e->getMessage();
1123 1130
 		}
1124 1131
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1125
-		if (isset($all[0])) return $all[0];
1126
-		else return array();
1132
+		if (isset($all[0])) {
1133
+			return $all[0];
1134
+		} else {
1135
+			return array();
1136
+		}
1127 1137
 	}
1128 1138
 
1129 1139
 	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) {
@@ -1201,7 +1211,9 @@  discard block
 block discarded – undo
1201 1211
 					foreach ($alldata as $initial_data) {
1202 1212
 						$data = $this->parse($initial_data);
1203 1213
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1204
-						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']);
1214
+						if (count($notamref) == 0) {
1215
+							$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']);
1216
+						}
1205 1217
 					}
1206 1218
 				}
1207 1219
 			}
@@ -1214,7 +1226,9 @@  discard block
 block discarded – undo
1214 1226
 			foreach ($alldata as $initial_data) {
1215 1227
 				$data = $this->parse($initial_data);
1216 1228
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1217
-				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']);
1229
+				if (!isset($notamref['notam_id'])) {
1230
+					$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']);
1231
+				}
1218 1232
 			}
1219 1233
 		}
1220 1234
 	}
@@ -1226,11 +1240,15 @@  discard block
 block discarded – undo
1226 1240
 		foreach (array_chunk($allairports,20) as $airport) {
1227 1241
 			$airports_icao = array();
1228 1242
 			foreach($airport as $icao) {
1229
-				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1243
+				if (isset($icao['icao'])) {
1244
+					$airports_icao[] = $icao['icao'];
1245
+				}
1230 1246
 			}
1231 1247
 			$airport_icao = implode(',',$airports_icao);
1232 1248
 			$alldata = $this->downloadNOTAM($airport_icao);
1233
-			if ($globalTransaction) $this->db->beginTransaction();
1249
+			if ($globalTransaction) {
1250
+				$this->db->beginTransaction();
1251
+			}
1234 1252
 			if (count($alldata) > 0) {
1235 1253
 				foreach ($alldata as $initial_data) {
1236 1254
 					//print_r($initial_data);
@@ -1239,14 +1257,23 @@  discard block
 block discarded – undo
1239 1257
 					if (isset($data['ref'])) {
1240 1258
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1241 1259
 						if (count($notamref) == 0) {
1242
-							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1243
-							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1244
-							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']);
1260
+							if (isset($data['ref_replaced'])) {
1261
+								$this->deleteNOTAMbyRef($data['ref_replaced']);
1262
+							}
1263
+							if (isset($data['ref_cancelled'])) {
1264
+								$this->deleteNOTAMbyRef($data['ref_cancelled']);
1265
+							} elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) {
1266
+								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']);
1267
+							}
1245 1268
 						}
1246 1269
 					}
1247 1270
 				}
1248
-			} else echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1249
-			if ($globalTransaction) $this->db->commit();
1271
+			} else {
1272
+				echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1273
+			}
1274
+			if ($globalTransaction) {
1275
+				$this->db->commit();
1276
+			}
1250 1277
 			sleep(5);
1251 1278
 		}
1252 1279
 	}
@@ -1259,8 +1286,11 @@  discard block
 block discarded – undo
1259 1286
 		$data = $Common->getData($url);
1260 1287
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1261 1288
 		//print_r($matches);
1262
-		if (isset($matches[1])) return $matches[1];
1263
-		else return array();
1289
+		if (isset($matches[1])) {
1290
+			return $matches[1];
1291
+		} else {
1292
+			return array();
1293
+		}
1264 1294
 	}
1265 1295
 
1266 1296
 	public function parse($data) {
@@ -1294,99 +1324,156 @@  discard block
 block discarded – undo
1294 1324
 					$rules = str_split($matches[3]);
1295 1325
 					foreach ($rules as $rule) {
1296 1326
 						if ($rule == 'I') {
1297
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR';
1298
-							else $result['rules'] = 'IFR';
1327
+							if (isset($result['rules'])) {
1328
+								$result['rules'] = $result['rules'].'/IFR';
1329
+							} else {
1330
+								$result['rules'] = 'IFR';
1331
+							}
1299 1332
 						} elseif ($rule == 'V') {
1300
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR';
1301
-							else $result['rules'] = 'VFR';
1333
+							if (isset($result['rules'])) {
1334
+								$result['rules'] = $result['rules'].'/VFR';
1335
+							} else {
1336
+								$result['rules'] = 'VFR';
1337
+							}
1302 1338
 						} elseif ($rule == 'K') {
1303
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist';
1304
-							else $result['rules'] = 'Checklist';
1339
+							if (isset($result['rules'])) {
1340
+								$result['rules'] = $result['rules'].'/Checklist';
1341
+							} else {
1342
+								$result['rules'] = 'Checklist';
1343
+							}
1305 1344
 						}
1306 1345
 					}
1307 1346
 					$attentions = str_split($matches[4]);
1308 1347
 					foreach ($attentions as $attention) {
1309 1348
 						if ($attention == 'N') {
1310
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention';
1311
-							else $result['rules'] = 'Immediate attention';
1349
+							if (isset($result['attention'])) {
1350
+								$result['attention'] = $result['attention'].' / Immediate attention';
1351
+							} else {
1352
+								$result['rules'] = 'Immediate attention';
1353
+							}
1312 1354
 						} elseif ($attention == 'B') {
1313
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance';
1314
-							else $result['rules'] = 'Operational significance';
1355
+							if (isset($result['attention'])) {
1356
+								$result['attention'] = $result['attention'].' / Operational significance';
1357
+							} else {
1358
+								$result['rules'] = 'Operational significance';
1359
+							}
1315 1360
 						} elseif ($attention == 'O') {
1316
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations';
1317
-							else $result['rules'] = 'Flight operations';
1361
+							if (isset($result['attention'])) {
1362
+								$result['attention'] = $result['attention'].' / Flight operations';
1363
+							} else {
1364
+								$result['rules'] = 'Flight operations';
1365
+							}
1318 1366
 						} elseif ($attention == 'M') {
1319
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc';
1320
-							else $result['rules'] = 'Misc';
1367
+							if (isset($result['attention'])) {
1368
+								$result['attention'] = $result['attention'].' / Misc';
1369
+							} else {
1370
+								$result['rules'] = 'Misc';
1371
+							}
1321 1372
 						} elseif ($attention == 'K') {
1322
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist';
1323
-							else $result['rules'] = 'Checklist';
1373
+							if (isset($result['attention'])) {
1374
+								$result['attention'] = $result['attention'].' / Checklist';
1375
+							} else {
1376
+								$result['rules'] = 'Checklist';
1377
+							}
1324 1378
 						}
1325 1379
 					}
1326
-					if ($matches[5] == 'A') $result['scope'] = 'Airport warning';
1327
-					elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning';
1328
-					elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning';
1329
-					elseif ($matches[5] == 'K') $result['scope'] = 'Checklist';
1330
-					elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning';
1331
-					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1380
+					if ($matches[5] == 'A') {
1381
+						$result['scope'] = 'Airport warning';
1382
+					} elseif ($matches[5] == 'E') {
1383
+						$result['scope'] = 'Enroute warning';
1384
+					} elseif ($matches[5] == 'W') {
1385
+						$result['scope'] = 'Navigation warning';
1386
+					} elseif ($matches[5] == 'K') {
1387
+						$result['scope'] = 'Checklist';
1388
+					} elseif ($matches[5] == 'AE') {
1389
+						$result['scope'] = 'Airport/Enroute warning';
1390
+					} elseif ($matches[5] == 'AW') {
1391
+						$result['scope'] = 'Airport/Navigation warning';
1392
+					}
1332 1393
 					$result['lower_limit'] = $matches[6];
1333 1394
 					$result['upper_limit'] = $matches[7];
1334 1395
 					$latitude = $Common->convertDec($matches[8],'latitude');
1335
-					if ($matches[9] == 'S') $latitude = -$latitude;
1396
+					if ($matches[9] == 'S') {
1397
+						$latitude = -$latitude;
1398
+					}
1336 1399
 					$longitude = $Common->convertDec($matches[10],'longitude');
1337
-					if ($matches[11] == 'W') $longitude = -$longitude;
1400
+					if ($matches[11] == 'W') {
1401
+						$longitude = -$longitude;
1402
+					}
1338 1403
 					$result['latitude'] = $latitude;
1339 1404
 					$result['longitude'] = $longitude;
1340
-					if ($matches[12] != '') $result['radius'] = intval($matches[12]);
1341
-					else $result['radius'] = 0;
1405
+					if ($matches[12] != '') {
1406
+						$result['radius'] = intval($matches[12]);
1407
+					} else {
1408
+						$result['radius'] = 0;
1409
+					}
1342 1410
 					$q = true;
1343 1411
 				} elseif ($globalDebug) {
1344 1412
 					echo 'NOTAM error : '.$result['full_notam']."\n";
1345 1413
 					echo "Can't parse : ".$line."\n";
1346 1414
 				}
1347
-			}
1348
-			elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) {
1415
+			} elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) {
1349 1416
 				$result['icao'] = $matches[2];
1350 1417
 				$a = true;
1351
-			}
1352
-			elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) {
1353
-				if ($matches[1] > 50) $year = '19'.$matches[2];
1354
-				else $year = '20'.$matches[2];
1418
+			} elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) {
1419
+				if ($matches[1] > 50) {
1420
+					$year = '19'.$matches[2];
1421
+				} else {
1422
+					$year = '20'.$matches[2];
1423
+				}
1355 1424
 				$result['date_begin'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6];
1356 1425
 				$b = true;
1357
-			}
1358
-			elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) {
1359
-				if ($matches[2] > 50) $year = '19'.$matches[2];
1360
-				else $year = '20'.$matches[2];
1426
+			} elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) {
1427
+				if ($matches[2] > 50) {
1428
+					$year = '19'.$matches[2];
1429
+				} else {
1430
+					$year = '20'.$matches[2];
1431
+				}
1361 1432
 				$result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6];
1362 1433
 				$result['permanent'] = 0;
1363 1434
 				$c = true;
1364
-			}
1365
-			elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) {
1366
-				if ($matches[2] > 50) $year = '19'.$matches[2];
1367
-				else $year = '20'.$matches[2];
1435
+			} elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) {
1436
+				if ($matches[2] > 50) {
1437
+					$year = '19'.$matches[2];
1438
+				} else {
1439
+					$year = '20'.$matches[2];
1440
+				}
1368 1441
 				$result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6];
1369
-				if ($matches[7] == 'EST') $result['estimated'] = 1;
1370
-				else $result['estimated'] = 0;
1371
-				if ($matches[7] == 'PERM') $result['permanent'] = 1;
1372
-				else $result['permanent'] = 0;
1442
+				if ($matches[7] == 'EST') {
1443
+					$result['estimated'] = 1;
1444
+				} else {
1445
+					$result['estimated'] = 0;
1446
+				}
1447
+				if ($matches[7] == 'PERM') {
1448
+					$result['permanent'] = 1;
1449
+				} else {
1450
+					$result['permanent'] = 0;
1451
+				}
1373 1452
 				$c = true;
1374
-			}
1375
-			elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) {
1453
+			} elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) {
1376 1454
 				$result['date_end'] = '2030/12/20 12:00';
1377
-				if ($matches[2] == 'EST') $result['estimated'] = 1;
1378
-				else $result['estimated'] = 0;
1379
-				if ($matches[2] == 'PERM') $result['permanent'] = 1;
1380
-				else $result['permanent'] = 0;
1455
+				if ($matches[2] == 'EST') {
1456
+					$result['estimated'] = 1;
1457
+				} else {
1458
+					$result['estimated'] = 0;
1459
+				}
1460
+				if ($matches[2] == 'PERM') {
1461
+					$result['permanent'] = 1;
1462
+				} else {
1463
+					$result['permanent'] = 0;
1464
+				}
1381 1465
 				$c = true;
1382
-			}
1383
-			elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) {
1466
+			} elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) {
1384 1467
 				$rtext = array();
1385 1468
 				$text = explode(' ',$matches[2]);
1386 1469
 				foreach ($text as $word) {
1387
-					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1388
-					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);
1389
-					else $rtext[] = $word;
1470
+					if (isset($this->abbr[$word])) {
1471
+						$rtext[] = strtoupper($this->abbr[$word]);
1472
+					} elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) {
1473
+						$rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1474
+					} else {
1475
+						$rtext[] = $word;
1476
+					}
1390 1477
 				}
1391 1478
 				$result['text'] = implode(' ',$rtext);
1392 1479
 				$e = true;
@@ -1395,7 +1482,9 @@  discard block
 block discarded – undo
1395 1482
 			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1396 1483
 				$text = explode(' ',$line);
1397 1484
 				$result['ref'] = $text[0];
1398
-				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1485
+				if ($matches[1] == 'NOTAMN') {
1486
+					$result['type'] = 'new';
1487
+				}
1399 1488
 				if ($matches[1] == 'NOTAMC') {
1400 1489
 					$result['type'] = 'cancel';
1401 1490
 					$result['ref_cancelled'] = $text[2];
@@ -1417,69 +1506,101 @@  discard block
 block discarded – undo
1417 1506
 		switch ($code[1]) {
1418 1507
 			case 'A':
1419 1508
 				$result = 'Airspace organization ';
1420
-				if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp];
1509
+				if (isset($this->code_airspace[$code_fp])) {
1510
+					$result .= $this->code_airspace[$code_fp];
1511
+				}
1421 1512
 				break;
1422 1513
 			case 'C':
1423 1514
 				$result = 'Communications and radar facilities ';
1424
-				if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp];
1515
+				if (isset($this->code_comradar[$code_fp])) {
1516
+					$result .= $this->code_comradar[$code_fp];
1517
+				}
1425 1518
 				break;
1426 1519
 			case 'F':
1427 1520
 				$result = 'Facilities and services ';
1428
-				if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp];
1521
+				if (isset($this->code_facilities[$code_fp])) {
1522
+					$result .= $this->code_facilities[$code_fp];
1523
+				}
1429 1524
 				break;
1430 1525
 			case 'I':
1431 1526
 				$result = 'Instrument and Microwave Landing System ';
1432
-				if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp];
1527
+				if (isset($this->code_instrumentlanding[$code_fp])) {
1528
+					$result .= $this->code_instrumentlanding[$code_fp];
1529
+				}
1433 1530
 				break;
1434 1531
 			case 'L':
1435 1532
 				$result = 'Lighting facilities ';
1436
-				if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp];
1533
+				if (isset($this->code_lightingfacilities[$code_fp])) {
1534
+					$result .= $this->code_lightingfacilities[$code_fp];
1535
+				}
1437 1536
 				break;
1438 1537
 			case 'M':
1439 1538
 				$result = 'Movement and landing areas ';
1440
-				if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp];
1539
+				if (isset($this->code_movementareas[$code_fp])) {
1540
+					$result .= $this->code_movementareas[$code_fp];
1541
+				}
1441 1542
 				break;
1442 1543
 			case 'N':
1443 1544
 				$result = 'Terminal and En Route Navigation Facilities ';
1444
-				if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp];
1545
+				if (isset($this->code_terminalfacilities[$code_fp])) {
1546
+					$result .= $this->code_terminalfacilities[$code_fp];
1547
+				}
1445 1548
 				break;
1446 1549
 			case 'O':
1447 1550
 				$result = 'Other information ';
1448
-				if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp];
1551
+				if (isset($this->code_information[$code_fp])) {
1552
+					$result .= $this->code_information[$code_fp];
1553
+				}
1449 1554
 				break;
1450 1555
 			case 'P':
1451 1556
 				$result = 'Air Traffic procedures ';
1452
-				if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp];
1557
+				if (isset($this->code_airtraffic[$code_fp])) {
1558
+					$result .= $this->code_airtraffic[$code_fp];
1559
+				}
1453 1560
 				break;
1454 1561
 			case 'R':
1455 1562
 				$result = 'Navigation Warnings: Airspace Restrictions ';
1456
-				if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp];
1563
+				if (isset($this->code_navigationw[$code_fp])) {
1564
+					$result .= $this->code_navigationw[$code_fp];
1565
+				}
1457 1566
 				break;
1458 1567
 			case 'S':
1459 1568
 				$result = 'Air Traffic and VOLMET Services ';
1460
-				if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp];
1569
+				if (isset($this->code_volmet[$code_fp])) {
1570
+					$result .= $this->code_volmet[$code_fp];
1571
+				}
1461 1572
 				break;
1462 1573
 			case 'W':
1463 1574
 				$result = 'Navigation Warnings: Warnings ';
1464
-				if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp];
1575
+				if (isset($this->code_warnings[$code_fp])) {
1576
+					$result .= $this->code_warnings[$code_fp];
1577
+				}
1465 1578
 				break;
1466 1579
 		}
1467 1580
 		switch ($code[3]) {
1468 1581
 			case 'A':
1469 1582
 				// Availability
1470
-				if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp];
1583
+				if (isset($this->code_sp_availabity[$code_sp])) {
1584
+					$result .= ' '.$this->code_sp_availabity[$code_sp];
1585
+				}
1471 1586
 				break;
1472 1587
 			case 'C':
1473 1588
 				// Changes
1474
-				if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp];
1589
+				if (isset($this->code_sp_changes[$code_sp])) {
1590
+					$result .= ' '.$this->code_sp_changes[$code_sp];
1591
+				}
1475 1592
 				break;
1476 1593
 			case 'H':
1477 1594
 				// Hazardous conditions
1478
-				if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp];
1595
+				if (isset($this->code_sp_hazardous[$code_sp])) {
1596
+					$result .= ' '.$this->code_sp_hazardous[$code_sp];
1597
+				}
1479 1598
 				break;
1480 1599
 			case 'L':
1481 1600
 				// Limitations
1482
-				if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp];
1601
+				if (isset($this->code_sp_limitations[$code_sp])) {
1602
+					$result .= ' '.$this->code_sp_limitations[$code_sp];
1603
+				}
1483 1604
 				break;
1484 1605
 			case 'X':
1485 1606
 				// Other Information
Please login to merge, or discard this patch.
import/callback.php 1 patch
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,15 +27,21 @@  discard block
 block discarded – undo
27 27
 		}
28 28
 	}
29 29
 }
30
-if ($authorize === false) die;
30
+if ($authorize === false) {
31
+	die;
32
+}
31 33
 
32
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
34
+if (isset($globalTracker) && $globalTracker) {
35
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
36
+}
33 37
 if (isset($globalMarine) && $globalMarine) {
34 38
 	require_once(dirname(__FILE__).'/../require/class.AIS.php');
35 39
 	require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
36 40
 }
37 41
 
38
-if (!isset($globalDebug)) $globalDebug = FALSE;
42
+if (!isset($globalDebug)) {
43
+	$globalDebug = FALSE;
44
+}
39 45
 
40 46
 // Check if schema is at latest version
41 47
 $Connection = new Connection();
@@ -45,10 +51,16 @@  discard block
 block discarded – undo
45 51
 }
46 52
 
47 53
 if (isset($globalServer) && $globalServer) {
48
-	if ($globalDebug) echo "Using Server Mode\n";
54
+	if ($globalDebug) {
55
+		echo "Using Server Mode\n";
56
+	}
49 57
 	$SI=new SpotterServer();
50
-} else $SI=new SpotterImport($Connection->db);
51
-if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
58
+} else {
59
+	$SI=new SpotterImport($Connection->db);
60
+}
61
+if (isset($globalTracker) && $globalTracker) {
62
+	$TI = new TrackerImport($Connection->db);
63
+}
52 64
 if (isset($globalMarine) && $globalMarine) {
53 65
 	$AIS = new AIS();
54 66
 	$MI = new MarineImport($Connection->db);
@@ -57,7 +69,9 @@  discard block
 block discarded – undo
57 69
 date_default_timezone_set('UTC');
58 70
 
59 71
 $buffer = '';
60
-if (isset($_POST)) $buffer = $_POST;
72
+if (isset($_POST)) {
73
+	$buffer = $_POST;
74
+}
61 75
 $data = array();
62 76
 if (isset($buffer['type_event']) && isset($buffer['lat']) && isset($buffer['lon'])) {
63 77
 	$data['ident'] = $buffer['device_id'];
@@ -68,15 +82,27 @@  discard block
 block discarded – undo
68 82
 	//$data['heading'] = $buffer['cap']; // Only N/S/E/W
69 83
 	$data['datetime'] = date('Y-m-d H:i:s',$buffer['timestamp']);
70 84
 	$data['comment'] = '';
71
-	if (isset($buffer['battery']) && $buffer['battery'] != '') $data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
85
+	if (isset($buffer['battery']) && $buffer['battery'] != '') {
86
+		$data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
87
+	}
72 88
 	//if (isset($buffer['snr']) && $buffer['snr'] != '') $data['comment'] .= 'SNR: '.$buffer['snr'].' ';
73
-	if (isset($buffer['temp']) && $buffer['temp'] != '') $data['comment'] .= 'Temperature: '.$buffer['temp'].'°C ';
74
-	if (isset($buffer['press']) && $buffer['press'] != '') $data['comment'] .= 'Pressure: '.$buffer['press'].'hPa ';
89
+	if (isset($buffer['temp']) && $buffer['temp'] != '') {
90
+		$data['comment'] .= 'Temperature: '.$buffer['temp'].'°C ';
91
+	}
92
+	if (isset($buffer['press']) && $buffer['press'] != '') {
93
+		$data['comment'] .= 'Pressure: '.$buffer['press'].'hPa ';
94
+	}
75 95
 	$TI->add($data);
76 96
 	unset($data);
77 97
 }
78
-if (isset($SI)) $SI->checkAll();
79
-if (isset($MI)) $MI->checkAll();
80
-if (isset($TI)) $TI->checkAll();
98
+if (isset($SI)) {
99
+	$SI->checkAll();
100
+}
101
+if (isset($MI)) {
102
+	$MI->checkAll();
103
+}
104
+if (isset($TI)) {
105
+	$TI->checkAll();
106
+}
81 107
 
82 108
 ?>
Please login to merge, or discard this patch.
tools-geoid.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,11 @@
 block discarded – undo
61 61
 		print '<div class="col-sm-6">'.round($altitude-$geoid,3).'</div>';
62 62
 	}
63 63
 	print '<div class="col-sm-6"><b>Earth Gravity Model</b></div>';
64
-	if (isset($globalGeoidSource) && $globalGeoidSource != '') $geoidsource = $globalGeoidSource;
65
-	else $geoidsource = 'EGM96-15';
64
+	if (isset($globalGeoidSource) && $globalGeoidSource != '') {
65
+		$geoidsource = $globalGeoidSource;
66
+	} else {
67
+		$geoidsource = 'EGM96-15';
68
+	}
66 69
 	print '<div class="col-sm-6">'.$geoidsource.'</div>';
67 70
 	print '</div>';
68 71
 }
Please login to merge, or discard this patch.
require/class.METAR.php 1 patch
Braces   +100 added lines, -38 removed lines patch added patch discarded remove patch
@@ -59,8 +59,11 @@  discard block
 block discarded – undo
59 59
 		}
60 60
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
61 61
 		$sth->closeCursor();
62
-		if ($row['nb'] > 0) return false;
63
-		else return true;
62
+		if ($row['nb'] > 0) {
63
+			return false;
64
+		} else {
65
+			return true;
66
+		}
64 67
 	}
65 68
 
66 69
 	public static function insert_last_update() {
@@ -82,9 +85,14 @@  discard block
 block discarded – undo
82 85
 		//$pieces = explode(' ',$data);
83 86
 		$pieces = preg_split('/\s/',$data);
84 87
 		$pos = 0;
85
-		if ($pieces[0] == 'METAR') $pos++;
86
-		elseif ($pieces[0] == 'SPECI') $pos++;
87
-		if (strlen($pieces[$pos]) != 4) $pos++;
88
+		if ($pieces[0] == 'METAR') {
89
+			$pos++;
90
+		} elseif ($pieces[0] == 'SPECI') {
91
+			$pos++;
92
+		}
93
+		if (strlen($pieces[$pos]) != 4) {
94
+			$pos++;
95
+		}
88 96
 		$result = array();
89 97
 		$result['location'] = $pieces[$pos];
90 98
 		$pos++;
@@ -93,16 +101,26 @@  discard block
 block discarded – undo
93 101
 		$c = count($pieces);
94 102
 		for($pos++; $pos < $c; $pos++) {
95 103
 			$piece = $pieces[$pos];
96
-			if ($piece == 'RMK') break;
97
-			if ($piece == 'AUTO') $result['auto'] = true;
98
-			if ($piece == 'COR') $result['correction'] = true;
104
+			if ($piece == 'RMK') {
105
+				break;
106
+			}
107
+			if ($piece == 'AUTO') {
108
+				$result['auto'] = true;
109
+			}
110
+			if ($piece == 'COR') {
111
+				$result['correction'] = true;
112
+			}
99 113
 			// Wind Speed
100 114
 			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
101 115
 				$result['wind']['direction'] = (float)$matches[1];
102 116
 				$result['wind']['unit'] = $matches[4];
103
-				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
104
-				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
105
-				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
117
+				if ($result['wind']['unit'] == 'KT') {
118
+					$result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
119
+				} elseif ($result['wind']['unit'] == 'KPH') {
120
+					$result['wind']['speed'] = round(((float)$matches[2])*1000,2);
121
+				} elseif ($result['wind']['unit'] == 'MPS') {
122
+					$result['wind']['speed'] = round(((float)$matches[2]),2);
123
+				}
106 124
 				$result['wind']['gust'] = (float)$matches[3];
107 125
 				$result['wind']['unit'] = $matches[4];
108 126
 				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
@@ -185,14 +203,23 @@  discard block
 block discarded – undo
185 203
 				//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
186 204
 				$type = $matches[1];
187 205
 				$cloud = array();
188
-				if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
189
-				elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
190
-				elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
191
-				elseif ($type == 'FEW') $cloud['type'] = 'Few';
192
-				elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
193
-				elseif ($type == 'BKN') $cloud['type'] = 'Broken';
194
-				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
195
-				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
206
+				if ($type == 'SKC') {
207
+					$cloud['type'] = 'No cloud/Sky clear';
208
+				} elseif ($type == 'CLR') {
209
+					$cloud['type'] = 'No cloud below 12,000ft (3700m)';
210
+				} elseif ($type == 'NSC') {
211
+					$cloud['type'] = 'No significant cloud';
212
+				} elseif ($type == 'FEW') {
213
+					$cloud['type'] = 'Few';
214
+				} elseif ($type == 'SCT') {
215
+					$cloud['type'] = 'Scattered';
216
+				} elseif ($type == 'BKN') {
217
+					$cloud['type'] = 'Broken';
218
+				} elseif ($type == 'OVC') {
219
+					$cloud['type'] = 'Overcast/Full cloud coverage';
220
+				} elseif ($type == 'VV') {
221
+					$cloud['type'] = 'Vertical visibility';
222
+				}
196 223
 				$cloud['type_code'] = $type;
197 224
 				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
198 225
 				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
@@ -218,8 +245,11 @@  discard block
 block discarded – undo
218 245
 				$result['RVR']['friction'] = $matches[5];
219 246
 			}
220 247
 			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
221
-				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
222
-				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
248
+				if (isset($matches[5])) {
249
+					$range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
250
+				} else {
251
+					$range = array('exact' => (float)$matches[2], 'unit' => 'M');
252
+				}
223 253
 				if (isset($matches[3])) {
224 254
 					$range = Array(
225 255
 					    'from' => (float)$matches[2],
@@ -252,8 +282,11 @@  discard block
 block discarded – undo
252 282
 				if (isset($matches[3])) {
253 283
 					$text[] = $this->texts[$matches[3]];
254 284
 				}
255
-				if (!isset($result['weather'])) $result['weather'] = implode(' ', $text);
256
-				else $result['weather'] = $result['weather'].' / '.implode(' ', $text);
285
+				if (!isset($result['weather'])) {
286
+					$result['weather'] = implode(' ', $text);
287
+				} else {
288
+					$result['weather'] = $result['weather'].' / '.implode(' ', $text);
289
+				}
257 290
 			}
258 291
 		}
259 292
 		return $result;
@@ -264,8 +297,11 @@  discard block
 block discarded – undo
264 297
 		if (isset($globalMETARcycle) && $globalMETARcycle) {
265 298
 			$query = "SELECT * FROM metar WHERE metar_location = :icao";
266 299
 		} else {
267
-			if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
268
-			else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
300
+			if ($globalDBdriver == 'mysql') {
301
+				$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
302
+			} else {
303
+				$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
304
+			}
269 305
 		}
270 306
 		$query_values = array(':icao' => $icao);
271 307
 		try {
@@ -321,7 +357,9 @@  discard block
 block discarded – undo
321 357
 
322 358
 	public function addMETARCycle() {
323 359
 		global $globalDebug, $globalIVAO, $globalTransaction;
324
-		if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
360
+		if (isset($globalDebug) && $globalDebug) {
361
+			echo "Downloading METAR cycle...";
362
+		}
325 363
 		date_default_timezone_set("UTC");
326 364
 		$Common = new Common();
327 365
 		if (isset($globalIVAO) && $globalIVAO) {
@@ -332,31 +370,47 @@  discard block
 block discarded – undo
332 370
 			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
333 371
 		}
334 372
 		if ($handle) {
335
-			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
373
+			if (isset($globalDebug) && $globalDebug) {
374
+				echo "Done - Updating DB...";
375
+			}
336 376
 			$date = '';
337
-			if ($globalTransaction) $this->db->beginTransaction();
377
+			if ($globalTransaction) {
378
+				$this->db->beginTransaction();
379
+			}
338 380
 			while(($line = fgets($handle,4096)) !== false) {
339 381
 				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
340 382
 					$date = $line;
341 383
 				} elseif ($line != '') {
342
-					if ($date == '') $date = date('Y/m/d H:m');
384
+					if ($date == '') {
385
+						$date = date('Y/m/d H:m');
386
+					}
343 387
 					$pos = 0;
344 388
 					$pieces = preg_split('/\s/',$line);
345
-					if ($pieces[0] == 'METAR') $pos++;
346
-					if (strlen($pieces[$pos]) != 4) $pos++;
389
+					if ($pieces[0] == 'METAR') {
390
+						$pos++;
391
+					}
392
+					if (strlen($pieces[$pos]) != 4) {
393
+						$pos++;
394
+					}
347 395
 					$location = $pieces[$pos];
348 396
 					echo $this->addMETAR($location,$line,$date);
349 397
 				}
350 398
 			}
351 399
 			fclose($handle);
352
-			if ($globalTransaction) $this->db->commit();
400
+			if ($globalTransaction) {
401
+				$this->db->commit();
402
+			}
403
+		}
404
+		if (isset($globalDebug) && $globalDebug) {
405
+			echo "Done\n";
353 406
 		}
354
-		if (isset($globalDebug) && $globalDebug) echo "Done\n";
355 407
 	}
356 408
 
357 409
 	public function downloadMETAR($icao) {
358 410
 		global $globalMETARurl;
359
-		if ($globalMETARurl == '') return array();
411
+		if ($globalMETARurl == '') {
412
+			return array();
413
+		}
360 414
 		date_default_timezone_set("UTC");
361 415
 		$Common = new Common();
362 416
 		$url = str_replace('{icao}',$icao,$globalMETARurl);
@@ -367,16 +421,24 @@  discard block
 block discarded – undo
367 421
 				$date = $line;
368 422
 			} 
369 423
 			if ($line != '') {
370
-				if ($date == '') $date = date('Y/m/d H:m');
424
+				if ($date == '') {
425
+					$date = date('Y/m/d H:m');
426
+				}
371 427
 				$pos = 0;
372 428
 				$pieces = preg_split('/\s/',$line);
373
-				if ($pieces[0] == 'METAR') $pos++;
374
-				if (strlen($pieces[$pos]) != 4) $pos++;
429
+				if ($pieces[0] == 'METAR') {
430
+					$pos++;
431
+				}
432
+				if (strlen($pieces[$pos]) != 4) {
433
+					$pos++;
434
+				}
375 435
 				$location = $pieces[$pos];
376 436
 				if (strlen($location == 4)) {
377 437
 					$this->addMETAR($location,$line,$date);
378 438
 					return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
379
-				} else return array();
439
+				} else {
440
+					return array();
441
+				}
380 442
 			}
381 443
 		}
382 444
 		return array();
Please login to merge, or discard this patch.
flightid-overview.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
 		$all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']);
49 49
 		if (isset($globalTimezone)) {
50 50
 			date_default_timezone_set($globalTimezone);
51
-		} else date_default_timezone_set('UTC');
51
+		} else {
52
+			date_default_timezone_set('UTC');
53
+		}
52 54
 		
53 55
 		if (is_array($all_data) && count($all_data) > 1) {
54 56
 			print '<br/>';
@@ -327,9 +329,13 @@  discard block
 block discarded – undo
327 329
 			print '<div>';
328 330
 			if (isset($spotter_item['pilot_id']) && $spotter_item['pilot_id'] != "")
329 331
 			{
330
-				if ($spotter_item['format_source'] == 'whazzup') print '<a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>';
331
-				elseif ($spotter_item['format_source'] == 'vatsimtxt') print '<a href="http://www.vataware.com/pilot/'.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>';
332
-				else print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
332
+				if ($spotter_item['format_source'] == 'whazzup') {
333
+					print '<a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>';
334
+				} elseif ($spotter_item['format_source'] == 'vatsimtxt') {
335
+					print '<a href="http://www.vataware.com/pilot/'.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>';
336
+				} else {
337
+					print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
338
+				}
333 339
 			} else {
334 340
 				if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != "")
335 341
 				{
Please login to merge, or discard this patch.
ident-detailed.php 1 patch
Braces   +22 added lines, -8 removed lines patch added patch discarded remove patch
@@ -118,8 +118,12 @@  discard block
 block discarded – undo
118 118
 	{
119 119
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']);
120 120
 		$ident = $spotter_array[0]['ident'];
121
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
122
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
121
+		if (isset($spotter_array[0]['latitude'])) {
122
+			$latitude = $spotter_array[0]['latitude'];
123
+		}
124
+		if (isset($spotter_array[0]['longitude'])) {
125
+			$longitude = $spotter_array[0]['longitude'];
126
+		}
123 127
 		require_once('header.php');
124 128
 		if (isset($globalArchive) && $globalArchive && $type == 'aircraft') {
125 129
 			// Requirement for altitude graph
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 			$all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']);
128 132
 			if (isset($globalTimezone)) {
129 133
 				date_default_timezone_set($globalTimezone);
130
-			} else date_default_timezone_set('UTC');
134
+			} else {
135
+				date_default_timezone_set('UTC');
136
+			}
131 137
 			if (is_array($all_data) && count($all_data) > 1) {
132 138
 				print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
133 139
 				print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
@@ -204,14 +210,22 @@  discard block
 block discarded – undo
204 210
 		if (isset($spotter_array[0]['airline_icao'])) {
205 211
 			print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; 
206 212
 		}
207
-		if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
213
+		if ($type == 'aircraft') {
214
+			print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
215
+		}
208 216
 		print '</div>';
209 217
 	
210
-		if ($type == 'aircraft') include('ident-sub-menu.php');
218
+		if ($type == 'aircraft') {
219
+			include('ident-sub-menu.php');
220
+		}
211 221
 		print '<div class="table column">';
212
-		if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
213
-		elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
214
-		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
222
+		if ($type == 'aircraft') {
223
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
224
+		} elseif ($type == 'marine') {
225
+			print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
226
+		} elseif ($type == 'tracker') {
227
+			print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
228
+		}
215 229
 
216 230
 		include('table-output.php'); 
217 231
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
airport-detailed.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		$limit_start = 0;
16 16
 		$limit_end = 25;
17 17
 		$absolute_difference = 25;
18
-	}  else {
18
+	} else {
19 19
 		$limit_explode = explode(",", $_GET['limit']);
20 20
 		$limit_start = $limit_explode[0];
21 21
 		$limit_end = $limit_explode[1];
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 			$METAR = new METAR();
48 48
 			$metar_info = $METAR->getMETAR($airport_icao);
49 49
 			//print_r($metar_info);
50
-			if (isset($metar_info[0]['metar'])) $metar_parse = $METAR->parse($metar_info[0]['metar']);
50
+			if (isset($metar_info[0]['metar'])) {
51
+				$metar_parse = $METAR->parse($metar_info[0]['metar']);
52
+			}
51 53
             		//print_r($metar_parse);
52 54
 		}
53 55
 		
@@ -61,7 +63,9 @@  discard block
 block discarded – undo
61 63
 		print '<option></option>';
62 64
 		$Stats = new Stats();
63 65
 		$airport_names = $Stats->getAllAirportNames();
64
-		if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
66
+		if (empty($airport_names)) {
67
+			$airport_names = $Spotter->getAllAirportNames();
68
+		}
65 69
 		ksort($airport_names);
66 70
 		foreach($airport_names as $airport_name)
67 71
 		{
@@ -102,7 +106,9 @@  discard block
 block discarded – undo
102 106
 			// Use spotter also
103 107
 			if (isset($globalTimezone)) {
104 108
 				date_default_timezone_set($globalTimezone);
105
-			} else date_default_timezone_set('UTC');
109
+			} else {
110
+				date_default_timezone_set('UTC');
111
+			}
106 112
 			if (count($all_data) > 0) {
107 113
 				print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
108 114
 				print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Braces   +101 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,10 +4,15 @@  discard block
 block discarded – undo
4 4
 
5 5
 setcookie("MapFormat",'2d');
6 6
 
7
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
7
+if (!isset($globalOpenWeatherMapKey)) {
8
+	$globalOpenWeatherMapKey = '';
9
+}
8 10
 // Compressed GeoJson is used if true
9
-if (!isset($globalJsonCompress)) $compress = true;
10
-else $compress = $globalJsonCompress;
11
+if (!isset($globalJsonCompress)) {
12
+	$compress = true;
13
+} else {
14
+	$compress = $globalJsonCompress;
15
+}
11 16
 if (isset($_GET['archive'])) {
12 17
 	$archive = true;
13 18
 	//$archiveupdatetime = 50;
@@ -18,8 +23,11 @@  discard block
 block discarded – undo
18 23
 	//$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10));
19 24
 	//$lastupd = 20;
20 25
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
21
-	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
22
-	else $enddate = time();
26
+	if (isset($_GET['enddate']) && $_GET['enddate'] != '') {
27
+		$enddate = $_GET['enddate'];
28
+	} else {
29
+		$enddate = time();
30
+	}
23 31
 	setcookie("archive_begin",$begindate);
24 32
 	setcookie("archive_end",$enddate);
25 33
 	setcookie("archive_update",$lastupd);
@@ -106,7 +114,17 @@  discard block
 block discarded – undo
106 114
 	}
107 115
 
108 116
 	//create the map
109
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
117
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
118
+	print $latitude;
119
+} else {
120
+	print $globalCenterLatitude;
121
+}
122
+?>,<?php if (isset($longitude)) {
123
+	print $longitude;
124
+} else {
125
+	print $globalCenterLongitude;
126
+}
127
+?>], zoom);
110 128
 <?php
111 129
 	} else {
112 130
 ?>
@@ -119,9 +137,19 @@  discard block
 block discarded – undo
119 137
 	     || navigator.userAgent.match(/BlackBerry/i)
120 138
 	     || navigator.userAgent.match(/Windows Phone/i))
121 139
 	{
122
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>;
140
+		var zoom = <?php if (isset($globalLiveZoom)) {
141
+	print $globalLiveZoom-1;
142
+} else {
143
+	print '8';
144
+}
145
+?>;
123 146
 	} else {
124
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>;
147
+		var zoom = <?php if (isset($globalLiveZoom)) {
148
+	print $globalLiveZoom;
149
+} else {
150
+	print '9';
151
+}
152
+?>;
125 153
 	}
126 154
 
127 155
 	//create the map
@@ -146,16 +174,27 @@  discard block
 block discarded – undo
146 174
 	bounds = L.latLngBounds(southWest,northEast);
147 175
 	//a few title layers
148 176
 <?php
149
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
150
-	else $MapType = $globalMapProvider;
177
+	if (isset($_COOKIE['MapType'])) {
178
+		$MapType = $_COOKIE['MapType'];
179
+	} else {
180
+		$MapType = $globalMapProvider;
181
+	}
151 182
 
152 183
 	if ($MapType == 'Mapbox') {
153
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
154
-		else $MapBoxId = $_COOKIE['MapTypeId'];
155
-?>
184
+		if ($_COOKIE['MapTypeId'] == 'default') {
185
+			$MapBoxId = $globalMapboxId;
186
+		} else {
187
+			$MapBoxId = $_COOKIE['MapTypeId'];
188
+		}
189
+		?>
156 190
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
157 191
 	    maxZoom: 18,
158
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
192
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
193
+	print 'false';
194
+} else {
195
+	print 'true';
196
+}
197
+?>,
159 198
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
160 199
 	      '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
161 200
 	      'Imagery © <a href="http://mapbox.com">Mapbox</a>',
@@ -167,7 +206,12 @@  discard block
 block discarded – undo
167 206
 ?>
168 207
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
169 208
 	    maxZoom: 18,
170
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
209
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
210
+	print 'false';
211
+} else {
212
+	print 'true';
213
+}
214
+?>,
171 215
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
172 216
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
173 217
 	}).addTo(map);
@@ -213,20 +257,26 @@  discard block
 block discarded – undo
213 257
 	map.addLayer(yandexLayer);
214 258
 <?php
215 259
 	} elseif ($MapType == 'Bing-Aerial') {
216
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
217
-?>
260
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
261
+			setcookie('MapType','OpenStreetMap');
262
+		}
263
+		?>
218 264
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
219 265
 	map.addLayer(bingLayer);
220 266
 <?php
221 267
 	} elseif ($MapType == 'Bing-Hybrid') {
222
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
223
-?>
268
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
269
+			setcookie('MapType','OpenStreetMap');
270
+		}
271
+		?>
224 272
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
225 273
 	map.addLayer(bingLayer);
226 274
 <?php
227 275
 	} elseif ($MapType == 'Bing-Road') {
228
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
229
-?>
276
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
277
+			setcookie('MapType','OpenStreetMap');
278
+		}
279
+		?>
230 280
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
231 281
 	map.addLayer(bingLayer);
232 282
 <?php
@@ -249,9 +299,24 @@  discard block
 block discarded – undo
249 299
 		$customid = $MapType;
250 300
 ?>
251 301
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
252
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
253
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
254
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
302
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
303
+	print $globalMapCustomLayer[$customid]['maxZoom'];
304
+} else {
305
+	print '18';
306
+}
307
+?>,
308
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
309
+	print $globalMapCustomLayer[$customid]['minZoom'];
310
+} else {
311
+	print '0';
312
+}
313
+?>,
314
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
315
+	print 'false';
316
+} else {
317
+	print 'true';
318
+}
319
+?>,
255 320
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
256 321
 	}).addTo(map);
257 322
 
@@ -285,7 +350,12 @@  discard block
 block discarded – undo
285 350
 		}
286 351
 	} elseif ($globalBounding == 'circle') {
287 352
 ?>
288
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
353
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
354
+	print $globalBoundingCircleSize;
355
+} else {
356
+	print '70000';
357
+}
358
+?>,{
289 359
 	    color: '#92C7D1',
290 360
 	    fillColor: '#92C7D1',
291 361
 	    fillOpacity: 0.3,
@@ -382,7 +452,12 @@  discard block
 block discarded – undo
382 452
 		//}
383 453
 	});
384 454
 update_locationsLayer();
385
-setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
455
+setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
456
+	print $globalMapRefresh*1000*2;
457
+} else {
458
+	print '60000';
459
+}
460
+?>);
386 461
 
387 462
 <?php
388 463
     // Add support for custom json via $globalMapJson
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Braces   +307 added lines, -110 removed lines patch added patch discarded remove patch
@@ -184,17 +184,23 @@  discard block
 block discarded – undo
184 184
 	
185 185
 	/* Check that end was found and body has at least one byte. */
186 186
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
187
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
187
+	    if ($globalDebug) {
188
+	    	echo '!!! APRS invalid : '.$input."\n";
189
+	    }
188 190
 	    return false;
189 191
 	}
190 192
 	
191
-	if ($debug) echo 'input : '.$input."\n";
193
+	if ($debug) {
194
+		echo 'input : '.$input."\n";
195
+	}
192 196
 	/* Save header and body. */
193 197
 	$body = substr($input,$splitpos+1,$input_len);
194 198
 	$body_len = strlen($body);
195 199
 	$header = substr($input,0,$splitpos);
196 200
 	//$header_len = strlen($header);
197
-	if ($debug) echo 'header : '.$header."\n";
201
+	if ($debug) {
202
+		echo 'header : '.$header."\n";
203
+	}
198 204
 	
199 205
 	/* Parse source, target and path. */
200 206
 	//FLRDF0A52>APRS,qAS,LSTB
@@ -208,11 +214,15 @@  discard block
 block discarded – undo
208 214
 		$result['format_source'] = 'famaprs';
209 215
 		$result['source_type'] = 'ais';
210 216
 	    } else {
211
-		if ($debug) echo 'ident : '.$ident."\n";
217
+		if ($debug) {
218
+			echo 'ident : '.$ident."\n";
219
+		}
212 220
 		$result['ident'] = $ident;
213 221
 	    }
214 222
 	} else {
215
-	    if ($debug) 'No ident'."\n";
223
+	    if ($debug) {
224
+	    	'No ident'."\n";
225
+	    }
216 226
 	    return false;
217 227
 	}
218 228
 	$elements = explode(',',$all_elements);
@@ -223,7 +233,9 @@  discard block
 block discarded – undo
223 233
 	        //echo "ok";
224 234
 	        //if ($element == 'TCPIP*') return false;
225 235
 	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
226
-		if ($debug) echo 'element : '.$element."\n";
236
+		if ($debug) {
237
+			echo 'element : '.$element."\n";
238
+		}
227 239
 		return false;
228 240
 	    }
229 241
 	    /*
@@ -236,13 +248,17 @@  discard block
 block discarded – undo
236 248
 	}
237 249
 	
238 250
 	$type = substr($body,0,1);
239
-	if ($debug) echo 'type : '.$type."\n";
251
+	if ($debug) {
252
+		echo 'type : '.$type."\n";
253
+	}
240 254
 	if ($type == ';') {
241 255
 		if (isset($result['source_type']) && $result['source_type'] == 'modes') {
242 256
 			$result['address'] = trim(substr($body,1,9));
243 257
 		} elseif (isset($result['source_type']) && $result['source_type'] == 'ais') {
244 258
 			$result['mmsi'] = trim(substr($body,1,9));
245
-		} else $result['ident'] = trim(substr($body,1,9));
259
+		} else {
260
+			$result['ident'] = trim(substr($body,1,9));
261
+		}
246 262
 	} elseif ($type == ',') {
247 263
 		// Invalid data or test data
248 264
 		return false;
@@ -311,7 +327,9 @@  discard block
 block discarded – undo
311 327
 		//$symbol_table = $matches[4];
312 328
 		$lat = intval($lat_deg);
313 329
 		$lon = intval($lon_deg);
314
-		if ($lat > 89 || $lon > 179) return false;
330
+		if ($lat > 89 || $lon > 179) {
331
+			return false;
332
+		}
315 333
 	    
316 334
 	    /*
317 335
 	    $tmp_5b = str_replace('.','',$lat_min);
@@ -321,8 +339,12 @@  discard block
 block discarded – undo
321 339
 	    */
322 340
 		$latitude = $lat + floatval($lat_min)/60;
323 341
 		$longitude = $lon + floatval($lon_min)/60;
324
-		if ($sind == 'S') $latitude = 0-$latitude;
325
-		if ($wind == 'W') $longitude = 0-$longitude;
342
+		if ($sind == 'S') {
343
+			$latitude = 0-$latitude;
344
+		}
345
+		if ($wind == 'W') {
346
+			$longitude = 0-$longitude;
347
+		}
326 348
 		$result['latitude'] = $latitude;
327 349
 		$result['longitude'] = $longitude;
328 350
 		$body_parse = substr($body_parse,18);
@@ -350,8 +372,11 @@  discard block
 block discarded – undo
350 372
 			//echo 'find'."\n";
351 373
 			$body_split = str_split($body_parse);
352 374
 			$symbol_code = $body_split[0];
353
-			if (!isset($symbolll) || $symbolll == '/') $symbol_code = '/'.$symbol_code;
354
-			else $symbol_code = '\\'.$symbol_code;
375
+			if (!isset($symbolll) || $symbolll == '/') {
376
+				$symbol_code = '/'.$symbol_code;
377
+			} else {
378
+				$symbol_code = '\\'.$symbol_code;
379
+			}
355 380
 		//'
356 381
 		//}
357 382
 		//echo $body_parse;
@@ -360,7 +385,9 @@  discard block
 block discarded – undo
360 385
 			$body_parse = substr($body_parse,1);
361 386
 			$body_parse_len = strlen($body_parse);
362 387
 			$result['symbol_code'] = $symbol_code;
363
-			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
388
+			if (isset($this->symbols[$symbol_code])) {
389
+				$result['symbol'] = $this->symbols[$symbol_code];
390
+			}
364 391
 			if ($symbol_code != '_') {
365 392
 			}
366 393
 		    //$body_parse = substr($body_parse,1);
@@ -371,7 +398,9 @@  discard block
 block discarded – undo
371 398
 		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372 399
 		    	    $course = substr($body_parse,0,3);
373 400
 		    	    $tmp_s = intval($course);
374
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
401
+		    	    if ($tmp_s >= 1 && $tmp_s <= 360) {
402
+		    	    	$result['heading'] = intval($course);
403
+		    	    }
375 404
 		    	    $speed = substr($body_parse,4,3);
376 405
 		    	    if ($speed != '...') {
377 406
 		    		//$result['speed'] = round($speed*1.852);
@@ -412,10 +441,16 @@  discard block
 block discarded – undo
412 441
 			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413 442
 			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
414 443
 			    
415
-				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
416
-				else $result['latitude'] += $lat_off;
417
-				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
418
-				else $result['longitude'] += $lon_off;
444
+				if ($result['latitude'] < 0) {
445
+					$result['latitude'] -= $lat_off;
446
+				} else {
447
+					$result['latitude'] += $lat_off;
448
+				}
449
+				if ($result['longitude'] < 0) {
450
+					$result['longitude'] -= $lon_off;
451
+				} else {
452
+					$result['longitude'] += $lon_off;
453
+				}
419 454
 			    }
420 455
 			    
421 456
 		            $body_parse = substr($body_parse,6);
@@ -457,27 +492,48 @@  discard block
 block discarded – undo
457 492
 			$address = substr($id,2);
458 493
 			//print_r($matches);
459 494
 			$addressType = (intval(substr($id,0,2),16))&3;
460
-			if ($addressType == 0) $result['addresstype'] = "RANDOM";
461
-			elseif ($addressType == 1) $result['addresstype'] = "ICAO";
462
-			elseif ($addressType == 2) $result['addresstype'] = "FLARM";
463
-			elseif ($addressType == 3) $result['addresstype'] = "OGN";
495
+			if ($addressType == 0) {
496
+				$result['addresstype'] = "RANDOM";
497
+			} elseif ($addressType == 1) {
498
+				$result['addresstype'] = "ICAO";
499
+			} elseif ($addressType == 2) {
500
+				$result['addresstype'] = "FLARM";
501
+			} elseif ($addressType == 3) {
502
+				$result['addresstype'] = "OGN";
503
+			}
464 504
 			$aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2);
465 505
 			$result['aircrafttype_code'] = $aircraftType;
466
-			if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN";
467
-			elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER";
468
-			elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE";
469
-			elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
470
-			elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE";
471
-			elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE";
472
-			elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER";
473
-			elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER";
474
-			elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT";
475
-			elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT";
476
-			elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO";
477
-			elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON";
478
-			elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP";
479
-			elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV";
480
-			elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT";
506
+			if ($aircraftType == 0) {
507
+				$result['aircrafttype'] = "UNKNOWN";
508
+			} elseif ($aircraftType == 1) {
509
+				$result['aircrafttype'] = "GLIDER";
510
+			} elseif ($aircraftType == 2) {
511
+				$result['aircrafttype'] = "TOW_PLANE";
512
+			} elseif ($aircraftType == 3) {
513
+				$result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
514
+			} elseif ($aircraftType == 4) {
515
+				$result['aircrafttype'] = "PARACHUTE";
516
+			} elseif ($aircraftType == 5) {
517
+				$result['aircrafttype'] = "DROP_PLANE";
518
+			} elseif ($aircraftType == 6) {
519
+				$result['aircrafttype'] = "HANG_GLIDER";
520
+			} elseif ($aircraftType == 7) {
521
+				$result['aircrafttype'] = "PARA_GLIDER";
522
+			} elseif ($aircraftType == 8) {
523
+				$result['aircrafttype'] = "POWERED_AIRCRAFT";
524
+			} elseif ($aircraftType == 9) {
525
+				$result['aircrafttype'] = "JET_AIRCRAFT";
526
+			} elseif ($aircraftType == 10) {
527
+				$result['aircrafttype'] = "UFO";
528
+			} elseif ($aircraftType == 11) {
529
+				$result['aircrafttype'] = "BALLOON";
530
+			} elseif ($aircraftType == 12) {
531
+				$result['aircrafttype'] = "AIRSHIP";
532
+			} elseif ($aircraftType == 13) {
533
+				$result['aircrafttype'] = "UAV";
534
+			} elseif ($aircraftType == 15) {
535
+				$result['aircrafttype'] = "STATIC_OBJECT";
536
+			}
481 537
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
482 538
 			$result['stealth'] = $stealth;
483 539
 			$result['address'] = $address;
@@ -517,79 +573,183 @@  discard block
 block discarded – undo
517 573
 		    //g012t088r000p000P000h38b10110
518 574
 		    //g011t086r000p000P000h29b10198
519 575
 		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
520
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
521
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
522
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
523
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
524
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
525
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
526
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
576
+			if ($matches[1] != '...') {
577
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
578
+			}
579
+			if ($matches[2] != '...') {
580
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
581
+			}
582
+			if ($matches[3] != '...') {
583
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
584
+			}
585
+			if ($matches[4] != '...') {
586
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
587
+			}
588
+			if ($matches[5] != '...') {
589
+				$result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
590
+			}
591
+			if ($matches[6] != '...') {
592
+				$result['humidity'] = intval($matches[6]);
593
+			}
594
+			if ($matches[7] != '...') {
595
+				$result['pressure'] = round((intval($matches[7])/10),1);
596
+			}
527 597
 		        $body_parse = substr($body_parse,strlen($matches[0]));
528 598
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
529
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
530
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
531
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
532
-			if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1);
533
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
534
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
535
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
599
+			if ($matches[1] != '...') {
600
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
601
+			}
602
+			if ($matches[2] != '...') {
603
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
604
+			}
605
+			if ($matches[3] != '...') {
606
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
607
+			}
608
+			if ($matches[5] != '...') {
609
+				$result['precipitation'] = round((intval($matches[5])/100)*25.1,1);
610
+			}
611
+			if ($matches[4] != '...') {
612
+				$result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
613
+			}
614
+			if ($matches[6] != '...') {
615
+				$result['humidity'] = intval($matches[6]);
616
+			}
617
+			if ($matches[7] != '...') {
618
+				$result['pressure'] = round((intval($matches[7])/10),1);
619
+			}
536 620
 		        $body_parse = substr($body_parse,strlen($matches[0]));
537 621
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
538
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
539
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
540
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
541
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
542
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
543
-			if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
544
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
622
+			if ($matches[1] != '...') {
623
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
624
+			}
625
+			if ($matches[2] != '...') {
626
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
627
+			}
628
+			if ($matches[3] != '...') {
629
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
630
+			}
631
+			if ($matches[4] != '...') {
632
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
633
+			}
634
+			if ($matches[5] != '...') {
635
+				$result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
636
+			}
637
+			if ($matches[7] != '...') {
638
+				$result['humidity'] = intval($matches[7]);
639
+			}
640
+			if ($matches[6] != '...') {
641
+				$result['pressure'] = round((intval($matches[6])/10),1);
642
+			}
545 643
 		        $body_parse = substr($body_parse,strlen($matches[0]));
546 644
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
547
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
548
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
549
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
550
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
551
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
552
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
645
+			if ($matches[1] != '...') {
646
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
647
+			}
648
+			if ($matches[2] != '...') {
649
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
650
+			}
651
+			if ($matches[3] != '...') {
652
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
653
+			}
654
+			if ($matches[4] != '...') {
655
+				$result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
656
+			}
657
+			if ($matches[6] != '...') {
658
+				$result['humidity'] = intval($matches[6]);
659
+			}
660
+			if ($matches[5] != '...') {
661
+				$result['pressure'] = round((intval($matches[5])/10),1);
662
+			}
553 663
 		        $body_parse = substr($body_parse,strlen($matches[0]));
554 664
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
555
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
556
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
557
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
558
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
559
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
560
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
665
+			if ($matches[1] != '...') {
666
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
667
+			}
668
+			if ($matches[2] != '...') {
669
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
670
+			}
671
+			if ($matches[3] != '...') {
672
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
673
+			}
674
+			if ($matches[4] != '...') {
675
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
676
+			}
677
+			if ($matches[6] != '...') {
678
+				$result['humidity'] = intval($matches[6]);
679
+			}
680
+			if ($matches[5] != '...') {
681
+				$result['pressure'] = round((intval($matches[5])/10),1);
682
+			}
561 683
 		        $body_parse = substr($body_parse,strlen($matches[0]));
562 684
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
563
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
564
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
565
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
566
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
567
-			if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
568
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
685
+			if ($matches[1] != '...') {
686
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
687
+			}
688
+			if ($matches[2] != '...') {
689
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
690
+			}
691
+			if ($matches[3] != '...') {
692
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
693
+			}
694
+			if ($matches[4] != '...') {
695
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
696
+			}
697
+			if ($matches[5] != '...') {
698
+				$result['humidity'] = intval($matches[5]);
699
+			}
700
+			if ($matches[6] != '...') {
701
+				$result['pressure'] = round((intval($matches[6])/10),1);
702
+			}
569 703
 		        $body_parse = substr($body_parse,strlen($matches[0]));
570 704
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
571
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
572
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
573
-			if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
574
-			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
705
+			if ($matches[1] != '...') {
706
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
707
+			}
708
+			if ($matches[2] != '...') {
709
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
710
+			}
711
+			if ($matches[2] != '...') {
712
+				$result['humidity'] = intval($matches[3]);
713
+			}
714
+			if ($matches[4] != '...') {
715
+				$result['pressure'] = round((intval($matches[4])/10),1);
716
+			}
575 717
 		        $body_parse = substr($body_parse,strlen($matches[0]));
576 718
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
577
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
578
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
579
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
580
-			if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
581
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
719
+			if ($matches[1] != '...') {
720
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
721
+			}
722
+			if ($matches[2] != '...') {
723
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
724
+			}
725
+			if ($matches[3] != '...') {
726
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
727
+			}
728
+			if ($matches[4] != '...') {
729
+				$result['humidity'] = intval($matches[4]);
730
+			}
731
+			if ($matches[5] != '...') {
732
+				$result['pressure'] = round((intval($matches[5])/10),1);
733
+			}
582 734
 		        $body_parse = substr($body_parse,strlen($matches[0]));
583 735
 		    }
584 736
 		    $result['comment'] = trim($body_parse);
585 737
 		}
586
-		} else $result['comment'] = trim($body_parse);
738
+		} else {
739
+			$result['comment'] = trim($body_parse);
740
+		}
587 741
 
588 742
 	    }
589 743
 	//}
590
-	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
591
-	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
592
-	if ($debug) print_r($result);
744
+	if (isset($result['latitude'])) {
745
+		$result['latitude'] = round($result['latitude'],4);
746
+	}
747
+	if (isset($result['longitude'])) {
748
+		$result['longitude'] = round($result['longitude'],4);
749
+	}
750
+	if ($debug) {
751
+		print_r($result);
752
+	}
593 753
 	return $result;
594 754
     }
595 755
     
@@ -598,12 +758,21 @@  discard block
 block discarded – undo
598 758
 	$aprs_connect = 0;
599 759
 	$aprs_keep = 120;
600 760
 	$aprs_last_tx = time();
601
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
602
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
603
-	if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid;
604
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
605
-	if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass;
606
-	else $aprs_pass = '-1';
761
+	if (isset($globalAPRSversion)) {
762
+		$aprs_version = $globalAPRSversion;
763
+	} else {
764
+		$aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
765
+	}
766
+	if (isset($globalServerAPRSssid)) {
767
+		$aprs_ssid = $globalServerAPRSssid;
768
+	} else {
769
+		$aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
770
+	}
771
+	if (isset($globalServerAPRSpass)) {
772
+		$aprs_pass = $globalServerAPRSpass;
773
+	} else {
774
+		$aprs_pass = '-1';
775
+	}
607 776
 	
608 777
 	$aprs_filter  = '';
609 778
 	$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
@@ -636,10 +805,14 @@  discard block
 block discarded – undo
636 805
     
637 806
     public function send($data) {
638 807
 	global $globalDebug;
639
-	if ($this->connected === false) $this->connect();
808
+	if ($this->connected === false) {
809
+		$this->connect();
810
+	}
640 811
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
641 812
 	if ($send === FALSE) {
642
-		if ($globalDebug) echo 'Reconnect...';
813
+		if ($globalDebug) {
814
+			echo 'Reconnect...';
815
+		}
643 816
 		socket_close($this->socket);
644 817
 		$this->connect();
645 818
 	}
@@ -661,22 +834,32 @@  discard block
 block discarded – undo
661 834
 			//$w = '00';
662 835
 			$custom = '';
663 836
 			if ($ident != '') {
664
-				if ($custom != '') $custom .= '/';
837
+				if ($custom != '') {
838
+					$custom .= '/';
839
+				}
665 840
 				$custom .= 'CS='.$ident;
666 841
 			}
667 842
 			if ($squawk != '') {
668
-				if ($custom != '') $custom .= '/';
843
+				if ($custom != '') {
844
+					$custom .= '/';
845
+				}
669 846
 				$custom .= 'SQ='.$squawk;
670 847
 			}
671 848
 			if ($verticalrate != '') {
672
-				if ($custom != '') $custom .= '/';
849
+				if ($custom != '') {
850
+					$custom .= '/';
851
+				}
673 852
 				$custom .= 'VR='.$verticalrate;
674 853
 			}
675 854
 			if ($aircraft_icao != '' && $aircraft_icao != 'NA') {
676
-				if ($custom != '') $custom .= '/';
855
+				if ($custom != '') {
856
+					$custom .= '/';
857
+				}
677 858
 				$custom .= 'AI='.$aircraft_icao;
678 859
 			}
679
-			if ($custom != '') $custom = ' '.$custom;
860
+			if ($custom != '') {
861
+				$custom = ' '.$custom;
862
+			}
680 863
 			/*
681 864
 			// Use AMSL altitude
682 865
 			$GeoidClass = new GeoidHeight();
@@ -700,30 +883,44 @@  discard block
 block discarded – undo
700 883
 			//$w = '00';
701 884
 			$custom = '';
702 885
 			if ($ident != '') {
703
-				if ($custom != '') $custom .= '/';
886
+				if ($custom != '') {
887
+					$custom .= '/';
888
+				}
704 889
 				$custom .= 'CS='.str_replace(' ','_',$ident);
705 890
 			}
706 891
 			if ($typeid != '') {
707
-				if ($custom != '') $custom .= '/';
892
+				if ($custom != '') {
893
+					$custom .= '/';
894
+				}
708 895
 				$custom .= 'TI='.$typeid;
709 896
 			}
710 897
 			if ($statusid != '') {
711
-				if ($custom != '') $custom .= '/';
898
+				if ($custom != '') {
899
+					$custom .= '/';
900
+				}
712 901
 				$custom .= 'SI='.$statusid;
713 902
 			}
714 903
 			if ($imo != '') {
715
-				if ($custom != '') $custom .= '/';
904
+				if ($custom != '') {
905
+					$custom .= '/';
906
+				}
716 907
 				$custom .= 'IMO='.$imo;
717 908
 			}
718 909
 			if ($arrival_date != '') {
719
-				if ($custom != '') $custom .= '/';
910
+				if ($custom != '') {
911
+					$custom .= '/';
912
+				}
720 913
 				$custom .= 'AD='.strtotime($arrival_date);
721 914
 			}
722 915
 			if ($arrival_code != '') {
723
-				if ($custom != '') $custom .= '/';
916
+				if ($custom != '') {
917
+					$custom .= '/';
918
+				}
724 919
 				$custom .= 'AC='.str_replace(' ','_',$arrival_code);
725 920
 			}
726
-			if ($custom != '') $custom = ' '.$custom;
921
+			if ($custom != '') {
922
+				$custom = ' '.$custom;
923
+			}
727 924
 			$altitude = 0;
728 925
 			$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");
729 926
 		}
Please login to merge, or discard this patch.