Completed
Push — master ( d6b14e...e982bb )
by Yannick
54:14 queued 25:57
created
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.
live-geojson.php 1 patch
Braces   +291 added lines, -114 removed lines patch added patch discarded remove patch
@@ -48,27 +48,52 @@  discard block
 block discarded – undo
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
51
-if (!isset($globalJsonCompress)) $compress = true;
52
-else $compress = $globalJsonCompress;
51
+if (!isset($globalJsonCompress)) {
52
+	$compress = true;
53
+} else {
54
+	$compress = $globalJsonCompress;
55
+}
53 56
 
54 57
 $from_archive = false;
55 58
 $min = true;
56 59
 $allhistory = false;
57 60
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
61
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
62
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
63
+}
64
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
65
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
66
+}
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
68
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
+}
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
71
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
+}
73
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
75
+}
76
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
77
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
78
+}
79
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
80
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
81
+}
82
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
83
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
84
+}
85
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
86
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
87
+}
88
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
89
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
90
+}
68 91
 
69 92
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
70 93
 	$min = true;
71
-} else $min = false;
94
+} else {
95
+	$min = false;
96
+}
72 97
 
73 98
 if (isset($_GET['ident'])) {
74 99
 	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
@@ -157,21 +182,33 @@  discard block
 block discarded – undo
157 182
 		} else {
158 183
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
159 184
 		}
160
-	} else $flightcnt = count($spotter_array);
161
-	if ($flightcnt == '') $flightcnt = 0;
162
-} else $flightcnt = 0;
185
+	} else {
186
+		$flightcnt = count($spotter_array);
187
+	}
188
+	if ($flightcnt == '') {
189
+		$flightcnt = 0;
190
+	}
191
+	} else {
192
+	$flightcnt = 0;
193
+}
163 194
 
164 195
 $sqltime = round(microtime(true)-$begintime,2);
165 196
 
166
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
167
-else $usenextlatlon = true;
197
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
198
+	$usenextlatlon = false;
199
+} else {
200
+	$usenextlatlon = true;
201
+}
168 202
 $j = 0;
169 203
 $prev_flightaware_id = '';
170 204
 $aircrafts_shadow = array();
171 205
 $output = '{';
172 206
 	$output .= '"type": "FeatureCollection",';
173
-		if ($min) $output .= '"minimal": "true",';
174
-		else $output .= '"minimal": "false",';
207
+		if ($min) {
208
+			$output .= '"minimal": "true",';
209
+		} else {
210
+			$output .= '"minimal": "false",';
211
+		}
175 212
 		//$output .= '"fc": "'.$flightcnt.'",';
176 213
 		$output .= '"sqt": "'.$sqltime.'",';
177 214
 
@@ -215,18 +252,29 @@  discard block
 block discarded – undo
215 252
 						}
216 253
 						$output .= '"properties": {';
217 254
 						if (isset($spotter_item['flightaware_id'])) {
218
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
219
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
255
+							if ($compress) {
256
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
257
+							} else {
258
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
259
+							}
220 260
 						} elseif (isset($spotter_item['famtrackid'])) {
221
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
222
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
261
+							if ($compress) {
262
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
263
+							} else {
264
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
265
+							}
223 266
 						} elseif (isset($spotter_item['fammarine_id'])) {
224
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
225
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
267
+							if ($compress) {
268
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
269
+							} else {
270
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
271
+							}
226 272
 						}
227 273
 							$output .= '"fc": "'.$flightcnt.'",';
228 274
 							$output .= '"sqt": "'.$sqltime.'",';
229
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
275
+							if (isset($begindate)) {
276
+								$output .= '"archive_date": "'.$begindate.'",';
277
+							}
230 278
 
231 279
 /*
232 280
 							if ($min) $output .= '"minimal": "true",';
@@ -234,14 +282,22 @@  discard block
 block discarded – undo
234 282
 */
235 283
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
236 284
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
237
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
238
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
285
+							if ($compress) {
286
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
287
+							} else {
288
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
289
+							}
239 290
 							//"
240 291
 						} else {
241
-							if ($compress) $output .= '"c": "NA",';
242
-							else $output .= '"callsign": "NA",';
292
+							if ($compress) {
293
+								$output .= '"c": "NA",';
294
+							} else {
295
+								$output .= '"callsign": "NA",';
296
+							}
297
+						}
298
+						if (isset($spotter_item['registration'])) {
299
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
243 300
 						}
244
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
245 301
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
246 302
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
247 303
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -254,16 +310,23 @@  discard block
 block discarded – undo
254 310
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
255 311
 						}
256 312
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
257
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
258
-							else {
313
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
314
+								$spotter_item['aircraft_shadow'] = '';
315
+							} else {
259 316
 								$aircraft_icao = $spotter_item['aircraft_icao'];
260
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
261
-								else {
317
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
318
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
319
+								} else {
262 320
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
263
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
264
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
265
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
266
-									else $spotter_item['aircraft_shadow'] = '';
321
+									if (count($aircraft_info) > 0) {
322
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
323
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
324
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
325
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
326
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
327
+									} else {
328
+										$spotter_item['aircraft_shadow'] = '';
329
+									}
267 330
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
268 331
 								}
269 332
 							}
@@ -271,73 +334,139 @@  discard block
 block discarded – undo
