Completed
Push — master ( 536398...4468a8 )
by Yannick
06:51 queued 47s
created
require/class.NOTAM.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -982,19 +982,19 @@  discard block
 block discarded – undo
982 982
 		try {
983 983
 			$sth = $this->db->prepare($query);
984 984
 			$sth->execute($query_values);
985
-		} catch(PDOException $e) {
985
+		} catch (PDOException $e) {
986 986
 			echo "error : ".$e->getMessage();
987 987
 		}
988 988
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
989 989
 		return $all;
990 990
 	}
991 991
 	public function getAllNOTAMtext() {
992
-		$query  = 'SELECT full_notam FROM notam';
992
+		$query = 'SELECT full_notam FROM notam';
993 993
 		$query_values = array();
994 994
 		try {
995 995
 			$sth = $this->db->prepare($query);
996 996
 			$sth->execute($query_values);
997
-		} catch(PDOException $e) {
997
+		} catch (PDOException $e) {
998 998
 			echo "error : ".$e->getMessage();
999 999
 		}
1000 1000
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1003,13 +1003,13 @@  discard block
 block discarded – undo
1003 1003
 	public function createNOTAMtextFile($filename) {
1004 1004
 		$allnotam_result = $this->getAllNOTAMtext();
1005 1005
 		$notamtext = '';
1006
-		foreach($allnotam_result as $notam) {
1006
+		foreach ($allnotam_result as $notam) {
1007 1007
 			$notamtext .= '%%'."\n";
1008 1008
 			$notamtext .= $notam['full_notam'];
1009 1009
 			$notamtext .= "\n".'%%'."\n";
1010 1010
 		}
1011 1011
 		//$allnotam = implode('\n%%%%\n',$allnotam_result);
1012
-		file_put_contents($filename,$notamtext);
1012
+		file_put_contents($filename, $notamtext);
1013 1013
 	}
1014 1014
 	public function parseNOTAMtextFile($filename) {
1015 1015
 		$data = file_get_contents($filename);
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 		try {
1031 1031
 			$sth = $this->db->prepare($query);
1032 1032
 			$sth->execute($query_values);
1033
-		} catch(PDOException $e) {
1033
+		} catch (PDOException $e) {
1034 1034
 			echo "error : ".$e->getMessage();
1035 1035
 		}
1036 1036
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1039,10 +1039,10 @@  discard block
 block discarded – undo
1039 1039
 	public function getAllNOTAMbyCoord($coord) {
1040 1040
 		global $globalDBdriver;
1041 1041
 		if (is_array($coord)) {
1042
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1043
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1044
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1045
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1042
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1043
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1044
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1045
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1046 1046
 		} else return array();
1047 1047
 		if ($globalDBdriver == 'mysql') {
1048 1048
 			$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()';
@@ -1054,19 +1054,19 @@  discard block
 block discarded – undo
1054 1054
 		try {
1055 1055
 			$sth = $this->db->prepare($query);
1056 1056
 			$sth->execute($query_values);
1057
-		} catch(PDOException $e) {
1057
+		} catch (PDOException $e) {
1058 1058
 			echo "error : ".$e->getMessage();
1059 1059
 		}
1060 1060
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1061 1061
 		return $all;
1062 1062
 	}
1063
-	public function getAllNOTAMbyCoordScope($coord,$scope) {
1063
+	public function getAllNOTAMbyCoordScope($coord, $scope) {
1064 1064
 		global $globalDBdriver;
1065 1065
 		if (is_array($coord)) {
1066
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1067
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1068
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1069
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1066
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1067
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1068
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1069
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1070 1070
 		} else return array();
1071 1071
 		if ($globalDBdriver == 'mysql') {
1072 1072
 			$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';
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 		try {
1079 1079
 			$sth = $this->db->prepare($query);
1080 1080
 			$sth->execute($query_values);
1081
-		} catch(PDOException $e) {
1081
+		} catch (PDOException $e) {
1082 1082
 			echo "error : ".$e->getMessage();
1083 1083
 		}
1084 1084
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 		try {
1091 1091
 			$sth = $this->db->prepare($query);
1092 1092
 			$sth->execute($query_values);
1093
-		} catch(PDOException $e) {
1093
+		} catch (PDOException $e) {
1094 1094
 			return "error : ".$e->getMessage();
1095 1095
 		}
1096 1096
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1098,13 +1098,13 @@  discard block
 block discarded – undo
1098 1098
 		else return array();
1099 1099
 	}
1100 1100
 
1101
-	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) {
1101
+	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) {
1102 1102
 		$query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)";
1103
-		$query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam);
1103
+		$query_values = array(':ref' => $ref, ':title' => $title, ':type' => $type, ':fir' => $fir, ':code' => $code, ':rules' => $rules, ':scope' => $scope, ':lower_limit' => $lower_limit, ':upper_limit' => $upper_limit, ':center_latitude' => $center_latitude, ':center_longitude' => $center_longitude, ':radius' => $radius, ':date_begin' => $date_begin, ':date_end' => $date_end, ':permanent' => $permanent, ':text' => $text, ':full_notam' => $full_notam);
1104 1104
 		try {
1105 1105
 			$sth = $this->db->prepare($query);
1106 1106
 			$sth->execute($query_values);
1107
-		} catch(PDOException $e) {
1107
+		} catch (PDOException $e) {
1108 1108
 			return "error : ".$e->getMessage();
1109 1109
 		}
1110 1110
 	}
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 		try {
1116 1116
 			$sth = $this->db->prepare($query);
1117 1117
 			$sth->execute($query_values);
1118
-		} catch(PDOException $e) {
1118
+		} catch (PDOException $e) {
1119 1119
 			return "error : ".$e->getMessage();
1120 1120
 		}
1121 1121
 	}
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 		try {
1131 1131
 			$sth = $this->db->prepare($query);
1132 1132
 			$sth->execute($query_values);
1133
-		} catch(PDOException $e) {
1133
+		} catch (PDOException $e) {
1134 1134
 			return "error : ".$e->getMessage();
1135 1135
 		}
1136 1136
 	}
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 		try {
1141 1141
 			$sth = $this->db->prepare($query);
1142 1142
 			$sth->execute($query_values);
1143
-		} catch(PDOException $e) {
1143
+		} catch (PDOException $e) {
1144 1144
 			return "error : ".$e->getMessage();
1145 1145
 		}
1146 1146
 	}
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 		try {
1150 1150
 			$sth = $this->db->prepare($query);
1151 1151
 			$sth->execute();
1152
-		} catch(PDOException $e) {
1152
+		} catch (PDOException $e) {
1153 1153
 			return "error : ".$e->getMessage();
1154 1154
 		}
1155 1155
 	}
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 		try {
1159 1159
 			$sth = $this->db->prepare($query);
1160 1160
 			$sth->execute();
1161
-		} catch(PDOException $e) {
1161
+		} catch (PDOException $e) {
1162 1162
 			return "error : ".$e->getMessage();
1163 1163
 		}
1164 1164
 	}
@@ -1166,14 +1166,14 @@  discard block
 block discarded – undo
