Completed
Push — master ( baa1fe...14925d )
by Yannick
164:26 queued 132:19
created
aircraft-data.php 1 patch
Braces   +51 added lines, -20 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@  discard block
 block discarded – undo
57 57
 {
58 58
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
59 59
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
60
-	} else $image = $spotter_item['image_thumbnail'];
60
+	} else {
61
+		$image = $spotter_item['image_thumbnail'];
62
+	}
61 63
 
62 64
 }
63 65
 /* else {
@@ -70,8 +72,12 @@  discard block
 block discarded – undo
70 72
 }
71 73
 print '<div class="right">';
72 74
 print '<div class="callsign-details">';
73
-if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
74
-if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
75
+if ($spotter_item['ident'] != 'Not Available') {
76
+	print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
77
+}
78
+if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') {
79
+	print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
80
+}
75 81
 print '</div>';
76 82
 if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') {
77 83
 	print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
@@ -103,10 +109,16 @@  discard block
 block discarded – undo
103 109
 print '</div>';
104 110
 print '<div id="aircraft">';
105 111
 print '<span>'._("Aircraft").'</span>';
106
-if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
107
-if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
108
-elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
109
-else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
112
+if (isset($spotter_item['aircraft_wiki'])) {
113
+	print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
114
+}
115
+if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
116
+	print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
117
+} elseif (isset($spotter_item['aircraft_type'])) {
118
+	print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
119
+} else {
120
+	print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
121
+}
110 122
 print '</div>';
111 123
 print '<div id ="altitude"><span>'._("Altitude").'</span>';
112 124
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
@@ -117,12 +129,18 @@  discard block
 block discarded – undo
117 129
 }
118 130
 
119 131
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
120
-	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
121
-	else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
122
-} else {
123
-	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
124
-	else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
125
-}
132
+	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
133
+		print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
134
+	} else {
135
+		print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
136
+	}
137
+	} else {
138
+	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
139
+		print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
140
+	} else {
141
+		print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
142
+	}
143
+	}
126 144
 
127 145
 if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) {
128 146
 	print '<br>';
@@ -136,7 +154,9 @@  discard block
 block discarded – undo
136 154
 }
137 155
 
138 156
 print '</div>';
139
-if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
157
+if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
158
+	print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
159
+}
140 160
 print '<div id="speed"><span>'._("Speed").'</span>';
141 161
 if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
142 162
 	print round($spotter_item['ground_speed']*1.15078).' mph';
@@ -150,8 +170,11 @@  discard block
 block discarded – undo
150 170
 print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>';
151 171
 if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
152 172
 	print '<div id="pilot"><span>'._("Pilot").'</span>';
153
-	if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
154
-	else print $spotter_item['pilot_name'];
173
+	if (isset($spotter_item['pilot_id'])) {
174
+		print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
175
+	} else {
176
+		print $spotter_item['pilot_name'];
177
+	}
155 178
 	print '</div>';
156 179
 }
157 180
 
@@ -179,10 +202,18 @@  discard block
 block discarded – undo
179 202
 print '</div>';
180 203
 print '</div>';
181 204
 
182
-if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
183
-if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
184
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
185
-if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
205
+if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
206
+	print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
207
+}
208
+if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
209
+	print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
210
+}
211
+if (isset($spotter_item['acars']['message'])) {
212
+	print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
213
+}
214
+if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
215
+	print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
216
+}
186 217
 print '</div>';
187 218
 ?>
188 219
 </div>
189 220
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.Elevation.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 	private $openedFiles = [];
29 29
 
30 30
 	public function __construct($htgFilesDestination = '', $resolution = 3) {
31
-		if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/';
31
+		if ($htgFilesDestination == '') {
32
+			$htgFilesDestination = dirname(__FILE__).'/../data/';
33
+		}
32 34
 		$this->htgFilesDestination = $htgFilesDestination;
33 35
 		$this->resolution          = $resolution;
34 36
 		switch ($resolution) {
@@ -171,16 +173,26 @@  discard block
 block discarded – undo
171 173
 		$fileName  = "N{$N}E{$E}.hgt";
172 174
 		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
173 175
 			$Common = new Common();
174
-			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
176
+			if ($debug) {
177
+				echo 'Downloading '.$fileName.'.gz ...';
178
+			}
175 179
 			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
176 180
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
177
-				if ($debug) echo "File '{$fileName}.gz' not exists.";
181
+				if ($debug) {
182
+					echo "File '{$fileName}.gz' not exists.";
183
+				}
178 184
 				return false;
179 185
 			}
180
-			if ($debug) echo 'Done'."\n";
181
-			if ($debug) echo 'Decompress '.$fileName.' ....';
186
+			if ($debug) {
187
+				echo 'Done'."\n";
188
+			}
189
+			if ($debug) {
190
+				echo 'Decompress '.$fileName.' ....';
191
+			}
182 192
 			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
183
-			if ($debug) echo 'Done'."\n";
193
+			if ($debug) {
194
+				echo 'Done'."\n";
195
+			}
184 196
 			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
185 197
 		}
186 198
 		return true;
Please login to merge, or discard this patch.
require/class.GeoidHeight.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,8 +38,11 @@  discard block
 block discarded – undo
38 38
 		global $globalGeoidSource;
39 39
 		//if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm';
40 40
 		if ($name == '') {
41
-			if (isset($globalGeoidSource) && $globalGeoidSource != '') $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm';
42
-			else $name = dirname(__FILE__).'/../data/egm96-15.pgm';
41
+			if (isset($globalGeoidSource) && $globalGeoidSource != '') {
42
+				$name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm';
43
+			} else {
44
+				$name = dirname(__FILE__).'/../data/egm96-15.pgm';
45
+			}
43 46
 		}
44 47
 
45 48
 		$f = @fopen($name,"r");
@@ -156,7 +159,9 @@  discard block
 block discarded – undo
156 159
 				}
157 160
 			}
158 161
 			$this->t = $t;
159
-		} else $t = $this->t;
162
+		} else {
163
+			$t = $this->t;
164
+		}
160 165
 		if (!($cubic)) {
161 166
 			$a = (((1 - $fx) * $this->v00) + ($fx * $this->v01));
162 167
 			$b = (((1 - $fx) * $this->v10) + ($fx * $this->v11));
Please login to merge, or discard this patch.
require/class.NOTAM.php 1 patch
Braces   +210 added lines, -89 removed lines patch added patch discarded remove patch
@@ -1033,8 +1033,11 @@  discard block
 block discarded – undo
1033 1033
 		$data = file_get_contents($filename);
1034 1034
 		preg_match_all("/%%(.+?)%%/is", $data, $matches);
1035 1035
 		//print_r($matches);
1036
-		if (isset($matches[1])) return $matches[1];
1037
-		else return array();
1036
+		if (isset($matches[1])) {
1037
+			return $matches[1];
1038
+		} else {
1039
+			return array();
1040
+		}
1038 1041
 	}
1039 1042
 	public function getAllNOTAMbyScope($scope) {
1040 1043
 		global $globalDBdriver;
@@ -1071,7 +1074,9 @@  discard block
 block discarded – undo
1071 1074
 				$minlong = $maxlong;
1072 1075
 				$maxlong = $tmplong;
1073 1076
 			}
1074
-		} else return array();
1077
+		} else {
1078
+			return array();
1079
+		}
1075 1080
 		if ($globalDBdriver == 'mysql') {
1076 1081
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
1077 1082
 		} else {
@@ -1095,7 +1100,9 @@  discard block
 block discarded – undo
1095 1100
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1096 1101
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1097 1102
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1098
-		} else return array();
1103
+		} else {
1104
+			return array();
1105
+		}
1099 1106
 		if ($globalDBdriver == 'mysql') {
1100 1107
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
1101 1108
 		} else {
@@ -1122,8 +1129,11 @@  discard block
 block discarded – undo
1122 1129
 			return "error : ".$e->getMessage();
1123 1130
 		}
1124 1131
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1125
-		if (isset($all[0])) return $all[0];
1126
-		else return array();
1132
+		if (isset($all[0])) {
1133
+			return $all[0];
1134
+		} else {
1135
+			return array();
1136
+		}
1127 1137
 	}
1128 1138
 
1129 1139
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
@@ -1201,7 +1211,9 @@  discard block
 block discarded – undo
1201 1211
 					foreach ($alldata as $initial_data) {
1202 1212
 						$data = $this->parse($initial_data);
1203 1213
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1204
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1214
+						if (count($notamref) == 0) {
1215
+							$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1216
+						}
1205 1217
 					}
1206 1218
 				}
1207 1219
 			}
@@ -1214,7 +1226,9 @@  discard block
 block discarded – undo
1214 1226
 			foreach ($alldata as $initial_data) {
1215 1227
 				$data = $this->parse($initial_data);
1216 1228
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1217
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1229
+				if (!isset($notamref['notam_id'])) {
1230
+					$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1231
+				}
1218 1232
 			}
1219 1233
 		}
1220 1234
 	}
@@ -1226,11 +1240,15 @@  discard block
 block discarded – undo
1226 1240
 		foreach (array_chunk($allairports,20) as $airport) {
1227 1241
 			$airports_icao = array();
1228 1242
 			foreach($airport as $icao) {
1229
-				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1243
+				if (isset($icao['icao'])) {
1244
+					$airports_icao[] = $icao['icao'];
1245
+				}
1230 1246
 			}
1231 1247
 			$airport_icao = implode(',',$airports_icao);
1232 1248
 			$alldata = $this->downloadNOTAM($airport_icao);
1233
-			if ($globalTransaction) $this->db->beginTransaction();
1249
+			if ($globalTransaction) {
1250
+				$this->db->beginTransaction();
1251
+			}
1234 1252
 			if (count($alldata) > 0) {
1235 1253
 				foreach ($alldata as $initial_data) {
1236 1254
 					//print_r($initial_data);
@@ -1239,14 +1257,23 @@  discard block
 block discarded – undo
1239 1257
 					if (isset($data['ref'])) {
1240 1258
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1241 1259
 						if (count($notamref) == 0) {
1242
-							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1243
-							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1244
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1260
+							if (isset($data['ref_replaced'])) {
1261
+								$this->deleteNOTAMbyRef($data['ref_replaced']);
1262
+							}
1263
+							if (isset($data['ref_cancelled'])) {
1264
+								$this->deleteNOTAMbyRef($data['ref_cancelled']);
1265
+							} elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) {
1266
+								echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1267
+							}
1245 1268
 						}
1246 1269
 					}
1247 1270
 				}
1248
-			} else echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1249
-			if ($globalTransaction) $this->db->commit();
1271
+			} else {
1272
+				echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1273
+			}
1274
+			if ($globalTransaction) {
1275
+				$this->db->commit();
1276
+			}
1250 1277
 			sleep(5);
1251 1278
 		}
1252 1279
 	}
@@ -1259,8 +1286,11 @@  discard block
 block discarded – undo
1259 1286
 		$data = $Common->getData($url);
1260 1287
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1261 1288
 		//print_r($matches);
1262
-		if (isset($matches[1])) return $matches[1];
1263
-		else return array();
1289
+		if (isset($matches[1])) {
1290
+			return $matches[1];
1291
+		} else {
1292
+			return array();
1293
+		}
1264 1294
 	}
1265 1295
 
1266 1296
 	public function parse($data) {
@@ -1294,99 +1324,156 @@  discard block
 block discarded – undo
1294 1324
 					$rules = str_split($matches[3]);
1295 1325
 					foreach ($rules as $rule) {
1296 1326
 						if ($rule == 'I') {
1297
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR';
1298
-							else $result['rules'] = 'IFR';
1327
+							if (isset($result['rules'])) {
1328
+								$result['rules'] = $result['rules'].'/IFR';
1329
+							} else {
1330
+								$result['rules'] = 'IFR';
1331
+							}
1299 1332
 						} elseif ($rule == 'V') {
1300
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR';
1301
-							else $result['rules'] = 'VFR';
1333
+							if (isset($result['rules'])) {
1334
+								$result['rules'] = $result['rules'].'/VFR';
1335
+							} else {
1336
+								$result['rules'] = 'VFR';
1337
+							}
1302 1338
 						} elseif ($rule == 'K') {
1303
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist';
1304
-							else $result['rules'] = 'Checklist';
1339
+							if (isset($result['rules'])) {
1340
+								$result['rules'] = $result['rules'].'/Checklist';
1341
+							} else {
1342
+								$result['rules'] = 'Checklist';
1343
+							}
1305 1344
 						}
1306 1345
 					}
1307 1346
 					$attentions = str_split($matches[4]);
1308 1347
 					foreach ($attentions as $attention) {
1309 1348
 						if ($attention == 'N') {
1310
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention';
1311
-							else $result['rules'] = 'Immediate attention';
1349
+							if (isset($result['attention'])) {
1350
+								$result['attention'] = $result['attention'].' / Immediate attention';
1351
+							} else {
1352
+								$result['rules'] = 'Immediate attention';
1353
+							}
1312 1354
 						} elseif ($attention == 'B') {
1313
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance';
1314
-							else $result['rules'] = 'Operational significance';
1355
+							if (isset($result['attention'])) {
1356
+								$result['attention'] = $result['attention'].' / Operational significance';
1357
+							} else {
1358
+								$result['rules'] = 'Operational significance';
1359
+							}
1315 1360
 						} elseif ($attention == 'O') {
1316
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations';
1317
-							else $result['rules'] = 'Flight operations';
1361
+							if (isset($result['attention'])) {
1362
+								$result['attention'] = $result['attention'].' / Flight operations';
1363
+							} else {
1364
+								$result['rules'] = 'Flight operations';
1365
+							}
1318 1366
 						} elseif ($attention == 'M') {
1319
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc';
1320
-							else $result['rules'] = 'Misc';
1367
+							if (isset($result['attention'])) {
1368
+								$result['attention'] = $result['attention'].' / Misc';
1369
+							} else {
1370
+								$result['rules'] = 'Misc';
1371
+							}
1321 1372
 						} elseif ($attention == 'K') {
1322
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist';
1323
-							else $result['rules'] = 'Checklist';
1373
+							if (isset($result['attention'])) {
1374
+								$result['attention'] = $result['attention'].' / Checklist';
1375
+							} else {
1376
+								$result['rules'] = 'Checklist';
1377
+							}
1324 1378
 						}
1325 1379
 					}
1326
-					if ($matches[5] == 'A') $result['scope'] = 'Airport warning';
1327
-					elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning';
1328
-					elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning';
1329
-					elseif ($matches[5] == 'K') $result['scope'] = 'Checklist';
1330
-					elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning';
1331
-					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1380
+					if ($matches[5] == 'A') {
1381
+						$result['scope'] = 'Airport warning';
1382
+					} elseif ($matches[5] == 'E') {
1383
+						$result['scope'] = 'Enroute warning';
1384
+					} elseif ($matches[5] == 'W') {
1385
+						$result['scope'] = 'Navigation warning';
1386
+					} elseif ($matches[5] == 'K') {
1387
+						$result['scope'] = 'Checklist';
1388
+					} elseif ($matches[5] == 'AE') {
1389
+						$result['scope'] = 'Airport/Enroute warning';
1390
+					} elseif ($matches[5] == 'AW') {
1391
+						$result['scope'] = 'Airport/Navigation warning';
1392
+					}
1332 1393
 					$result['lower_limit'] = $matches[6];
1333 1394
 					$result['upper_limit'] = $matches[7];
1334 1395
 					$latitude = $Common->convertDec($matches[8],'latitude');
1335
-					if ($matches[9] == 'S') $latitude = -$latitude;
1396
+					if ($matches[9] == 'S') {
1397
+						$latitude = -$latitude;
1398
+					}
1336 1399
 					$longitude = $Common->convertDec($matches[10],'longitude');
1337
-					if ($matches[11] == 'W') $longitude = -$longitude;
1400
+					if ($matches[11] == 'W') {
1401
+						$longitude = -$longitude;
1402
+					}
1338 1403
 					$result['latitude'] = $latitude;
1339 1404
 					$result['longitude'] = $longitude;
1340
-					if ($matches[12] != '') $result['radius'] = intval($matches[12]);
1341
-					else $result['radius'] = 0;
1405
+					if ($matches[12] != '') {
1406
+						$result['radius'] = intval($matches[12]);
1407
+					} else {
1408
+						$result['radius'] = 0;
1409
+					}
1342 1410
 					$q = true;
1343 1411
 				} elseif ($globalDebug) {
1344 1412
 					echo 'NOTAM error : '.$result['full_notam']."\n";
1345 1413
 					echo "Can't parse : ".$line."\n";
1346 1414
 				}
1347
-			}
1348
-			elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) {
1415
+			} elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) {
1349 1416
 				$result['icao'] = $matches[2];
1350 1417
 				$a = true;
1351
-			}
1352
-			elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) {
1353
-				if ($matches[1] > 50) $year = '19'.$matches[2];
1354
-				else $year = '20'.$matches[2];
1418
+			} elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) {
1419
+				if ($matches[1] > 50) {
1420
+					$year = '19'.$matches[2];
1421
+				} else {
1422
+					$year = '20'.$matches[2];
1423
+				}
1355 1424
 				$result['date_begin'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6];
1356 1425
 				$b = true;
1357
-			}
1358
-			elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) {
1359
-				if ($matches[2] > 50) $year = '19'.$matches[2];
1360
-				else $year = '20'.$matches[2];
1426
+			} elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) {
1427
+				if ($matches[2] > 50) {
1428
+					$year = '19'.$matches[2];
1429
+				} else {
1430
+					$year = '20'.$matches[2];
1431
+				}
1361 1432
 				$result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6];
1362 1433
 				$result['permanent'] = 0;
1363 1434
 				$c = true;
1364
-			}
1365
-			elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) {
1366
-				if ($matches[2] > 50) $year = '19'.$matches[2];
1367
-				else $year = '20'.$matches[2];
1435
+			} elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) {
1436
+				if ($matches[2] > 50) {
1437
+					$year = '19'.$matches[2];
1438
+				} else {
1439
+					$year = '20'.$matches[2];
1440
+				}
1368 1441
 				$result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6];
1369
-				if ($matches[7] == 'EST') $result['estimated'] = 1;
1370
-				else $result['estimated'] = 0;
1371
-				if ($matches[7] == 'PERM') $result['permanent'] = 1;
1372
-				else $result['permanent'] = 0;
1442
+				if ($matches[7] == 'EST') {
1443
+					$result['estimated'] = 1;
1444
+				} else {
1445
+					$result['estimated'] = 0;
1446
+				}
1447
+				if ($matches[7] == 'PERM') {
1448
+					$result['permanent'] = 1;
1449
+				} else {
1450
+					$result['permanent'] = 0;
1451
+				}
1373 1452
 				$c = true;
1374
-			}
1375
-			elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) {
1453
+			} elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) {
1376 1454
 				$result['date_end'] = '2030/12/20 12:00';
1377
-				if ($matches[2] == 'EST') $result['estimated'] = 1;
1378
-				else $result['estimated'] = 0;
1379
-				if ($matches[2] == 'PERM') $result['permanent'] = 1;
1380
-				else $result['permanent'] = 0;
1455
+				if ($matches[2] == 'EST') {
1456
+					$result['estimated'] = 1;
1457
+				} else {
1458
+					$result['estimated'] = 0;
1459
+				}
1460
+				if ($matches[2] == 'PERM') {
1461
+					$result['permanent'] = 1;
1462
+				} else {
1463
+					$result['permanent'] = 0;
1464
+				}
1381 1465
 				$c = true;
1382
-			}
1383
-			elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) {
1466
+			} elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) {
1384 1467
 				$rtext = array();
1385 1468
 				$text = explode(' ',$matches[2]);
1386 1469
 				foreach ($text as $word) {
1387
-					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1388
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1389
-					else $rtext[] = $word;
1470
+					if (isset($this->abbr[$word])) {
1471
+						$rtext[] = strtoupper($this->abbr[$word]);
1472
+					} elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) {
1473
+						$rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1474
+					} else {
1475
+						$rtext[] = $word;
1476
+					}
1390 1477
 				}
1391 1478
 				$result['text'] = implode(' ',$rtext);
1392 1479
 				$e = true;
@@ -1395,7 +1482,9 @@  discard block
 block discarded – undo
1395 1482
 			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1396 1483
 				$text = explode(' ',$line);
1397 1484
 				$result['ref'] = $text[0];
1398
-				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1485
+				if ($matches[1] == 'NOTAMN') {
1486
+					$result['type'] = 'new';
1487
+				}
1399 1488
 				if ($matches[1] == 'NOTAMC') {
1400 1489
 					$result['type'] = 'cancel';
1401 1490
 					$result['ref_cancelled'] = $text[2];
@@ -1417,69 +1506,101 @@  discard block
 block discarded – undo
1417 1506
 		switch ($code[1]) {
1418 1507
 			case 'A':
1419 1508
 				$result = 'Airspace organization ';
1420
-				if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp];
1509
+				if (isset($this->code_airspace[$code_fp])) {
1510
+					$result .= $this->code_airspace[$code_fp];
1511
+				}
1421 1512
 				break;
1422 1513
 			case 'C':
1423 1514
 				$result = 'Communications and radar facilities ';
1424
-				if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp];
1515
+				if (isset($this->code_comradar[$code_fp])) {
1516
+					$result .= $this->code_comradar[$code_fp];
1517
+				}
1425 1518
 				break;
1426 1519
 			case 'F':
1427 1520
 				$result = 'Facilities and services ';
1428
-				if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp];
1521
+				if (isset($this->code_facilities[$code_fp])) {
1522
+					$result .= $this->code_facilities[$code_fp];
1523
+				}
1429 1524
 				break;
1430 1525
 			case 'I':
1431 1526
 				$result = 'Instrument and Microwave Landing System ';
1432
-				if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp];
1527
+				if (isset($this->code_instrumentlanding[$code_fp])) {
1528
+					$result .= $this->code_instrumentlanding[$code_fp];
1529
+				}
1433 1530
 				break;
1434 1531
 			case 'L':
1435 1532
 				$result = 'Lighting facilities ';
1436
-				if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp];
1533
+				if (isset($this->code_lightingfacilities[$code_fp])) {
1534
+					$result .= $this->code_lightingfacilities[$code_fp];
1535
+				}
1437 1536
 				break;
1438 1537
 			case 'M':
1439 1538
 				$result = 'Movement and landing areas ';
1440
-				if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp];
1539
+				if (isset($this->code_movementareas[$code_fp])) {
1540
+					$result .= $this->code_movementareas[$code_fp];
1541
+				}
1441 1542
 				break;
1442 1543
 			case 'N':
1443 1544
 				$result = 'Terminal and En Route Navigation Facilities ';
1444
-				if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp];
1545
+				if (isset($this->code_terminalfacilities[$code_fp])) {
1546
+					$result .= $this->code_terminalfacilities[$code_fp];
1547
+				}
1445 1548
 				break;
1446 1549
 			case 'O':
1447 1550
 				$result = 'Other information ';
1448
-				if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp];
1551
+				if (isset($this->code_information[$code_fp])) {
1552
+					$result .= $this->code_information[$code_fp];
1553
+				}
1449 1554
 				break;
1450 1555
 			case 'P':
1451 1556
 				$result = 'Air Traffic procedures ';
1452
-				if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp];
1557
+				if (isset($this->code_airtraffic[$code_fp])) {
1558
+					$result .= $this->code_airtraffic[$code_fp];
1559
+				}
1453 1560
 				break;
1454 1561
 			case 'R':
1455 1562
 				$result = 'Navigation Warnings: Airspace Restrictions ';
1456
-				if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp];
1563
+				if (isset($this->code_navigationw[$code_fp])) {
1564
+					$result .= $this->code_navigationw[$code_fp];
1565
+				}
1457 1566
 				break;
1458 1567
 			case 'S':
1459 1568
 				$result = 'Air Traffic and VOLMET Services ';
1460
-				if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp];
1569
+				if (isset($this->code_volmet[$code_fp])) {
1570
+					$result .= $this->code_volmet[$code_fp];
1571
+				}
1461 1572
 				break;
1462 1573
 			case 'W':
1463 1574
 				$result = 'Navigation Warnings: Warnings ';
1464
-				if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp];
1575
+				if (isset($this->code_warnings[$code_fp])) {
1576
+					$result .= $this->code_warnings[$code_fp];
1577
+				}
1465 1578
 				break;
1466 1579
 		}
1467 1580
 		switch ($code[3]) {
1468 1581
 			case 'A':
1469 1582
 				// Availability
1470
-				if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp];
1583
+				if (isset($this->code_sp_availabity[$code_sp])) {
1584
+					$result .= ' '.$this->code_sp_availabity[$code_sp];
1585
+				}
1471 1586
 				break;
1472 1587
 			case 'C':
1473 1588
 				// Changes
1474
-				if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp];
1589
+				if (isset($this->code_sp_changes[$code_sp])) {
1590
+					$result .= ' '.$this->code_sp_changes[$code_sp];
1591
+				}
1475 1592
 				break;
1476 1593
 			case 'H':
1477 1594
 				// Hazardous conditions
1478
-				if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp];
1595
+				if (isset($this->code_sp_hazardous[$code_sp])) {
1596
+					$result .= ' '.$this->code_sp_hazardous[$code_sp];
1597
+				}
1479 1598
 				break;
1480 1599
 			case 'L':
1481 1600
 				// Limitations
1482
-				if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp];
1601
+				if (isset($this->code_sp_limitations[$code_sp])) {
1602
+					$result .= ' '.$this->code_sp_limitations[$code_sp];
1603
+				}
1483 1604
 				break;
1484 1605
 			case 'X':
1485 1606
 				// Other Information
Please login to merge, or discard this patch.
import/callback.php 1 patch
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,15 +27,21 @@  discard block
 block discarded – undo
27 27
 		}
28 28
 	}
29 29
 }
30
-if ($authorize === false) die;
30
+if ($authorize === false) {
31
+	die;
32
+}
31 33
 
32
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
34
+if (isset($globalTracker) && $globalTracker) {
35
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
36
+}
33 37
 if (isset($globalMarine) && $globalMarine) {
34 38
 	require_once(dirname(__FILE__).'/../require/class.AIS.php');
35 39
 	require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
36 40
 }
37 41
 
38
-if (!isset($globalDebug)) $globalDebug = FALSE;
42
+if (!isset($globalDebug)) {
43
+	$globalDebug = FALSE;
44
+}
39 45
 
40 46
 // Check if schema is at latest version
41 47
 $Connection = new Connection();
@@ -45,10 +51,16 @@  discard block
 block discarded – undo
45 51
 }
46 52
 
47 53
 if (isset($globalServer) && $globalServer) {
48
-	if ($globalDebug) echo "Using Server Mode\n";
54
+	if ($globalDebug) {
55
+		echo "Using Server Mode\n";
56
+	}
49 57
 	$SI=new SpotterServer();
50
-} else $SI=new SpotterImport($Connection->db);
51
-if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
58
+} else {
59
+	$SI=new SpotterImport($Connection->db);
60
+}
61
+if (isset($globalTracker) && $globalTracker) {
62
+	$TI = new TrackerImport($Connection->db);
63
+}
52 64
 if (isset($globalMarine) && $globalMarine) {
53 65
 	$AIS = new AIS();
54 66
 	$MI = new MarineImport($Connection->db);
@@ -57,7 +69,9 @@  discard block
 block discarded – undo
57 69
 date_default_timezone_set('UTC');
58 70
 
59 71
 $buffer = '';
60
-if (isset($_POST)) $buffer = $_POST;
72
+if (isset($_POST)) {
73
+	$buffer = $_POST;
74
+}
61 75
 $data = array();
62 76
 if (isset($buffer['type_event']) && isset($buffer['lat']) && isset($buffer['lon'])) {
63 77
 	$data['ident'] = $buffer['device_id'];
@@ -68,15 +82,27 @@  discard block
 block discarded – undo
68 82
 	//$data['heading'] = $buffer['cap']; // Only N/S/E/W
69 83
 	$data['datetime'] = date('Y-m-d H:i:s',$buffer['timestamp']);
70 84
 	$data['comment'] = '';
71
-	if (isset($buffer['battery']) && $buffer['battery'] != '') $data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
85
+	if (isset($buffer['battery']) && $buffer['battery'] != '') {
86
+		$data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
87
+	}
72 88
 	//if (isset($buffer['snr']) && $buffer['snr'] != '') $data['comment'] .= 'SNR: '.$buffer['snr'].' ';
73
-	if (isset($buffer['temp']) && $buffer['temp'] != '') $data['comment'] .= 'Temperature: '.$buffer['temp'].'°C ';
74
-	if (isset($buffer['press']) && $buffer['press'] != '') $data['comment'] .= 'Pressure: '.$buffer['press'].'hPa ';
89
+	if (isset($buffer['temp']) && $buffer['temp'] != '') {
90
+		$data['comment'] .= 'Temperature: '.$buffer['temp'].'°C ';
91
+	}
92
+	if (isset($buffer['press']) && $buffer['press'] != '') {
93
+		$data['comment'] .= 'Pressure: '.$buffer['press'].'hPa ';
94
+	}
75 95
 	$TI->add($data);
76 96
 	unset($data);
77 97
 }
78
-if (isset($SI)) $SI->checkAll();
79
-if (isset($MI)) $MI->checkAll();
80
-if (isset($TI)) $TI->checkAll();
98
+if (isset($SI)) {
99
+	$SI->checkAll();
100
+}
101
+if (isset($MI)) {
102
+	$MI->checkAll();
103
+}
104
+if (isset($TI)) {
105
+	$TI->checkAll();
106
+}
81 107
 
82 108
 ?>
Please login to merge, or discard this patch.
tools-geoid.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,11 @@
 block discarded – undo
61 61
 		print '<div class="col-sm-6">'.round($altitude-$geoid,3).'</div>';
62 62
 	}
63 63
 	print '<div class="col-sm-6"><b>Earth Gravity Model</b></div>';
64
-	if (isset($globalGeoidSource) && $globalGeoidSource != '') $geoidsource = $globalGeoidSource;
65
-	else $geoidsource = 'EGM96-15';
64
+	if (isset($globalGeoidSource) && $globalGeoidSource != '') {
65
+		$geoidsource = $globalGeoidSource;
66
+	} else {
67
+		$geoidsource = 'EGM96-15';
68
+	}
66 69
 	print '<div class="col-sm-6">'.$geoidsource.'</div>';
67 70
 	print '</div>';
68 71
 }
Please login to merge, or discard this patch.
require/class.METAR.php 1 patch
Braces   +100 added lines, -38 removed lines patch added patch discarded remove patch
@@ -59,8 +59,11 @@  discard block
 block discarded – undo
59 59
 		}
60 60
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
61 61
 		$sth->closeCursor();
62
-		if ($row['nb'] > 0) return false;
63
-		else return true;
62
+		if ($row['nb'] > 0) {
63
+			return false;
64
+		} else {
65
+			return true;
66
+		}
64 67
 	}
65 68
 
66 69
 	public static function insert_last_update() {
@@ -82,9 +85,14 @@  discard block
 block discarded – undo
82 85
 		//$pieces = explode(' ',$data);
83 86
 		$pieces = preg_split('/\s/',$data);
84 87
 		$pos = 0;
85
-		if ($pieces[0] == 'METAR') $pos++;
86
-		elseif ($pieces[0] == 'SPECI') $pos++;
87
-		if (strlen($pieces[$pos]) != 4) $pos++;
88
+		if ($pieces[0] == 'METAR') {
89
+			$pos++;
90
+		} elseif ($pieces[0] == 'SPECI') {
91
+			$pos++;
92
+		}
93
+		if (strlen($pieces[$pos]) != 4) {
94
+			$pos++;
95
+		}
88 96
 		$result = array();
89 97
 		$result['location'] = $pieces[$pos];
90 98
 		$pos++;
@@ -93,16 +101,26 @@  discard block
 block discarded – undo
93 101
 		$c = count($pieces);
94 102
 		for($pos++; $pos < $c; $pos++) {
95 103
 			$piece = $pieces[$pos];
96
-			if ($piece == 'RMK') break;
97
-			if ($piece == 'AUTO') $result['auto'] = true;
98
-			if ($piece == 'COR') $result['correction'] = true;
104
+			if ($piece == 'RMK') {
105
+				break;
106
+			}
107
+			if ($piece == 'AUTO') {
108
+				$result['auto'] = true;
109
+			}
110
+			if ($piece == 'COR') {
111
+				$result['correction'] = true;
112
+			}
99 113
 			// Wind Speed
100 114
 			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
101 115
 				$result['wind']['direction'] = (float)$matches[1];
102 116
 				$result['wind']['unit'] = $matches[4];
103
-				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
104
-				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
105
-				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
117
+				if ($result['wind']['unit'] == 'KT') {
118
+					$result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
119
+				} elseif ($result['wind']['unit'] == 'KPH') {
120
+					$result['wind']['speed'] = round(((float)$matches[2])*1000,2);
121
+				} elseif ($result['wind']['unit'] == 'MPS') {
122
+					$result['wind']['speed'] = round(((float)$matches[2]),2);
123
+				}
106 124
 				$result['wind']['gust'] = (float)$matches[3];
107 125
 				$result['wind']['unit'] = $matches[4];
108 126
 				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
@@ -185,14 +203,23 @@  discard block
 block discarded – undo
185 203
 				//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
186 204
 				$type = $matches[1];
187 205
 				$cloud = array();
188
-				if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
189
-				elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
190
-				elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
191
-				elseif ($type == 'FEW') $cloud['type'] = 'Few';
192
-				elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
193
-				elseif ($type == 'BKN') $cloud['type'] = 'Broken';
194
-				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
195
-				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
206
+				if ($type == 'SKC') {
207
+					$cloud['type'] = 'No cloud/Sky clear';
208
+				} elseif ($type == 'CLR') {
209
+					$cloud['type'] = 'No cloud below 12,000ft (3700m)';
210
+				} elseif ($type == 'NSC') {
211
+					$cloud['type'] = 'No significant cloud';
212
+				} elseif ($type == 'FEW') {
213
+					$cloud['type'] = 'Few';
214
+				} elseif ($type == 'SCT') {
215
+					$cloud['type'] = 'Scattered';
216
+				} elseif ($type == 'BKN') {
217
+					$cloud['type'] = 'Broken';
218
+				} elseif ($type == 'OVC') {
219
+					$cloud['type'] = 'Overcast/Full cloud coverage';
220
+				} elseif ($type == 'VV') {
221
+					$cloud['type'] = 'Vertical visibility';
222
+				}
196 223
 				$cloud['type_code'] = $type;
197 224
 				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
198 225
 				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
@@ -218,8 +245,11 @@  discard block
 block discarded – undo
218 245
 				$result['RVR']['friction'] = $matches[5];
219 246
 			}
220 247
 			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
221
-				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
222
-				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
248
+				if (isset($matches[5])) {
249
+					$range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
250
+				} else {
251
+					$range = array('exact' => (float)$matches[2], 'unit' => 'M');
252
+				}
223 253
 				if (isset($matches[3])) {
224 254
 					$range = Array(
225 255
 					    'from' => (float)$matches[2],
@@ -252,8 +282,11 @@  discard block
 block discarded – undo
252 282
 				if (isset($matches[3])) {
253 283
 					$text[] = $this->texts[$matches[3]];
254 284
 				}
255
-				if (!isset($result['weather'])) $result['weather'] = implode(' ', $text);
256
-				else $result['weather'] = $result['weather'].' / '.implode(' ', $text);
285
+				if (!isset($result['weather'])) {
286
+					$result['weather'] = implode(' ', $text);
287
+				} else {
288
+					$result['weather'] = $result['weather'].' / '.implode(' ', $text);
289
+				}
257 290
 			}
258 291
 		}
259 292
 		return $result;
@@ -264,8 +297,11 @@  discard block
 block discarded – undo
264 297
 		if (isset($globalMETARcycle) && $globalMETARcycle) {
265 298
 			$query = "SELECT * FROM metar WHERE metar_location = :icao";
266 299
 		} else {
267
-			if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
268
-			else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
300
+			if ($globalDBdriver == 'mysql') {
301
+				$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
302
+			} else {
303
+				$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
304
+			}
269 305
 		}
270 306
 		$query_values = array(':icao' => $icao);
271 307
 		try {
@@ -321,7 +357,9 @@  discard block
 block discarded – undo
321 357
 
322 358
 	public function addMETARCycle() {
323 359
 		global $globalDebug, $globalIVAO, $globalTransaction;
324
-		if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
360
+		if (isset($globalDebug) && $globalDebug) {
361
+			echo "Downloading METAR cycle...";
362
+		}
325 363
 		date_default_timezone_set("UTC");
326 364
 		$Common = new Common();
327 365
 		if (isset($globalIVAO) && $globalIVAO) {
@@ -332,31 +370,47 @@  discard block
 block discarded – undo
332 370
 			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
333 371
 		}
334 372
 		if ($handle) {
335
-			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
373
+			if (isset($globalDebug) && $globalDebug) {
374
+				echo "Done - Updating DB...";
375
+			}
336 376
 			$date = '';
337
-			if ($globalTransaction) $this->db->beginTransaction();
377
+			if ($globalTransaction) {
378
+				$this->db->beginTransaction();
379
+			}
338 380
 			while(($line = fgets($handle,4096)) !== false) {
339 381
 				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
340 382
 					$date = $line;
341 383
 				} elseif ($line != '') {
342
-					if ($date == '') $date = date('Y/m/d H:m');
384
+					if ($date == '') {
385
+						$date = date('Y/m/d H:m');
386
+					}
343 387
 					$pos = 0;
344 388
 					$pieces = preg_split('/\s/',$line);
345
-					if ($pieces[0] == 'METAR') $pos++;
346
-					if (strlen($pieces[$pos]) != 4) $pos++;
389
+					if ($pieces[0] == 'METAR') {
390
+						$pos++;
391
+					}
392
+					if (strlen($pieces[$pos]) != 4) {
393
+						$pos++;
394
+					}
347 395
 					$location = $pieces[$pos];
348 396
 					echo $this->addMETAR($location,$line,$date);
349 397
 				}
350 398
 			}
351 399
 			fclose($handle);
352
-			if ($globalTransaction) $this->db->commit();
400
+			if ($globalTransaction) {
401
+				$this->db->commit();
402
+			}
403
+		}
404
+		if (isset($globalDebug) && $globalDebug) {
405
+			echo "Done\n";
353 406
 		}
354
-		if (isset($globalDebug) && $globalDebug) echo "Done\n";
355 407
 	}
356 408
 
357 409
 	public function downloadMETAR($icao) {
358 410
 		global $globalMETARurl;
359
-		if ($globalMETARurl == '') return array();
411
+		if ($globalMETARurl == '') {
412
+			return array();
413
+		}
360 414
 		date_default_timezone_set("UTC");
361 415
 		$Common = new Common();
362 416
 		$url = str_replace('{icao}',$icao,$globalMETARurl);
@@ -367,16 +421,24 @@  discard block
 block discarded – undo
367 421
 				$date = $line;
368 422
 			} 
369 423
 			if ($line != '') {
370
-				if ($date == '') $date = date('Y/m/d H:m');
424
+				if ($date == '') {
425
+					$date = date('Y/m/d H:m');
426
+				}
371 427
 				$pos = 0;
372 428
 				$pieces = preg_split('/\s/',$line);
373
-				if ($pieces[0] == 'METAR') $pos++;
374
-				if (strlen($pieces[$pos]) != 4) $pos++;
429
+				if ($pieces[0] == 'METAR') {
430
+					$pos++;
431
+				}
432
+				if (strlen($pieces[$pos]) != 4) {
433
+					$pos++;
434
+				}
375 435
 				$location = $pieces[$pos];
376 436
 				if (strlen($location == 4)) {
377 437
 					$this->addMETAR($location,$line,$date);
378 438
 					return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
379
-				} else return array();
439
+				} else {
440
+					return array();
441
+				}
380 442
 			}
381 443
 		}
382 444
 		return array();
Please login to merge, or discard this patch.
flightid-overview.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
 		$all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']);
49 49
 		if (isset($globalTimezone)) {
50 50
 			date_default_timezone_set($globalTimezone);
51
-		} else date_default_timezone_set('UTC');
51
+		} else {
52
+			date_default_timezone_set('UTC');
53
+		}
52 54
 		
53 55
 		if (is_array($all_data) && count($all_data) > 1) {
54 56
 			print '<br/>';
@@ -327,9 +329,13 @@  discard block
 block discarded – undo
327 329
 			print '<div>';
328 330
 			if (isset($spotter_item['pilot_id']) && $spotter_item['pilot_id'] != "")
329 331
 			{
330
-				if ($spotter_item['format_source'] == 'whazzup') print '<a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>';
331
-				elseif ($spotter_item['format_source'] == 'vatsimtxt') print '<a href="http://www.vataware.com/pilot/'.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>';
332
-				else print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
332
+				if ($spotter_item['format_source'] == 'whazzup') {
333
+					print '<a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>';
334
+				} elseif ($spotter_item['format_source'] == 'vatsimtxt') {
335
+					print '<a href="http://www.vataware.com/pilot/'.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>';
336
+				} else {
337
+					print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
338
+				}
333 339
 			} else {
334 340
 				if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != "")
335 341
 				{
Please login to merge, or discard this patch.
ident-detailed.php 1 patch
Braces   +22 added lines, -8 removed lines patch added patch discarded remove patch
@@ -118,8 +118,12 @@  discard block
 block discarded – undo
118 118
 	{
119 119
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']);
120 120
 		$ident = $spotter_array[0]['ident'];
121
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
122
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
121
+		if (isset($spotter_array[0]['latitude'])) {
122
+			$latitude = $spotter_array[0]['latitude'];
123
+		}
124
+		if (isset($spotter_array[0]['longitude'])) {
125
+			$longitude = $spotter_array[0]['longitude'];
126
+		}
123 127
 		require_once('header.php');
124 128
 		if (isset($globalArchive) && $globalArchive && $type == 'aircraft') {
125 129
 			// Requirement for altitude graph
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 			$all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']);
128 132
 			if (isset($globalTimezone)) {
129 133
 				date_default_timezone_set($globalTimezone);
130
-			} else date_default_timezone_set('UTC');
134
+			} else {
135
+				date_default_timezone_set('UTC');
136
+			}
131 137
 			if (is_array($all_data) && count($all_data) > 1) {
132 138
 				print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
133 139
 				print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
@@ -204,14 +210,22 @@  discard block
 block discarded – undo
204 210
 		if (isset($spotter_array[0]['airline_icao'])) {
205 211
 			print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; 
206 212
 		}
207
-		if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
213
+		if ($type == 'aircraft') {
214
+			print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
215
+		}
208 216
 		print '</div>';
209 217
 	
210
-		if ($type == 'aircraft') include('ident-sub-menu.php');
218
+		if ($type == 'aircraft') {
219
+			include('ident-sub-menu.php');
220
+		}
211 221
 		print '<div class="table column">';
212
-		if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
213
-		elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
214
-		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
222
+		if ($type == 'aircraft') {
223
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
224
+		} elseif ($type == 'marine') {
225
+			print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
226
+		} elseif ($type == 'tracker') {
227
+			print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
228
+		}
215 229
 
216 230
 		include('table-output.php'); 
217 231
 		print '<div class="pagination">';
Please login to merge, or discard this patch.