271 334
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
272 335
 							if ($tracker) {
273 336
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
274
-									if ($compress) $output .= '"as": "ambulance.png",';
275
-									else $output .= '"aircraft_shadow": "ambulance.png",';
337
+									if ($compress) {
338
+										$output .= '"as": "ambulance.png",';
339
+									} else {
340
+										$output .= '"aircraft_shadow": "ambulance.png",';
341
+									}
276 342
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
277
-									if ($compress) $output .= '"as": "police.png",';
278
-									else $output .= '"aircraft_shadow": "police.png",';
343
+									if ($compress) {
344
+										$output .= '"as": "police.png",';
345
+									} else {
346
+										$output .= '"aircraft_shadow": "police.png",';
347
+									}
279 348
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
280
-									if ($compress) $output .= '"as": "ship.png",';
281
-									else $output .= '"aircraft_shadow": "ship.png",';
349
+									if ($compress) {
350
+										$output .= '"as": "ship.png",';
351
+									} else {
352
+										$output .= '"aircraft_shadow": "ship.png",';
353
+									}
282 354
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
283
-									if ($compress) $output .= '"as": "ship.png",';
284
-									else $output .= '"aircraft_shadow": "ship.png",';
355
+									if ($compress) {
356
+										$output .= '"as": "ship.png",';
357
+									} else {
358
+										$output .= '"aircraft_shadow": "ship.png",';
359
+									}
285 360
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
286
-									if ($compress) $output .= '"as": "ship.png",';
287
-									else $output .= '"aircraft_shadow": "ship.png",';
361
+									if ($compress) {
362
+										$output .= '"as": "ship.png",';
363
+									} else {
364
+										$output .= '"aircraft_shadow": "ship.png",';
365
+									}
288 366
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
289
-									if ($compress) $output .= '"as": "truck.png",';
290
-									else $output .= '"aircraft_shadow": "truck.png",';
367
+									if ($compress) {
368
+										$output .= '"as": "truck.png",';
369
+									} else {
370
+										$output .= '"aircraft_shadow": "truck.png",';
371
+									}
291 372
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
292
-									if ($compress) $output .= '"as": "truck.png",';
293
-									else $output .= '"aircraft_shadow": "truck.png",';
373
+									if ($compress) {
374
+										$output .= '"as": "truck.png",';
375
+									} else {
376
+										$output .= '"aircraft_shadow": "truck.png",';
377
+									}
294 378
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
295
-									if ($compress) $output .= '"as": "aircraft.png",';
296
-									else $output .= '"aircraft_shadow": "aircraft.png",';
379
+									if ($compress) {
380
+										$output .= '"as": "aircraft.png",';
381
+									} else {
382
+										$output .= '"aircraft_shadow": "aircraft.png",';
383
+									}
297 384
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
298
-									if ($compress) $output .= '"as": "aircraft.png",';
299
-									else $output .= '"aircraft_shadow": "aircraft.png",';
385
+									if ($compress) {
386
+										$output .= '"as": "aircraft.png",';
387
+									} else {
388
+										$output .= '"aircraft_shadow": "aircraft.png",';
389
+									}
300 390
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
301
-									if ($compress) $output .= '"as": "helico.png",';
302
-									else $output .= '"aircraft_shadow": "helico.png",';
391
+									if ($compress) {
392
+										$output .= '"as": "helico.png",';
393
+									} else {
394
+										$output .= '"aircraft_shadow": "helico.png",';
395
+									}
303 396
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
304
-									if ($compress) $output .= '"as": "rail.png",';
305
-									else $output .= '"aircraft_shadow": "rail.png",';
397
+									if ($compress) {
398
+										$output .= '"as": "rail.png",';
399
+									} else {
400
+										$output .= '"aircraft_shadow": "rail.png",';
401
+									}
306 402
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
307
-									if ($compress) $output .= '"as": "firetruck.png",';
308
-									else $output .= '"aircraft_shadow": "firetruck.png",';
403
+									if ($compress) {
404
+										$output .= '"as": "firetruck.png",';
405
+									} else {
406
+										$output .= '"aircraft_shadow": "firetruck.png",';
407
+									}
309 408
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
310
-									if ($compress) $output .= '"as": "bus.png",';
311
-									else $output .= '"aircraft_shadow": "bus.png",';
409
+									if ($compress) {
410
+										$output .= '"as": "bus.png",';
411
+									} else {
412
+										$output .= '"aircraft_shadow": "bus.png",';
413
+									}
312 414
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
313
-									if ($compress) $output .= '"as": "phone.png",';
314
-									else $output .= '"aircraft_shadow": "phone.png",';
415
+									if ($compress) {
416
+										$output .= '"as": "phone.png",';
417
+									} else {
418
+										$output .= '"aircraft_shadow": "phone.png",';
419
+									}
315 420
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
316
-									if ($compress) $output .= '"as": "jogger.png",';
317
-									else $output .= '"aircraft_shadow": "jogger.png",';
421
+									if ($compress) {
422
+										$output .= '"as": "jogger.png",';
423
+									} else {
424
+										$output .= '"aircraft_shadow": "jogger.png",';
425
+									}
318 426
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
319
-									if ($compress) $output .= '"as": "bike.png",';
320
-									else $output .= '"aircraft_shadow": "bike.png",';
427
+									if ($compress) {
428
+										$output .= '"as": "bike.png",';
429
+									} else {
430
+										$output .= '"aircraft_shadow": "bike.png",';
431
+									}
321 432
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
322
-									if ($compress) $output .= '"as": "motorcycle.png",';
323
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
433
+									if ($compress) {
434
+										$output .= '"as": "motorcycle.png",';
435
+									} else {
436
+										$output .= '"aircraft_shadow": "motorcycle.png",';
437
+									}
324 438
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
325
-									if ($compress) $output .= '"as": "balloon.png",';
326
-									else $output .= '"aircraft_shadow": "balloon.png",';
439
+									if ($compress) {
440
+										$output .= '"as": "balloon.png",';
441
+									} else {
442
+										$output .= '"aircraft_shadow": "balloon.png",';
443
+									}
327 444
 								} else {
328
-									if ($compress) $output .= '"as": "car.png",';
329
-									else $output .= '"aircraft_shadow": "car.png",';
445
+									if ($compress) {
446
+										$output .= '"as": "car.png",';
447
+									} else {
448
+										$output .= '"aircraft_shadow": "car.png",';
449
+									}
330 450
 								}
331 451
 							} elseif ($marine) {
332
-								if ($compress) $output .= '"as": "ship.png",';
333
-								else $output .= '"aircraft_shadow": "ship.png",';
452
+								if ($compress) {
453
+									$output .= '"as": "ship.png",';
454
+								} else {
455
+									$output .= '"aircraft_shadow": "ship.png",';
456
+								}
334 457
 							} else {
335
-								if ($compress) $output .= '"as": "default.png",';
336
-								else $output .= '"aircraft_shadow": "default.png",';
458
+								if ($compress) {
459
+									$output .= '"as": "default.png",';
460
+								} else {
461
+									$output .= '"aircraft_shadow": "default.png",';
462
+								}
337 463
 							}
338 464
 						} else {
339
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
340
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
465
+							if ($compress) {
466
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
467
+							} else {
468
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
469
+							}
341 470
 						}
342 471
 						if (isset($spotter_item['airline_name'])) {
343 472
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -345,8 +474,11 @@  discard block
 block discarded – undo
345 474
 							$output .= '"airline_name": "NA",';
346 475
 						}
347 476
 						if (isset($spotter_item['departure_airport'])) {
348
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
349
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
477
+							if ($compress) {
478
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
479
+							} else {
480
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
481
+							}
350 482
 						}
351 483
 						if (isset($spotter_item['departure_airport_city'])) {
352 484
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -358,8 +490,11 @@  discard block
 block discarded – undo
358 490
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
359 491
 						}
360 492
 						if (isset($spotter_item['arrival_airport'])) {
361
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
362
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
493
+							if ($compress) {
494
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
495
+							} else {
496
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
497
+							}
363 498
 						}