1166 1166
 	public function updateNOTAM() {
1167 1167
 		global $globalNOTAMAirports;
1168 1168
 		if (isset($globalNOTAMAirports) && is_array($globalNOTAMAirports) && count($globalNOTAMAirports) > 0) {
1169
-			foreach (array_chunk($globalNOTAMAirports,10) as $airport) {
1170
-				$airport_icao = implode(',',$airport);
1169
+			foreach (array_chunk($globalNOTAMAirports, 10) as $airport) {
1170
+				$airport_icao = implode(',', $airport);
1171 1171
 				$alldata = $this->downloadNOTAM($airport_icao);
1172 1172
 				if (count($alldata) > 0) {
1173 1173
 					foreach ($alldata as $initial_data) {
1174 1174
 						$data = $this->parse($initial_data);
1175 1175
 						$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']);
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']);
1177 1177
 					}
1178 1178
 				}
1179 1179
 			}
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 			foreach ($alldata as $initial_data) {
1187 1187
 				$data = $this->parse($initial_data);
1188 1188
 				$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']);
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']);
1190 1190
 			}
1191 1191
 		}
1192 1192
 	}
@@ -1195,12 +1195,12 @@  discard block
 block discarded – undo
1195 1195
 		global $globalTransaction;
1196 1196
 		$Spotter = new Spotter();
1197 1197
 		$allairports = $Spotter->getAllAirportInfo();
1198
-		foreach (array_chunk($allairports,20) as $airport) {
1198
+		foreach (array_chunk($allairports, 20) as $airport) {
1199 1199
 			$airports_icao = array();
1200
-			foreach($airport as $icao) {
1200
+			foreach ($airport as $icao) {
1201 1201
 				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1202 1202
 			}
1203
-			$airport_icao = implode(',',$airports_icao);
1203
+			$airport_icao = implode(',', $airports_icao);
1204 1204
 			$alldata = $this->downloadNOTAM($airport_icao);
1205 1205
 			if ($globalTransaction) $this->db->beginTransaction();
1206 1206
 			if (count($alldata) > 0) {
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 						if (count($notamref) == 0) {
1214 1214
 							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1215 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']);
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']);
1217 1217
 						}
1218 1218
 					}
1219 1219
 				}
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 		date_default_timezone_set("UTC");
1228 1228
 		$Common = new Common();
1229 1229
 		//$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1230
-		$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1230
+		$url = str_replace('{icao}', $icao, 'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1231 1231
 		$data = $Common->getData($url);
1232 1232
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1233 1233
 		//print_r($matches);
@@ -1239,14 +1239,14 @@  discard block
 block discarded – undo
1239 1239
 		$Common = new Common();
1240 1240
 		$result = array();
1241 1241
 		$result['full_notam'] = $data;
1242
-		$data = str_ireplace(array("\r","\n",'\r','\n'),' ',$data);
1243
-		$data = preg_split('#(?=([A-Z]\)\s))#',$data);
1242
+		$data = str_ireplace(array("\r", "\n", '\r', '\n'), ' ', $data);
1243
+		$data = preg_split('#(?=([A-Z]\)\s))#', $data);
1244 1244
 		//print_r($data);
1245 1245
 		foreach ($data as $line) {
1246 1246
 			$line = trim($line);
1247
-			if (preg_match('#Q\) (.*)#',$line,$matches)) {
1248
-				$line = str_replace(' ','',$line);
1249
-				if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) {
1247
+			if (preg_match('#Q\) (.*)#', $line, $matches)) {
1248
+				$line = str_replace(' ', '', $line);
1249
+				if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#', $line, $matches)) {
1250 1250
 				//if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) {
1251 1251
 					//print_r($matches);
1252 1252
 					$result['fir'] = $matches[1];
@@ -1292,30 +1292,30 @@  discard block
 block discarded – undo
1292 1292
 					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1293 1293
 					$result['lower_limit'] = $matches[6];
1294 1294
 					$result['upper_limit'] = $matches[7];
1295
-					$latitude = $Common->convertDec($matches[8],'latitude');
1295
+					$latitude = $Common->convertDec($matches[8], 'latitude');
1296 1296
 					if ($matches[9] == 'S') $latitude = -$latitude;
1297
-					$longitude = $Common->convertDec($matches[10],'longitude');
1297
+					$longitude = $Common->convertDec($matches[10], 'longitude');
1298 1298
 					if ($matches[11] == 'W') $longitude = -$longitude;
1299 1299
 					$result['latitude'] = $latitude;
1300 1300
 					$result['longitude'] = $longitude;
1301 1301
 					$result['radius'] = intval($matches[12]);
1302 1302
 				} else echo 'ERROR : '.$line."\n";
1303 1303
 			}
1304
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1304
+			elseif (preg_match('#A\) (.*)#', $line, $matches)) {
1305 1305
 				$result['icao'] = $matches[1];
1306 1306
 			}
1307
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1307
+			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#', $line, $matches)) {
1308 1308
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1309 1309
 				else $year = '20'.$matches[1];
1310 1310
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1311 1311
 			}
1312
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1312
+			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#', $line, $matches)) {
1313 1313
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1314 1314
 				else $year = '20'.$matches[1];
1315 1315
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1316 1316
 				$result['permanent'] = 0;
1317 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)) {
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 1319
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1320 1320
 				else $year = '20'.$matches[1];
1321 1321
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
@@ -1324,26 +1324,26 @@  discard block
 block discarded – undo
1324 1324
 				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1325 1325
 				else $result['permanent'] = 0;
1326 1326
 			}
1327
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1327
+			elseif (preg_match('#C\) (EST|PERM)$#', $line, $matches)) {
1328 1328
 				$result['date_end'] = '2030/12/20 12:00';
1329 1329
 				if ($matches[1] == 'EST') $result['estimated'] = 1;
1330 1330
 				else $result['estimated'] = 0;
1331 1331
 				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1332 1332
 				else $result['permanent'] = 0;
1333 1333
 			}
1334
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1334
+			elseif (preg_match('#E\) (.*)#', $line, $matches)) {
1335 1335
 				$rtext = array();
1336
-				$text = explode(' ',$matches[1]);
1336
+				$text = explode(' ', $matches[1]);
1337 1337
 				foreach ($text as $word) {
1338 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);
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 1340
 					else $rtext[] = $word;
1341 1341
 				}
1342
-				$result['text'] = implode(' ',$rtext);
1342
+				$result['text'] = implode(' ', $rtext);
1343 1343
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
1344 1344
 			//} elseif (preg_match('#G\) (.*)#',$line,$matches)) {
1345
-			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1346
-				$text = explode(' ',$line);
1345
+			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#', $line, $matches)) {
1346
+				$text = explode(' ', $line);
1347 1347
 				$result['ref'] = $text[0];
1348 1348
 				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1349 1349
 				if ($matches[1] == 'NOTAMC') {
Please login to merge, or discard this patch.
notam-geojson.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,24 +10,24 @@  discard block
 block discarded – undo
10 10
 
11 11
 if (isset($_GET['coord'])) 
12 12
 {
13
-	$coords = explode(',',$_GET['coord']);
13
+	$coords = explode(',', $_GET['coord']);
14 14
 	if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] != '' && $_COOKIE['notamscope'] != 'All') {
15
-		$scope = filter_var($_COOOKIE['notamscope'],FILTER_SANITIZE_STRING);
16
-		$spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords,$scope);
15
+		$scope = filter_var($_COOOKIE['notamscope'], FILTER_SANITIZE_STRING);
16
+		$spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords, $scope);
17 17
 	} elseif (isset($_GET['scope']) && $_GET['scope'] != '' && $_GET['scope'] != 'All') {
18
-		$scope = filter_input(INPUT_GET,'scope',FILTER_SANITIZE_STRING);
19
-		$spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords,$scope);
18
+		$scope = filter_input(INPUT_GET, 'scope', FILTER_SANITIZE_STRING);
19
+		$spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords, $scope);
20 20
 	} else {
21 21
 		$spotter_array = $NOTAM->getAllNOTAMbyCoord($coords);
22 22
 	}
23 23
 //	$spotter_array = $NOTAM->getAllNOTAM();
24 24
 } else {
25 25
 	if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] != '' && $_COOKIE['notamscope'] != 'All') {
26
-		$scope = filter_var($_COOKIE['notamscope'],FILTER_SANITIZE_STRING);
26
+		$scope = filter_var($_COOKIE['notamscope'], FILTER_SANITIZE_STRING);
27 27
 		$spotter_array = $NOTAM->getAllNOTAMbyScope($scope);
28 28
 	} elseif (isset($_GET['scope']) && $_GET['scope'] != '' && $_GET['scope'] != 'All') {
29
-		$scope = filter_input(INPUT_GET,'scope',FILTER_SANITIZE_STRING);
30
-		$spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords,$scope);
29
+		$scope = filter_input(INPUT_GET, 'scope', FILTER_SANITIZE_STRING);
30
+		$spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords, $scope);
31 31
 	} else {
32 32
 		$spotter_array = $NOTAM->getAllNOTAM();
33 33
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             
38 38
 if (!empty($spotter_array))
39 39
 {	  
40
-	foreach($spotter_array as $spotter_item)
40
+	foreach ($spotter_array as $spotter_item)
41 41
 	{
42 42
 		date_default_timezone_set('UTC');
43 43
 		//waypoint plotting
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 			$output .= '"ref": "'.$spotter_item['ref'].'",';
47 47
 			$output .= '"title": "'.$spotter_item['title'].'",';
48 48
 			$output .= '"fir": "'.$spotter_item['fir'].'",';
49
-			$output .= '"text": "'.str_replace(array("\r\n", "\r", "\n"),'<br />',str_replace(array('"',"\t"), '',$spotter_item['notam_text'])).'",';
49
+			$output .= '"text": "'.str_replace(array("\r\n", "\r", "\n"), '<br />', str_replace(array('"', "\t"), '', $spotter_item['notam_text'])).'",';
50 50
 			$output .= '"latitude": '.$spotter_item['center_latitude'].',';
51 51
 			$output .= '"longitude": '.$spotter_item['center_longitude'].',';
52 52
 			$output .= '"lower_limit": '.$spotter_item['lower_limit'].',';
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		    $output .= '}';
86 86
 		$output .= '},';
87 87
 	}
88
-	$output  = substr($output, 0, -1);
88
+	$output = substr($output, 0, -1);
89 89
 }
90 90
 $output .= ']}';
91 91
 
Please login to merge, or discard this patch.
waypoints-geojson.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 if (isset($_GET['coord'])) 
12 12
 {
13
-	$coords = explode(',',$_GET['coord']);
13
+	$coords = explode(',', $_GET['coord']);
14 14
 	$spotter_array = $Spotter->getAllWaypointsInfobyCoord($coords);
15 15
 } else {
16 16
 	die;
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 if (!empty($spotter_array))
22 22
 {	  
23 23
 //	print_r($spotter_array);
24
-	foreach($spotter_array as $spotter_item)
24
+	foreach ($spotter_array as $spotter_item)
25 25
 	{
26 26
 		date_default_timezone_set('UTC');
27 27
 		//waypoint plotting
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		    $output .= '"geometry": {';
103 103
 			$output .= '"type": "Point",';
104 104
 			$output .= '"coordinates": [';
105
-			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
105
+			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048); ;
106 106
 			$output .= ']';
107 107
 		    $output .= '}';
108 108
 
Please login to merge, or discard this patch.
airspace-data.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 <button type="button" class="close">&times;</button>
8 8
 <?php
9 9
 
10
-$airspaceid = filter_input(INPUT_GET,'airspace',FILTER_SANITIZE_NUMBER_INT);
10
+$airspaceid = filter_input(INPUT_GET, 'airspace', FILTER_SANITIZE_NUMBER_INT);
11 11
 //$notamref = urldecode($notamref);
12 12
 if ($globalDBdriver == 'mysql') {
13 13
 	$query = "SELECT * FROM airspace WHERE ogr_fid = :id";
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 try {
19 19
 	$sth = $Connection->db->prepare($query);
20 20
 	$sth->execute(array(':id' => $airspaceid));
21
-} catch(PDOException $e) {
21
+} catch (PDOException $e) {
22 22
 	echo "error";
23 23
 }
24
-$result=$sth->fetchAll(PDO::FETCH_ASSOC);
24
+$result = $sth->fetchAll(PDO::FETCH_ASSOC);
25 25
 $airspace = $result[0];
26 26
 date_default_timezone_set('UTC');
27 27
 print '<div class="top">';
Please login to merge, or discard this patch.
airspace-geojson.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 
17 17
 if (isset($_GET['coord'])) 
18 18
 {
19
-	$coords = explode(',',$_GET['coord']);
19
+	$coords = explode(',', $_GET['coord']);
20 20
         if ($globalDBdriver == 'mysql') {
21 21
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, ST_Envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
22 22
 		try {
23 23
 			$sth = $Connection->db->prepare($query);
24
-			$sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3]));
24
+			$sth->execute(array(':minlon' => $coords[0], ':minlat' => $coords[1], ':maxlon' => $coords[2], ':maxlat' => $coords[3]));
25 25
 			//$sth->execute();
26
-		} catch(PDOException $e) {
26
+		} catch (PDOException $e) {
27 27
 			echo "error";
28 28
 		}
29 29
 	} else {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 			$sth = $Connection->db->prepare($query);
33 33
 			//$sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3]));
34 34
 			$sth->execute();
35
-		} catch(PDOException $e) {
35
+		} catch (PDOException $e) {
36 36
 			echo "error";
37 37
 		}
38 38
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	try {
46 46
 		$sth = $Connection->db->prepare($query);
47 47
 		$sth->execute();
48
-	} catch(PDOException $e) {
48
+	} catch (PDOException $e) {
49 49
 		echo "error";
50 50
 	}
51 51
 }
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
 		elseif (isset($properties['ogc_fid'])) $properties['id'] = $properties['ogc_fid'];
74 74
 		if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling'];
75 75
 		if (isset($properties['floor'])) $properties['base'] = $properties['floor'];
76
-		if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) {
76
+		if (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['tops']), $matches)) {
77 77
 			$properties['upper_limit'] = round($matches['alt']*100*0.38048);
78
-		} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['tops']),$matches)) {
78
+		} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['tops']), $matches)) {
79 79
 			$properties['upper_limit'] = round($matches['alt']*0.38048);
80
-		} elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['tops']),$matches)) {
80
+		} elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['tops']), $matches)) {
81 81
 			$properties['upper_limit'] = $matches['alt'];
82 82
 		}