364 499
 						if (isset($spotter_item['arrival_airport_city'])) {
365 500
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -378,11 +513,17 @@  discard block
 block discarded – undo
378 513
 						}
379 514
 						
380 515
 						if (isset($spotter_item['altitude'])) {
381
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
382
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
516
+							if ($compress) {
517
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
518
+							} else {
519
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
520
+							}
521
+						}
522
+						if ($compress) {
523
+							$output .= '"h": "'.$spotter_item['heading'].'",';
524
+						} else {
525
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
383 526
 						}
384
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
385
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
386 527
 						
387 528
 						if (isset($archivespeed)) {
388 529
 							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
@@ -392,7 +533,9 @@  discard block
 block discarded – undo
392 533
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
393 534
 						}
394 535
 
395
-						if (!$min) $output .= '"image": "'.$image.'",';
536
+						if (!$min) {
537
+							$output .= '"image": "'.$image.'",';
538
+						}
396 539
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
397 540
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
398 541
 						}
@@ -400,8 +543,11 @@  discard block
 block discarded – undo
400 543
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
401 544
 						}
402 545
 						if (isset($spotter_item['squawk'])) {
403
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
404
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
546
+							if ($compress) {
547
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
548
+							} else {
549
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
550
+							}
405 551
 						}
406 552
 						if (isset($spotter_item['squawk_usage'])) {
407 553
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -420,14 +566,23 @@  discard block
 block discarded – undo
420 566
 						}
421 567
 						// type when not aircraft ?
422 568
 						if (isset($spotter_item['type'])) {
423
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
424
-							else $output .= '"type": "'.$spotter_item['type'].'"';
569
+							if ($compress) {
570
+								$output .= '"t": "'.$spotter_item['type'].'"';
571
+							} else {
572
+								$output .= '"type": "'.$spotter_item['type'].'"';
573
+							}
425 574
 						} elseif ($marine) {
426
-							if ($compress) $output .= '"t": "ship"';
427
-							else $output .= '"type": "ship"';
575
+							if ($compress) {
576
+								$output .= '"t": "ship"';
577
+							} else {
578
+								$output .= '"type": "ship"';
579
+							}
428 580
 						} else {
429
-							if ($compress) $output .= '"t": "aircraft"';
430
-							else $output .= '"type": "aircraft"';
581
+							if ($compress) {
582
+								$output .= '"t": "aircraft"';
583
+							} else {
584
+								$output .= '"type": "aircraft"';
585
+							}
431 586
 						}
432 587
 						$output .= '},';
433 588
 						$output .= '"geometry": {';
@@ -495,7 +650,9 @@  discard block
 block discarded – undo
495 650
 			}
496 651
 */
497 652
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
498
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
653
+				if ($history == '' && isset($_COOKIE['history'])) {
654
+					$history = $_COOKIE['history'];
655
+				}
499 656
 				
500 657
 				if (
501 658
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -539,8 +696,11 @@  discard block
 block discarded – undo
539 696
 									$output_history .= ']}},';
540 697
 									$output .= $output_history;
541 698
 								}
542
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
543
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
699
+								if ($compress) {
700
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
701
+								} else {
702
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
703
+								}
544 704
 							}
545 705
 							$output_history .= '[';
546 706
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -559,9 +719,14 @@  discard block
 block discarded – undo
559 719
 							$prev_alt = $alt;
560 720
 						} else {
561 721
 							if ($d == false) {
562
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
563
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
564
-							} else $d = true;
722
+								if ($compress) {
723
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
724
+								} else {
725
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
726
+								}
727
+							} else {
728
+								$d = true;
729
+							}
565 730
 							$output_history .= '[';
566 731
 							$output_history .=  $spotter_history['longitude'].', ';
567 732
 							$output_history .=  $spotter_history['latitude'];
@@ -582,7 +747,9 @@  discard block
 block discarded – undo
582 747
 							$output_historyd = '[';
583 748
 							$output_historyd .=  $spotter_item['longitude'].', ';
584 749
 							$output_historyd .=  $spotter_item['latitude'];
585
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
750
+							if (isset($spotter_history['altitude'])) {
751
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
752
+							}
586 753
 							$output_historyd .= '],';
587 754
 							//$output_history = $output_historyd.$output_history;
588 755
 							$output_history = $output_history.$output_historyd;
@@ -604,8 +771,11 @@  discard block
 block discarded – undo
604 771
 				        && $spotter_item['arrival_airport'] != 'NA' 
605 772
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
606 773
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
607
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
774
+				    if ($compress) {
775
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
776
+				    } else {
777
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
778
+				    }
609 779
 				    if (isset($spotter_item['departure_airport_latitude'])) {
610 780
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
611 781
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -638,8 +808,11 @@  discard block
 block discarded – undo
638 808
 				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
639 809
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
640 810
 				    $havedata = false;
641
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
811
+				    if ($compress) {
812
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
813
+				    } else {
814
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
+				    }
643 816
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
644 817
 
645 818
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -654,7 +827,9 @@  discard block
 block discarded – undo
654 827
 				    }
655 828
 				    //$output_dest  = substr($output_dest, 0, -1);
656 829
 				    $output_dest .= ']}},';
657
-				    if ($havedata) $output .= $output_dest;
830
+				    if ($havedata) {
831
+				    	$output .= $output_dest;
832
+				    }
658 833
 				    unset($output_dest);
659 834
 				}
660 835
 			}
@@ -662,7 +837,9 @@  discard block
 block discarded – undo
662 837
 			$output .= ']';
663 838
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
664 839
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
665
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
840
+			if (isset($begindate)) {
841
+				$output .= '"archive_date": "'.$begindate.'",';
842
+			}
666 843
 			$output .= '"fc": "'.$j.'"';
667 844
 		} else {
668 845
 			$output .= '"features": ';
Please login to merge, or discard this patch.
header.php 1 patch
Braces   +73 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,10 +3,15 @@  discard block
 block discarded – undo
3 3
 //gets the page file and stores it in a variable
4 4
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
5 5
 $current_page = $file_path['filename'];
6
-if ($globalTimezone == '') $globalTimezone = 'UTC';
6
+if ($globalTimezone == '') {
7
+	$globalTimezone = 'UTC';
8
+}
7 9
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
10
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
11
+	$MapType = $_COOKIE['MapType'];
12
+} else {
13
+	$MapType = $globalMapProvider;
14
+}
10 15
 if (isset($_GET['3d'])) {
11 16
 	setcookie('MapFormat','3d');
12 17
 } else if (isset($_GET['2d'])) {
@@ -240,7 +245,13 @@  discard block
 block discarded – undo
240 245
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
241 246
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
242 247
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
243
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
248
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
249
+	print '&latitude='.$latitude;
250
+}
251
+?><?php if(isset($longitude)) {
252
+	print '&longitude='.$longitude;
253
+}
254
+?>&<?php print time(); ?>"></script>
244 255
 <?php
245 256
 		if (!isset($type) || $type == 'aircraft') {
246 257
 ?>
@@ -310,7 +321,13 @@  discard block
 block discarded – undo
310 321
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
311 322
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
312 323
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
313
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
324
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
325
+	print '&latitude='.$latitude;
326
+}
327
+?><?php if(isset($longitude)) {
328
+	print '&longitude='.$longitude;
329
+}
330
+?>&<?php print time(); ?>"></script>
314 331
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
315 332
 <?php
316 333
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -391,7 +408,12 @@  discard block
 block discarded – undo
391 408
         <span class="icon-bar"></span>
392 409
       </button>
393 410
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
394
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
411
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
412
+	print '/';
413
+} else {
414
+	print $globalURL;
415
+}
416
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
395 417
     </div>
396 418
     <div class="collapse navbar-collapse">
397 419
 
@@ -417,7 +439,10 @@  discard block
 block discarded – undo
417 439
 <?php
418 440
     }
419 441
 ?>
420
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
442
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
443
+	echo 'right-';
444
+}
445
+?>caret"></b></a>
421 446
           <ul class="dropdown-menu">
422 447
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
423 448
 <?php
@@ -488,8 +513,14 @@  discard block
 block discarded – undo
488 513
         </li>
489 514
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
490 515
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
491
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
492
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
516
+        <li class="dropdown<?php if ($sub) {
517
+	echo '-submenu';
518
+}
519
+?>">
520
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
521
+	echo 'right-';
522
+}
523
+?>caret"></b></a>
493 524
           <ul class="dropdown-menu">
494 525
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
495 526
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -518,7 +549,10 @@  discard block
 block discarded – undo
518 549
 <?php
519 550
 	}
520 551
 ?>
521
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
552
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
553
+	echo 'right-';
554
+}
555
+?>caret"></b></a>
522 556
 		<ul class="dropdown-menu">
523 557
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
524 558
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -550,7 +584,10 @@  discard block
 block discarded – undo
550 584
 <?php
551 585
 	}
552 586
 ?>
553
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
587
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
588
+	echo 'right-';
589
+}
590
+?>caret"></b></a>
554 591
 		<ul class="dropdown-menu">
555 592
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
556 593
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -606,7 +643,9 @@  discard block
 block discarded – undo
606 643
   		        $alllang = $Language->getLanguages();
607 644
   		        foreach ($alllang as $key => $lang) {
608 645
   		            print '<option value="'.$key.'"';
609
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
646
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
647
+  		            	print ' selected ';
648
+  		            }
610 649
   		            print '>'.$lang[0].'</option>';
611 650
   		        }
612 651
   		    ?>
@@ -746,9 +785,24 @@  discard block
 block discarded – undo
746 785
 	$customid = $globalMapProvider;
747 786
 ?>
748 787
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
749
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
750
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
751
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
788
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
789
+	print $globalMapCustomLayer[$customid]['maxZoom'];
790
+} else {
791
+	print '18';
792
+}
793
+?>,
794
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
795
+	print $globalMapCustomLayer[$customid]['minZoom'];
796
+} else {
797
+	print '0';
798
+}
799
+?>,
800
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
801
+	print 'false';
802
+} else {
803
+	print 'true';
804
+}
805
+?>,
752 806
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
753 807
     }).addTo(map);
754 808
 <?php
@@ -771,4 +825,7 @@  discard block
 block discarded – undo
771 825
 
772 826
 ?>
773 827
 
774
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
828
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
829
+	print 'index ';
830
+}
831
+?>clear">
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.
install/class.update_schema.php 1 patch
Braces   +414 added lines, -153 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1332,20 +1390,28 @@  discard block
 block discarded – undo
1332 1390
 		}
1333 1391
 		if ($globalDBdriver == 'mysql') {
1334 1392
 			$error .= create_db::import_file('../db/airlines.sql');
1335
-			if ($error != '') return $error;
1393
+			if ($error != '') {
1394
+				return $error;
1395
+			}
1336 1396
 		} else {
1337 1397
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
1338
-			if ($error != '') return $error;
1398
+			if ($error != '') {
1399
+				return $error;
1400
+			}
1339 1401
 		}
1340 1402
 		if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) {
1341 1403
 			include_once(dirname(__FILE__).'/class.update_db.php');
1342 1404
 			if (isset($globalVATSIM) && $globalVATSIM) {
1343 1405
 				$error .= update_db::update_vatsim();
1344
-				if ($error != '') return $error;
1406
+				if ($error != '') {
1407
+					return $error;
1408
+				}
1345 1409
 			}
1346 1410
 			if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) {
1347 1411
 				$error .= update_db::update_IVAO();
1348
-				if ($error != '') return $error;
1412
+				if ($error != '') {
1413
+					return $error;
1414
+				}
1349 1415
 			}
1350 1416
 		}
1351 1417
 
@@ -1608,41 +1674,65 @@  discard block
 block discarded – undo