83 83
 		if ($properties['base'] == 'SFC' || $properties['base'] == 'MSL' || $properties['base'] == 'GROUND' || $properties['base'] == 'GND') {
84 84
 			$properties['lower_limit'] = 0;
85
-		} elseif (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['base']),$matches)) {
85
+		} elseif (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['base']), $matches)) {
86 86
 			$properties['lower_limit'] = round($matches['alt']*100*0.38048);
87
-		} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['base']),$matches)) {
87
+		} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['base']), $matches)) {
88 88
 			$properties['lower_limit'] = round($matches['alt']*0.38048);
89
-		} elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['base']),$matches)) {
89
+		} elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['base']), $matches)) {
90 90
 			$properties['lower_limit'] = $matches['alt'];
91 91
 		}
92 92
 		if ($properties['type'] == 'RESTRICTED' || $properties['type'] == 'R') {
Please login to merge, or discard this patch.
scripts/update_db.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) if (strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
13 13
 	if ($j > 1) {
14 14
 		echo "Script is already runnning...";
15 15
 		die();
Please login to merge, or discard this patch.
install/VAM/VAM-json.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,27 +11,27 @@
 block discarded – undo
11 11
 	die();
12 12
 }
13 13
 $query = 'select * from vam_live_flights rc, gvausers gu where gu.gvauser_id = rc.gvauser_id';  
14
-$json_data=array();  
14
+$json_data = array();  
15 15
 $result = $db->query($query);
16 16
 while ($rec = $result->fetch_assoc())
17 17
 {  
18
-	$json_array['gvauser_id']=$rec['gvauser_id']; // users "pilot unique ID" "40"
19
-	$json_array['flight_id']=$rec['flight_id']; // flight_id
20
-	$json_array['pilot_id']=$rec['callsign']; // users pilot_id "VAM500"
21
-	$json_array['callsign']=substr($rec['flight_id'],-7);  // substr icao Flight "AFR524"
22
-	$json_array['pilot_name']=$rec['name'] .' '.$rec['surname'] ;  // Users "name + surname"
23
-	$json_array['plane_type']=$rec['plane_type'];  // type Plane "B739"
24
-	$json_array['departure']=$rec['departure'];  // departure ICAO
25
-	$json_array['arrival']=$rec['arrival'];     // arrival Ident
26
-	$json_array['latitude']=$rec['latitude'];  // return 55.7328860921521
27
-	$json_array['longitude']=$rec['longitude'];  // return 8.87433614409404
28
-	$json_array['altitude']=$rec['altitude'];  // return "147"
29
-	$json_array['heading']=$rec['heading'];  // return "307"
30
-	$json_array['ias']=$rec['ias'];  // return speed "IAS"
31
-	$json_array['gs']=$rec['gs'];  // return speed "GS"
18
+	$json_array['gvauser_id'] = $rec['gvauser_id']; // users "pilot unique ID" "40"
19
+	$json_array['flight_id'] = $rec['flight_id']; // flight_id
20
+	$json_array['pilot_id'] = $rec['callsign']; // users pilot_id "VAM500"
21
+	$json_array['callsign'] = substr($rec['flight_id'], -7); // substr icao Flight "AFR524"
22
+	$json_array['pilot_name'] = $rec['name'].' '.$rec['surname']; // Users "name + surname"
23
+	$json_array['plane_type'] = $rec['plane_type']; // type Plane "B739"
24
+	$json_array['departure'] = $rec['departure']; // departure ICAO
25
+	$json_array['arrival'] = $rec['arrival']; // arrival Ident
26
+	$json_array['latitude'] = $rec['latitude']; // return 55.7328860921521
27
+	$json_array['longitude'] = $rec['longitude']; // return 8.87433614409404
28
+	$json_array['altitude'] = $rec['altitude']; // return "147"
29
+	$json_array['heading'] = $rec['heading']; // return "307"
30
+	$json_array['ias'] = $rec['ias']; // return speed "IAS"
31
+	$json_array['gs'] = $rec['gs']; // return speed "GS"
32 32
 	// $json_array['routes']=$rec['routes'];  // (unusable)
33
-	$json_array['flight_status']=$rec['flight_status'];  // "return Status"
34
-	$json_array['last_update']=$rec['last_update'];  // return "DateTime"
33
+	$json_array['flight_status'] = $rec['flight_status']; // "return Status"
34
+	$json_array['last_update'] = $rec['last_update']; // return "DateTime"
35 35
 	$json_data[] = $json_array;
36 36
  }  
37 37
 echo json_encode($json_data);
Please login to merge, or discard this patch.
install/class.create_db.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -4,24 +4,24 @@  discard block
 block discarded – undo
4 4
 
5 5
 class create_db {
6 6
 	public static function import_file($filename) {
7
-		$filename = filter_var($filename,FILTER_SANITIZE_STRING);
7
+		$filename = filter_var($filename, FILTER_SANITIZE_STRING);
8 8
 		$Connection = new Connection();
9 9
 		//Connection::$db->beginTransaction();
10 10
 		$templine = '';
11
-		$handle = @fopen($filename,"r");
11
+		$handle = @fopen($filename, "r");
12 12
 		if ($handle) {
13 13
 			//$lines = file($filename);
14 14
 			//foreach ($lines as $line)
15
-			while (($line = fgets($handle,4096)) !== false)
15
+			while (($line = fgets($handle, 4096)) !== false)
16 16
 			{
17
-				if (substr($line,0,2) == '--' || $line == '') continue;
17
+				if (substr($line, 0, 2) == '--' || $line == '') continue;
18 18
 				$templine .= $line;
19
-				if (substr(trim($line), -1,1) == ';')
19
+				if (substr(trim($line), -1, 1) == ';')
20 20
 				{
21 21
 					try {
22 22
 						$sth = $Connection->db->prepare($templine);
23 23
 						$sth->execute();
24
-					} catch(PDOException $e) {
24
+					} catch (PDOException $e) {
25 25
 						return "error (import ".$filename.") : ".$e->getMessage()."\n";
26 26
 					}
27 27
 					$templine = '';
@@ -38,27 +38,27 @@  discard block
 block discarded – undo
38 38
 		$error = '';
39 39
 		$dh = opendir($directory);
40 40
 		//foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename)
41
-		while(false !== ($filename = readdir($dh)))
41
+		while (false !== ($filename = readdir($dh)))
42 42
 		{
43
-		    if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename);
43
+		    if (preg_match('/\.sql$/', $filename)) $error .= create_db::import_file($directory.$filename);
44 44
 		}
45 45
 		return $error;
46 46
 	}
47 47
 
48
-	public static function create_database($root,$root_pass,$user,$pass,$db,$db_type,$host) {
49
-		$root = filter_var($root,FILTER_SANITIZE_STRING);
50
-		$root_pass = filter_var($root_pass,FILTER_SANITIZE_STRING);
51
-		$user = filter_var($user,FILTER_SANITIZE_STRING);
52
-		$password = filter_var($pass,FILTER_SANITIZE_STRING);
53
-		$db = filter_var($db,FILTER_SANITIZE_STRING);
54
-		$db_type = filter_var($db_type,FILTER_SANITIZE_STRING);
55
-		$host = filter_var($host,FILTER_SANITIZE_STRING);
48
+	public static function create_database($root, $root_pass, $user, $pass, $db, $db_type, $host) {
49
+		$root = filter_var($root, FILTER_SANITIZE_STRING);
50
+		$root_pass = filter_var($root_pass, FILTER_SANITIZE_STRING);
51
+		$user = filter_var($user, FILTER_SANITIZE_STRING);
52
+		$password = filter_var($pass, FILTER_SANITIZE_STRING);
53
+		$db = filter_var($db, FILTER_SANITIZE_STRING);
54
+		$db_type = filter_var($db_type, FILTER_SANITIZE_STRING);
55
+		$host = filter_var($host, FILTER_SANITIZE_STRING);
56 56
 		// Dirty hack
57 57
 		if ($host != 'localhost' && $host != '127.0.0.1') {
58 58
 		    $grantright = $_SERVER['SERVER_ADDR'];
59 59
 		} else $grantright = 'localhost';
60 60
 		try {
61
-			$dbh = new PDO($db_type.':host='.$host,$root,$root_pass);
61
+			$dbh = new PDO($db_type.':host='.$host, $root, $root_pass);
62 62
 			$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
63 63
 			if ($db_type == 'mysql') {
64 64
 				$dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				$dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."';
69 69
 					GRANT ALL PRIVILEGES ON DATABASE ".$db." TO ".$user.";");
70 70
 			}
71
-		} catch(PDOException $e) {
71
+		} catch (PDOException $e) {
72 72
 			$dbh = null;
73 73
 			return "error : ".$e->getMessage();
74 74
 		}
Please login to merge, or discard this patch.
require/class.ACARS.php 1 patch
Spacing   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 	* @return String the icao
23 23
 	*/
24 24
 	public function ident2icao($ident) {
25
-		if (substr($ident,0,2) == 'AF') {
26
-			if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
27
-			else $icao = 'AFR'.ltrim(substr($ident,2),'0');
25
+		if (substr($ident, 0, 2) == 'AF') {
26
+			if (filter_var(substr($ident, 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
27
+			else $icao = 'AFR'.ltrim(substr($ident, 2), '0');
28 28
 		} else {
29 29
 			$Spotter = new Spotter($this->db);
30
-			$identicao = $Spotter->getAllAirlineInfo(substr($ident,0,2));
30
+			$identicao = $Spotter->getAllAirlineInfo(substr($ident, 0, 2));
31 31
 			if (isset($identicao[0])) {
32
-				$icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0');
32
+				$icao = $identicao[0]['icao'].ltrim(substr($ident, 2), '0');
33 33
 			} else $icao = $ident;
34 34
 		}
35 35
 		return $icao;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 			$sth = $this->db->prepare($query);
55 55
 			$sth->execute();
56
-		} catch(PDOException $e) {
56
+		} catch (PDOException $e) {
57 57
 			return "error";
58 58
 		}
59 59
 		return "success";
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 			$sth = $this->db->prepare($query);
79 79
 			$sth->execute();
80
-		} catch(PDOException $e) {
80
+		} catch (PDOException $e) {
81 81
 			return "error";
82 82
 		}
83 83
 		return "success";
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 		$ident = '';
103 103
 		$message = '';
104 104
 		$result = array();
105
-		$n = sscanf($data,'(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
106
-		if ($n == 0) $n = sscanf($data,'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
107
-		if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
108
-		if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
105
+		$n = sscanf($data, '(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message);
106
+		if ($n == 0) $n = sscanf($data, 'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message);
107
+		if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message);
108
+		if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message);
109 109
 		if ($n != 0) {
110
-			$registration = str_replace('.','',$registration);
111
-			$result = array('registration' => $registration, 'ident' => $ident,'label' => $label, 'block_id' => $block_id,'msg_no' => $msg_no,'message' => $message);
110
+			$registration = str_replace('.', '', $registration);
111
+			$result = array('registration' => $registration, 'ident' => $ident, 'label' => $label, 'block_id' => $block_id, 'msg_no' => $msg_no, 'message' => $message);
112 112
 			if ($globalDebug) echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n";
113 113
 		} else $message = $data;
114 114
 		$decode = array();
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 				$temp = '';
129 129
 				$n = sscanf($message, "FST01%4c%4c%c%06d%c%07d%03d%*8[0-9a-zA-Z ]-%02dC", $dair, $darr, $lac, $la, $lnc, $ln, $alt, $temp);
130 130
 				if ($n > 5 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) {
131
-					$latitude = $la / 10000.0;
132
-					$longitude = $ln / 10000.0;
131
+					$latitude = $la/10000.0;
132
+					$longitude = $ln/10000.0;
133 133
 					if ($lac == 'S') $latitude = '-'.$latitude;
134 134
 					if ($lnc == 'W') $longitude = '-'.$longitude;
135 135
 					// Temp not always available
136 136
 					if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n";
137
-					if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt);
138
-					else $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C');
137
+					if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => $alt);
138
+					else $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt, 'Temperature' => $temp.'°C');
139 139
 
140 140
 					//$icao = $Translation->checkTranslation($ident);
141 141
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
 				$dhour = '';
148 148
 				$darr = '';
149 149
 				$ahour = '';
150
-				$n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr,$ahour);
150
+				$n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr, $ahour);
151 151
 				if ($n == 4 && strlen($darr) == 4) {
152
-					if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
153
-					if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2);
154
-					if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n";
152
+					if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2);
153
+					if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2);
154
+					if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '.$darr.' - departure hour : '.$dhour.' - arrival hour : '.$ahour."\n";
155 155
 					//$icao = ACARS->ident2icao($ident);
156 156
 					//$icao = $Translation->checkTranslation($ident);
157 157
 					//$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS');
158 158
 					$decode = array('Departure airport' => $dair, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour);
159 159
 					$found = true;
160 160
 				}
161
-				elseif ($n == 2 || $n  == 4) {
162
-					if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
161
+				elseif ($n == 2 || $n == 4) {
162
+					if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2);
163 163
 					if ($globalDebug) echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n";
164 164
 					//$icao = ACARS->ident2icao($ident);
165 165
 					//$icao = $Translation->checkTranslation($ident);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 				$ahour = '';
218 218
 				$aair = '';
219 219
 				$apiste = '';
220
-				$n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao,$aident,$dair, $darr, $ddate, $dhour,$ahour, $aair, $apiste);
220
+				$n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao, $aident, $dair, $darr, $ddate, $dhour, $ahour, $aair, $apiste);
221 221
 				if ($n > 8) {
222
-					if ($globalDebug) echo 'airicao : '. $airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '. $darr.' - date depart : '.$ddate.' - departure hour : '. $dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n";
223
-					if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
224
-					if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2);
222
+					if ($globalDebug) echo 'airicao : '.$airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '.$darr.' - date depart : '.$ddate.' - departure hour : '.$dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n";
223
+					if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2);
224
+					if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2);
225 225
 					$icao = trim($aident);
226 226
 
227 227
 					//$decode = 'Departure airport : '.$dair.' ('.$ddate.' at '.$dhour.') - Arrival Airport : '.$aair.' (at '.$ahour.') way '.$apiste;
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 				if ($n == 10 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) {
247 247
 					$las = $las.'.'.$lass;
248 248
 					$lns = $lns.'.'.$lns;
249
-					$latitude = $las / 1000.0;
250
-					$longitude = $lns / 1000.0;
249
+					$latitude = $las/1000.0;
250
+					$longitude = $lns/1000.0;
251 251
 					if ($lac == 'S') $latitude = '-'.$latitude;
252 252
 					if ($lnc == 'W') $longitude = '-'.$longitude;
253 253
 					if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n";
@@ -342,17 +342,17 @@  discard block
 block discarded – undo
342 342
 				$alt = '';
343 343
 				$fuel = '';
344 344
 				$speed = '';
345
-				$n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed);
345
+				$n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed);
346 346
 				if ($n == 9) {
347 347
 					//if (self->$debug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
348 348
 					$icao = trim($aident);
349 349
 					$decode['icao'] = $icao;
350
-					$latitude = $las / 100.0;
351
-					$longitude = $lns / 100.0;
350
+					$latitude = $las/100.0;
351
+					$longitude = $lns/100.0;
352 352
 					if ($lac == 'S') $latitude = '-'.$latitude;
353 353
 					if ($lnc == 'W') $longitude = '-'.$longitude;
354 354
 
355
-					$decode = array('Latitude' => $latitude,'Longitude' => $longitude,'Altitude' => 'FL'.$alt,'Fuel' => $fuel,'speed' => $speed);
355
+					$decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Altitude' => 'FL'.$alt, 'Fuel' => $fuel, 'speed' => $speed);
356 356
 					$found = true;
357 357
 				}