1608 1674
 		if ($globalDBdriver == 'mysql') {
1609 1675
 			if (!$Connection->tableExists('tracker_output')) {
1610 1676
 				$error .= create_db::import_file('../db/tracker_output.sql');
1611
-				if ($error != '') return $error;
1677
+				if ($error != '') {
1678
+					return $error;
1679
+				}
1612 1680
 			}
1613 1681
 			if (!$Connection->tableExists('tracker_live')) {
1614 1682
 				$error .= create_db::import_file('../db/tracker_live.sql');
1615
-				if ($error != '') return $error;
1683
+				if ($error != '') {
1684
+					return $error;
1685
+				}
1616 1686
 			}
1617 1687
 			if (!$Connection->tableExists('marine_output')) {
1618 1688
 				$error .= create_db::import_file('../db/marine_output.sql');
1619
-				if ($error != '') return $error;
1689
+				if ($error != '') {
1690
+					return $error;
1691
+				}
1620 1692
 			}
1621 1693
 			if (!$Connection->tableExists('marine_live')) {
1622 1694
 				$error .= create_db::import_file('../db/marine_live.sql');
1623
-				if ($error != '') return $error;
1695
+				if ($error != '') {
1696
+					return $error;
1697
+				}
1624 1698
 			}
1625 1699
 			if (!$Connection->tableExists('marine_identity')) {
1626 1700
 				$error .= create_db::import_file('../db/marine_identity.sql');
1627
-				if ($error != '') return $error;
1701
+				if ($error != '') {
1702
+					return $error;
1703
+				}
1628 1704
 			}
1629 1705
 			if (!$Connection->tableExists('marine_mid')) {
1630 1706
 				$error .= create_db::import_file('../db/marine_mid.sql');
1631
-				if ($error != '') return $error;
1707
+				if ($error != '') {
1708
+					return $error;
1709
+				}
1632 1710
 			}
1633 1711
 		} else {
1634 1712
 			$error .= create_db::import_file('../db/pgsql/tracker_output.sql');
1635
-			if ($error != '') return $error;
1713
+			if ($error != '') {
1714
+				return $error;
1715
+			}
1636 1716
 			$error .= create_db::import_file('../db/pgsql/tracker_live.sql');
1637
-			if ($error != '') return $error;
1717
+			if ($error != '') {
1718
+				return $error;
1719
+			}
1638 1720
 			$error .= create_db::import_file('../db/pgsql/marine_output.sql');
1639
-			if ($error != '') return $error;
1721
+			if ($error != '') {
1722
+				return $error;
1723
+			}
1640 1724
 			$error .= create_db::import_file('../db/pgsql/marine_live.sql');
1641
-			if ($error != '') return $error;
1725
+			if ($error != '') {
1726
+				return $error;
1727
+			}
1642 1728
 			$error .= create_db::import_file('../db/pgsql/marine_identity.sql');
1643
-			if ($error != '') return $error;
1729
+			if ($error != '') {
1730
+				return $error;
1731
+			}
1644 1732
 			$error .= create_db::import_file('../db/pgsql/marine_mid.sql');
1645
-			if ($error != '') return $error;
1733
+			if ($error != '') {
1734
+				return $error;
1735
+			}
1646 1736
 		}
1647 1737
 		$query = "UPDATE config SET value = '37' WHERE name = 'schema_version'";
1648 1738
 		try {
@@ -1661,39 +1751,61 @@  discard block
 block discarded – undo
1661 1751
 		if ($globalDBdriver == 'mysql') {
1662 1752
 			if (!$Connection->tableExists('marine_image')) {
1663 1753
 				$error .= create_db::import_file('../db/marine_image.sql');
1664
-				if ($error != '') return $error;
1754
+				if ($error != '') {
1755
+					return $error;
1756
+				}
1665 1757
 			}
1666 1758
 			if (!$Connection->tableExists('marine_archive')) {
1667 1759
 				$error .= create_db::import_file('../db/marine_archive.sql');
1668
-				if ($error != '') return $error;
1760
+				if ($error != '') {
1761
+					return $error;
1762
+				}
1669 1763
 			}
1670 1764
 			if (!$Connection->tableExists('marine_archive_output')) {
1671 1765
 				$error .= create_db::import_file('../db/marine_archive_output.sql');
1672
-				if ($error != '') return $error;
1766
+				if ($error != '') {
1767
+					return $error;
1768
+				}
1673 1769
 			}
1674 1770
 			if (!$Connection->tableExists('tracker_archive')) {
1675 1771
 				$error .= create_db::import_file('../db/tracker_archive.sql');
1676
-				if ($error != '') return $error;
1772
+				if ($error != '') {
1773
+					return $error;
1774
+				}
1677 1775
 			}
1678 1776
 			if (!$Connection->tableExists('tracker_archive_output')) {
1679 1777
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
1680
-				if ($error != '') return $error;
1778
+				if ($error != '') {
1779
+					return $error;
1780
+				}
1681 1781
 			}
1682 1782
 			if (!$Connection->tableExists('marine_archive_output')) {
1683 1783
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
1684
-				if ($error != '') return $error;
1784
+				if ($error != '') {
1785
+					return $error;
1786
+				}
1685 1787
 			}
1686 1788
 		} else {
1687 1789
 			$error .= create_db::import_file('../db/pgsql/marine_image.sql');
1688
-			if ($error != '') return $error;
1790
+			if ($error != '') {
1791
+				return $error;
1792
+			}
1689 1793
 			$error .= create_db::import_file('../db/pgsql/marine_archive.sql');
1690
-			if ($error != '') return $error;
1794
+			if ($error != '') {
1795
+				return $error;
1796
+			}
1691 1797
 			$error .= create_db::import_file('../db/pgsql/marine_archive_output.sql');
1692
-			if ($error != '') return $error;
1798
+			if ($error != '') {
1799
+				return $error;
1800
+			}
1693 1801
 			$error .= create_db::import_file('../db/pgsql/tracker_archive.sql');
1694
-			if ($error != '') return $error;
1802
+			if ($error != '') {
1803
+				return $error;
1804
+			}
1695 1805
 			$error .= create_db::import_file('../db/pgsql/tracker_archive_output.sql');
1696
-			if ($error != '') return $error;
1806
+			if ($error != '') {
1807
+				return $error;
1808
+			}
1697 1809
 		}
1698 1810
 		if ($globalDBdriver == 'mysql') {
1699 1811
 			$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
@@ -2064,7 +2176,9 @@  discard block
 block discarded – undo
2064 2176
 		if ($globalDBdriver == 'mysql') {
2065 2177
 			if (!$Connection->tableExists('tracker_archive_output')) {
2066 2178
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
2067
-				if ($error != '') return $error;
2179
+				if ($error != '') {
2180
+					return $error;
2181
+				}
2068 2182
 			}
2069 2183
 			$query = "ALTER TABLE tracker_live MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;";
2070 2184
 		} else {
@@ -2092,14 +2206,22 @@  discard block
 block discarded – undo
2092 2206
 		$error = '';
2093 2207
 		if ($globalDBdriver == 'mysql') {
2094 2208
 			$error .= create_db::import_file('../db/airport.sql');
2095
-			if ($error != '') return $error;
2209
+			if ($error != '') {
2210
+				return $error;
2211
+			}
2096 2212
 			$error .= create_db::import_file('../db/airlines.sql');
2097
-			if ($error != '') return $error;
2213
+			if ($error != '') {
2214
+				return $error;
2215
+			}
2098 2216
 		} else {
2099 2217
 			$error .= create_db::import_file('../db/pgsql/airport.sql');
2100
-			if ($error != '') return $error;
2218
+			if ($error != '') {
2219
+				return $error;
2220
+			}
2101 2221
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
2102
-			if ($error != '') return $error;
2222
+			if ($error != '') {
2223
+				return $error;
2224
+			}
2103 2225
 		}
2104 2226
 		if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
2105 2227
 			if (file_exists('tmp/ivae_feb2013.zip')) {
@@ -2116,7 +2238,9 @@  discard block
 block discarded – undo
2116 2238
 				$error .= update_db::update_vatsim();
2117 2239
 			}
2118 2240
 		}
2119
-		if ($error != '') return $error;
2241
+		if ($error != '') {
2242
+			return $error;
2243
+		}
2120 2244
 		$query = "UPDATE config SET value = '45' WHERE name = 'schema_version'";
2121 2245
 		try {
2122 2246
 			$sth = $Connection->db->prepare($query);
@@ -2136,8 +2260,11 @@  discard block
 block discarded – undo
2136 2260
     	    if ($Connection->tableExists('aircraft')) {
2137 2261
     		if (!$Connection->tableExists('config')) {
2138 2262
     		    $version = '1';
2139
-    		    if ($update) return self::update_from_1();
2140
-    		    else return $version;
2263
+    		    if ($update) {
2264
+    		    	return self::update_from_1();
2265
+    		    } else {
2266
+    		    	return $version;
2267
+    		    }
2141 2268
 		} else {
2142 2269
     		    $Connection = new Connection();
2143 2270
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -2151,182 +2278,316 @@  discard block
 block discarded – undo
2151 2278
     		    if ($update) {
2152 2279
     			if ($result['value'] == '2') {
2153 2280
     			    $error = self::update_from_2();
2154
-    			    if ($error != '') return $error;
2155
-    			    else return self::check_version(true);
2281
+    			    if ($error != '') {
2282
+    			    	return $error;
2283
+    			    } else {
2284
+    			    	return self::check_version(true);
2285
+    			    }
2156 2286
     			} elseif ($result['value'] == '3') {
2157 2287
     			    $error = self::update_from_3();
2158
-    			    if ($error != '') return $error;
2159
-    			    else return self::check_version(true);
2288
+    			    if ($error != '') {
2289
+    			    	return $error;
2290
+    			    } else {
2291
+    			    	return self::check_version(true);
2292
+    			    }
2160 2293
     			} elseif ($result['value'] == '4') {
2161 2294
     			    $error = self::update_from_4();
2162
-    			    if ($error != '') return $error;
2163
-    			    else return self::check_version(true);
2295
+    			    if ($error != '') {
2296
+    			    	return $error;
2297
+    			    } else {
2298
+    			    	return self::check_version(true);
2299
+    			    }
2164 2300
     			} elseif ($result['value'] == '5') {
2165 2301
     			    $error = self::update_from_5();
2166
-    			    if ($error != '') return $error;
2167
-    			    else return self::check_version(true);
2302
+    			    if ($error != '') {
2303
+    			    	return $error;
2304
+    			    } else {
2305
+    			    	return self::check_version(true);
2306
+    			    }
2168 2307
     			} elseif ($result['value'] == '6') {
2169 2308
     			    $error = self::update_from_6();
2170
-    			    if ($error != '') return $error;
2171
-    			    else return self::check_version(true);
2309
+    			    if ($error != '') {
2310
+    			    	return $error;
2311
+    			    } else {
2312
+    			    	return self::check_version(true);
2313
+    			    }
2172 2314
     			} elseif ($result['value'] == '7') {
2173 2315
     			    $error = self::update_from_7();
2174
-    			    if ($error != '') return $error;
2175
-    			    else return self::check_version(true);
2316
+    			    if ($error != '') {
2317
+    			    	return $error;
2318
+    			    } else {
2319
+    			    	return self::check_version(true);
2320
+    			    }
2176 2321
     			} elseif ($result['value'] == '8') {
2177 2322
     			    $error = self::update_from_8();
2178
-    			    if ($error != '') return $error;
2179
-    			    else return self::check_version(true);
2323
+    			    if ($error != '') {
2324
+    			    	return $error;
2325
+    			    } else {
2326
+    			    	return self::check_version(true);
2327
+    			    }
2180 2328
     			} elseif ($result['value'] == '9') {
2181 2329
     			    $error = self::update_from_9();
2182
-    			    if ($error != '') return $error;
2183
-    			    else return self::check_version(true);
2330
+    			    if ($error != '') {
2331
+    			    	return $error;
2332
+    			    } else {
2333
+    			    	return self::check_version(true);
2334
+    			    }
2184 2335
     			} elseif ($result['value'] == '10') {
2185 2336
     			    $error = self::update_from_10();
2186
-    			    if ($error != '') return $error;
2187
-    			    else return self::check_version(true);
2337
+    			    if ($error != '') {
2338
+    			    	return $error;
2339
+    			    } else {
2340
+    			    	return self::check_version(true);
2341
+    			    }
2188 2342
     			} elseif ($result['value'] == '11') {
2189 2343
     			    $error = self::update_from_11();
2190
-    			    if ($error != '') return $error;
2191
-    			    else return self::check_version(true);
2344
+    			    if ($error != '') {
2345
+    			    	return $error;
2346
+    			    } else {
2347
+    			    	return self::check_version(true);
2348
+    			    }
2192 2349
     			} elseif ($result['value'] == '12') {
2193 2350
     			    $error = self::update_from_12();
2194
-    			    if ($error != '') return $error;
2195
-    			    else return self::check_version(true);
2351
+    			    if ($error != '') {
2352
+    			    	return $error;
2353
+    			    } else {
2354
+    			    	return self::check_version(true);
2355
+    			    }
2196 2356
     			} elseif ($result['value'] == '13') {
2197 2357
     			    $error = self::update_from_13();
2198
-    			    if ($error != '') return $error;
2199
-    			    else return self::check_version(true);
2358
+    			    if ($error != '') {
2359
+    			    	return $error;
2360
+    			    } else {
2361
+    			    	return self::check_version(true);
2362
+    			    }
2200 2363
     			} elseif ($result['value'] == '14') {
2201 2364
     			    $error = self::update_from_14();
2202
-    			    if ($error != '') return $error;
2203
-    			    else return self::check_version(true);
2365
+    			    if ($error != '') {
2366
+    			    	return $error;
2367
+    			    } else {
2368
+    			    	return self::check_version(true);
2369
+    			    }
2204 2370
     			} elseif ($result['value'] == '15') {
2205 2371
     			    $error = self::update_from_15();
2206
-    			    if ($error != '') return $error;
2207
-    			    else return self::check_version(true);
2372
+    			    if ($error != '') {
2373
+    			    	return $error;
2374
+    			    } else {
2375
+    			    	return self::check_version(true);
2376
+    			    }
2208 2377
     			} elseif ($result['value'] == '16') {
2209 2378
     			    $error = self::update_from_16();
2210
-    			    if ($error != '') return $error;
2211
-    			    else return self::check_version(true);
2379
+    			    if ($error != '') {
2380
+    			    	return $error;
2381
+    			    } else {
2382
+    			    	return self::check_version(true);
2383
+    			    }
2212 2384
     			} elseif ($result['value'] == '17') {
2213 2385
     			    $error = self::update_from_17();
2214
-    			    if ($error != '') return $error;
2215
-    			    else return self::check_version(true);
2386
+    			    if ($error != '') {
2387
+    			    	return $error;
2388
+    			    } else {
2389
+    			    	return self::check_version(true);
2390
+    			    }
2216 2391
     			} elseif ($result['value'] == '18') {
2217 2392
     			    $error = self::update_from_18();
2218
-    			    if ($error != '') return $error;
2219
-    			    else return self::check_version(true);
2393
+    			    if ($error != '') {
2394
+    			    	return $error;
2395
+    			    } else {
2396
+    			    	return self::check_version(true);
2397
+    			    }
2220 2398
     			} elseif ($result['value'] == '19') {
2221 2399
     			    $error = self::update_from_19();
2222
-    			    if ($error != '') return $error;
2223
-    			    else return self::check_version(true);
2400
+    			    if ($error != '') {
2401
+    			    	return $error;
2402
+    			    } else {
2403
+    			    	return self::check_version(true);
2404
+    			    }
2224 2405
     			} elseif ($result['value'] == '20') {
2225 2406
     			    $error = self::update_from_20();
2226
-    			    if ($error != '') return $error;
2227
-    			    else return self::check_version(true);
2407
+    			    if ($error != '') {
2408
+    			    	return $error;
2409
+    			    } else {
2410
+    			    	return self::check_version(true);
2411
+    			    }
2228 2412
     			} elseif ($result['value'] == '21') {
2229 2413
     			    $error = self::update_from_21();
2230
-    			    if ($error != '') return $error;
2231
-    			    else return self::check_version(true);
2414
+    			    if ($error != '') {
2415
+    			    	return $error;
2416
+    			    } else {
2417
+    			    	return self::check_version(true);
2418
+    			    }
2232 2419
     			} elseif ($result['value'] == '22') {
2233 2420
     			    $error = self::update_from_22();
2234
-    			    if ($error != '') return $error;
2235
-    			    else return self::check_version(true);
2421
+    			    if ($error != '') {
2422
+    			    	return $error;
2423
+    			    } else {
2424
+    			    	return self::check_version(true);
2425
+    			    }
2236 2426
     			} elseif ($result['value'] == '23') {
2237 2427
     			    $error = self::update_from_23();
2238
-    			    if ($error != '') return $error;
2239
-    			    else return self::check_version(true);
2428
+    			    if ($error != '') {
2429
+    			    	return $error;
2430
+    			    } else {
2431
+    			    	return self::check_version(true);
2432
+    			    }
2240 2433
     			} elseif ($result['value'] == '24') {
2241 2434
     			    $error = self::update_from_24();
2242
-    			    if ($error != '') return $error;
2243
-    			    else return self::check_version(true);
2435
+    			    if ($error != '') {
2436
+    			    	return $error;
2437
+    			    } else {
2438
+    			    	return self::check_version(true);
2439
+    			    }
2244 2440
     			} elseif ($result['value'] == '25') {
2245 2441
     			    $error = self::update_from_25();
2246
-    			    if ($error != '') return $error;
2247
-    			    else return self::check_version(true);
2442
+    			    if ($error != '') {
2443
+    			    	return $error;
2444
+    			    } else {
2445
+    			    	return self::check_version(true);
2446
+    			    }
2248 2447
     			} elseif ($result['value'] == '26') {
2249 2448
     			    $error = self::update_from_26();
2250
-    			    if ($error != '') return $error;
2251
-    			    else return self::check_version(true);
2449
+    			    if ($error != '') {
2450
+    			    	return $error;
2451
+    			    } else {
2452
+    			    	return self::check_version(true);
2453
+    			    }
2252 2454
     			} elseif ($result['value'] == '27') {
2253 2455
     			    $error = self::update_from_27();
2254
-    			    if ($error != '') return $error;
2255
-    			    else return self::check_version(true);
2456
+    			    if ($error != '') {
2457
+    			    	return $error;
2458
+    			    } else {
2459
+    			    	return self::check_version(true);
2460
+    			    }
2256 2461
     			} elseif ($result['value'] == '28') {
2257 2462
     			    $error = self::update_from_28();
2258
-    			    if ($error != '') return $error;
2259
-    			    else return self::check_version(true);
2463
+    			    if ($error != '') {
2464
+    			    	return $error;
2465
+    			    } else {
2466
+    			    	return self::check_version(true);
2467
+    			    }
2260 2468
     			} elseif ($result['value'] == '29') {
2261 2469
     			    $error = self::update_from_29();
2262
-    			    if ($error != '') return $error;
2263
-    			    else return self::check_version(true);
2470
+    			    if ($error != '') {
2471
+    			    	return $error;
2472
+    			    } else {
2473
+    			    	return self::check_version(true);
2474
+    			    }
2264 2475
     			} elseif ($result['value'] == '30') {
2265 2476
     			    $error = self::update_from_30();
2266
-    			    if ($error != '') return $error;
2267
-    			    else return self::check_version(true);
2477
+    			    if ($error != '') {
2478
+    			    	return $error;
2479
+    			    } else {
2480
+    			    	return self::check_version(true);
2481
+    			    }
2268 2482
     			} elseif ($result['value'] == '31') {
2269 2483
     			    $error = self::update_from_31();
2270
-    			    if ($error != '') return $error;
2271
-    			    else return self::check_version(true);
2484
+    			    if ($error != '') {
2485
+    			    	return $error;
2486
+    			    } else {
2487
+    			    	return self::check_version(true);
2488
+    			    }
2272 2489
     			} elseif ($result['value'] == '32') {
2273 2490
     			    $error = self::update_from_32();
2274
-    			    if ($error != '') return $error;
2275
-    			    else return self::check_version(true);
2491
+    			    if ($error != '') {
2492
+    			    	return $error;
2493
+    			    } else {
2494
+    			    	return self::check_version(true);
2495
+    			    }
2276 2496
     			} elseif ($result['value'] == '33') {
2277 2497
     			    $error = self::update_from_33();
2278
-    			    if ($error != '') return $error;
2279
-    			    else return self::check_version(true);
2498
+    			    if ($error != '') {
2499
+    			    	return $error;
2500
+    			    } else {
2501
+    			    	return self::check_version(true);
2502
+    			    }
2280 2503
     			} elseif ($result['value'] == '34') {
2281 2504
     			    $error = self::update_from_34();
2282
-    			    if ($error != '') return $error;
2283
-    			    else return self::check_version(true);
2505
+    			    if ($error != '') {
2506
+    			    	return $error;
2507
+    			    } else {
2508
+    			    	return self::check_version(true);
2509
+    			    }
2284 2510
     			} elseif ($result['value'] == '35') {
2285 2511
     			    $error = self::update_from_35();
2286
-    			    if ($error != '') return $error;
2287
-    			    else return self::check_version(true);
2512
+    			    if ($error != '') {
2513
+    			    	return $error;
2514
+    			    } else {
2515
+    			    	return self::check_version(true);
2516
+    			    }
2288 2517
     			} elseif ($result['value'] == '36') {
2289 2518
     			    $error = self::update_from_36();
2290
-    			    if ($error != '') return $error;
2291
-    			    else return self::check_version(true);
2519
+    			    if ($error != '') {
2520
+    			    	return $error;
2521
+    			    } else {
2522
+    			    	return self::check_version(true);
2523
+    			    }
2292 2524
     			} elseif ($result['value'] == '37') {
2293 2525
     			    $error = self::update_from_37();
2294
-    			    if ($error != '') return $error;
2295
-    			    else return self::check_version(true);
2526
+    			    if ($error != '') {
2527
+    			    	return $error;
2528
+    			    } else {
2529
+    			    	return self::check_version(true);
2530
+    			    }
2296 2531
     			} elseif ($result['value'] == '38') {
2297 2532
     			    $error = self::update_from_38();
2298
-    			    if ($error != '') return $error;
2299
-    			    else return self::check_version(true);
2533
+    			    if ($error != '') {
2534
+    			    	return $error;
2535
+    			    } else {
2536
+    			    	return self::check_version(true);
2537
+    			    }
2300 2538
     			} elseif ($result['value'] == '39') {
2301 2539
     			    $error = self::update_from_39();
2302
-    			    if ($error != '') return $error;
2303
-    			    else return self::check_version(true);
2540
+    			    if ($error != '') {
2541
+    			    	return $error;
2542
+    			    } else {
2543
+    			    	return self::check_version(true);
2544
+    			    }
2304 2545
     			} elseif ($result['value'] == '40') {
2305 2546
     			    $error = self::update_from_40();
2306
-    			    if ($error != '') return $error;
2307
-    			    else return self::check_version(true);
2547
+    			    if ($error != '') {
2548
+    			    	return $error;
2549
+    			    } else {
2550
+    			    	return self::check_version(true);
2551
+    			    }
2308 2552
     			} elseif ($result['value'] == '41') {
2309 2553
     			    $error = self::update_from_41();
2310
-    			    if ($error != '') return $error;
2311
-    			    else return self::check_version(true);
2554
+    			    if ($error != '') {
2555
+    			    	return $error;
2556
+    			    } else {
2557
+    			    	return self::check_version(true);
2558
+    			    }
2312 2559
     			} elseif ($result['value'] == '42') {
2313 2560
     			    $error = self::update_from_42();
2314
-    			    if ($error != '') return $error;
2315
-    			    else return self::check_version(true);
2561
+    			    if ($error != '') {
2562
+    			    	return $error;
2563
+    			    } else {
2564
+    			    	return self::check_version(true);
2565
+    			    }
2316 2566
     			} elseif ($result['value'] == '43') {
2317 2567
     			    $error = self::update_from_43();
2318
-    			    if ($error != '') return $error;
2319
-    			    else return self::check_version(true);
2568
+    			    if ($error != '') {
2569
+    			    	return $error;
2570
+    			    } else {
2571
+    			    	return self::check_version(true);
2572
+    			    }
2320 2573
     			} elseif ($result['value'] == '44') {
2321 2574
     			    $error = self::update_from_44();
2322
-    			    if ($error != '') return $error;
2323
-    			    else return self::check_version(true);
2324
-    			} else return '';
2575
+    			    if ($error != '') {
2576
+    			    	return $error;
2577
+    			    } else {
2578
+    			    	return self::check_version(true);
2579
+    			    }
2580
+    			} else {
2581
+    				return '';
2582
+    			}
2583
+    		    } else {
2584
+    		    	return $result['value'];
2325 2585
     		    }
2326
-    		    else return $result['value'];
2327 2586
 		}
2328 2587
 		
2329
-	    } else return $version;
2588
+	    } else {
2589
+	    	return $version;
2590
+	    }
2330 2591
     	}