358 358
 			}
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 					if ($lac == 'S') $latitude = '-'.$latitude;
372 372
 					if ($lnc == 'W') $longitude = '-'.$longitude;
373 373
 
374
-					$decode = array('Latitude' => $latitude,'Longitude' => $longitude);
374
+					$decode = array('Latitude' => $latitude, 'Longitude' => $longitude);
375 375
 					$found = true;
376 376
 				}
377 377
 			}
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 				$dair = '';
405 405
 				$darr = '';
406 406
 				$aident = '';
407
-				$n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident);
407
+				$n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident);
408 408
 				if ($n == 8) {
409 409
 					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
410 410
 					$icao = trim($aident);
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 				*/
438 438
 				$dair = '';
439 439
 				$darr = '';
440
-				$n = sscanf($message,'%4[A-Z]%4[A-Z]%*4d',$dair,$darr);
440
+				$n = sscanf($message, '%4[A-Z]%4[A-Z]%*4d', $dair, $darr);
441 441
 				if ($n == 3) {
442 442
 					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
443 443
 					//$icao = $Translation->checkTranslation($ident);
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 				*/
454 454
 				$dair = '';
455 455
 				$darr = '';
456
-				$n = sscanf($message,'3J01 DSPTCH %*d/%*d %4s/%4s .%*6s',$dair,$darr);
456
+				$n = sscanf($message, '3J01 DSPTCH %*d/%*d %4s/%4s .%*6s', $dair, $darr);
457 457
 				if ($n == 3) {
458 458
 					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
459 459
 					//$icao = $Translation->checkTranslation($ident);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 				}
465 465
 			}
466 466
 			if (!$found) {
467
-				$n = sscanf($message,'MET01%4c',$airport);
467
+				$n = sscanf($message, 'MET01%4c', $airport);
468 468
 				if ($n == 1) {
469 469
 					if ($globalDebug) echo 'airport name : '.$airport;
470 470
 					$decode = array('Airport/Waypoint name' => $airport);
@@ -473,241 +473,241 @@  discard block
 block discarded – undo
473 473
 			}
474 474
 
475 475
 			if ($label == 'H1') {
476
-				if (preg_match('/^#CFBFLR/',$message) || preg_match('/^#CFBWRN/',$message)) {
477
-					$decode = array_merge(array('Message nature' => 'Equipment failure'),$decode);
476
+				if (preg_match('/^#CFBFLR/', $message) || preg_match('/^#CFBWRN/', $message)) {
477
+					$decode = array_merge(array('Message nature' => 'Equipment failure'), $decode);
478 478
 				}
479
-				elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) {
480
-					$decode = array_merge(array('Message nature' => 'Take off performance data'),$decode);
479
+				elseif (preg_match('/^#DFB\*TKO/', $message) || preg_match('/^#DFBTKO/', $message)) {
480
+					$decode = array_merge(array('Message nature' => 'Take off performance data'), $decode);
481 481
 				}
482
-				elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) {
483
-					$decode = array_merge(array('Message nature' => 'Cruise performance data'),$decode);
482
+				elseif (preg_match('/^#DFB\*CRZ/', $message) || preg_match('/^#DFBCRZ/', $message)) {
483
+					$decode = array_merge(array('Message nature' => 'Cruise performance data'), $decode);
484 484
 				}
485
-				elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) {
486
-					$decode = array_merge(array('Message nature' => 'Weather observation'),$decode);
485
+				elseif (preg_match('/^#DFB\*WOB/', $message) || preg_match('/^#DFBWOB/', $message)) {
486
+					$decode = array_merge(array('Message nature' => 'Weather observation'), $decode);
487 487
 				}
488
-				elseif (preg_match(':^#DFB/PIREP:',$message)) {
489
-					$decode = array_merge(array('Message nature' => 'Pilot Report'),$decode);
488
+				elseif (preg_match(':^#DFB/PIREP:', $message)) {
489
+					$decode = array_merge(array('Message nature' => 'Pilot Report'), $decode);
490 490
 				}
491
-				elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) {
492
-					$decode = array_merge(array('Message nature' => 'Engine Data'),$decode);
491
+				elseif (preg_match('/^#DFBEDA/', $message) || preg_match('/^#DFBENG/', $message)) {
492
+					$decode = array_merge(array('Message nature' => 'Engine Data'), $decode);
493 493
 				}
494
-				elseif (preg_match(':^#M1AAEP:',$message)) {
495
-					$decode = array_merge(array('Message nature' => 'Position/Weather Report'),$decode);
494
+				elseif (preg_match(':^#M1AAEP:', $message)) {
495
+					$decode = array_merge(array('Message nature' => 'Position/Weather Report'), $decode);
496 496
 				}
497
-				elseif (preg_match(':^#M2APWD:',$message)) {
498
-					$decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'),$decode);
497
+				elseif (preg_match(':^#M2APWD:', $message)) {
498
+					$decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'), $decode);
499 499
 				}
500
-				elseif (preg_match(':^#M1BREQPWI:',$message)) {
501
-					$decode = array_merge(array('Message nature' => 'Predicted wind info request'),$decode);
500
+				elseif (preg_match(':^#M1BREQPWI:', $message)) {
501
+					$decode = array_merge(array('Message nature' => 'Predicted wind info request'), $decode);
502 502
 				}
503
-				elseif (preg_match(':^#CF:',$message)) {
504
-					$decode = array_merge(array('Message nature' => 'Central Fault Display'),$decode);
503
+				elseif (preg_match(':^#CF:', $message)) {
504
+					$decode = array_merge(array('Message nature' => 'Central Fault Display'), $decode);
505 505
 				}
506
-				elseif (preg_match(':^#DF:',$message)) {
507
-					$decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'),$decode);
506
+				elseif (preg_match(':^#DF:', $message)) {
507
+					$decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'), $decode);
508 508
 				}
509
-				elseif (preg_match(':^#EC:',$message)) {
510
-					$decode = array_merge(array('Message nature' => 'Engine Display System'),$decode);
509
+				elseif (preg_match(':^#EC:', $message)) {
510
+					$decode = array_merge(array('Message nature' => 'Engine Display System'), $decode);
511 511
 				}
512
-				elseif (preg_match(':^#EI:',$message)) {
513
-					$decode = array_merge(array('Message nature' => 'Engine Report'),$decode);
512
+				elseif (preg_match(':^#EI:', $message)) {
513
+					$decode = array_merge(array('Message nature' => 'Engine Report'), $decode);
514 514
 				}
515
-				elseif (preg_match(':^#H1:',$message)) {
516
-					$decode = array_merge(array('Message nature' => 'HF Data Radio - Left'),$decode);
515
+				elseif (preg_match(':^#H1:', $message)) {
516
+					$decode = array_merge(array('Message nature' => 'HF Data Radio - Left'), $decode);
517 517
 				}
518
-				elseif (preg_match(':^#H2:',$message)) {
519
-					$decode = array_merge(array('Message nature' => 'HF Data Radio - Right'),$decode);
518
+				elseif (preg_match(':^#H2:', $message)) {
519
+					$decode = array_merge(array('Message nature' => 'HF Data Radio - Right'), $decode);
520 520
 				}
521
-				elseif (preg_match(':^#HD:',$message)) {
522
-					$decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'),$decode);
521
+				elseif (preg_match(':^#HD:', $message)) {
522
+					$decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'), $decode);
523 523
 				}
524
-				elseif (preg_match(':^#M1:',$message)) {
525
-					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'),$decode);
524
+				elseif (preg_match(':^#M1:', $message)) {
525
+					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'), $decode);
526 526
 				}
527
-				elseif (preg_match(':^#M2:',$message)) {
528
-					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'),$decode);
527
+				elseif (preg_match(':^#M2:', $message)) {
528
+					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'), $decode);
529 529
 				}
530
-				elseif (preg_match(':^#M3:',$message)) {
531
-					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'),$decode);
530
+				elseif (preg_match(':^#M3:', $message)) {
531
+					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'), $decode);
532 532
 				}
533
-				elseif (preg_match(':^#MD:',$message)) {
534
-					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'),$decode);
533
+				elseif (preg_match(':^#MD:', $message)) {
534
+					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'), $decode);
535 535
 				}
536
-				elseif (preg_match(':^#PS:',$message)) {
537
-					$decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'),$decode);
536
+				elseif (preg_match(':^#PS:', $message)) {
537
+					$decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'), $decode);
538 538
 				}
539
-				elseif (preg_match(':^#S1:',$message)) {
540
-					$decode = array_merge(array('Message nature' => 'SDU - Left'),$decode);
539
+				elseif (preg_match(':^#S1:', $message)) {
540
+					$decode = array_merge(array('Message nature' => 'SDU - Left'), $decode);
541 541
 				}
542
-				elseif (preg_match(':^#S2:',$message)) {
543
-					$decode = array_merge(array('Message nature' => 'SDU - Right'),$decode);
542
+				elseif (preg_match(':^#S2:', $message)) {
543
+					$decode = array_merge(array('Message nature' => 'SDU - Right'), $decode);
544 544
 				}
545
-				elseif (preg_match(':^#SD:',$message)) {
546
-					$decode = array_merge(array('Message nature' => 'SDU - Selected'),$decode);
545
+				elseif (preg_match(':^#SD:', $message)) {
546
+					$decode = array_merge(array('Message nature' => 'SDU - Selected'), $decode);
547 547
 				}
548
-				elseif (preg_match(':^#T[0-8]:',$message)) {
549
-					$decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'),$decode);
548
+				elseif (preg_match(':^#T[0-8]:', $message)) {
549
+					$decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'), $decode);
550 550
 				}
551
-				elseif (preg_match(':^#WO:',$message)) {
552
-					$decode = array_merge(array('Message nature' => 'Weather Observation Report'),$decode);
551
+				elseif (preg_match(':^#WO:', $message)) {
552
+					$decode = array_merge(array('Message nature' => 'Weather Observation Report'), $decode);
553 553
 				}
554
-				elseif (preg_match(':^#A1:',$message)) {
555
-					$decode = array_merge(array('Message nature' => 'Oceanic Clearance'),$decode);
554
+				elseif (preg_match(':^#A1:', $message)) {
555
+					$decode = array_merge(array('Message nature' => 'Oceanic Clearance'), $decode);
556 556
 				}
557
-				elseif (preg_match(':^#A3:',$message)) {
558
-					$decode = array_merge(array('Message nature' => 'Departure Clearance Response'),$decode);
557
+				elseif (preg_match(':^#A3:', $message)) {
558
+					$decode = array_merge(array('Message nature' => 'Departure Clearance Response'), $decode);
559 559
 				}
560
-				elseif (preg_match(':^#A4:',$message)) {
561
-					$decode = array_merge(array('Message nature' => 'Flight Systems Message'),$decode);
560
+				elseif (preg_match(':^#A4:', $message)) {
561
+					$decode = array_merge(array('Message nature' => 'Flight Systems Message'), $decode);
562 562
 				}
563
-				elseif (preg_match(':^#A6:',$message)) {
564
-					$decode = array_merge(array('Message nature' => 'Request ADS Reports'),$decode);
563
+				elseif (preg_match(':^#A6:', $message)) {
564
+					$decode = array_merge(array('Message nature' => 'Request ADS Reports'), $decode);
565 565
 				}
566
-				elseif (preg_match(':^#A8:',$message)) {
567
-					$decode = array_merge(array('Message nature' => 'Deliver Departure Slot'),$decode);
566
+				elseif (preg_match(':^#A8:', $message)) {
567
+					$decode = array_merge(array('Message nature' => 'Deliver Departure Slot'), $decode);
568 568
 				}
569
-				elseif (preg_match(':^#A9:',$message)) {
570
-					$decode = array_merge(array('Message nature' => 'ATIS report'),$decode);
569
+				elseif (preg_match(':^#A9:', $message)) {
570
+					$decode = array_merge(array('Message nature' => 'ATIS report'), $decode);
571 571
 				}
572
-				elseif (preg_match(':^#A0:',$message)) {
573
-					$decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'),$decode);
572
+				elseif (preg_match(':^#A0:', $message)) {
573
+					$decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'), $decode);
574 574
 				}
575
-				elseif (preg_match(':^#AA:',$message)) {
576
-					$decode = array_merge(array('Message nature' => 'ATCComm'),$decode);
575
+				elseif (preg_match(':^#AA:', $message)) {
576
+					$decode = array_merge(array('Message nature' => 'ATCComm'), $decode);
577 577
 				}
578
-				elseif (preg_match(':^#AB:',$message)) {
579
-					$decode = array_merge(array('Message nature' => 'TWIP Report'),$decode);
578
+				elseif (preg_match(':^#AB:', $message)) {
579
+					$decode = array_merge(array('Message nature' => 'TWIP Report'), $decode);
580 580
 				}
581
-				elseif (preg_match(':^#AC:',$message)) {
582
-					$decode = array_merge(array('Message nature' => 'Pushback Clearance'),$decode);
581
+				elseif (preg_match(':^#AC:', $message)) {
582
+					$decode = array_merge(array('Message nature' => 'Pushback Clearance'), $decode);
583 583
 				}
584
-				elseif (preg_match(':^#AD:',$message)) {
585
-					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'),$decode);
584
+				elseif (preg_match(':^#AD:', $message)) {
585
+					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'), $decode);
586 586
 				}
587
-				elseif (preg_match(':^#AF:',$message)) {
588
-					$decode = array_merge(array('Message nature' => 'CPC Command/Response'),$decode);
587
+				elseif (preg_match(':^#AF:', $message)) {
588
+					$decode = array_merge(array('Message nature' => 'CPC Command/Response'), $decode);
589 589
 				}
590
-				elseif (preg_match(':^#B1:',$message)) {
591
-					$decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'),$decode);
590
+				elseif (preg_match(':^#B1:', $message)) {
591
+					$decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'), $decode);
592 592
 				}
593
-				elseif (preg_match(':^#B2:',$message)) {
594
-					$decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'),$decode);
593
+				elseif (preg_match(':^#B2:', $message)) {
594
+					$decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'), $decode);
595 595
 				}
596
-				elseif (preg_match(':^#B3:',$message)) {
597
-					$decode = array_merge(array('Message nature' => 'Request Departure Clearance'),$decode);
596
+				elseif (preg_match(':^#B3:', $message)) {
597
+					$decode = array_merge(array('Message nature' => 'Request Departure Clearance'), $decode);
598 598
 				}
599
-				elseif (preg_match(':^#B4:',$message)) {
600
-					$decode = array_merge(array('Message nature' => 'Departure Clearance Readback'),$decode);
599
+				elseif (preg_match(':^#B4:', $message)) {
600
+					$decode = array_merge(array('Message nature' => 'Departure Clearance Readback'), $decode);
601 601
 				}
602
-				elseif (preg_match(':^#B6:',$message)) {
603
-					$decode = array_merge(array('Message nature' => 'Provide ADS Report'),$decode);
602
+				elseif (preg_match(':^#B6:', $message)) {
603
+					$decode = array_merge(array('Message nature' => 'Provide ADS Report'), $decode);
604 604
 				}
605
-				elseif (preg_match(':^#B8:',$message)) {
606
-					$decode = array_merge(array('Message nature' => 'Request Departure Slot'),$decode);
605
+				elseif (preg_match(':^#B8:', $message)) {
606
+					$decode = array_merge(array('Message nature' => 'Request Departure Slot'), $decode);
607 607
 				}
608
-				elseif (preg_match(':^#B9:',$message)) {
609
-					$decode = array_merge(array('Message nature' => 'Request ATIS Report'),$decode);
608
+				elseif (preg_match(':^#B9:', $message)) {
609
+					$decode = array_merge(array('Message nature' => 'Request ATIS Report'), $decode);
610 610
 				}
611
-				elseif (preg_match(':^#B0:',$message)) {
612
-					$decode = array_merge(array('Message nature' => 'ATS Facility Notification'),$decode);
611
+				elseif (preg_match(':^#B0:', $message)) {
612
+					$decode = array_merge(array('Message nature' => 'ATS Facility Notification'), $decode);
613 613
 				}
614
-				elseif (preg_match(':^#BA:',$message)) {
615
-					$decode = array_merge(array('Message nature' => 'ATCComm'),$decode);
614
+				elseif (preg_match(':^#BA:', $message)) {
615
+					$decode = array_merge(array('Message nature' => 'ATCComm'), $decode);
616 616
 				}
617
-				elseif (preg_match(':^#BB:',$message)) {
618
-					$decode = array_merge(array('Message nature' => 'Request TWIP Report'),$decode);
617
+				elseif (preg_match(':^#BB:', $message)) {
618
+					$decode = array_merge(array('Message nature' => 'Request TWIP Report'), $decode);
619 619
 				}
620
-				elseif (preg_match(':^#BC:',$message)) {
621
-					$decode = array_merge(array('Message nature' => 'Pushback Clearance Request'),$decode);
620
+				elseif (preg_match(':^#BC:', $message)) {
621
+					$decode = array_merge(array('Message nature' => 'Pushback Clearance Request'), $decode);
622 622
 				}
623
-				elseif (preg_match(':^#BD:',$message)) {
624
-					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'),$decode);
623
+				elseif (preg_match(':^#BD:', $message)) {
624
+					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'), $decode);
625 625
 				}
626
-				elseif (preg_match(':^#BE:',$message)) {
627
-					$decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'),$decode);
626
+				elseif (preg_match(':^#BE:', $message)) {
627
+					$decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'), $decode);
628 628
 				}
629
-				elseif (preg_match(':^#BF:',$message)) {
630
-					$decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'),$decode);
629
+				elseif (preg_match(':^#BF:', $message)) {
630
+					$decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'), $decode);
631 631
 				}
632
-				elseif (preg_match(':^#H3:',$message)) {
633
-					$decode = array_merge(array('Message nature' => 'Icing Report'),$decode);
632
+				elseif (preg_match(':^#H3:', $message)) {
633
+					$decode = array_merge(array('Message nature' => 'Icing Report'), $decode);
634 634
 				}
635 635
 			}
636 636
 			if ($label == '10') {
637
-				if (preg_match(':^DTO01:',$message)) {
638
-					$decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'),$decode);
637
+				if (preg_match(':^DTO01:', $message)) {
638
+					$decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'), $decode);
639 639
 				}
640
-				elseif (preg_match(':^AIS01:',$message)) {
641
-					$decode = array_merge(array('Message nature' => 'AIS Request'),$decode);
640
+				elseif (preg_match(':^AIS01:', $message)) {
641
+					$decode = array_merge(array('Message nature' => 'AIS Request'), $decode);
642 642
 				}
643
-				elseif (preg_match(':^FTX01:',$message)) {
644
-					$decode = array_merge(array('Message nature' => 'Free Text Downlink'),$decode);
643
+				elseif (preg_match(':^FTX01:', $message)) {
644
+					$decode = array_merge(array('Message nature' => 'Free Text Downlink'), $decode);
645 645
 				}
646
-				elseif (preg_match(':^FPL01:',$message)) {
647
-					$decode = array_merge(array('Message nature' => 'Flight Plan Request'),$decode);
646
+				elseif (preg_match(':^FPL01:', $message)) {
647
+					$decode = array_merge(array('Message nature' => 'Flight Plan Request'), $decode);
648 648
 				}
649
-				elseif (preg_match(':^WAB01:',$message)) {
650
-					$decode = array_merge(array('Message nature' => 'Weight & Balance Request'),$decode);
649
+				elseif (preg_match(':^WAB01:', $message)) {
650
+					$decode = array_merge(array('Message nature' => 'Weight & Balance Request'), $decode);
651 651
 				}
652
-				elseif (preg_match(':^MET01:',$message)) {
653
-					$decode = array_merge(array('Message nature' => 'Weather Data Request'),$decode);
652
+				elseif (preg_match(':^MET01:', $message)) {
653
+					$decode = array_merge(array('Message nature' => 'Weather Data Request'), $decode);
654 654
 				}
655
-				elseif (preg_match(':^WAB02:',$message)) {
656
-					$decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'),$decode);
655
+				elseif (preg_match(':^WAB02:', $message)) {
656
+					$decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'), $decode);
657 657
 				}
658 658
 			}
659 659
 			if ($label == '15') {
660
-				if (preg_match(':^FST01:',$message)) {
661
-					$decode = array_merge(array('Message nature' => 'Flight Status Report'),$decode);
660
+				if (preg_match(':^FST01:', $message)) {
661
+					$decode = array_merge(array('Message nature' => 'Flight Status Report'), $decode);
662 662
 				}
663 663
 			}
664 664
 			if (!$found && $label == 'SA') {
665
-				$n = sscanf($message, "%d%c%c%6[0-9]", $version,$state,$type,$at);
665
+				$n = sscanf($message, "%d%c%c%6[0-9]", $version, $state, $type, $at);
666 666
 				if ($n == 4) {
667 667
 					$vsta = array('Version' => $version);
668 668
 					if ($state == 'E') {
669
-						$vsta = array_merge($vsta,array('Link state' => 'Established'));
669
+						$vsta = array_merge($vsta, array('Link state' => 'Established'));
670 670
 					}
671 671
 					elseif ($state == 'L') {
672
-						$vsta = array_merge($vsta,array('Link state' => 'Lost'));
672
+						$vsta = array_merge($vsta, array('Link state' => 'Lost'));
673 673
 					}
674 674
 					else {
675
-						$vsta = array_merge($vsta,array('Link state' => 'Unknown'));
675
+						$vsta = array_merge($vsta, array('Link state' => 'Unknown'));
676 676
 					}
677 677
 					if ($type == 'V') {
678
-						$vsta = array_merge($vsta,array('Link type' => 'VHF ACARS'));
678
+						$vsta = array_merge($vsta, array('Link type' => 'VHF ACARS'));
679 679
 					}
680 680
 					elseif ($type == 'S') {
681
-						$vsta = array_merge($vsta,array('Link type' => 'Generic SATCOM'));
681
+						$vsta = array_merge($vsta, array('Link type' => 'Generic SATCOM'));
682 682
 					}
683 683
 					elseif ($type == 'H') {
684
-						$vsta = array_merge($vsta,array('Link type' => 'HF'));
684
+						$vsta = array_merge($vsta, array('Link type' => 'HF'));
685 685
 					}
686 686
 					elseif ($type == 'G') {
687
-						$vsta = array_merge($vsta,array('Link type' => 'GlobalStar SATCOM'));
687
+						$vsta = array_merge($vsta, array('Link type' => 'GlobalStar SATCOM'));
688 688
 					}
689 689
 					elseif ($type == 'C') {
690
-						$vsta = array_merge($vsta,array('Link type' => 'ICO SATCOM'));
690
+						$vsta = array_merge($vsta, array('Link type' => 'ICO SATCOM'));
691 691
 					}
692 692
 					elseif ($type == '2') {
693
-						$vsta = array_merge($vsta,array('Link type' => 'VDL Mode 2'));
693
+						$vsta = array_merge($vsta, array('Link type' => 'VDL Mode 2'));
694 694
 					}
695 695
 					elseif ($type == 'X') {
696
-						$vsta = array_merge($vsta,array('Link type' => 'Inmarsat Aero'));
696
+						$vsta = array_merge($vsta, array('Link type' => 'Inmarsat Aero'));
697 697
 					}
698 698
 					elseif ($type == 'I') {
699
-						$vsta = array_merge($vsta,array('Link type' => 'Irridium SATCOM'));
699
+						$vsta = array_merge($vsta, array('Link type' => 'Irridium SATCOM'));
700 700
 					}
701 701
 					else {
702
-						$vsta = array_merge($vsta,array('Link type' => 'Unknown'));
702
+						$vsta = array_merge($vsta, array('Link type' => 'Unknown'));
703 703
 					}
704
-					$vsta = array_merge($vsta,array('Event occured at' => implode(':',str_split($at,2))));
705
-					$decode = array_merge($vsta,$decode);
704
+					$vsta = array_merge($vsta, array('Event occured at' => implode(':', str_split($at, 2))));
705
+					$decode = array_merge($vsta, $decode);
706 706
 				}
707 707
 			}
708 708
 
709 709
 			$title = $this->getTitlefromLabel($label);
710
-			if ($title != '') $decode = array_merge(array('Message title' => $title),$decode);
710
+			if ($title != '') $decode = array_merge(array('Message title' => $title), $decode);
711 711
 
712 712
 			/*
713 713
 			// Business jets always use GS0001
@@ -740,13 +740,13 @@  discard block
 block discarded – undo
740 740
 		$message = $this->parse($data);
741 741
 		if (isset($message['registration']) && $message['registration'] != '' && $message['ident'] != '' && $message['registration'] != '!') {
742 742
 		
743
-			$ident = (string)$message['ident'];
743
+			$ident = (string) $message['ident'];
744 744
 			$label = $message['label'];
745 745
 			$block_id = $message['block_id'];
746 746
 			$msg_no = $message['msg_no'];
747 747
 			$msg = $message['message'];
748 748
 			$decode = $message['decode'];
749
-			$registration = (string)$message['registration'];
749
+			$registration = (string) $message['registration'];
750 750
 		
751 751
 			if (isset($decode['latitude'])) $latitude = $decode['latitude'];
752 752
 			else $latitude = '';
@@ -763,23 +763,23 @@  discard block
 block discarded – undo
763 763
 			}
764 764
 		
765 765
 			// Business jets always use GS0001
766
-			if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude);
766
+			if ($ident != 'GS0001') $info = $this->addModeSData($ident, $registration, $icao, $airicao, $latitude, $longitude);
767 767
 			if ($globalDebug && isset($info) && $info != '') echo $info;
768 768
 
769 769
 			if (count($decode) > 0) $decode_json = json_encode($decode);
770 770
 			else $decode_json = '';
771 771
 			if (isset($decode['Departure airport']) && isset($decode['Departure hour']) && isset($decode['Arrival airport']) && isset($decode['Arrival hour'])) {
772
-				$Schedule->addSchedule($icao,$decode['Departure airport'],$decode['Departure hour'],$decode['Arrival airport'],$decode['Arrival hour'],'ACARS');
772
+				$Schedule->addSchedule($icao, $decode['Departure airport'], $decode['Departure hour'], $decode['Arrival airport'], $decode['Arrival hour'], 'ACARS');
773 773
 			} elseif (isset($decode['Departure airport']) && isset($decode['Arrival airport'])) {
774
-				$Schedule->addSchedule($icao,$decode['Departure airport'],'',$decode['Arrival airport'],'','ACARS');
774
+				$Schedule->addSchedule($icao, $decode['Departure airport'], '', $decode['Arrival airport'], '', 'ACARS');
775 775
 			}
776 776
 
777
-			$result = $this->addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json);
778
-			if (!isset($globalACARSArchive)) $globalACARSArchive = array('10','80','81','82','3F');
779
-			if ($result && in_array($label,$globalACARSArchive)) $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json);
777
+			$result = $this->addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json);
778
+			if (!isset($globalACARSArchive)) $globalACARSArchive = array('10', '80', '81', '82', '3F');
779
+			if ($result && in_array($label, $globalACARSArchive)) $this->addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json);
780 780
 
781 781
 			if ($globalDebug && count($decode) > 0) {
782
-				echo "Human readable data : ".implode(' - ',$decode)."\n";
782
+				echo "Human readable data : ".implode(' - ', $decode)."\n";
783 783
 			}
784 784
 		}
785 785
 	}
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 	* @param String $msg_no Number of the ACARS message
795 795
 	* @param String $message ACARS message
796 796
 	*/
797
-	public function addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
797
+	public function addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') {
798 798
 		global $globalDebug;
799 799
 		date_default_timezone_set('UTC');
800 800
 		if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '') {
@@ -803,22 +803,22 @@  discard block
 block discarded – undo
803 803
 
804 804
 			if ($globalDebug) echo "Test if not already in Live ACARS table...";
805 805
 			$query_test = "SELECT COUNT(*) as nb FROM acars_live WHERE ident = :ident AND registration = :registration AND message = :message";
806
-			$query_test_values = array(':ident' => $ident,':registration' => $registration, ':message' => $message);
806
+			$query_test_values = array(':ident' => $ident, ':registration' => $registration, ':message' => $message);
807 807
 			try {
808 808
 				$stht = $this->db->prepare($query_test);
809 809
 				$stht->execute($query_test_values);
810
-			} catch(PDOException $e) {
810
+			} catch (PDOException $e) {
811 811
 				return "error : ".$e->getMessage();
812 812
 			}
813 813
 			if ($stht->fetchColumn() == 0) {
814 814
 				if ($globalDebug) echo "Add Live ACARS data...";
815 815
 				$query = "INSERT INTO acars_live (ident,registration,label,block_id,msg_no,message,decode,date) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode,:date)";
816
-				$query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode,':date' => date("Y-m-d H:i:s"));
816
+				$query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode, ':date' => date("Y-m-d H:i:s"));
817 817
 				try {
818 818
 
819 819
 					$sth = $this->db->prepare($query);
820 820
 					$sth->execute($query_values);
821
-				} catch(PDOException $e) {
821
+				} catch (PDOException $e) {
822 822
 					return "error : ".$e->getMessage();
823 823
 				}
824 824
 			} else {
@@ -840,10 +840,10 @@  discard block
 block discarded – undo
840 840
 	* @param String $msg_no Number of the ACARS message
841 841
 	* @param String $message ACARS message
842 842
 	*/
843
-	public function addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
843
+	public function addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') {
844 844
 		global $globalDebug;
845 845
 		date_default_timezone_set('UTC');
846
-		if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/',$message) === 0 && preg_match('/^ARR0/',$message) === 0 && preg_match('/^ETA/',$message) === 0 && preg_match('/^WXR/',$message) === 0 && preg_match('/^FTX01.FIC/',$message) === 0) {
846
+		if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/', $message) === 0 && preg_match('/^ARR0/', $message) === 0 && preg_match('/^ETA/', $message) === 0 && preg_match('/^WXR/', $message) === 0 && preg_match('/^FTX01.FIC/', $message) === 0) {
847 847
 			/*
848 848
 				    if ($globalDebug) echo "Test if not already in Archive ACARS table...";
849 849
 			    	    $query_test = "SELECT COUNT(*) as nb FROM acars_archive WHERE ident = :ident AND registration = :registration AND message = :message";
@@ -859,12 +859,12 @@  discard block
 block discarded – undo
859 859
 			*/
860 860
 			if ($globalDebug) echo "Add Live ACARS data...";
861 861
 			$query = "INSERT INTO acars_archive (ident,registration,label,block_id,msg_no,message,decode) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode)";
862
-			$query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode);
862
+			$query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode);
863 863
 			try {
864 864
 
865 865
 				$sth = $this->db->prepare($query);
866 866
 				$sth->execute($query_values);
867
-			} catch(PDOException $e) {
867
+			} catch (PDOException $e) {
868 868
 				return "error : ".$e->getMessage();
869 869
 			}
870 870
 //    	    }
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 
888 888
 			$sth = $this->db->prepare($query);
889 889
 			$sth->execute($query_values);
890
-		} catch(PDOException $e) {
890
+		} catch (PDOException $e) {
891 891
 			echo "error : ".$e->getMessage();
892 892
 			die;
893 893
 		}
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 
909 909
 			$sth = $this->db->prepare($query);
910 910
 			$sth->execute($query_values);
911
-		} catch(PDOException $e) {
911
+		} catch (PDOException $e) {
912 912
 			echo "error : ".$e->getMessage();
913 913
 			die;
914 914
 		}
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 
931 931
 			$sth = $this->db->prepare($query);
932 932
 			$sth->execute($query_values);
933
-		} catch(PDOException $e) {
933
+		} catch (PDOException $e) {
934 934
 			echo "error : ".$e->getMessage();
935 935
 			die;
936 936
 		}
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 	*
945 945
 	* @return Array Return ACARS data in array
946 946
 	*/
947
-	public function getLatestAcarsData($limit = '',$label = '') {
947
+	public function getLatestAcarsData($limit = '', $label = '') {
948 948
 		global $globalURL, $globalDBdriver;
949 949
 		$Image = new Image($this->db);
950 950
 		$Spotter = new Spotter($this->db);
@@ -956,8 +956,8 @@  discard block
 block discarded – undo
956 956
 		{
957 957
 			$limit_array = explode(",", $limit);
958 958
 
959
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
960
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
959
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
960
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
961 961
 
962 962
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
963 963
 			{
@@ -979,48 +979,48 @@  discard block
 block discarded – undo
979 979
 
980 980
 			$sth = $this->db->prepare($query);
981 981
 			$sth->execute($query_values);
982
-		} catch(PDOException $e) {
982
+		} catch (PDOException $e) {
983 983
 			return "error : ".$e->getMessage();
984 984
 		}
985 985
 		$i = 0;
986 986
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
987 987
 			$data = array();
988 988
 			if ($row['registration'] != '') {
989
-				$row['registration'] = str_replace('.','',$row['registration']);
989
+				$row['registration'] = str_replace('.', '', $row['registration']);
990 990
 				$image_array = $Image->getSpotterImage($row['registration']);
991
-				if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
992
-				else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
993
-			} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
991
+				if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website']));
992
+				else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
993
+			} else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
994 994
 			if ($row['registration'] == '') $row['registration'] = 'NA';
995 995
 			if ($row['ident'] == '') $row['ident'] = 'NA';
996
-			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2));
996
+			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2));
997 997
 			if (isset($identicao[0])) {
998
-				if (substr($row['ident'],0,2) == 'AF') {
999
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1000
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
1001
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
998
+				if (substr($row['ident'], 0, 2) == 'AF') {
999
+					if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1000
+					else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0');
1001
+				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0');
1002 1002
 
1003
-				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
1003
+				$data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name']));
1004 1004
 			} else $icao = $row['ident'];
1005
-			$icao = $Translation->checkTranslation($icao,false);
1005
+			$icao = $Translation->checkTranslation($icao, false);
1006 1006
 
1007
-			$decode = json_decode($row['decode'],true);
1007
+			$decode = json_decode($row['decode'], true);
1008 1008
 			$found = false;
1009
-			if ($decode != '' && array_key_exists('Departure airport',$decode)) {
1009
+			if ($decode != '' && array_key_exists('Departure airport', $decode)) {
1010 1010
 				$airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']);
1011 1011
 				if (isset($airport_info[0]['icao'])) {
1012 1012
 					$decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1013 1013
 					$found = true;
1014 1014
 				}
1015 1015
 			}
1016
-			if ($decode != '' && array_key_exists('Arrival airport',$decode)) {
1016
+			if ($decode != '' && array_key_exists('Arrival airport', $decode)) {
1017 1017
 				$airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']);
1018 1018
 				if (isset($airport_info[0]['icao'])) {
1019 1019
 					$decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1020 1020
 					$found = true;
1021 1021
 				}
1022 1022
 			}
1023
-			if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) {
1023
+			if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) {
1024 1024
 				$airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']);
1025 1025
 				if (isset($airport_info[0]['icao'])) {
1026 1026
 					$decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 				}
1029 1029
 			}
1030 1030
 			if ($found) $row['decode'] = json_encode($decode);
1031
-			$data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1031
+			$data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1032 1032
 			$result[] = $data;
1033 1033
 			$i++;
1034 1034
 		}
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 	*
1045 1045
 	* @return Array Return ACARS data in array
1046 1046
 	*/
1047
-	public function getArchiveAcarsData($limit = '',$label = '') {
1047
+	public function getArchiveAcarsData($limit = '', $label = '') {
1048 1048
 		global $globalURL, $globalDBdriver;
1049 1049
 		$Image = new Image($this->db);
1050 1050
 		$Spotter = new Spotter($this->db);
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 		{
1057 1057
 			$limit_array = explode(",", $limit);
1058 1058
 
1059
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1060
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1059
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1060
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1061 1061
 
1062 1062
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1063 1063
 			{
@@ -1087,45 +1087,45 @@  discard block
 block discarded – undo
1087 1087
 
1088 1088
 			$sth = $this->db->prepare($query);
1089 1089
 			$sth->execute($query_values);
1090
-		} catch(PDOException $e) {
1090
+		} catch (PDOException $e) {
1091 1091
 			return "error : ".$e->getMessage();
1092 1092
 		}
1093
-		$i=0;
1093
+		$i = 0;
1094 1094
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
1095 1095
 			$data = array();
1096 1096
 			if ($row['registration'] != '') {
1097
-				$row['registration'] = str_replace('.','',$row['registration']);
1097
+				$row['registration'] = str_replace('.', '', $row['registration']);
1098 1098
 				$image_array = $Image->getSpotterImage($row['registration']);
1099
-				if (count($image_array) > 0) $data = array_merge($data,array('image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
1100
-				else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1101
-			} else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1099
+				if (count($image_array) > 0) $data = array_merge($data, array('image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website']));
1100
+				else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
1101
+			} else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
1102 1102
 			$icao = '';
1103 1103
 			if ($row['registration'] == '') $row['registration'] = 'NA';
1104 1104
 			if ($row['ident'] == '') $row['ident'] = 'NA';
1105
-			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2));
1105
+			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2));
1106 1106
 			if (isset($identicao[0])) {
1107
-				if (substr($row['ident'],0,2) == 'AF') {
1108
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1109
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
1110
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
1111
-				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
1107
+				if (substr($row['ident'], 0, 2) == 'AF') {
1108
+					if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1109
+					else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0');
1110
+				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0');
1111
+				$data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name']));
1112 1112
 			} else $icao = $row['ident'];
1113 1113
 			$icao = $Translation->checkTranslation($icao);
1114 1114
 
1115 1115
 
1116
-			$decode = json_decode($row['decode'],true);
1116
+			$decode = json_decode($row['decode'], true);
1117 1117
 			$found = false;
1118
-			if ($decode != '' && array_key_exists('Departure airport',$decode)) {
1118
+			if ($decode != '' && array_key_exists('Departure airport', $decode)) {
1119 1119
 				$airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']);
1120 1120
 				if (isset($airport_info[0]['icao'])) $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1121 1121
 				$found = true;
1122 1122
 			}
1123
-			if ($decode != '' && array_key_exists('Arrival airport',$decode)) {
1123
+			if ($decode != '' && array_key_exists('Arrival airport', $decode)) {
1124 1124
 				$airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']);
1125 1125
 				if (isset($airport_info[0]['icao'])) $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1126 1126
 				$found = true;
1127 1127
 			}
1128
-			if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) {
1128
+			if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) {
1129 1129
 				$airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']);
1130 1130
 				if (isset($airport_info[0]['icao'])) {
1131 1131
 					$decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 			}
1135 1135
 			if ($found) $row['decode'] = json_encode($decode);
1136 1136
 
1137
-			$data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1137
+			$data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1138 1138
 			$result[] = $data;
1139 1139
 			$i++;
1140 1140
 		}
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 	* @param String $icao
1153 1153
 	* @param String $ICAOTypeCode
1154 1154
 	*/
1155
-	public function addModeSData($ident,$registration,$icao = '',$ICAOTypeCode = '',$latitude = '', $longitude = '') {
1155
+	public function addModeSData($ident, $registration, $icao = '', $ICAOTypeCode = '', $latitude = '', $longitude = '') {
1156 1156
 		global $globalDebug, $globalDBdriver;
1157 1157
 		$ident = trim($ident);
1158 1158
 		$Translation = new Translation($this->db);
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 			return '';
1167 1167
 		}
1168 1168
 
1169
-		$registration = str_replace('.','',$registration);
1169
+		$registration = str_replace('.', '', $registration);
1170 1170
 		$ident = $Translation->ident2icao($ident);
1171 1171
 		// Check if a flight with same registration is flying now, if ok check if callsign = name in ACARS, else add it to translation
1172 1172
 		if ($globalDebug) echo "Check if needed to add translation ".$ident.'... ';
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 
1177 1177
 			$sthsi = $this->db->prepare($querysi);
1178 1178
 			$sthsi->execute($querysi_values);
1179
-		} catch(PDOException $e) {
1179
+		} catch (PDOException $e) {
1180 1180
 			if ($globalDebug) echo $e->getMessage();
1181 1181
 			return "error : ".$e->getMessage();
1182 1182
 		}
@@ -1187,8 +1187,8 @@  discard block
 block discarded – undo
1187 1187
 			$Translation = new Translation($this->db);
1188 1188
 			$trans_ident = $Translation->getOperator($resultsi['ident']);
1189 1189
 			if ($globalDebug) echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' ';
1190
-			if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'],$ident,'ACARS');
1191
-			elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'],$ident,'ACARS');
1190
+			if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'], $ident, 'ACARS');
1191
+			elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'], $ident, 'ACARS');
1192 1192
 		} else {
1193 1193
 			if ($registration != '' && $latitude != '' && $longitude != '') {
1194 1194
 				$query = "SELECT ModeS FROM aircraft_modes WHERE Registration = :registration LIMIT 1";
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 				try {
1197 1197
 					$sth = $this->db->prepare($query);
1198 1198
 					$sth->execute($query_values);
1199
-				} catch(PDOException $e) {
1199
+				} catch (PDOException $e) {
1200 1200
 					if ($globalDebug) echo $e->getMessage();
1201 1201
 					return "error : ".$e->getMessage();
1202 1202
 				}
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 				$sth->closeCursor();
1205 1205
 				if (isset($result['modes'])) $hex = $result['modes'];
1206 1206
 				else $hex = '';
1207
-				$SI_data = array('hex' => $hex,'ident' => $ident,'aircraft_icao' => $ICAOTypeCode,'registration' => $registration,'latitude' => $latitude,'$longitude' => $longitude,'format_source' => 'ACARS');
1207
+				$SI_data = array('hex' => $hex, 'ident' => $ident, 'aircraft_icao' => $ICAOTypeCode, 'registration' => $registration, 'latitude' => $latitude, '$longitude' => $longitude, 'format_source' => 'ACARS');
1208 1208
 				$this->SI->add($SI_data);
1209 1209
 			}
1210 1210
 		}
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 
1217 1217
 			$sth = $this->db->prepare($query);
1218 1218
 			$sth->execute($query_values);
1219
-		} catch(PDOException $e) {
1219
+		} catch (PDOException $e) {
1220 1220
 			if ($globalDebug) echo $e->getMessage();
1221 1221
 			return "error : ".$e->getMessage();
1222 1222
 		}
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			if (isset($result['ModeS'])) $ModeS = $result['ModeS'];
1228 1228
 			else $ModeS = '';
1229 1229
 			if ($ModeS == '') {
1230
-				$id = explode('-',$result['flightaware_id']);
1230
+				$id = explode('-', $result['flightaware_id']);
1231 1231
 				$ModeS = $id[0];
1232 1232
 			}
1233 1233
 			if ($ModeS != '') {
@@ -1238,21 +1238,21 @@  discard block
 block discarded – undo
1238 1238
 
1239 1239
 					$sthc = $this->db->prepare($queryc);
1240 1240
 					$sthc->execute($queryc_values);
1241
-				} catch(PDOException $e) {
1241
+				} catch (PDOException $e) {
1242 1242
 					if ($globalDebug) echo $e->getMessage();
1243 1243
 					return "error : ".$e->getMessage();
1244 1244
 				}
1245 1245
 				$row = $sthc->fetch(PDO::FETCH_ASSOC);
1246 1246
 				$sthc->closeCursor();
1247
-				if (count($row) ==  0) {
1247
+				if (count($row) == 0) {
1248 1248
 					if ($globalDebug) echo " Add to ModeS table - ";
1249 1249
 					$queryi = "INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:ModeSCountry,:Registration, :ICAOTypeCode,'ACARS')";
1250
-					$queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
1250
+					$queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
1251 1251
 					try {
1252 1252
 
1253 1253
 						$sthi = $this->db->prepare($queryi);
1254 1254
 						$sthi->execute($queryi_values);
1255
-					} catch(PDOException $e) {
1255
+					} catch (PDOException $e) {
1256 1256
 						if ($globalDebug) echo $e->getMessage();
1257 1257
 						return "error : ".$e->getMessage();
1258 1258
 					}
@@ -1260,16 +1260,16 @@  discard block
 block discarded – undo
1260 1260
 					if ($globalDebug) echo " Update ModeS table - ";
1261 1261
 					if ($ICAOTypeCode != '') {
1262 1262
 						$queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,ICAOTypeCode = :ICAOTypeCode,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS";
1263
-						$queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
1263
+						$queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
1264 1264
 					} else {
1265 1265
 						$queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS";
1266
-						$queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration);
1266
+						$queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration);
1267 1267
 					}
1268 1268
 					try {
1269 1269
 
1270 1270
 						$sthi = $this->db->prepare($queryi);
1271 1271
 						$sthi->execute($queryi_values);
1272
-					} catch(PDOException $e) {
1272
+					} catch (PDOException $e) {
1273 1273
 						if ($globalDebug) echo $e->getMessage();
1274 1274
 						return "error : ".$e->getMessage();
1275 1275
 					}
@@ -1307,13 +1307,13 @@  discard block
 block discarded – undo
1307 1307
 					elseif ($globalDBdriver == 'pgsql') {
1308 1308
 						$queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= NOW() AT TIME ZONE 'UTC' - INTERVAL '1 HOUR'";
1309 1309
 					}
1310
-					$queryi_values = array(':Registration' => $registration,':ident' => $icao);
1310
+					$queryi_values = array(':Registration' => $registration, ':ident' => $icao);
1311 1311
 				}
1312 1312
 				try {
1313 1313
 
1314 1314
 					$sthi = $this->db->prepare($queryi);
1315 1315
 					$sthi->execute($queryi_values);
1316
-				} catch(PDOException $e) {
1316
+				} catch (PDOException $e) {
1317 1317
 					if ($globalDebug) echo $e->getMessage();
1318 1318
 					return "error : ".$e->getMessage();
1319 1319
 				}
Please login to merge, or discard this patch.