2331 2592
     	
2332 2593
 }
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.ATC.php 1 patch
Braces   +17 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,20 +19,27 @@  discard block
 block discarded – undo
19 19
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
20 20
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21 21
 				foreach($globalStatsFilters[$globalFilterName] as $source) {
22
-					if (isset($source['source'])) $filter['source'][] = $source['source'];
22
+					if (isset($source['source'])) {
23
+						$filter['source'][] = $source['source'];
24
+					}
23 25
 				}
24 26
 			} else {
25 27
 				$filter = $globalStatsFilters[$globalFilterName];
26 28
 			}
27 29
 		}
28
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) {
31
+			$filter = array_merge($filter,$globalFilter);
32
+		}
29 33
 		$filter_query_join = '';
30 34
 		$filter_query_where = '';
31 35
 		if (isset($filter['source']) && !empty($filter['source'])) {
32 36
 			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
33 37
 		}
34
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
35
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
38
+		if ($filter_query_where == '' && $where) {
39
+			$filter_query_where = ' WHERE';
40
+		} elseif ($filter_query_where != '' && $and) {
41
+			$filter_query_where .= ' AND';
42
+		}
36 43
 		$filter_query = $filter_query_join.$filter_query_where;
37 44
 		return $filter_query;
38 45
 	}
@@ -89,7 +96,9 @@  discard block
 block discarded – undo
89 96
 		$info = str_replace('^','<br />',$info);
90 97
 		$info = str_replace('&amp;sect;','',$info);
91 98
 		$info = str_replace('"','',$info);
92
-		if ($type == '') $type = NULL;
99
+		if ($type == '') {
100
+			$type = NULL;
101
+		}
93 102
 		$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
94 103
 		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
95 104
 		try {
@@ -105,7 +114,9 @@  discard block
 block discarded – undo
105 114
 		$info = str_replace('^','<br />',$info);
106 115
 		$info = str_replace('&amp;sect;','',$info);
107 116
 		$info = str_replace('"','',$info);
108
-		if ($type == '') $type = NULL;
117
+		if ($type == '') {
118
+			$type = NULL;
119
+		}
109 120
 		$query = "UPDATE atc SET frequency = :frequency,latitude = :latitude,longitude = :longitude,atc_range = :range,info = :info,atc_lastseen = :date,type = :type,ivao_id = :ivao_id,ivao_name = :ivao_name WHERE ident = :ident AND format_source = :format_source AND source_name = :source_name";
110 121
 		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
111 122
 		try {
Please login to merge, or discard this patch.