Completed
Push — master ( 932a16...3c5f23 )
by Yannick
34:57
created
install/class.update_db.php 1 patch
Braces   +1226 added lines, -424 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
27 27
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
28 28
 		curl_setopt($ch, CURLOPT_TIMEOUT, 200);
29
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
29
+		if ($referer != '') {
30
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
31
+		}
30 32
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
31 33
 		curl_setopt($ch, CURLOPT_FILE, $fp);
32 34
 		curl_exec($ch);
@@ -37,12 +39,16 @@  discard block
 block discarded – undo
37 39
 	public static function gunzip($in_file,$out_file_name = '') {
38 40
 		//echo $in_file.' -> '.$out_file_name."\n";
39 41
 		$buffer_size = 4096; // read 4kb at a time
40
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
42
+		if ($out_file_name == '') {
43
+			$out_file_name = str_replace('.gz', '', $in_file);
44
+		}
41 45
 		if ($in_file != '' && file_exists($in_file)) {
42 46
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
43
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
44
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
45
-			else {
47
+			if (function_exists('gzopen')) {
48
+				$file = gzopen($in_file,'rb');
49
+			} elseif (function_exists('gzopen64')) {
50
+				$file = gzopen64($in_file,'rb');
51
+			} else {
46 52
 				echo 'gzopen not available';
47 53
 				die;
48 54
 			}
@@ -63,8 +69,12 @@  discard block
 block discarded – undo
63 69
 			if ($res === TRUE) {
64 70
 				$zip->extractTo($path);
65 71
 				$zip->close();
66
-			} else return false;
67
-		} else return false;
72
+			} else {
73
+				return false;
74
+			}
75
+		} else {
76
+			return false;
77
+		}
68 78
 	}
69 79
 	
70 80
 	public static function connect_sqlite($database) {
@@ -79,7 +89,9 @@  discard block
 block discarded – undo
79 89
 	public static function retrieve_route_sqlite_to_dest($database_file) {
80 90
 		global $globalDebug, $globalTransaction;
81 91
 		//$query = 'TRUNCATE TABLE routes';
82
-		if ($globalDebug) echo " - Delete previous routes from DB -";
92
+		if ($globalDebug) {
93
+			echo " - Delete previous routes from DB -";
94
+		}
83 95
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
84 96
 		$Connection = new Connection();
85 97
 		try {
@@ -90,7 +102,9 @@  discard block
 block discarded – undo
90 102
                         return "error : ".$e->getMessage();
91 103
                 }
92 104
 
93
-    		if ($globalDebug) echo " - Add routes to DB -";
105
+    		if ($globalDebug) {
106
+    			echo " - Add routes to DB -";
107
+    		}
94 108
     		update_db::connect_sqlite($database_file);
95 109
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
96 110
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
@@ -105,15 +119,21 @@  discard block
 block discarded – undo
105 119
 		$Connection = new Connection();
106 120
 		$sth_dest = $Connection->db->prepare($query_dest);
107 121
 		try {
108
-			if ($globalTransaction) $Connection->db->beginTransaction();
122
+			if ($globalTransaction) {
123
+				$Connection->db->beginTransaction();
124
+			}
109 125
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
110 126
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
111 127
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
112 128
 				$sth_dest->execute($query_dest_values);
113 129
             		}
114
-			if ($globalTransaction) $Connection->db->commit();
130
+			if ($globalTransaction) {
131
+				$Connection->db->commit();
132
+			}
115 133
 		} catch(PDOException $e) {
116
-			if ($globalTransaction) $Connection->db->rollBack(); 
134
+			if ($globalTransaction) {
135
+				$Connection->db->rollBack();
136
+			}
117 137
 			return "error : ".$e->getMessage();
118 138
 		}
119 139
                 return '';
@@ -121,7 +141,9 @@  discard block
 block discarded – undo
121 141
 	public static function retrieve_route_oneworld($database_file) {
122 142
 		global $globalDebug, $globalTransaction;
123 143
 		//$query = 'TRUNCATE TABLE routes';
124
-		if ($globalDebug) echo " - Delete previous routes from DB -";
144
+		if ($globalDebug) {
145
+			echo " - Delete previous routes from DB -";
146
+		}
125 147
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
126 148
 		$Connection = new Connection();
127 149
 		try {
@@ -132,14 +154,18 @@  discard block
 block discarded – undo
132 154
                         return "error : ".$e->getMessage();
133 155
                 }
134 156
 
135
-    		if ($globalDebug) echo " - Add routes to DB -";
157
+    		if ($globalDebug) {
158
+    			echo " - Add routes to DB -";
159
+    		}
136 160
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
137 161
 		$Spotter = new Spotter();
138 162
 		if ($fh = fopen($database_file,"r")) {
139 163
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
140 164
 			$Connection = new Connection();
141 165
 			$sth_dest = $Connection->db->prepare($query_dest);
142
-			if ($globalTransaction) $Connection->db->beginTransaction();
166
+			if ($globalTransaction) {
167
+				$Connection->db->beginTransaction();
168
+			}
143 169
 			while (!feof($fh)) {
144 170
 				$line = fgetcsv($fh,9999,',');
145 171
 				if ($line[0] != '') {
@@ -148,13 +174,17 @@  discard block
 block discarded – undo
148 174
 							$query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld');
149 175
 							$sth_dest->execute($query_dest_values);
150 176
 						} catch(PDOException $e) {
151
-							if ($globalTransaction) $Connection->db->rollBack(); 
177
+							if ($globalTransaction) {
178
+								$Connection->db->rollBack();
179
+							}
152 180
 							return "error : ".$e->getMessage();
153 181
 						}
154 182
 					}
155 183
 				}
156 184
 			}
157
-			if ($globalTransaction) $Connection->db->commit();
185
+			if ($globalTransaction) {
186
+				$Connection->db->commit();
187
+			}
158 188
 		}
159 189
                 return '';
160 190
 	}
@@ -162,7 +192,9 @@  discard block
 block discarded – undo
162 192
 	public static function retrieve_route_skyteam($database_file) {
163 193
 		global $globalDebug, $globalTransaction;
164 194
 		//$query = 'TRUNCATE TABLE routes';
165
-		if ($globalDebug) echo " - Delete previous routes from DB -";
195
+		if ($globalDebug) {
196
+			echo " - Delete previous routes from DB -";
197
+		}
166 198
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
167 199
 		$Connection = new Connection();
168 200
 		try {
@@ -173,7 +205,9 @@  discard block
 block discarded – undo
173 205
                         return "error : ".$e->getMessage();
174 206
                 }
175 207
 
176
-    		if ($globalDebug) echo " - Add routes to DB -";
208
+    		if ($globalDebug) {
209
+    			echo " - Add routes to DB -";
210
+    		}
177 211
 
178 212
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
179 213
 		$Spotter = new Spotter();
@@ -182,7 +216,9 @@  discard block
 block discarded – undo
182 216
 			$Connection = new Connection();
183 217
 			$sth_dest = $Connection->db->prepare($query_dest);
184 218
 			try {
185
-				if ($globalTransaction) $Connection->db->beginTransaction();
219
+				if ($globalTransaction) {
220
+					$Connection->db->beginTransaction();
221
+				}
186 222
 				while (!feof($fh)) {
187 223
 					$line = fgetcsv($fh,9999,',');
188 224
 					if ($line[0] != '') {
@@ -193,9 +229,13 @@  discard block
 block discarded – undo
193 229
 						}
194 230
 					}
195 231
 				}
196
-				if ($globalTransaction) $Connection->db->commit();
232
+				if ($globalTransaction) {
233
+					$Connection->db->commit();
234
+				}
197 235
 			} catch(PDOException $e) {
198
-				if ($globalTransaction) $Connection->db->rollBack(); 
236
+				if ($globalTransaction) {
237
+					$Connection->db->rollBack();
238
+				}
199 239
 				return "error : ".$e->getMessage();
200 240
 			}
201 241
 		}
@@ -238,11 +278,16 @@  discard block
 block discarded – undo
238 278
 		$sth_dest = $Connection->db->prepare($query_dest);
239 279
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
240 280
 		try {
241
-			if ($globalTransaction) $Connection->db->beginTransaction();
281
+			if ($globalTransaction) {
282
+				$Connection->db->beginTransaction();
283
+			}
242 284
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
243 285
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
244
-				if ($values['UserString4'] == 'M') $type = 'military';
245
-				else $type = null;
286
+				if ($values['UserString4'] == 'M') {
287
+					$type = 'military';
288
+				} else {
289
+					$type = null;
290
+				}
246 291
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
247 292
 				$sth_dest->execute($query_dest_values);
248 293
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
@@ -250,7 +295,9 @@  discard block
 block discarded – undo
250 295
 				    $sth_dest_owner->execute($query_dest_owner_values);
251 296
 				}
252 297
             		}
253
-			if ($globalTransaction) $Connection->db->commit();
298
+			if ($globalTransaction) {
299
+				$Connection->db->commit();
300
+			}
254 301
 		} catch(PDOException $e) {
255 302
 			return "error : ".$e->getMessage();
256 303
 		}
@@ -287,7 +334,9 @@  discard block
 block discarded – undo
287 334
 			$Connection = new Connection();
288 335
 			$sth_dest = $Connection->db->prepare($query_dest);
289 336
 			try {
290
-				if ($globalTransaction) $Connection->db->beginTransaction();
337
+				if ($globalTransaction) {
338
+					$Connection->db->beginTransaction();
339
+				}
291 340
             			while (!feof($fh)) {
292 341
             				$values = array();
293 342
             				$line = $Common->hex2str(fgets($fh,9999));
@@ -298,7 +347,9 @@  discard block
 block discarded – undo
298 347
             				// Check if we can find ICAO, else set it to GLID
299 348
             				$aircraft_name_split = explode(' ',$aircraft_name);
300 349
             				$search_more = '';
301
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
350
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
351
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
352
+            				}
302 353
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
303 354
             				$sth_search = $Connection->db->prepare($query_search);
304 355
 					try {
@@ -311,7 +362,9 @@  discard block
 block discarded – undo
311 362
 					} catch(PDOException $e) {
312 363
 						return "error : ".$e->getMessage();
313 364
 					}
314
-					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
365
+					if (!isset($values['ICAOTypeCode'])) {
366
+						$values['ICAOTypeCode'] = 'GLID';
367
+					}
315 368
 					// Add data to db
316 369
 					if ($values['Registration'] != '' && $values['Registration'] != '0000') {
317 370
 						//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
@@ -320,7 +373,9 @@  discard block
 block discarded – undo
320 373
 						$sth_dest->execute($query_dest_values);
321 374
 					}
322 375
 				}
323
-				if ($globalTransaction) $Connection->db->commit();
376
+				if ($globalTransaction) {
377
+					$Connection->db->commit();
378
+				}
324 379
 			} catch(PDOException $e) {
325 380
 				return "error : ".$e->getMessage();
326 381
 			}
@@ -356,7 +411,9 @@  discard block
 block discarded – undo
356 411
 			$Connection = new Connection();
357 412
 			$sth_dest = $Connection->db->prepare($query_dest);
358 413
 			try {
359
-				if ($globalTransaction) $Connection->db->beginTransaction();
414
+				if ($globalTransaction) {
415
+					$Connection->db->beginTransaction();
416
+				}
360 417
 				$tmp = fgetcsv($fh,9999,',',"'");
361 418
             			while (!feof($fh)) {
362 419
             				$line = fgetcsv($fh,9999,',',"'");
@@ -370,13 +427,17 @@  discard block
 block discarded – undo
370 427
             				// Check if we can find ICAO, else set it to GLID
371 428
             				$aircraft_name_split = explode(' ',$aircraft_name);
372 429
             				$search_more = '';
373
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
430
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
431
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
432
+            				}
374 433
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
375 434
             				$sth_search = $Connection->db->prepare($query_search);
376 435
 					try {
377 436
                                     		$sth_search->execute();
378 437
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
379
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
438
+	            				if (isset($result['icao']) && $result['icao'] != '') {
439
+	            					$values['ICAOTypeCode'] = $result['icao'];
440
+	            				}
380 441
 					} catch(PDOException $e) {
381 442
 						return "error : ".$e->getMessage();
382 443
 					}
@@ -389,7 +450,9 @@  discard block
 block discarded – undo
389 450
 						$sth_dest->execute($query_dest_values);
390 451
 					}
391 452
 				}
392
-				if ($globalTransaction) $Connection->db->commit();
453
+				if ($globalTransaction) {
454
+					$Connection->db->commit();
455
+				}
393 456
 			} catch(PDOException $e) {
394 457
 				return "error : ".$e->getMessage();
395 458
 			}
@@ -428,7 +491,9 @@  discard block
 block discarded – undo
428 491
 			$sth_dest = $Connection->db->prepare($query_dest);
429 492
 			$sth_modes = $Connection->db->prepare($query_modes);
430 493
 			try {
431
-				if ($globalTransaction) $Connection->db->beginTransaction();
494
+				if ($globalTransaction) {
495
+					$Connection->db->beginTransaction();
496
+				}
432 497
 				$tmp = fgetcsv($fh,9999,',','"');
433 498
             			while (!feof($fh)) {
434 499
             				$line = fgetcsv($fh,9999,',','"');
@@ -438,16 +503,22 @@  discard block
 block discarded – undo
438 503
             				    $values['registration'] = $line[0];
439 504
             				    $values['base'] = $line[4];
440 505
             				    $values['owner'] = $line[5];
441
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
442
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
506
+            				    if ($line[6] == '') {
507
+            				    	$values['date_first_reg'] = null;
508
+            				    } else {
509
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
510
+					    }
443 511
 					    $values['cancel'] = $line[7];
444 512
 					} elseif ($country == 'EI') {
445 513
 					    // TODO : add modeS & reg to aircraft_modes
446 514
             				    $values['registration'] = $line[0];
447 515
             				    $values['base'] = $line[3];
448 516
             				    $values['owner'] = $line[2];
449
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
450
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
517
+            				    if ($line[1] == '') {
518
+            				    	$values['date_first_reg'] = null;
519
+            				    } else {
520
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
521
+					    }
451 522
 					    $values['cancel'] = '';
452 523
 					    $values['modes'] = $line[7];
453 524
 					    $values['icao'] = $line[8];
@@ -466,16 +537,22 @@  discard block
 block discarded – undo
466 537
             				    $values['registration'] = $line[3];
467 538
             				    $values['base'] = null;
468 539
             				    $values['owner'] = $line[5];
469
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
470
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
540
+            				    if ($line[18] == '') {
541
+            				    	$values['date_first_reg'] = null;
542
+            				    } else {
543
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
544
+					    }
471 545
 					    $values['cancel'] = '';
472 546
 					} elseif ($country == 'VH') {
473 547
 					    // TODO : add modeS & reg to aircraft_modes
474 548
             				    $values['registration'] = $line[0];
475 549
             				    $values['base'] = null;
476 550
             				    $values['owner'] = $line[12];
477
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
478
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
551
+            				    if ($line[28] == '') {
552
+            				    	$values['date_first_reg'] = null;
553
+            				    } else {
554
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
555
+					    }
479 556
 
480 557
 					    $values['cancel'] = $line[39];
481 558
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -494,29 +571,41 @@  discard block
 block discarded – undo
494 571
             				    $values['registration'] = $line[0];
495 572
             				    $values['base'] = null;
496 573
             				    $values['owner'] = $line[8];
497
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
498
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
574
+            				    if ($line[7] == '') {
575
+            				    	$values['date_first_reg'] = null;
576
+            				    } else {
577
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
578
+					    }
499 579
 					    $values['cancel'] = '';
500 580
 					} elseif ($country == 'PP') {
501 581
             				    $values['registration'] = $line[0];
502 582
             				    $values['base'] = null;
503 583
             				    $values['owner'] = $line[4];
504
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
505
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
584
+            				    if ($line[6] == '') {
585
+            				    	$values['date_first_reg'] = null;
586
+            				    } else {
587
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
588
+					    }
506 589
 					    $values['cancel'] = $line[7];
507 590
 					} elseif ($country == 'E7') {
508 591
             				    $values['registration'] = $line[0];
509 592
             				    $values['base'] = null;
510 593
             				    $values['owner'] = $line[4];
511
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
512
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
594
+            				    if ($line[5] == '') {
595
+            				    	$values['date_first_reg'] = null;
596
+            				    } else {
597
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
598
+					    }
513 599
 					    $values['cancel'] = '';
514 600
 					} elseif ($country == '8Q') {
515 601
             				    $values['registration'] = $line[0];
516 602
             				    $values['base'] = null;
517 603
             				    $values['owner'] = $line[3];
518
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
519
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
604
+            				    if ($line[7] == '') {
605
+            				    	$values['date_first_reg'] = null;
606
+            				    } else {
607
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
608
+					    }
520 609
 					    $values['cancel'] = '';
521 610
 					} elseif ($country == 'ZK') {
522 611
             				    $values['registration'] = $line[0];
@@ -561,7 +650,9 @@  discard block
 block discarded – undo
561 650
 						$sth_modes->execute($query_modes_values);
562 651
 					}
563 652
 				}
564
-				if ($globalTransaction) $Connection->db->commit();
653
+				if ($globalTransaction) {
654
+					$Connection->db->commit();
655
+				}
565 656
 			} catch(PDOException $e) {
566 657
 				return "error : ".$e->getMessage();
567 658
 			}
@@ -697,25 +788,45 @@  discard block
 block discarded – undo
697 788
 		    VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)";
698 789
 		$Connection = new Connection();
699 790
 		$sth_dest = $Connection->db->prepare($query_dest);
700
-		if ($globalTransaction) $Connection->db->beginTransaction();
791
+		if ($globalTransaction) {
792
+			$Connection->db->beginTransaction();
793
+		}
701 794
   
702 795
 		$i = 0;
703 796
 		while($row = sparql_fetch_array($result))
704 797
 		{
705 798
 			if ($i >= 1) {
706 799
 			//print_r($row);
707
-			if (!isset($row['iata'])) $row['iata'] = '';
708
-			if (!isset($row['icao'])) $row['icao'] = '';
709
-			if (!isset($row['type'])) $row['type'] = '';
710
-			if (!isset($row['altitude'])) $row['altitude'] = '';
800
+			if (!isset($row['iata'])) {
801
+				$row['iata'] = '';
802
+			}
803
+			if (!isset($row['icao'])) {
804
+				$row['icao'] = '';
805
+			}
806
+			if (!isset($row['type'])) {
807
+				$row['type'] = '';
808
+			}
809
+			if (!isset($row['altitude'])) {
810
+				$row['altitude'] = '';
811
+			}
711 812
 			if (isset($row['city_bis'])) {
712 813
 				$row['city'] = $row['city_bis'];
713 814
 			}
714
-			if (!isset($row['city'])) $row['city'] = '';
715
-			if (!isset($row['country'])) $row['country'] = '';
716
-			if (!isset($row['homepage'])) $row['homepage'] = '';
717
-			if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = '';
718
-			if (!isset($row['name'])) continue;
815
+			if (!isset($row['city'])) {
816
+				$row['city'] = '';
817
+			}
818
+			if (!isset($row['country'])) {
819
+				$row['country'] = '';
820
+			}
821
+			if (!isset($row['homepage'])) {
822
+				$row['homepage'] = '';
823
+			}
824
+			if (!isset($row['wikipedia_page'])) {
825
+				$row['wikipedia_page'] = '';
826
+			}
827
+			if (!isset($row['name'])) {
828
+				continue;
829
+			}
719 830
 			if (!isset($row['image'])) {
720 831
 				$row['image'] = '';
721 832
 				$row['image_thumb'] = '';
@@ -771,7 +882,9 @@  discard block
 block discarded – undo
771 882
 
772 883
 			$i++;
773 884
 		}
774
-		if ($globalTransaction) $Connection->db->commit();
885
+		if ($globalTransaction) {
886
+			$Connection->db->commit();
887
+		}
775 888
 		/*
776 889
 		echo "Delete duplicate rows...\n";
777 890
 		$query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)';
@@ -814,7 +927,9 @@  discard block
 block discarded – undo
814 927
 		$delimiter = ',';
815 928
 		$out_file = $tmp_dir.'airports.csv';
816 929
 		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
817
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
930
+		if (!file_exists($out_file) || !is_readable($out_file)) {
931
+			return FALSE;
932
+		}
818 933
 		echo "Add data from ourairports.com...\n";
819 934
 
820 935
 		$header = NULL;
@@ -824,8 +939,9 @@  discard block
 block discarded – undo
824 939
 			//$Connection->db->beginTransaction();
825 940
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
826 941
 			{
827
-				if(!$header) $header = $row;
828
-				else {
942
+				if(!$header) {
943
+					$header = $row;
944
+				} else {
829 945
 					$data = array();
830 946
 					$data = array_combine($header, $row);
831 947
 					try {
@@ -866,7 +982,9 @@  discard block
 block discarded – undo
866 982
 		echo "Download data from another free database...\n";
867 983
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
868 984
 		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
869
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
985
+		if (!file_exists($out_file) || !is_readable($out_file)) {
986
+			return FALSE;
987
+		}
870 988
 		update_db::unzip($out_file);
871 989
 		$header = NULL;
872 990
 		echo "Add data from another free database...\n";
@@ -877,8 +995,9 @@  discard block
 block discarded – undo
877 995
 			//$Connection->db->beginTransaction();
878 996
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
879 997
 			{
880
-				if(!$header) $header = $row;
881
-				else {
998
+				if(!$header) {
999
+					$header = $row;
1000
+				} else {
882 1001
 					$data = $row;
883 1002
 
884 1003
 					$query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao';
@@ -1047,7 +1166,9 @@  discard block
 block discarded – undo
1047 1166
 		if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE)
1048 1167
 		{
1049 1168
 			$i = 0;
1050
-			if ($globalTransaction) $Connection->db->beginTransaction();
1169
+			if ($globalTransaction) {
1170
+				$Connection->db->beginTransaction();
1171
+			}
1051 1172
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1052 1173
 			{
1053 1174
 				if ($i > 0) {
@@ -1060,7 +1181,9 @@  discard block
 block discarded – undo
1060 1181
 					}
1061 1182
 					$result_search = $sths->fetchAll(PDO::FETCH_ASSOC);
1062 1183
 					if (!empty($result_search)) {
1063
-						if ($globalDebug) echo '.';
1184
+						if ($globalDebug) {
1185
+							echo '.';
1186
+						}
1064 1187
 							//if ($globalDBdriver == 'mysql') {
1065 1188
 							//	$queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao';
1066 1189
 							//} else {
@@ -1082,8 +1205,12 @@  discard block
 block discarded – undo
1082 1205
 						}
1083 1206
 						$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC);
1084 1207
 						if (!empty($result_search_mfr)) {
1085
-							if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23];
1086
-							if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15];
1208
+							if (trim($data[16]) == '' && trim($data[23]) != '') {
1209
+								$data[16] = $data[23];
1210
+							}
1211
+							if (trim($data[16]) == '' && trim($data[15]) != '') {
1212
+								$data[16] = $data[15];
1213
+							}
1087 1214
 							$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)';
1088 1215
 							try {
1089 1216
 								$sthf = $Connection->db->prepare($queryf);
@@ -1094,7 +1221,9 @@  discard block
 block discarded – undo
1094 1221
 						}
1095 1222
 					}
1096 1223
 					if (strtotime($data[29]) > time()) {
1097
-						if ($globalDebug) echo 'i';
1224
+						if ($globalDebug) {
1225
+							echo 'i';
1226
+						}
1098 1227
 						$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
1099 1228
 						try {
1100 1229
 							$sth = $Connection->db->prepare($query);
@@ -1105,13 +1234,19 @@  discard block
 block discarded – undo
1105 1234
 					}
1106 1235
 				}
1107 1236
 				if ($i % 90 == 0) {
1108
-					if ($globalTransaction) $Connection->db->commit();
1109
-					if ($globalTransaction) $Connection->db->beginTransaction();
1237
+					if ($globalTransaction) {
1238
+						$Connection->db->commit();
1239
+					}
1240
+					if ($globalTransaction) {
1241
+						$Connection->db->beginTransaction();
1242
+					}
1110 1243
 				}
1111 1244
 				$i++;
1112 1245
 			}
1113 1246
 			fclose($handle);
1114
-			if ($globalTransaction) $Connection->db->commit();
1247
+			if ($globalTransaction) {
1248
+				$Connection->db->commit();
1249
+			}
1115 1250
 		}
1116 1251
 		return '';
1117 1252
 	}
@@ -1131,11 +1266,15 @@  discard block
 block discarded – undo
1131 1266
 		if (($handle = fopen($tmp_dir.'modes.tsv', 'r')) !== FALSE)
1132 1267
 		{
1133 1268
 			$i = 0;
1134
-			if ($globalTransaction) $Connection->db->beginTransaction();
1269
+			if ($globalTransaction) {
1270
+				$Connection->db->beginTransaction();
1271
+			}
1135 1272
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1136 1273
 			{
1137 1274
 				if ($i > 0) {
1138
-					if ($data[1] == 'NULL') $data[1] = $data[0];
1275
+					if ($data[1] == 'NULL') {
1276
+						$data[1] = $data[0];
1277
+					}
1139 1278
 					$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)';
1140 1279
 					try {
1141 1280
 						$sth = $Connection->db->prepare($query);
@@ -1147,7 +1286,9 @@  discard block
 block discarded – undo
1147 1286
 				$i++;
1148 1287
 			}
1149 1288
 			fclose($handle);
1150
-			if ($globalTransaction) $Connection->db->commit();
1289
+			if ($globalTransaction) {
1290
+				$Connection->db->commit();
1291
+			}
1151 1292
 		}
1152 1293
 		return '';
1153 1294
 	}
@@ -1179,11 +1320,15 @@  discard block
 block discarded – undo
1179 1320
 		if (($handle = fopen($tmp_dir.'airlines.tsv', 'r')) !== FALSE)
1180 1321
 		{
1181 1322
 			$i = 0;
1182
-			if ($globalTransaction) $Connection->db->beginTransaction();
1323
+			if ($globalTransaction) {
1324
+				$Connection->db->beginTransaction();
1325
+			}
1183 1326
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1184 1327
 			{
1185 1328
 				if ($i > 0) {
1186
-					if ($data[1] == 'NULL') $data[1] = $data[0];
1329
+					if ($data[1] == 'NULL') {
1330
+						$data[1] = $data[0];
1331
+					}
1187 1332
 					$query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)';
1188 1333
 					try {
1189 1334
 						$sth = $Connection->db->prepare($query);
@@ -1195,7 +1340,9 @@  discard block
 block discarded – undo
1195 1340
 				$i++;
1196 1341
 			}
1197 1342
 			fclose($handle);
1198
-			if ($globalTransaction) $Connection->db->commit();
1343
+			if ($globalTransaction) {
1344
+				$Connection->db->commit();
1345
+			}
1199 1346
 		}
1200 1347
 		/*
1201 1348
 		$query = "UNLOCK TABLES";
@@ -1225,7 +1372,9 @@  discard block
 block discarded – undo
1225 1372
 		if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE)
1226 1373
 		{
1227 1374
 			$i = 0;
1228
-			if ($globalTransaction) $Connection->db->beginTransaction();
1375
+			if ($globalTransaction) {
1376
+				$Connection->db->beginTransaction();
1377
+			}
1229 1378
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1230 1379
 			{
1231 1380
 				if ($i > 0) {
@@ -1241,7 +1390,9 @@  discard block
 block discarded – undo
1241 1390
 				$i++;
1242 1391
 			}
1243 1392
 			fclose($handle);
1244
-			if ($globalTransaction) $Connection->db->commit();
1393
+			if ($globalTransaction) {
1394
+				$Connection->db->commit();
1395
+			}
1245 1396
 		}
1246 1397
 		return '';
1247 1398
         }
@@ -1261,7 +1412,9 @@  discard block
 block discarded – undo
1261 1412
 		if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE)
1262 1413
 		{
1263 1414
 			$i = 0;
1264
-			if ($globalTransaction) $Connection->db->beginTransaction();
1415
+			if ($globalTransaction) {
1416
+				$Connection->db->beginTransaction();
1417
+			}
1265 1418
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1266 1419
 			{
1267 1420
 				if ($i > 0) {
@@ -1271,19 +1424,25 @@  discard block
 block discarded – undo
1271 1424
 						$sth = $Connection->db->prepare($query);
1272 1425
 						$sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam'));
1273 1426
 					} catch(PDOException $e) {
1274
-						if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1427
+						if ($globalDebug) {
1428
+							echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1429
+						}
1275 1430
 						die();
1276 1431
 					}
1277 1432
 				}
1278 1433
 				if ($globalTransaction && $i % 2000 == 0) {
1279 1434
 					$Connection->db->commit();
1280
-					if ($globalDebug) echo '.';
1435
+					if ($globalDebug) {
1436
+						echo '.';
1437
+					}
1281 1438
 					$Connection->db->beginTransaction();
1282 1439
 				}
1283 1440
 				$i++;
1284 1441
 			}
1285 1442
 			fclose($handle);
1286
-			if ($globalTransaction) $Connection->db->commit();
1443
+			if ($globalTransaction) {
1444
+				$Connection->db->commit();
1445
+			}
1287 1446
 		}
1288 1447
 		return '';
1289 1448
 	}
@@ -1302,7 +1461,9 @@  discard block
 block discarded – undo
1302 1461
 		if (($handle = fopen($tmp_dir.'block.tsv', 'r')) !== FALSE)
1303 1462
 		{
1304 1463
 			$i = 0;
1305
-			if ($globalTransaction) $Connection->db->beginTransaction();
1464
+			if ($globalTransaction) {
1465
+				$Connection->db->beginTransaction();
1466
+			}
1306 1467
 			while (($data = fgets($handle, 1000)) !== FALSE)
1307 1468
 			{
1308 1469
 				$query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)';
@@ -1310,18 +1471,24 @@  discard block
 block discarded – undo
1310 1471
 					$sth = $Connection->db->prepare($query);
1311 1472
 					$sth->execute(array(':callSign' => trim($data),':source' => 'website_fam'));
1312 1473
 				} catch(PDOException $e) {
1313
-					if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data;
1474
+					if ($globalDebug) {
1475
+						echo "error: ".$e->getMessage()." - data: ".$data;
1476
+					}
1314 1477
 					die();
1315 1478
 				}
1316 1479
 				if ($globalTransaction && $i % 2000 == 0) {
1317 1480
 					$Connection->db->commit();
1318
-					if ($globalDebug) echo '.';
1481
+					if ($globalDebug) {
1482
+						echo '.';
1483
+					}
1319 1484
 					$Connection->db->beginTransaction();
1320 1485
 				}
1321 1486
 				$i++;
1322 1487
 			}
1323 1488
 			fclose($handle);
1324
-			if ($globalTransaction) $Connection->db->commit();
1489
+			if ($globalTransaction) {
1490
+				$Connection->db->commit();
1491
+			}
1325 1492
 		}
1326 1493
 		return '';
1327 1494
         }
@@ -1346,7 +1513,9 @@  discard block
 block discarded – undo
1346 1513
 			$i = 0;
1347 1514
 			//$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
1348 1515
 			//$Connection->db->beginTransaction();
1349
-			if ($globalTransaction) $Connection->db->beginTransaction();
1516
+			if ($globalTransaction) {
1517
+				$Connection->db->beginTransaction();
1518
+			}
1350 1519
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1351 1520
 			{
1352 1521
 				if ($i > 0) {
@@ -1362,7 +1531,9 @@  discard block
 block discarded – undo
1362 1531
 				$i++;
1363 1532
 			}
1364 1533
 			fclose($handle);
1365
-			if ($globalTransaction) $Connection->db->commit();
1534
+			if ($globalTransaction) {
1535
+				$Connection->db->commit();
1536
+			}
1366 1537
 		}
1367 1538
 		return '';
1368 1539
         }
@@ -1382,7 +1553,9 @@  discard block
 block discarded – undo
1382 1553
 		if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE)
1383 1554
 		{
1384 1555
 			$i = 0;
1385
-			if ($globalTransaction) $Connection->db->beginTransaction();
1556
+			if ($globalTransaction) {
1557
+				$Connection->db->beginTransaction();
1558
+			}
1386 1559
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1387 1560
 			{
1388 1561
 				if ($i > 0) {
@@ -1399,7 +1572,9 @@  discard block
 block discarded – undo
1399 1572
 				$i++;
1400 1573
 			}
1401 1574
 			fclose($handle);
1402
-			if ($globalTransaction) $Connection->db->commit();
1575
+			if ($globalTransaction) {
1576
+				$Connection->db->commit();
1577
+			}
1403 1578
 		}
1404 1579
 		return '';
1405 1580
 	}
@@ -1418,7 +1593,9 @@  discard block
 block discarded – undo
1418 1593
 		$Connection = new Connection();
1419 1594
 		if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE)
1420 1595
 		{
1421
-			if ($globalTransaction) $Connection->db->beginTransaction();
1596
+			if ($globalTransaction) {
1597
+				$Connection->db->beginTransaction();
1598
+			}
1422 1599
 			while (($data = fgetcsv($handle, 1000)) !== FALSE)
1423 1600
 			{
1424 1601
 				$query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL';
@@ -1433,7 +1610,9 @@  discard block
 block discarded – undo
1433 1610
 				}
1434 1611
 			}
1435 1612
 			fclose($handle);
1436
-			if ($globalTransaction) $Connection->db->commit();
1613
+			if ($globalTransaction) {
1614
+				$Connection->db->commit();
1615
+			}
1437 1616
 		}
1438 1617
 		return '';
1439 1618
         }
@@ -1511,9 +1690,14 @@  discard block
 block discarded – undo
1511 1690
 				if ($i > 0 && $data[0] != '') {
1512 1691
 					$sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]);
1513 1692
 					$period = str_replace(',','',$data[14]);
1514
-					if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60;
1515
-					if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18]));
1516
-					else $launch_date = NULL;
1693
+					if (!empty($period) && strpos($period,'days')) {
1694
+						$period = str_replace(' days','',$period)*24*60;
1695
+					}
1696
+					if ($data[18] != '') {
1697
+						$launch_date = date('Y-m-d',strtotime($data[18]));
1698
+					} else {
1699
+						$launch_date = NULL;
1700
+					}
1517 1701
 					$data = array_map(function($value) {
1518 1702
 						return trim($value) === '' ? null : $value;
1519 1703
 					}, $data);
@@ -1876,7 +2060,9 @@  discard block
 block discarded – undo
1876 2060
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1877 2061
 		{
1878 2062
 			$i = 0;
1879
-			if ($globalTransaction) $Connection->db->beginTransaction();
2063
+			if ($globalTransaction) {
2064
+				$Connection->db->beginTransaction();
2065
+			}
1880 2066
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1881 2067
 			{
1882 2068
 				$i++;
@@ -1904,7 +2090,9 @@  discard block
 block discarded – undo
1904 2090
 				}
1905 2091
 			}
1906 2092
 			fclose($handle);
1907
-			if ($globalTransaction) $Connection->db->commit();
2093
+			if ($globalTransaction) {
2094
+				$Connection->db->commit();
2095
+			}
1908 2096
 		}
1909 2097
 		return '';
1910 2098
 	}
@@ -1920,7 +2108,9 @@  discard block
 block discarded – undo
1920 2108
 		$Source->deleteLocationByType('fires');
1921 2109
 		$i = 0;
1922 2110
 		if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) {
1923
-			if ($globalTransaction) $Connection->db->beginTransaction();
2111
+			if ($globalTransaction) {
2112
+				$Connection->db->beginTransaction();
2113
+			}
1924 2114
 			while (($row = fgetcsv($handle,1000)) !== false) {
1925 2115
 				if ($i > 0 && $row[0] != '' && $row[8] != 'low') {
1926 2116
 					$description = array('bright_t14' => $row[2],'scan' => $row[3],'track' => $row[4],'sat' => $row[7],'confidence' => $row[8],'version' => $row[9],'bright_t15' => $row[10],'frp' => $row[11],'daynight' => $row[12]);
@@ -1935,7 +2125,9 @@  discard block
 block discarded – undo
1935 2125
 				}
1936 2126
 				$i++;
1937 2127
 			}
1938
-			if ($globalTransaction) $Connection->db->commit();
2128
+			if ($globalTransaction) {
2129
+				$Connection->db->commit();
2130
+			}
1939 2131
 		}
1940 2132
 	}
1941 2133
 
@@ -1956,7 +2148,9 @@  discard block
 block discarded – undo
1956 2148
 		$Connection = new Connection();
1957 2149
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1958 2150
 		{
1959
-			if ($globalTransaction) $Connection->db->beginTransaction();
2151
+			if ($globalTransaction) {
2152
+				$Connection->db->beginTransaction();
2153
+			}
1960 2154
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1961 2155
 			{
1962 2156
 				if(count($row) > 1) {
@@ -1970,7 +2164,9 @@  discard block
 block discarded – undo
1970 2164
 				}
1971 2165
 			}
1972 2166
 			fclose($handle);
1973
-			if ($globalTransaction) $Connection->db->commit();
2167
+			if ($globalTransaction) {
2168
+				$Connection->db->commit();
2169
+			}
1974 2170
 		}
1975 2171
 		return '';
1976 2172
         }
@@ -1990,8 +2186,9 @@  discard block
 block discarded – undo
1990 2186
 	        }
1991 2187
 
1992 2188
 
1993
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
1994
-		else {
2189
+		if ($globalDBdriver == 'mysql') {
2190
+			update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
2191
+		} else {
1995 2192
 			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
1996 2193
 			$query = "CREATE EXTENSION postgis";
1997 2194
 			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
@@ -2010,7 +2207,9 @@  discard block
 block discarded – undo
2010 2207
 		global $tmp_dir, $globalDebug;
2011 2208
 		include_once('class.create_db.php');
2012 2209
 		require_once(dirname(__FILE__).'/../require/class.NOTAM.php');
2013
-		if ($globalDebug) echo "NOTAM from FlightAirMap website : Download...";
2210
+		if ($globalDebug) {
2211
+			echo "NOTAM from FlightAirMap website : Download...";
2212
+		}
2014 2213
 		update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5');
2015 2214
 		$error = '';
2016 2215
 		if (file_exists($tmp_dir.'notam.txt.gz.md5')) {
@@ -2020,20 +2219,34 @@  discard block
 block discarded – undo
2020 2219
 				update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz');
2021 2220
 				if (file_exists($tmp_dir.'notam.txt.gz')) {
2022 2221
 					if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) {
2023
-						if ($globalDebug) echo "Gunzip...";
2222
+						if ($globalDebug) {
2223
+							echo "Gunzip...";
2224
+						}
2024 2225
 						update_db::gunzip($tmp_dir.'notam.txt.gz');
2025
-						if ($globalDebug) echo "Add to DB...";
2226
+						if ($globalDebug) {
2227
+							echo "Add to DB...";
2228
+						}
2026 2229
 						//$error = create_db::import_file($tmp_dir.'notam.sql');
2027 2230
 						$NOTAM = new NOTAM();
2028 2231
 						$NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt');
2029 2232
 						update_db::insert_notam_version($notam_md5);
2030
-					} else $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed.";
2031
-				} else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed.";
2032
-			} elseif ($globalDebug) echo "No new version.";
2033
-		} else $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed.";
2233
+					} else {
2234
+						$error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed.";
2235
+					}
2236
+				} else {
2237
+					$error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed.";
2238
+				}
2239
+			} elseif ($globalDebug) {
2240
+				echo "No new version.";
2241
+			}
2242
+		} else {
2243
+			$error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed.";
2244
+		}
2034 2245
 		if ($error != '') {
2035 2246
 			return $error;
2036
-		} elseif ($globalDebug) echo "Done\n";
2247
+		} elseif ($globalDebug) {
2248
+			echo "Done\n";
2249
+		}
2037 2250
 		return '';
2038 2251
 	}
2039 2252
 
@@ -2088,68 +2301,114 @@  discard block
 block discarded – undo
2088 2301
 		//update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip');
2089 2302
 		if (extension_loaded('zip')) {
2090 2303
 			if (file_exists($tmp_dir.'ivae_feb2013.zip')) {
2091
-				if ($globalDebug) echo "Unzip...";
2304
+				if ($globalDebug) {
2305
+					echo "Unzip...";
2306
+				}
2092 2307
 				update_db::unzip($tmp_dir.'ivae_feb2013.zip');
2093
-				if ($globalDebug) echo "Add to DB...";
2308
+				if ($globalDebug) {
2309
+					echo "Add to DB...";
2310
+				}
2094 2311
 				update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
2095
-				if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
2312
+				if ($globalDebug) {
2313
+					echo "Copy airlines logos to airlines images directory...";
2314
+				}
2096 2315
 				if (is_writable(dirname(__FILE__).'/../images/airlines')) {
2097
-					if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
2098
-				} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
2099
-			} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
2100
-		} else $error = "ZIP module not loaded but required for IVAO.";
2316
+					if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) {
2317
+						$error = "Failed to copy airlines logo.";
2318
+					}
2319
+				} else {
2320
+					$error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
2321
+				}
2322
+			} else {
2323
+				$error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
2324
+			}
2325
+		} else {
2326
+			$error = "ZIP module not loaded but required for IVAO.";
2327
+		}
2101 2328
 		if ($error != '') {
2102 2329
 			return $error;
2103
-		} elseif ($globalDebug) echo "Done\n";
2330
+		} elseif ($globalDebug) {
2331
+			echo "Done\n";
2332
+		}
2104 2333
 		return '';
2105 2334
 	}
2106 2335
 
2107 2336
 	public static function update_routes() {
2108 2337
 		global $tmp_dir, $globalDebug;
2109 2338
 		$error = '';
2110
-		if ($globalDebug) echo "Routes : Download...";
2339
+		if ($globalDebug) {
2340
+			echo "Routes : Download...";
2341
+		}
2111 2342
 		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
2112 2343
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
2113
-			if ($globalDebug) echo "Gunzip...";
2344
+			if ($globalDebug) {
2345
+				echo "Gunzip...";
2346
+			}
2114 2347
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
2115
-			if ($globalDebug) echo "Add to DB...";
2348
+			if ($globalDebug) {
2349
+				echo "Add to DB...";
2350
+			}
2116 2351
 			$error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb');
2117
-		} else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
2352
+		} else {
2353
+			$error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
2354
+		}
2118 2355
 		if ($error != '') {
2119 2356
 			return $error;
2120
-		} elseif ($globalDebug) echo "Done\n";
2357
+		} elseif ($globalDebug) {
2358
+			echo "Done\n";
2359
+		}
2121 2360
 		return '';
2122 2361
 	}
2123 2362
 	public static function update_oneworld() {
2124 2363
 		global $tmp_dir, $globalDebug;
2125 2364
 		$error = '';
2126
-		if ($globalDebug) echo "Schedules Oneworld : Download...";
2365
+		if ($globalDebug) {
2366
+			echo "Schedules Oneworld : Download...";
2367
+		}
2127 2368
 		update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz');
2128 2369
 		if (file_exists($tmp_dir.'oneworld.csv.gz')) {
2129
-			if ($globalDebug) echo "Gunzip...";
2370
+			if ($globalDebug) {
2371
+				echo "Gunzip...";
2372
+			}
2130 2373
 			update_db::gunzip($tmp_dir.'oneworld.csv.gz');
2131
-			if ($globalDebug) echo "Add to DB...";
2374
+			if ($globalDebug) {
2375
+				echo "Add to DB...";
2376
+			}
2132 2377
 			$error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv');
2133
-		} else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed.";
2378
+		} else {
2379
+			$error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed.";
2380
+		}
2134 2381
 		if ($error != '') {
2135 2382
 			return $error;
2136
-		} elseif ($globalDebug) echo "Done\n";
2383
+		} elseif ($globalDebug) {
2384
+			echo "Done\n";
2385
+		}
2137 2386
 		return '';
2138 2387
 	}
2139 2388
 	public static function update_skyteam() {
2140 2389
 		global $tmp_dir, $globalDebug;
2141 2390
 		$error = '';
2142
-		if ($globalDebug) echo "Schedules Skyteam : Download...";
2391
+		if ($globalDebug) {
2392
+			echo "Schedules Skyteam : Download...";
2393
+		}
2143 2394
 		update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz');
2144 2395
 		if (file_exists($tmp_dir.'skyteam.csv.gz')) {
2145
-			if ($globalDebug) echo "Gunzip...";
2396
+			if ($globalDebug) {
2397
+				echo "Gunzip...";
2398
+			}
2146 2399
 			update_db::gunzip($tmp_dir.'skyteam.csv.gz');
2147
-			if ($globalDebug) echo "Add to DB...";
2400
+			if ($globalDebug) {
2401
+				echo "Add to DB...";
2402
+			}
2148 2403
 			$error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv');
2149
-		} else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed.";
2404
+		} else {
2405
+			$error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed.";
2406
+		}
2150 2407
 		if ($error != '') {
2151 2408
 			return $error;
2152
-		} elseif ($globalDebug) echo "Done\n";
2409
+		} elseif ($globalDebug) {
2410
+			echo "Done\n";
2411
+		}
2153 2412
 		return '';
2154 2413
 	}
2155 2414
 	public static function update_ModeS() {
@@ -2166,340 +2425,590 @@  discard block
 block discarded – undo
2166 2425
 			exit;
2167 2426
 		} elseif ($globalDebug) echo "Done\n";
2168 2427
 */
2169
-		if ($globalDebug) echo "Modes : Download...";
2170
-//		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2428
+		if ($globalDebug) {
2429
+			echo "Modes : Download...";
2430
+		}
2431
+		//		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2171 2432
 		update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz');
2172 2433
 
2173 2434
 //		if (file_exists($tmp_dir.'basestation_latest.zip')) {
2174 2435
 		if (file_exists($tmp_dir.'BaseStation.sqb.gz')) {
2175
-			if ($globalDebug) echo "Unzip...";
2176
-//			update_db::unzip($tmp_dir.'basestation_latest.zip');
2436
+			if ($globalDebug) {
2437
+				echo "Unzip...";
2438
+			}
2439
+			//			update_db::unzip($tmp_dir.'basestation_latest.zip');
2177 2440
 			update_db::gunzip($tmp_dir.'BaseStation.sqb.gz');
2178
-			if ($globalDebug) echo "Add to DB...";
2441
+			if ($globalDebug) {
2442
+				echo "Add to DB...";
2443
+			}
2179 2444
 			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb');
2180 2445
 //			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb');
2181
-		} else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
2446
+		} else {
2447
+			$error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
2448
+		}
2182 2449
 		if ($error != '') {
2183 2450
 			return $error;
2184
-		} elseif ($globalDebug) echo "Done\n";
2451
+		} elseif ($globalDebug) {
2452
+			echo "Done\n";
2453
+		}
2185 2454
 		return '';
2186 2455
 	}
2187 2456
 
2188 2457
 	public static function update_ModeS_faa() {
2189 2458
 		global $tmp_dir, $globalDebug;
2190
-		if ($globalDebug) echo "Modes FAA: Download...";
2459
+		if ($globalDebug) {
2460
+			echo "Modes FAA: Download...";
2461
+		}
2191 2462
 		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip');
2192 2463
 		if (file_exists($tmp_dir.'ReleasableAircraft.zip')) {
2193
-			if ($globalDebug) echo "Unzip...";
2464
+			if ($globalDebug) {
2465
+				echo "Unzip...";
2466
+			}
2194 2467
 			update_db::unzip($tmp_dir.'ReleasableAircraft.zip');
2195
-			if ($globalDebug) echo "Add to DB...";
2468
+			if ($globalDebug) {
2469
+				echo "Add to DB...";
2470
+			}
2196 2471
 			$error = update_db::modes_faa();
2197
-		} else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed.";
2472
+		} else {
2473
+			$error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed.";
2474
+		}
2198 2475
 		if ($error != '') {
2199 2476
 			return $error;
2200
-		} elseif ($globalDebug) echo "Done\n";
2477
+		} elseif ($globalDebug) {
2478
+			echo "Done\n";
2479
+		}
2201 2480
 		return '';
2202 2481
 	}
2203 2482
 
2204 2483
 	public static function update_ModeS_flarm() {
2205 2484
 		global $tmp_dir, $globalDebug;
2206
-		if ($globalDebug) echo "Modes Flarmnet: Download...";
2485
+		if ($globalDebug) {
2486
+			echo "Modes Flarmnet: Download...";
2487
+		}
2207 2488
 		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
2208 2489
 		if (file_exists($tmp_dir.'data.fln')) {
2209
-			if ($globalDebug) echo "Add to DB...";
2490
+			if ($globalDebug) {
2491
+				echo "Add to DB...";
2492
+			}
2210 2493
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
2211
-		} else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
2494
+		} else {
2495
+			$error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
2496
+		}
2212 2497
 		if ($error != '') {
2213 2498
 			return $error;
2214
-		} elseif ($globalDebug) echo "Done\n";
2499
+		} elseif ($globalDebug) {
2500
+			echo "Done\n";
2501
+		}
2215 2502
 		return '';
2216 2503
 	}
2217 2504
 
2218 2505
 	public static function update_ModeS_ogn() {
2219 2506
 		global $tmp_dir, $globalDebug;
2220
-		if ($globalDebug) echo "Modes OGN: Download...";
2507
+		if ($globalDebug) {
2508
+			echo "Modes OGN: Download...";
2509
+		}
2221 2510
 		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
2222 2511
 		if (file_exists($tmp_dir.'ogn.csv')) {
2223
-			if ($globalDebug) echo "Add to DB...";
2512
+			if ($globalDebug) {
2513
+				echo "Add to DB...";
2514
+			}
2224 2515
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
2225
-		} else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
2516
+		} else {
2517
+			$error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
2518
+		}
2226 2519
 		if ($error != '') {
2227 2520
 			return $error;
2228
-		} elseif ($globalDebug) echo "Done\n";
2521
+		} elseif ($globalDebug) {
2522
+			echo "Done\n";
2523
+		}
2229 2524
 		return '';
2230 2525
 	}
2231 2526
 
2232 2527
 	public static function update_owner() {
2233 2528
 		global $tmp_dir, $globalDebug, $globalMasterSource;
2234 2529
 		
2235
-		if ($globalDebug) echo "Owner France: Download...";
2530
+		if ($globalDebug) {
2531
+			echo "Owner France: Download...";
2532
+		}
2236 2533
 		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
2237 2534
 		if (file_exists($tmp_dir.'owner_f.csv')) {
2238
-			if ($globalDebug) echo "Add to DB...";
2535
+			if ($globalDebug) {
2536
+				echo "Add to DB...";
2537
+			}
2239 2538
 			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
2240
-		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2539
+		} else {
2540
+			$error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2541
+		}
2241 2542
 		if ($error != '') {
2242 2543
 			return $error;
2243
-		} elseif ($globalDebug) echo "Done\n";
2544
+		} elseif ($globalDebug) {
2545
+			echo "Done\n";
2546
+		}
2244 2547
 		
2245
-		if ($globalDebug) echo "Owner Ireland: Download...";
2548
+		if ($globalDebug) {
2549
+			echo "Owner Ireland: Download...";
2550
+		}
2246 2551
 		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
2247 2552
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
2248
-			if ($globalDebug) echo "Add to DB...";
2553
+			if ($globalDebug) {
2554
+				echo "Add to DB...";
2555
+			}
2249 2556
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
2250
-		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2557
+		} else {
2558
+			$error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2559
+		}
2251 2560
 		if ($error != '') {
2252 2561
 			return $error;
2253
-		} elseif ($globalDebug) echo "Done\n";
2254
-		if ($globalDebug) echo "Owner Switzerland: Download...";
2562
+		} elseif ($globalDebug) {
2563
+			echo "Done\n";
2564
+		}
2565
+		if ($globalDebug) {
2566
+			echo "Owner Switzerland: Download...";
2567
+		}
2255 2568
 		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
2256 2569
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
2257
-			if ($globalDebug) echo "Add to DB...";
2570
+			if ($globalDebug) {
2571
+				echo "Add to DB...";
2572
+			}
2258 2573
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
2259
-		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2574
+		} else {
2575
+			$error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2576
+		}
2260 2577
 		if ($error != '') {
2261 2578
 			return $error;
2262
-		} elseif ($globalDebug) echo "Done\n";
2263
-		if ($globalDebug) echo "Owner Czech Republic: Download...";
2579
+		} elseif ($globalDebug) {
2580
+			echo "Done\n";
2581
+		}
2582
+		if ($globalDebug) {
2583
+			echo "Owner Czech Republic: Download...";
2584
+		}
2264 2585
 		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
2265 2586
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
2266
-			if ($globalDebug) echo "Add to DB...";
2587
+			if ($globalDebug) {
2588
+				echo "Add to DB...";
2589
+			}
2267 2590
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
2268
-		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2591
+		} else {
2592
+			$error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2593
+		}
2269 2594
 		if ($error != '') {
2270 2595
 			return $error;
2271
-		} elseif ($globalDebug) echo "Done\n";
2272
-		if ($globalDebug) echo "Owner Australia: Download...";
2596
+		} elseif ($globalDebug) {
2597
+			echo "Done\n";
2598
+		}
2599
+		if ($globalDebug) {
2600
+			echo "Owner Australia: Download...";
2601
+		}
2273 2602
 		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
2274 2603
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
2275
-			if ($globalDebug) echo "Add to DB...";
2604
+			if ($globalDebug) {
2605
+				echo "Add to DB...";
2606
+			}
2276 2607
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
2277
-		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2608
+		} else {
2609
+			$error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2610
+		}
2278 2611
 		if ($error != '') {
2279 2612
 			return $error;
2280
-		} elseif ($globalDebug) echo "Done\n";
2281
-		if ($globalDebug) echo "Owner Austria: Download...";
2613
+		} elseif ($globalDebug) {
2614
+			echo "Done\n";
2615
+		}
2616
+		if ($globalDebug) {
2617
+			echo "Owner Austria: Download...";
2618
+		}
2282 2619
 		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
2283 2620
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
2284
-			if ($globalDebug) echo "Add to DB...";
2621
+			if ($globalDebug) {
2622
+				echo "Add to DB...";
2623
+			}
2285 2624
 			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
2286
-		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2625
+		} else {
2626
+			$error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2627
+		}
2287 2628
 		if ($error != '') {
2288 2629
 			return $error;
2289
-		} elseif ($globalDebug) echo "Done\n";
2290
-		if ($globalDebug) echo "Owner Chile: Download...";
2630
+		} elseif ($globalDebug) {
2631
+			echo "Done\n";
2632
+		}
2633
+		if ($globalDebug) {
2634
+			echo "Owner Chile: Download...";
2635
+		}
2291 2636
 		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
2292 2637
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
2293
-			if ($globalDebug) echo "Add to DB...";
2638
+			if ($globalDebug) {
2639
+				echo "Add to DB...";
2640
+			}
2294 2641
 			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
2295
-		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2642
+		} else {
2643
+			$error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2644
+		}
2296 2645
 		if ($error != '') {
2297 2646
 			return $error;
2298
-		} elseif ($globalDebug) echo "Done\n";
2299
-		if ($globalDebug) echo "Owner Colombia: Download...";
2647
+		} elseif ($globalDebug) {
2648
+			echo "Done\n";
2649
+		}
2650
+		if ($globalDebug) {
2651
+			echo "Owner Colombia: Download...";
2652
+		}
2300 2653
 		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
2301 2654
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
2302
-			if ($globalDebug) echo "Add to DB...";
2655
+			if ($globalDebug) {
2656
+				echo "Add to DB...";
2657
+			}
2303 2658
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
2304
-		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2659
+		} else {
2660
+			$error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2661
+		}
2305 2662
 		if ($error != '') {
2306 2663
 			return $error;
2307
-		} elseif ($globalDebug) echo "Done\n";
2308
-		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
2664
+		} elseif ($globalDebug) {
2665
+			echo "Done\n";
2666
+		}
2667
+		if ($globalDebug) {
2668
+			echo "Owner Bosnia Herzegobina: Download...";
2669
+		}
2309 2670
 		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
2310 2671
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
2311
-			if ($globalDebug) echo "Add to DB...";
2672
+			if ($globalDebug) {
2673
+				echo "Add to DB...";
2674
+			}
2312 2675
 			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
2313
-		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2676
+		} else {
2677
+			$error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2678
+		}
2314 2679
 		if ($error != '') {
2315 2680
 			return $error;
2316
-		} elseif ($globalDebug) echo "Done\n";
2317
-		if ($globalDebug) echo "Owner Brazil: Download...";
2681
+		} elseif ($globalDebug) {
2682
+			echo "Done\n";
2683
+		}
2684
+		if ($globalDebug) {
2685
+			echo "Owner Brazil: Download...";
2686
+		}
2318 2687
 		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
2319 2688
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
2320
-			if ($globalDebug) echo "Add to DB...";
2689
+			if ($globalDebug) {
2690
+				echo "Add to DB...";
2691
+			}
2321 2692
 			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
2322
-		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2693
+		} else {
2694
+			$error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2695
+		}
2323 2696
 		if ($error != '') {
2324 2697
 			return $error;
2325
-		} elseif ($globalDebug) echo "Done\n";
2326
-		if ($globalDebug) echo "Owner Cayman Islands: Download...";
2698
+		} elseif ($globalDebug) {
2699
+			echo "Done\n";
2700
+		}
2701
+		if ($globalDebug) {
2702
+			echo "Owner Cayman Islands: Download...";
2703
+		}
2327 2704
 		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
2328 2705
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
2329
-			if ($globalDebug) echo "Add to DB...";
2706
+			if ($globalDebug) {
2707
+				echo "Add to DB...";
2708
+			}
2330 2709
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
2331
-		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2710
+		} else {
2711
+			$error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2712
+		}
2332 2713
 		if ($error != '') {
2333 2714
 			return $error;
2334
-		} elseif ($globalDebug) echo "Done\n";
2335
-		if ($globalDebug) echo "Owner Croatia: Download...";
2715
+		} elseif ($globalDebug) {
2716
+			echo "Done\n";
2717
+		}
2718
+		if ($globalDebug) {
2719
+			echo "Owner Croatia: Download...";
2720
+		}
2336 2721
 		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
2337 2722
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
2338
-			if ($globalDebug) echo "Add to DB...";
2723
+			if ($globalDebug) {
2724
+				echo "Add to DB...";
2725
+			}
2339 2726
 			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
2340
-		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2727
+		} else {
2728
+			$error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2729
+		}
2341 2730
 		if ($error != '') {
2342 2731
 			return $error;
2343
-		} elseif ($globalDebug) echo "Done\n";
2344
-		if ($globalDebug) echo "Owner Luxembourg: Download...";
2732
+		} elseif ($globalDebug) {
2733
+			echo "Done\n";
2734
+		}
2735
+		if ($globalDebug) {
2736
+			echo "Owner Luxembourg: Download...";
2737
+		}
2345 2738
 		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
2346 2739
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
2347
-			if ($globalDebug) echo "Add to DB...";
2740
+			if ($globalDebug) {
2741
+				echo "Add to DB...";
2742
+			}
2348 2743
 			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
2349
-		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2744
+		} else {
2745
+			$error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2746
+		}
2350 2747
 		if ($error != '') {
2351 2748
 			return $error;
2352
-		} elseif ($globalDebug) echo "Done\n";
2353
-		if ($globalDebug) echo "Owner Maldives: Download...";
2749
+		} elseif ($globalDebug) {
2750
+			echo "Done\n";
2751
+		}
2752
+		if ($globalDebug) {
2753
+			echo "Owner Maldives: Download...";
2754
+		}
2354 2755
 		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
2355 2756
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
2356
-			if ($globalDebug) echo "Add to DB...";
2757
+			if ($globalDebug) {
2758
+				echo "Add to DB...";
2759
+			}
2357 2760
 			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
2358
-		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2761
+		} else {
2762
+			$error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2763
+		}
2359 2764
 		if ($error != '') {
2360 2765
 			return $error;
2361
-		} elseif ($globalDebug) echo "Done\n";
2362
-		if ($globalDebug) echo "Owner New Zealand: Download...";
2766
+		} elseif ($globalDebug) {
2767
+			echo "Done\n";
2768
+		}
2769
+		if ($globalDebug) {
2770
+			echo "Owner New Zealand: Download...";
2771
+		}
2363 2772
 		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
2364 2773
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
2365
-			if ($globalDebug) echo "Add to DB...";
2774
+			if ($globalDebug) {
2775
+				echo "Add to DB...";
2776
+			}
2366 2777
 			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
2367
-		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2778
+		} else {
2779
+			$error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2780
+		}
2368 2781
 		if ($error != '') {
2369 2782
 			return $error;
2370
-		} elseif ($globalDebug) echo "Done\n";
2371
-		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
2783
+		} elseif ($globalDebug) {
2784
+			echo "Done\n";
2785
+		}
2786
+		if ($globalDebug) {
2787
+			echo "Owner Papua New Guinea: Download...";
2788
+		}
2372 2789
 		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
2373 2790
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
2374
-			if ($globalDebug) echo "Add to DB...";
2791
+			if ($globalDebug) {
2792
+				echo "Add to DB...";
2793
+			}
2375 2794
 			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
2376
-		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2795
+		} else {
2796
+			$error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2797
+		}
2377 2798
 		if ($error != '') {
2378 2799
 			return $error;
2379
-		} elseif ($globalDebug) echo "Done\n";
2380
-		if ($globalDebug) echo "Owner Slovakia: Download...";
2800
+		} elseif ($globalDebug) {
2801
+			echo "Done\n";
2802
+		}
2803
+		if ($globalDebug) {
2804
+			echo "Owner Slovakia: Download...";
2805
+		}
2381 2806
 		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
2382 2807
 		if (file_exists($tmp_dir.'owner_om.csv')) {
2383
-			if ($globalDebug) echo "Add to DB...";
2808
+			if ($globalDebug) {
2809
+				echo "Add to DB...";
2810
+			}
2384 2811
 			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
2385
-		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2812
+		} else {
2813
+			$error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2814
+		}
2386 2815
 		if ($error != '') {
2387 2816
 			return $error;
2388
-		} elseif ($globalDebug) echo "Done\n";
2389
-		if ($globalDebug) echo "Owner Ecuador: Download...";
2817
+		} elseif ($globalDebug) {
2818
+			echo "Done\n";
2819
+		}
2820
+		if ($globalDebug) {
2821
+			echo "Owner Ecuador: Download...";
2822
+		}
2390 2823
 		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
2391 2824
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
2392
-			if ($globalDebug) echo "Add to DB...";
2825
+			if ($globalDebug) {
2826
+				echo "Add to DB...";
2827
+			}
2393 2828
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
2394
-		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2829
+		} else {
2830
+			$error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2831
+		}
2395 2832
 		if ($error != '') {
2396 2833
 			return $error;
2397
-		} elseif ($globalDebug) echo "Done\n";
2398
-		if ($globalDebug) echo "Owner Iceland: Download...";
2834
+		} elseif ($globalDebug) {
2835
+			echo "Done\n";
2836
+		}
2837
+		if ($globalDebug) {
2838
+			echo "Owner Iceland: Download...";
2839
+		}
2399 2840
 		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
2400 2841
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
2401
-			if ($globalDebug) echo "Add to DB...";
2842
+			if ($globalDebug) {
2843
+				echo "Add to DB...";
2844
+			}
2402 2845
 			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
2403
-		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2846
+		} else {
2847
+			$error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2848
+		}
2404 2849
 		if ($error != '') {
2405 2850
 			return $error;
2406
-		} elseif ($globalDebug) echo "Done\n";
2407
-		if ($globalDebug) echo "Owner Isle of Man: Download...";
2851
+		} elseif ($globalDebug) {
2852
+			echo "Done\n";
2853
+		}
2854
+		if ($globalDebug) {
2855
+			echo "Owner Isle of Man: Download...";
2856
+		}
2408 2857
 		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv');
2409 2858
 		if (file_exists($tmp_dir.'owner_m.csv')) {
2410
-			if ($globalDebug) echo "Add to DB...";
2859
+			if ($globalDebug) {
2860
+				echo "Add to DB...";
2861
+			}
2411 2862
 			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M');
2412
-		} else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2863
+		} else {
2864
+			$error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2865
+		}
2413 2866
 		if ($error != '') {
2414 2867
 			return $error;
2415
-		} elseif ($globalDebug) echo "Done\n";
2868
+		} elseif ($globalDebug) {
2869
+			echo "Done\n";
2870
+		}
2416 2871
 		if ($globalMasterSource) {
2417
-			if ($globalDebug) echo "ModeS Netherlands: Download...";
2872
+			if ($globalDebug) {
2873
+				echo "ModeS Netherlands: Download...";
2874
+			}
2418 2875
 			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv');
2419 2876
 			if (file_exists($tmp_dir.'owner_ph.csv')) {
2420
-				if ($globalDebug) echo "Add to DB...";
2877
+				if ($globalDebug) {
2878
+					echo "Add to DB...";
2879
+				}
2421 2880
 				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH');
2422
-			} else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2881
+			} else {
2882
+				$error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2883
+			}
2423 2884
 			if ($error != '') {
2424 2885
 				return $error;
2425
-			} elseif ($globalDebug) echo "Done\n";
2426
-			if ($globalDebug) echo "ModeS Denmark: Download...";
2886
+			} elseif ($globalDebug) {
2887
+				echo "Done\n";
2888
+			}
2889
+			if ($globalDebug) {
2890
+				echo "ModeS Denmark: Download...";
2891
+			}
2427 2892
 			update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv');
2428 2893
 			if (file_exists($tmp_dir.'owner_oy.csv')) {
2429
-				if ($globalDebug) echo "Add to DB...";
2894
+				if ($globalDebug) {
2895
+					echo "Add to DB...";
2896
+				}
2430 2897
 				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY');
2431
-			} else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2898
+			} else {
2899
+				$error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2900
+			}
2432 2901
 			if ($error != '') {
2433 2902
 				return $error;
2434
-			} elseif ($globalDebug) echo "Done\n";
2435
-		} elseif ($globalDebug) echo "Done\n";
2903
+			} elseif ($globalDebug) {
2904
+				echo "Done\n";
2905
+			}
2906
+		} elseif ($globalDebug) {
2907
+			echo "Done\n";
2908
+		}
2436 2909
 		return '';
2437 2910
 	}
2438 2911
 
2439 2912
 	public static function update_translation() {
2440 2913
 		global $tmp_dir, $globalDebug;
2441 2914
 		$error = '';
2442
-		if ($globalDebug) echo "Translation : Download...";
2915
+		if ($globalDebug) {
2916
+			echo "Translation : Download...";
2917
+		}
2443 2918
 		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
2444 2919
 		if (file_exists($tmp_dir.'translation.zip')) {
2445
-			if ($globalDebug) echo "Unzip...";
2920
+			if ($globalDebug) {
2921
+				echo "Unzip...";
2922
+			}
2446 2923
 			update_db::unzip($tmp_dir.'translation.zip');
2447
-			if ($globalDebug) echo "Add to DB...";
2924
+			if ($globalDebug) {
2925
+				echo "Add to DB...";
2926
+			}
2448 2927
 			$error = update_db::translation();
2449
-		} else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
2928
+		} else {
2929
+			$error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
2930
+		}
2450 2931
 		if ($error != '') {
2451 2932
 			return $error;
2452
-		} elseif ($globalDebug) echo "Done\n";
2933
+		} elseif ($globalDebug) {
2934
+			echo "Done\n";
2935
+		}
2453 2936
 		return '';
2454 2937
 	}
2455 2938
 
2456 2939
 	public static function update_translation_fam() {
2457 2940
 		global $tmp_dir, $globalDebug;
2458 2941
 		$error = '';
2459
-		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
2942
+		if ($globalDebug) {
2943
+			echo "Translation from FlightAirMap website : Download...";
2944
+		}
2460 2945
 		update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
2461 2946
 		update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5');
2462 2947
 		if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) {
2463 2948
 			$translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5'));
2464 2949
 			$translation_md5 = $translation_md5_file[0];
2465 2950
 			if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) {
2466
-				if ($globalDebug) echo "Gunzip...";
2951
+				if ($globalDebug) {
2952
+					echo "Gunzip...";
2953
+				}
2467 2954
 				update_db::gunzip($tmp_dir.'translation.tsv.gz');
2468
-				if ($globalDebug) echo "Add to DB...";
2955
+				if ($globalDebug) {
2956
+					echo "Add to DB...";
2957
+				}
2469 2958
 				$error = update_db::translation_fam();
2470
-			} else $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed.";
2471
-		} else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
2959
+			} else {
2960
+				$error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed.";
2961
+			}
2962
+		} else {
2963
+			$error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
2964
+		}
2472 2965
 		if ($error != '') {
2473 2966
 			return $error;
2474
-		} elseif ($globalDebug) echo "Done\n";
2967
+		} elseif ($globalDebug) {
2968
+			echo "Done\n";
2969
+		}
2475 2970
 		return '';
2476 2971
 	}
2477 2972
 	public static function update_ModeS_fam() {
2478 2973
 		global $tmp_dir, $globalDebug;
2479 2974
 		$error = '';
2480
-		if ($globalDebug) echo "ModeS from FlightAirMap website : Download...";
2975
+		if ($globalDebug) {
2976
+			echo "ModeS from FlightAirMap website : Download...";
2977
+		}
2481 2978
 		update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz');
2482 2979
 		update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5');
2483 2980
 		if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) {
2484 2981
 			$modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5'));
2485 2982
 			$modes_md5 = $modes_md5_file[0];
2486 2983
 			if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) {
2487
-				if ($globalDebug) echo "Gunzip...";
2984
+				if ($globalDebug) {
2985
+					echo "Gunzip...";
2986
+				}
2488 2987
 				update_db::gunzip($tmp_dir.'modes.tsv.gz');
2489
-				if ($globalDebug) echo "Add to DB...";
2988
+				if ($globalDebug) {
2989
+					echo "Add to DB...";
2990
+				}
2490 2991
 				$error = update_db::modes_fam();
2491
-			} else $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed.";
2492
-		} else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed.";
2992
+			} else {
2993
+				$error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed.";
2994
+			}
2995
+		} else {
2996
+			$error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed.";
2997
+		}
2493 2998
 		if ($error != '') {
2494 2999
 			return $error;
2495
-		} elseif ($globalDebug) echo "Done\n";
3000
+		} elseif ($globalDebug) {
3001
+			echo "Done\n";
3002
+		}
2496 3003
 		return '';
2497 3004
 	}
2498 3005
 
2499 3006
 	public static function update_airlines_fam() {
2500 3007
 		global $tmp_dir, $globalDebug;
2501 3008
 		$error = '';
2502
-		if ($globalDebug) echo "Airlines from FlightAirMap website : Download...";
3009
+		if ($globalDebug) {
3010
+			echo "Airlines from FlightAirMap website : Download...";
3011
+		}
2503 3012
 		update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5');
2504 3013
 		if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) {
2505 3014
 			$airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5'));
@@ -2508,26 +3017,42 @@  discard block
 block discarded – undo
2508 3017
 				update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz');
2509 3018
 				if (file_exists($tmp_dir.'airlines.tsv.gz')) {
2510 3019
 					if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) {
2511
-						if ($globalDebug) echo "Gunzip...";
3020
+						if ($globalDebug) {
3021
+							echo "Gunzip...";
3022
+						}
2512 3023
 						update_db::gunzip($tmp_dir.'airlines.tsv.gz');
2513
-						if ($globalDebug) echo "Add to DB...";
3024
+						if ($globalDebug) {
3025
+							echo "Add to DB...";
3026
+						}
2514 3027
 						$error = update_db::airlines_fam();
2515 3028
 						update_db::insert_airlines_version($airlines_md5);
2516
-					} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed.";
2517
-			    } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2518
-			} elseif ($globalDebug) echo "No update.";
2519
-		} else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed.";
3029
+					} else {
3030
+						$error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed.";
3031
+					}
3032
+			    } else {
3033
+			    	$error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
3034
+			    }
3035
+			} elseif ($globalDebug) {
3036
+				echo "No update.";
3037
+			}
3038
+		} else {
3039
+			$error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed.";
3040
+		}
2520 3041
 		if ($error != '') {
2521 3042
 			return $error;
2522 3043
 		} else {
2523
-			if ($globalDebug) echo "Done\n";
3044
+			if ($globalDebug) {
3045
+				echo "Done\n";
3046
+			}
2524 3047
 		}
2525 3048
 		return '';
2526 3049
 	}
2527 3050
 
2528 3051
 	public static function update_owner_fam() {
2529 3052
 		global $tmp_dir, $globalDebug, $globalOwner;
2530
-		if ($globalDebug) echo "owner from FlightAirMap website : Download...";
3053
+		if ($globalDebug) {
3054
+			echo "owner from FlightAirMap website : Download...";
3055
+		}
2531 3056
 		$error = '';
2532 3057
 		if ($globalOwner === TRUE) {
2533 3058
 			update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz');
@@ -2540,55 +3065,89 @@  discard block
 block discarded – undo
2540 3065
 			$owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5'));
2541 3066
 			$owners_md5 = $owners_md5_file[0];
2542 3067
 			if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) {
2543
-				if ($globalDebug) echo "Gunzip...";
3068
+				if ($globalDebug) {
3069
+					echo "Gunzip...";
3070
+				}
2544 3071
 				update_db::gunzip($tmp_dir.'owners.tsv.gz');
2545
-				if ($globalDebug) echo "Add to DB...";
3072
+				if ($globalDebug) {
3073
+					echo "Add to DB...";
3074
+				}
2546 3075
 				$error = update_db::owner_fam();
2547
-			} else $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed.";
2548
-		} else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed.";
3076
+			} else {
3077
+				$error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed.";
3078
+			}
3079
+		} else {
3080
+			$error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed.";
3081
+		}
2549 3082
 		if ($error != '') {
2550 3083
 			return $error;
2551
-		} elseif ($globalDebug) echo "Done\n";
3084
+		} elseif ($globalDebug) {
3085
+			echo "Done\n";
3086
+		}
2552 3087
 		return '';
2553 3088
 	}
2554 3089
 	public static function update_routes_fam() {
2555 3090
 		global $tmp_dir, $globalDebug;
2556
-		if ($globalDebug) echo "Routes from FlightAirMap website : Download...";
3091
+		if ($globalDebug) {
3092
+			echo "Routes from FlightAirMap website : Download...";
3093
+		}
2557 3094
 		update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz');
2558 3095
 		update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5');
2559 3096
 		if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) {
2560 3097
 			$routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5'));
2561 3098
 			$routes_md5 = $routes_md5_file[0];
2562 3099
 			if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) {
2563
-				if ($globalDebug) echo "Gunzip...";
3100
+				if ($globalDebug) {
3101
+					echo "Gunzip...";
3102
+				}
2564 3103
 				update_db::gunzip($tmp_dir.'routes.tsv.gz');
2565
-				if ($globalDebug) echo "Add to DB...";
3104
+				if ($globalDebug) {
3105
+					echo "Add to DB...";
3106
+				}
2566 3107
 				$error = update_db::routes_fam();
2567
-			} else $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed.";
2568
-		} else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed.";
3108
+			} else {
3109
+				$error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed.";
3110
+			}
3111
+		} else {
3112
+			$error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed.";
3113
+		}
2569 3114
 		if ($error != '') {
2570 3115
 			return $error;
2571
-		} elseif ($globalDebug) echo "Done\n";
3116
+		} elseif ($globalDebug) {
3117
+			echo "Done\n";
3118
+		}
2572 3119
 		return '';
2573 3120
 	}
2574 3121
 	public static function update_block_fam() {
2575 3122
 		global $tmp_dir, $globalDebug;
2576
-		if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download...";
3123
+		if ($globalDebug) {
3124
+			echo "Blocked aircraft from FlightAirMap website : Download...";
3125
+		}
2577 3126
 		update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz');
2578 3127
 		update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5');
2579 3128
 		if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) {
2580 3129
 			$block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5'));
2581 3130
 			$block_md5 = $block_md5_file[0];
2582 3131
 			if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) {
2583
-				if ($globalDebug) echo "Gunzip...";
3132
+				if ($globalDebug) {
3133
+					echo "Gunzip...";
3134
+				}
2584 3135
 				update_db::gunzip($tmp_dir.'block.tsv.gz');
2585
-				if ($globalDebug) echo "Add to DB...";
3136
+				if ($globalDebug) {
3137
+					echo "Add to DB...";
3138
+				}
2586 3139
 				$error = update_db::block_fam();
2587
-			} else $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed.";
2588
-		} else $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed.";
3140
+			} else {
3141
+				$error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed.";
3142
+			}
3143
+		} else {
3144
+			$error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed.";
3145
+		}
2589 3146
 		if ($error != '') {
2590 3147
 			return $error;
2591
-		} elseif ($globalDebug) echo "Done\n";
3148
+		} elseif ($globalDebug) {
3149
+			echo "Done\n";
3150
+		}
2592 3151
 		return '';
2593 3152
 	}
2594 3153
 	public static function update_marine_identity_fam() {
@@ -2598,21 +3157,33 @@  discard block
 block discarded – undo
2598 3157
 			$marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5'));
2599 3158
 			$marine_identity_md5 = $marine_identity_md5_file[0];
2600 3159
 			if (!update_db::check_marine_identity_version($marine_identity_md5)) {
2601
-				if ($globalDebug) echo "Marine identity from FlightAirMap website : Download...";
3160
+				if ($globalDebug) {
3161
+					echo "Marine identity from FlightAirMap website : Download...";
3162
+				}
2602 3163
 				update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz');
2603 3164
 				if (file_exists($tmp_dir.'marine_identity.tsv.gz')) {
2604 3165
 					if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) {
2605
-						if ($globalDebug) echo "Gunzip...";
3166
+						if ($globalDebug) {
3167
+							echo "Gunzip...";
3168
+						}
2606 3169
 						update_db::gunzip($tmp_dir.'marine_identity.tsv.gz');
2607
-						if ($globalDebug) echo "Add to DB...";
3170
+						if ($globalDebug) {
3171
+							echo "Add to DB...";
3172
+						}
2608 3173
 						$error = update_db::marine_identity_fam();
2609
-					} else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed.";
2610
-				} else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed.";
3174
+					} else {
3175
+						$error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed.";
3176
+					}
3177
+				} else {
3178
+					$error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed.";
3179
+				}
2611 3180
 				if ($error != '') {
2612 3181
 					return $error;
2613 3182
 				} else {
2614 3183
 					update_db::insert_marine_identity_version($marine_identity_md5);
2615
-					if ($globalDebug) echo "Done\n";
3184
+					if ($globalDebug) {
3185
+						echo "Done\n";
3186
+					}
2616 3187
 				}
2617 3188
 			}
2618 3189
 		}
@@ -2626,21 +3197,33 @@  discard block
 block discarded – undo
2626 3197
 			$satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5'));
2627 3198
 			$satellite_md5 = $satellite_md5_file[0];
2628 3199
 			if (!update_db::check_satellite_version($satellite_md5)) {
2629
-				if ($globalDebug) echo "Satellite from FlightAirMap website : Download...";
3200
+				if ($globalDebug) {
3201
+					echo "Satellite from FlightAirMap website : Download...";
3202
+				}
2630 3203
 				update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz');
2631 3204
 				if (file_exists($tmp_dir.'satellite.tsv.gz')) {
2632 3205
 					if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) {
2633
-						if ($globalDebug) echo "Gunzip...";
3206
+						if ($globalDebug) {
3207
+							echo "Gunzip...";
3208
+						}
2634 3209
 						update_db::gunzip($tmp_dir.'satellite.tsv.gz');
2635
-						if ($globalDebug) echo "Add to DB...";
3210
+						if ($globalDebug) {
3211
+							echo "Add to DB...";
3212
+						}
2636 3213
 						$error = update_db::satellite_fam();
2637
-					} else $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed.";
2638
-				} else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed.";
3214
+					} else {
3215
+						$error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed.";
3216
+					}
3217
+				} else {
3218
+					$error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed.";
3219
+				}
2639 3220
 				if ($error != '') {
2640 3221
 					return $error;
2641 3222
 				} else {
2642 3223
 					update_db::insert_satellite_version($satellite_md5);
2643
-					if ($globalDebug) echo "Done\n";
3224
+					if ($globalDebug) {
3225
+						echo "Done\n";
3226
+					}
2644 3227
 				}
2645 3228
 			}
2646 3229
 		}
@@ -2648,17 +3231,25 @@  discard block
 block discarded – undo
2648 3231
 	}
2649 3232
 	public static function update_banned_fam() {
2650 3233
 		global $tmp_dir, $globalDebug;
2651
-		if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download...";
3234
+		if ($globalDebug) {
3235
+			echo "Banned airlines in Europe from FlightAirMap website : Download...";
3236
+		}
2652 3237
 		update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv');
2653 3238
 		if (file_exists($tmp_dir.'ban_eu.csv')) {
2654 3239
 			//if ($globalDebug) echo "Gunzip...";
2655 3240
 			//update_db::gunzip($tmp_dir.'ban_ue.csv');
2656
-			if ($globalDebug) echo "Add to DB...";
3241
+			if ($globalDebug) {
3242
+				echo "Add to DB...";
3243
+			}
2657 3244
 			$error = update_db::banned_fam();
2658
-		} else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed.";
3245
+		} else {
3246
+			$error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed.";
3247
+		}
2659 3248
 		if ($error != '') {
2660 3249
 			return $error;
2661
-		} elseif ($globalDebug) echo "Done\n";
3250
+		} elseif ($globalDebug) {
3251
+			echo "Done\n";
3252
+		}
2662 3253
 		return '';
2663 3254
 	}
2664 3255
 
@@ -2666,7 +3257,9 @@  discard block
 block discarded – undo
2666 3257
 		global $tmp_dir, $globalDebug, $globalDBdriver;
2667 3258
 		include_once('class.create_db.php');
2668 3259
 		$error = '';
2669
-		if ($globalDebug) echo "Airspace from FlightAirMap website : Download...";
3260
+		if ($globalDebug) {
3261
+			echo "Airspace from FlightAirMap website : Download...";
3262
+		}
2670 3263
 		if ($globalDBdriver == 'mysql') {
2671 3264
 			update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2672 3265
 		} else {
@@ -2683,9 +3276,13 @@  discard block
 block discarded – undo
2683 3276
 				}
2684 3277
 				if (file_exists($tmp_dir.'airspace.sql.gz')) {
2685 3278
 					if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) {
2686
-						if ($globalDebug) echo "Gunzip...";
3279
+						if ($globalDebug) {
3280
+							echo "Gunzip...";
3281
+						}
2687 3282
 						update_db::gunzip($tmp_dir.'airspace.sql.gz');
2688
-						if ($globalDebug) echo "Add to DB...";
3283
+						if ($globalDebug) {
3284
+							echo "Add to DB...";
3285
+						}
2689 3286
 						$Connection = new Connection();
2690 3287
 						if ($Connection->tableExists('airspace')) {
2691 3288
 							$query = 'DROP TABLE airspace';
@@ -2698,20 +3295,30 @@  discard block
 block discarded – undo
2698 3295
 						}
2699 3296
 						$error = create_db::import_file($tmp_dir.'airspace.sql');
2700 3297
 						update_db::insert_airspace_version($airspace_md5);
2701
-					} else $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed.";
2702
-				} else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed.";
3298
+					} else {
3299
+						$error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed.";
3300
+					}
3301
+				} else {
3302
+					$error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed.";
3303
+				}
2703 3304
 			}
2704
-		} else $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed.";
3305
+		} else {
3306
+			$error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed.";
3307
+		}
2705 3308
 		if ($error != '') {
2706 3309
 			return $error;
2707
-		} elseif ($globalDebug) echo "Done\n";
3310
+		} elseif ($globalDebug) {
3311
+			echo "Done\n";
3312
+		}
2708 3313
 		return '';
2709 3314
 	}
2710 3315
 
2711 3316
 	public static function update_geoid_fam() {
2712 3317
 		global $tmp_dir, $globalDebug, $globalGeoidSource;
2713 3318
 		$error = '';
2714
-		if ($globalDebug) echo "Geoid from FlightAirMap website : Download...";
3319
+		if ($globalDebug) {
3320
+			echo "Geoid from FlightAirMap website : Download...";
3321
+		}
2715 3322
 		update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5');
2716 3323
 		if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) {
2717 3324
 			$geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5'));
@@ -2720,80 +3327,126 @@  discard block
 block discarded – undo
2720 3327
 				update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz');
2721 3328
 				if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) {
2722 3329
 					if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) {
2723
-						if ($globalDebug) echo "Gunzip...";
3330
+						if ($globalDebug) {
3331
+							echo "Gunzip...";
3332
+						}
2724 3333
 						update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm');
2725 3334
 						if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) {
2726 3335
 							update_db::insert_geoid_version($geoid_md5);
2727
-						} else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed.";
2728
-					} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed.";
2729
-				} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed.";
2730
-			} elseif ($globalDebug) echo 'No new version'."\n";
2731
-		} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed.";
3336
+						} else {
3337
+							$error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed.";
3338
+						}
3339
+					} else {
3340
+						$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed.";
3341
+					}
3342
+				} else {
3343
+					$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed.";
3344
+				}
3345
+			} elseif ($globalDebug) {
3346
+				echo 'No new version'."\n";
3347
+			}
3348
+		} else {
3349
+			$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed.";
3350
+		}
2732 3351
 		if ($error != '') {
2733 3352
 			return $error;
2734
-		} elseif ($globalDebug) echo "Done\n";
3353
+		} elseif ($globalDebug) {
3354
+			echo "Done\n";
3355
+		}
2735 3356
 		return '';
2736 3357
 	}
2737 3358
 
2738 3359
 	public static function update_tle() {
2739 3360
 		global $tmp_dir, $globalDebug;
2740
-		if ($globalDebug) echo "Download TLE : Download...";
3361
+		if ($globalDebug) {
3362
+			echo "Download TLE : Download...";
3363
+		}
2741 3364
 		$alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt',
2742 3365
 		'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt',
2743 3366
 		'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt');
2744 3367
 		foreach ($alltle as $filename) {
2745
-			if ($globalDebug) echo "downloading ".$filename.'...';
3368
+			if ($globalDebug) {
3369
+				echo "downloading ".$filename.'...';
3370
+			}
2746 3371
 			update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename);
2747 3372
 			if (file_exists($tmp_dir.$filename)) {
2748
-				if ($globalDebug) echo "Add to DB ".$filename."...";
3373
+				if ($globalDebug) {
3374
+					echo "Add to DB ".$filename."...";
3375
+				}
2749 3376
 				$error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename));
2750
-			} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
3377
+			} else {
3378
+				$error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
3379
+			}
2751 3380
 			if ($error != '') {
2752 3381
 				echo $error."\n";
2753
-			} elseif ($globalDebug) echo "Done\n";
3382
+			} elseif ($globalDebug) {
3383
+				echo "Done\n";
3384
+			}
2754 3385
 		}
2755 3386
 		return '';
2756 3387
 	}
2757 3388
 
2758 3389
 	public static function update_ucsdb() {
2759 3390
 		global $tmp_dir, $globalDebug;
2760
-		if ($globalDebug) echo "Download UCS DB : Download...";
3391
+		if ($globalDebug) {
3392
+			echo "Download UCS DB : Download...";
3393
+		}
2761 3394
 		update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt',$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt');
2762 3395
 		if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) {
2763
-			if ($globalDebug) echo "Add to DB...";
3396
+			if ($globalDebug) {
3397
+				echo "Add to DB...";
3398
+			}
2764 3399
 			$error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt');
2765
-		} else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed.";
3400
+		} else {
3401
+			$error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed.";
3402
+		}
2766 3403
 		if ($error != '') {
2767 3404
 			echo $error."\n";
2768
-		} elseif ($globalDebug) echo "Done\n";
3405
+		} elseif ($globalDebug) {
3406
+			echo "Done\n";
3407
+		}
2769 3408
 		return '';
2770 3409
 	}
2771 3410
 
2772 3411
 	public static function update_celestrak() {
2773 3412
 		global $tmp_dir, $globalDebug;
2774
-		if ($globalDebug) echo "Download Celestrak DB : Download...";
3413
+		if ($globalDebug) {
3414
+			echo "Download Celestrak DB : Download...";
3415
+		}
2775 3416
 		update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt');
2776 3417
 		if (file_exists($tmp_dir.'satcat.txt')) {
2777
-			if ($globalDebug) echo "Add to DB...";
3418
+			if ($globalDebug) {
3419
+				echo "Add to DB...";
3420
+			}
2778 3421
 			$error = update_db::satellite_celestrak($tmp_dir.'satcat.txt');
2779
-		} else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed.";
3422
+		} else {
3423
+			$error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed.";
3424
+		}
2780 3425
 		if ($error != '') {
2781 3426
 			echo $error."\n";
2782
-		} elseif ($globalDebug) echo "Done\n";
3427
+		} elseif ($globalDebug) {
3428
+			echo "Done\n";
3429
+		}
2783 3430
 		return '';
2784 3431
 	}
2785 3432
 
2786 3433
 	public static function update_models() {
2787 3434
 		global $tmp_dir, $globalDebug;
2788 3435
 		$error = '';
2789
-		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
3436
+		if ($globalDebug) {
3437
+			echo "Models from FlightAirMap website : Download...";
3438
+		}
2790 3439
 		if (!is_writable(dirname(__FILE__).'/../models')) {
2791
-			if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !';
3440
+			if ($globalDebug) {
3441
+				echo dirname(__FILE__).'/../models'.' is not writable !';
3442
+			}
2792 3443
 			return '';
2793 3444
 		}
2794 3445
 		update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum');
2795 3446
 		if (file_exists($tmp_dir.'models.md5sum')) {
2796
-			if ($globalDebug) echo "Check files...\n";
3447
+			if ($globalDebug) {
3448
+				echo "Check files...\n";
3449
+			}
2797 3450
 			$newmodelsdb = array();
2798 3451
 			if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) {
2799 3452
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2812,18 +3465,28 @@  discard block
 block discarded – undo
2812 3465
 			}
2813 3466
 			$diff = array_diff($newmodelsdb,$modelsdb);
2814 3467
 			foreach ($diff as $key => $value) {
2815
-				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
3468
+				if ($globalDebug) {
3469
+					echo 'Downloading model '.$key.' ...'."\n";
3470
+				}
2816 3471
 				update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key);
2817 3472
 			}
2818 3473
 			update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum');
2819
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3474
+		} else {
3475
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3476
+		}
2820 3477
 		if ($error != '') {
2821 3478
 			return $error;
2822
-		} elseif ($globalDebug) echo "Done\n";
2823
-		if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download...";
3479
+		} elseif ($globalDebug) {
3480
+			echo "Done\n";
3481
+		}
3482
+		if ($globalDebug) {
3483
+			echo "glTF 2.0 Models from FlightAirMap website : Download...";
3484
+		}
2824 3485
 		update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum');
2825 3486
 		if (file_exists($tmp_dir.'modelsgltf2.md5sum')) {
2826
-			if ($globalDebug) echo "Check files...\n";
3487
+			if ($globalDebug) {
3488
+				echo "Check files...\n";
3489
+			}
2827 3490
 			$newmodelsdb = array();
2828 3491
 			if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) {
2829 3492
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2842,29 +3505,43 @@  discard block
 block discarded – undo
2842 3505
 			}
2843 3506
 			$diff = array_diff($newmodelsdb,$modelsdb);
2844 3507
 			foreach ($diff as $key => $value) {
2845
-				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
3508
+				if ($globalDebug) {
3509
+					echo 'Downloading model '.$key.' ...'."\n";
3510
+				}
2846 3511
 				update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key);
2847 3512
 				
2848 3513
 			}
2849 3514
 			update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum');
2850
-		} else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed.";
3515
+		} else {
3516
+			$error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed.";
3517
+		}
2851 3518
 		if ($error != '') {
2852 3519
 			return $error;
2853
-		} elseif ($globalDebug) echo "Done\n";
3520
+		} elseif ($globalDebug) {
3521
+			echo "Done\n";
3522
+		}
2854 3523
 		return '';
2855 3524
 	}
2856 3525
 	public static function update_weather_models() {
2857 3526
 		global $tmp_dir, $globalDebug;
2858 3527
 		$error = '';
2859
-		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
3528
+		if ($globalDebug) {
3529
+			echo "Models from FlightAirMap website : Download...";
3530
+		}
2860 3531
 		if (!is_writable(dirname(__FILE__).'/../models/gltf2/weather')) {
2861
-			if ($globalDebug) echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !';
3532
+			if ($globalDebug) {
3533
+				echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !';
3534
+			}
2862 3535
 			return '';
2863 3536
 		}
2864
-		if ($globalDebug) echo "Weather Models from FlightAirMap website : Download...";
3537
+		if ($globalDebug) {
3538
+			echo "Weather Models from FlightAirMap website : Download...";
3539
+		}
2865 3540
 		update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum');
2866 3541
 		if (file_exists($tmp_dir.'modelsweather.md5sum')) {
2867
-			if ($globalDebug) echo "Check files...\n";
3542
+			if ($globalDebug) {
3543
+				echo "Check files...\n";
3544
+			}
2868 3545
 			$newmodelsdb = array();
2869 3546
 			if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) {
2870 3547
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2883,25 +3560,35 @@  discard block
 block discarded – undo
2883 3560
 			}
2884 3561
 			$diff = array_diff($newmodelsdb,$modelsdb);
2885 3562
 			foreach ($diff as $key => $value) {
2886
-				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
3563
+				if ($globalDebug) {
3564
+					echo 'Downloading model '.$key.' ...'."\n";
3565
+				}
2887 3566
 				update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key);
2888 3567
 				
2889 3568
 			}
2890 3569
 			update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum');
2891
-		} else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed.";
3570
+		} else {
3571
+			$error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed.";
3572
+		}
2892 3573
 		if ($error != '') {
2893 3574
 			return $error;
2894
-		} elseif ($globalDebug) echo "Done\n";
3575
+		} elseif ($globalDebug) {
3576
+			echo "Done\n";
3577
+		}
2895 3578
 		return '';
2896 3579
 	}
2897 3580
 
2898 3581
 	public static function update_liveries() {
2899 3582
 		global $tmp_dir, $globalDebug;
2900 3583
 		$error = '';
2901
-		if ($globalDebug) echo "Liveries from FlightAirMap website : Download...";
3584
+		if ($globalDebug) {
3585
+			echo "Liveries from FlightAirMap website : Download...";
3586
+		}
2902 3587
 		update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum');
2903 3588
 		if (file_exists($tmp_dir.'liveries.md5sum')) {
2904
-			if ($globalDebug) echo "Check files...\n";
3589
+			if ($globalDebug) {
3590
+				echo "Check files...\n";
3591
+			}
2905 3592
 			$newmodelsdb = array();
2906 3593
 			if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) {
2907 3594
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2920,15 +3607,21 @@  discard block
 block discarded – undo
2920 3607
 			}
2921 3608
 			$diff = array_diff($newmodelsdb,$modelsdb);
2922 3609
 			foreach ($diff as $key => $value) {
2923
-				if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n";
3610
+				if ($globalDebug) {
3611
+					echo 'Downloading liveries '.$key.' ...'."\n";
3612
+				}
2924 3613
 				update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key);
2925 3614
 				
2926 3615
 			}
2927 3616
 			update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum');
2928
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3617
+		} else {
3618
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3619
+		}
2929 3620
 		if ($error != '') {
2930 3621
 			return $error;
2931
-		} elseif ($globalDebug) echo "Done\n";
3622
+		} elseif ($globalDebug) {
3623
+			echo "Done\n";
3624
+		}
2932 3625
 		return '';
2933 3626
 	}
2934 3627
 
@@ -2936,13 +3629,19 @@  discard block
 block discarded – undo
2936 3629
 		global $tmp_dir, $globalDebug;
2937 3630
 		$error = '';
2938 3631
 		if (!is_writable(dirname(__FILE__).'/../models')) {
2939
-			if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !';
3632
+			if ($globalDebug) {
3633
+				echo dirname(__FILE__).'/../models'.' is not writable !';
3634
+			}
2940 3635
 			return '';
2941 3636
 		}
2942
-		if ($globalDebug) echo "Space models from FlightAirMap website : Download...";
3637
+		if ($globalDebug) {
3638
+			echo "Space models from FlightAirMap website : Download...";
3639
+		}
2943 3640
 		update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum');
2944 3641
 		if (file_exists($tmp_dir.'space_models.md5sum')) {
2945
-			if ($globalDebug) echo "Check files...\n";
3642
+			if ($globalDebug) {
3643
+				echo "Check files...\n";
3644
+			}
2946 3645
 			$newmodelsdb = array();
2947 3646
 			if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) {
2948 3647
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2961,15 +3660,21 @@  discard block
 block discarded – undo
2961 3660
 			}
2962 3661
 			$diff = array_diff($newmodelsdb,$modelsdb);
2963 3662
 			foreach ($diff as $key => $value) {
2964
-				if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n";
3663
+				if ($globalDebug) {
3664
+					echo 'Downloading space model '.$key.' ...'."\n";
3665
+				}
2965 3666
 				update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key);
2966 3667
 				
2967 3668
 			}
2968 3669
 			update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum');
2969
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3670
+		} else {
3671
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3672
+		}
2970 3673
 		if ($error != '') {
2971 3674
 			return $error;
2972
-		} elseif ($globalDebug) echo "Done\n";
3675
+		} elseif ($globalDebug) {
3676
+			echo "Done\n";
3677
+		}
2973 3678
 		return '';
2974 3679
 	}
2975 3680
 
@@ -2977,13 +3682,19 @@  discard block
 block discarded – undo
2977 3682
 		global $tmp_dir, $globalDebug;
2978 3683
 		$error = '';
2979 3684
 		if (!is_writable(dirname(__FILE__).'/../models/vehicules')) {
2980
-			if ($globalDebug) echo dirname(__FILE__).'/../models/vehicules'.' is not writable !';
3685
+			if ($globalDebug) {
3686
+				echo dirname(__FILE__).'/../models/vehicules'.' is not writable !';
3687
+			}
2981 3688
 			return '';
2982 3689
 		}
2983
-		if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download...";
3690
+		if ($globalDebug) {
3691
+			echo "Vehicules models from FlightAirMap website : Download...";
3692
+		}
2984 3693
 		update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum');
2985 3694
 		if (file_exists($tmp_dir.'vehicules_models.md5sum')) {
2986
-			if ($globalDebug) echo "Check files...\n";
3695
+			if ($globalDebug) {
3696
+				echo "Check files...\n";
3697
+			}
2987 3698
 			$newmodelsdb = array();
2988 3699
 			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) {
2989 3700
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -3002,15 +3713,21 @@  discard block
 block discarded – undo
3002 3713
 			}
3003 3714
 			$diff = array_diff($newmodelsdb,$modelsdb);
3004 3715
 			foreach ($diff as $key => $value) {
3005
-				if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n";
3716
+				if ($globalDebug) {
3717
+					echo 'Downloading vehicules model '.$key.' ...'."\n";
3718
+				}
3006 3719
 				update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key);
3007 3720
 				
3008 3721
 			}
3009 3722
 			update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
3010
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3723
+		} else {
3724
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3725
+		}
3011 3726
 		if ($error != '') {
3012 3727
 			return $error;
3013
-		} elseif ($globalDebug) echo "Done\n";
3728
+		} elseif ($globalDebug) {
3729
+			echo "Done\n";
3730
+		}
3014 3731
 		return '';
3015 3732
 	}
3016 3733
 
@@ -3083,7 +3800,9 @@  discard block
 block discarded – undo
3083 3800
                 }
3084 3801
 
3085 3802
 		$error = '';
3086
-		if ($globalDebug) echo "Notam : Download...";
3803
+		if ($globalDebug) {
3804
+			echo "Notam : Download...";
3805
+		}
3087 3806
 		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
3088 3807
 		if (file_exists($tmp_dir.'notam.rss')) {
3089 3808
 			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
@@ -3098,14 +3817,30 @@  discard block
 block discarded – undo
3098 3817
 				$data['fir'] = $q[0];
3099 3818
 				$data['code'] = $q[1];
3100 3819
 				$ifrvfr = $q[2];
3101
-				if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR';
3102
-				if ($ifrvfr == 'I') $data['rules'] = 'IFR';
3103
-				if ($ifrvfr == 'V') $data['rules'] = 'VFR';
3104
-				if ($q[4] == 'A') $data['scope'] = 'Airport warning';
3105
-				if ($q[4] == 'E') $data['scope'] = 'Enroute warning';
3106
-				if ($q[4] == 'W') $data['scope'] = 'Navigation warning';
3107
-				if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning';
3108
-				if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning';
3820
+				if ($ifrvfr == 'IV') {
3821
+					$data['rules'] = 'IFR/VFR';
3822
+				}
3823
+				if ($ifrvfr == 'I') {
3824
+					$data['rules'] = 'IFR';
3825
+				}
3826
+				if ($ifrvfr == 'V') {
3827
+					$data['rules'] = 'VFR';
3828
+				}
3829
+				if ($q[4] == 'A') {
3830
+					$data['scope'] = 'Airport warning';
3831
+				}
3832
+				if ($q[4] == 'E') {
3833
+					$data['scope'] = 'Enroute warning';
3834
+				}
3835
+				if ($q[4] == 'W') {
3836
+					$data['scope'] = 'Navigation warning';
3837
+				}
3838
+				if ($q[4] == 'AE') {
3839
+					$data['scope'] = 'Airport/Enroute warning';
3840
+				}
3841
+				if ($q[4] == 'AW') {
3842
+					$data['scope'] = 'Airport/Navigation warning';
3843
+				}
3109 3844
 				//$data['scope'] = $q[4];
3110 3845
 				$data['lower_limit'] = $q[5];
3111 3846
 				$data['upper_limit'] = $q[6];
@@ -3113,8 +3848,12 @@  discard block
 block discarded – undo
3113 3848
 				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
3114 3849
 				$latitude = $Common->convertDec($las,'latitude');
3115 3850
 				$longitude = $Common->convertDec($lns,'longitude');
3116
-				if ($lac == 'S') $latitude = '-'.$latitude;
3117
-				if ($lnc == 'W') $longitude = '-'.$longitude;
3851
+				if ($lac == 'S') {
3852
+					$latitude = '-'.$latitude;
3853
+				}
3854
+				if ($lnc == 'W') {
3855
+					$longitude = '-'.$longitude;
3856
+				}
3118 3857
 				$data['center_latitude'] = $latitude;
3119 3858
 				$data['center_longitude'] = $longitude;
3120 3859
 				$data['radius'] = intval($radius);
@@ -3144,10 +3883,14 @@  discard block
 block discarded – undo
3144 3883
 				$NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
3145 3884
 				unset($data);
3146 3885
 			} 
3147
-		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
3886
+		} else {
3887
+			$error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
3888
+		}
3148 3889
 		if ($error != '') {
3149 3890
 			return $error;
3150
-		} elseif ($globalDebug) echo "Done\n";
3891
+		} elseif ($globalDebug) {
3892
+			echo "Done\n";
3893
+		}
3151 3894
 		return '';
3152 3895
 	}
3153 3896
 	
@@ -3172,7 +3915,9 @@  discard block
 block discarded – undo
3172 3915
 		$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json');
3173 3916
 		$airspace_json = json_decode($airspace_lst,true);
3174 3917
 		foreach ($airspace_json['records'] as $airspace) {
3175
-			if ($globalDebug) echo $airspace['name']."...\n";
3918
+			if ($globalDebug) {
3919
+				echo $airspace['name']."...\n";
3920
+			}
3176 3921
 			update_db::download($airspace['uri'],$tmp_dir.$airspace['name']);
3177 3922
 			if (file_exists($tmp_dir.$airspace['name'])) {
3178 3923
 				file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name'])));
@@ -3216,8 +3961,11 @@  discard block
 block discarded – undo
3216 3961
                         return "error : ".$e->getMessage();
3217 3962
                 }
3218 3963
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3219
-                if ($row['nb'] > 0) return false;
3220
-                else return true;
3964
+                if ($row['nb'] > 0) {
3965
+                	return false;
3966
+                } else {
3967
+                	return true;
3968
+                }
3221 3969
 	}
3222 3970
 
3223 3971
 	public static function insert_last_update() {
@@ -3242,8 +3990,11 @@  discard block
 block discarded – undo
3242 3990
                         return "error : ".$e->getMessage();
3243 3991
                 }
3244 3992
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3245
-                if ($row['nb'] > 0) return true;
3246
-                else return false;
3993
+                if ($row['nb'] > 0) {
3994
+                	return true;
3995
+                } else {
3996
+                	return false;
3997
+                }
3247 3998
 	}
3248 3999
 
3249 4000
 	public static function check_geoid_version($version) {
@@ -3256,8 +4007,11 @@  discard block
 block discarded – undo
3256 4007
                         return "error : ".$e->getMessage();
3257 4008
                 }
3258 4009
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3259
-                if ($row['nb'] > 0) return true;
3260
-                else return false;
4010
+                if ($row['nb'] > 0) {
4011
+                	return true;
4012
+                } else {
4013
+                	return false;
4014
+                }
3261 4015
 	}
3262 4016
 
3263 4017
 	public static function check_marine_identity_version($version) {
@@ -3270,8 +4024,11 @@  discard block
 block discarded – undo
3270 4024
 			return "error : ".$e->getMessage();
3271 4025
 		}
3272 4026
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3273
-		if ($row['nb'] > 0) return true;
3274
-		else return false;
4027
+		if ($row['nb'] > 0) {
4028
+			return true;
4029
+		} else {
4030
+			return false;
4031
+		}
3275 4032
 	}
3276 4033
 
3277 4034
 	public static function check_satellite_version($version) {
@@ -3284,8 +4041,11 @@  discard block
 block discarded – undo
3284 4041
 			return "error : ".$e->getMessage();
3285 4042
 		}
3286 4043
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3287
-		if ($row['nb'] > 0) return true;
3288
-		else return false;
4044
+		if ($row['nb'] > 0) {
4045
+			return true;
4046
+		} else {
4047
+			return false;
4048
+		}
3289 4049
 	}
3290 4050
 
3291 4051
 	public static function check_airlines_version($version) {
@@ -3298,8 +4058,11 @@  discard block
 block discarded – undo
3298 4058
 			return "error : ".$e->getMessage();
3299 4059
 		}
3300 4060
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3301
-		if ($row['nb'] > 0) return true;
3302
-		else return false;
4061
+		if ($row['nb'] > 0) {
4062
+			return true;
4063
+		} else {
4064
+			return false;
4065
+		}
3303 4066
 	}
3304 4067
 
3305 4068
 	public static function check_notam_version($version) {
@@ -3312,8 +4075,11 @@  discard block
 block discarded – undo
3312 4075
 			return "error : ".$e->getMessage();
3313 4076
 		}
3314 4077
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3315
-		if ($row['nb'] > 0) return true;
3316
-		else return false;
4078
+		if ($row['nb'] > 0) {
4079
+			return true;
4080
+		} else {
4081
+			return false;
4082
+		}
3317 4083
 	}
3318 4084
 
3319 4085
 	public static function insert_airlines_version($version) {
@@ -3403,8 +4169,11 @@  discard block
 block discarded – undo
3403 4169
                         return "error : ".$e->getMessage();
3404 4170
                 }
3405 4171
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3406
-                if ($row['nb'] > 0) return false;
3407
-                else return true;
4172
+                if ($row['nb'] > 0) {
4173
+                	return false;
4174
+                } else {
4175
+                	return true;
4176
+                }
3408 4177
 	}
3409 4178
 
3410 4179
 	public static function insert_last_notam_update() {
@@ -3434,8 +4203,11 @@  discard block
 block discarded – undo
3434 4203
                         return "error : ".$e->getMessage();
3435 4204
                 }
3436 4205
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3437
-                if ($row['nb'] > 0) return false;
3438
-                else return true;
4206
+                if ($row['nb'] > 0) {
4207
+                	return false;
4208
+                } else {
4209
+                	return true;
4210
+                }
3439 4211
 	}
3440 4212
 
3441 4213
 	public static function insert_last_airspace_update() {
@@ -3465,8 +4237,11 @@  discard block
 block discarded – undo
3465 4237
                         return "error : ".$e->getMessage();
3466 4238
                 }
3467 4239
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3468
-                if ($row['nb'] > 0) return false;
3469
-                else return true;
4240
+                if ($row['nb'] > 0) {
4241
+                	return false;
4242
+                } else {
4243
+                	return true;
4244
+                }
3470 4245
 	}
3471 4246
 
3472 4247
 	public static function insert_last_geoid_update() {
@@ -3496,8 +4271,11 @@  discard block
 block discarded – undo
3496 4271
 			return "error : ".$e->getMessage();
3497 4272
 		}
3498 4273
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3499
-		if ($row['nb'] > 0) return false;
3500
-		else return true;
4274
+		if ($row['nb'] > 0) {
4275
+			return false;
4276
+		} else {
4277
+			return true;
4278
+		}
3501 4279
 	}
3502 4280
 
3503 4281
 	public static function insert_last_owner_update() {
@@ -3527,8 +4305,11 @@  discard block
 block discarded – undo
3527 4305
 			return "error : ".$e->getMessage();
3528 4306
 		}
3529 4307
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3530
-		if ($row['nb'] > 0) return false;
3531
-		else return true;
4308
+		if ($row['nb'] > 0) {
4309
+			return false;
4310
+		} else {
4311
+			return true;
4312
+		}
3532 4313
 	}
3533 4314
 
3534 4315
 	public static function insert_last_fires_update() {
@@ -3558,8 +4339,11 @@  discard block
 block discarded – undo
3558 4339
 			return "error : ".$e->getMessage();
3559 4340
 		}
3560 4341
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3561
-		if ($row['nb'] > 0) return false;
3562
-		else return true;
4342
+		if ($row['nb'] > 0) {
4343
+			return false;
4344
+		} else {
4345
+			return true;
4346
+		}
3563 4347
 	}
3564 4348
 
3565 4349
 	public static function insert_last_airlines_update() {
@@ -3589,8 +4373,11 @@  discard block
 block discarded – undo
3589 4373
                         return "error : ".$e->getMessage();
3590 4374
                 }
3591 4375
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3592
-                if ($row['nb'] > 0) return false;
3593
-                else return true;
4376
+                if ($row['nb'] > 0) {
4377
+                	return false;
4378
+                } else {
4379
+                	return true;
4380
+                }
3594 4381
 	}
3595 4382
 
3596 4383
 	public static function insert_last_schedules_update() {
@@ -3620,8 +4407,11 @@  discard block
 block discarded – undo
3620 4407
 			return "error : ".$e->getMessage();
3621 4408
 		}
3622 4409
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3623
-		if ($row['nb'] > 0) return false;
3624
-		else return true;
4410
+		if ($row['nb'] > 0) {
4411
+			return false;
4412
+		} else {
4413
+			return true;
4414
+		}
3625 4415
 	}
3626 4416
 
3627 4417
 	public static function insert_last_tle_update() {
@@ -3651,8 +4441,11 @@  discard block
 block discarded – undo
3651 4441
 			return "error : ".$e->getMessage();
3652 4442
 		}
3653 4443
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3654
-		if ($row['nb'] > 0) return false;
3655
-		else return true;
4444
+		if ($row['nb'] > 0) {
4445
+			return false;
4446
+		} else {
4447
+			return true;
4448
+		}
3656 4449
 	}
3657 4450
 
3658 4451
 	public static function insert_last_ucsdb_update() {
@@ -3682,8 +4475,11 @@  discard block
 block discarded – undo
3682 4475
 			return "error : ".$e->getMessage();
3683 4476
 		}
3684 4477
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3685
-		if ($row['nb'] > 0) return false;
3686
-		else return true;
4478
+		if ($row['nb'] > 0) {
4479
+			return false;
4480
+		} else {
4481
+			return true;
4482
+		}
3687 4483
 	}
3688 4484
 
3689 4485
 	public static function insert_last_celestrak_update() {
@@ -3713,8 +4509,11 @@  discard block
 block discarded – undo
3713 4509
 			return "error : ".$e->getMessage();
3714 4510
 		}
3715 4511
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3716
-		if ($row['nb'] > 0) return false;
3717
-		else return true;
4512
+		if ($row['nb'] > 0) {
4513
+			return false;
4514
+		} else {
4515
+			return true;
4516
+		}
3718 4517
 	}
3719 4518
 
3720 4519
 	public static function check_last_satellite_update() {
@@ -3732,8 +4531,11 @@  discard block
 block discarded – undo
3732 4531
 			return "error : ".$e->getMessage();
3733 4532
 		}
3734 4533
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3735
-		if ($row['nb'] > 0) return false;
3736
-		else return true;
4534
+		if ($row['nb'] > 0) {
4535
+			return false;
4536
+		} else {
4537
+			return true;
4538
+		}
3737 4539
 	}
3738 4540
 
3739 4541
 	public static function insert_last_marine_identity_update() {
Please login to merge, or discard this patch.
require/class.Source.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@  discard block
 block discarded – undo
18 18
 	public function __construct($dbc = null) {
19 19
 		$Connection = new Connection($dbc);
20 20
 		$this->db = $Connection->db;
21
-		if ($this->db === null) die('Error: No DB connection. (Source)');
21
+		if ($this->db === null) {
22
+			die('Error: No DB connection. (Source)');
23
+		}
22 24
 	}
23 25
 
24 26
 	public function getAllLocationInfo() {
@@ -83,7 +85,9 @@  discard block
 block discarded – undo
83 85
 			$query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0";
84 86
 		}
85 87
 		$query .= " ORDER BY last_seen DESC";
86
-		if ($limit) $query .= " LIMIT 600";
88
+		if ($limit) {
89
+			$query .= " LIMIT 600";
90
+		}
87 91
 		$query_values = array(':type' => $type);
88 92
 		try {
89 93
 			$sth = $this->db->prepare($query);
@@ -122,7 +126,9 @@  discard block
 block discarded – undo
122 126
 	}
123 127
 
124 128
 	public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') {
125
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
129
+		if ($last_seen == '') {
130
+			$last_seen = date('Y-m-d H:i:s');
131
+		}
126 132
 		$query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)";
127 133
 		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
128 134
 		try {
@@ -134,7 +140,9 @@  discard block
 block discarded – undo
134 140
 	}
135 141
 
136 142
 	public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') {
137
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
143
+		if ($last_seen == '') {
144
+			$last_seen = date('Y-m-d H:i:s');
145
+		}
138 146
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source";
139 147
 		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
140 148
 		try {
@@ -157,7 +165,9 @@  discard block
 block discarded – undo
157 165
 	}
158 166
 
159 167
 	public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') {
160
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
168
+		if ($last_seen == '') {
169
+			$last_seen = date('Y-m-d H:i:s');
170
+		}
161 171
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id";
162 172
 		$query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
163 173
 		try {
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +586 added lines, -148 removed lines patch added patch discarded remove patch
@@ -57,7 +57,10 @@  discard block
 block discarded – undo
57 57
 <?php
58 58
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
60
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
61
+	print '?tsk='.$tsk;
62
+}
63
+?>"></script>
61 64
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
62 65
 <script src="<?php echo $globalURL; ?>/js/map.3d.weather.js"></script>
63 66
 <?php
@@ -137,9 +140,18 @@  discard block
 block discarded – undo
137 140
 			<h1>Weather</h1>
138 141
 			<ul>
139 142
 			
140
-				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') print 'checked'; ?> /><?php echo _("Weather Winds"); ?></label></div></li>
141
-				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') print 'checked'; ?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
142
-				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') print 'checked'; ?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
143
+				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') {
144
+	print 'checked';
145
+}
146
+?> /><?php echo _("Weather Winds"); ?></label></div></li>
147
+				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') {
148
+	print 'checked';
149
+}
150
+?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
151
+				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') {
152
+	print 'checked';
153
+}
154
+?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
143 155
 			
144 156
 <?php
145 157
 		if (isset($globalOpenWeatherMapKey) && $globalOpenWeatherMapKey != '') {
@@ -158,7 +170,10 @@  discard block
 block discarded – undo
158 170
 ?>
159 171
 			<h1>Weather</h1>
160 172
 			<ul>
161
-				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display weather on 3D map"); ?></label></div></li>
173
+				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) {
174
+	print 'checked';
175
+}
176
+?> ><?php echo _("Display weather on 3D map"); ?></label></div></li>
162 177
 			<!--	<li><div class="checkbox"><label><input type="checkbox" name="displayrain" value="1" onclick="clickDisplayRain(this)" ><?php echo _("Display rain on 3D map"); ?></label></div></li>-->
163 178
 			</ul>
164 179
 <?php
@@ -176,13 +191,22 @@  discard block
 block discarded – undo
176 191
 <?php
177 192
 		if (!isset($globalAircraft) || $globalAircraft) {
178 193
 ?>
179
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
180
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
194
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
195
+	print 'checked';
196
+}
197
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
198
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
199
+	print 'checked';
200
+}
201
+?> /><?php echo _("Display airspace"); ?></label></div></li>
181 202
 <?php
182 203
 		}
183 204
 		if (isset($globalMarine) && $globalMarine) {
184 205
 ?>
185
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
206
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
207
+	print 'checked';
208
+}
209
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
186 210
 <?php
187 211
 		}
188 212
 ?>
@@ -197,13 +221,22 @@  discard block
 block discarded – undo
197 221
 <?php
198 222
 		if (!isset($globalAircraft) || $globalAircraft) {
199 223
 ?>
200
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
201
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
224
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
225
+	print 'checked';
226
+}
227
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
228
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
229
+	print 'checked';
230
+}
231
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
202 232
 <?php
203 233
 		}
204 234
 		if (isset($globalMarine) && $globalMarine) {
205 235
 ?>
206
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
236
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
237
+	print 'checked';
238
+}
239
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
207 240
 <?php
208 241
 		}
209 242
 ?>
@@ -218,14 +251,32 @@  discard block
 block discarded – undo
218 251
 		<h1>NOTAM</h1>
219 252
 		<form>
220 253
 			<ul>
221
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
254
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
255
+	print 'checked';
256
+}
257
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
222 258
 				<li><?php echo _("NOTAM scope:"); ?>
223 259
 					<select class="selectpicker" onchange="notamscope(this);">
224
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
225
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
226
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
227
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
228
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
260
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
261
+	print ' selected';
262
+}
263
+?>>All</option>
264
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
265
+	print ' selected';
266
+}
267
+?>>Airport/Enroute warning</option>
268
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
269
+	print ' selected';
270
+}
271
+?>>Airport warning</option>
272
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
273
+	print ' selected';
274
+}
275
+?>>Navigation warning</option>
276
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
277
+	print ' selected';
278
+}
279
+?>>Enroute warning</option>
229 280
 					</select
230 281
 				</li>
231 282
 			</ul>
@@ -253,7 +304,10 @@  discard block
 block discarded – undo
253 304
 		    <div class="form-group">
254 305
 			<label><?php echo _("From:"); ?></label>
255 306
 			<div class='input-group date' id='datetimepicker1'>
256
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
307
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
308
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC';
309
+}
310
+?>" required />
257 311
 			    <span class="input-group-addon">
258 312
 				<span class="glyphicon glyphicon-calendar"></span>
259 313
 			    </span>
@@ -262,7 +316,10 @@  discard block
 block discarded – undo
262 316
 		    <div class="form-group">
263 317
 			<label><?php echo _("To:"); ?></label>
264 318
 			<div class='input-group date' id='datetimepicker2'>
265
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
319
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') {
320
+	print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC';
321
+}
322
+?>" />
266 323
 			    <span class="input-group-addon">
267 324
 				<span class="glyphicon glyphicon-calendar"></span>
268 325
 			    </span>
@@ -294,8 +351,20 @@  discard block
 block discarded – undo
294 351
 		    </script>
295 352
 		<li><?php echo _("Playback speed:"); ?>
296 353
 		    <div class="range">
297
-			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
298
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
354
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
355
+	print $_POST['archivespeed'];
356
+} elseif (isset($_COOKIE['archive_speed'])) {
357
+	print $_COOKIE['archive_speed'];
358
+} else {
359
+	print '1';
360
+}
361
+?>">
362
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
363
+	print $_COOKIE['archive_speed'];
364
+} else {
365
+	print '1';
366
+}
367
+?></output>
299 368
 		    </div>
300 369
 		</li>
301 370
 		<?php
@@ -324,14 +393,20 @@  discard block
 block discarded – undo
324 393
 		    <li><?php echo _("Type of Map:"); ?>
325 394
 			    <?php
326 395
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
327
-					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
328
-					else $MapType = $_COOKIE['MapType'];
396
+					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
397
+						$MapType = $globalMapProvider;
398
+					} else {
399
+						$MapType = $_COOKIE['MapType'];
400
+					}
329 401
 			    ?>
330 402
 			<select  class="selectpicker" onchange="mapType(this);">
331 403
 			    <?php
332 404
 				} else {
333
-					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
334
-					else $MapType = $_COOKIE['MapType3D'];
405
+					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') {
406
+						$MapType = $globalMapProvider;
407
+					} else {
408
+						$MapType = $_COOKIE['MapType3D'];
409
+					}
335 410
 			    ?>
336 411
 			<select  class="selectpicker" onchange="mapType3D(this);">
337 412
 			    <?php
@@ -340,24 +415,48 @@  discard block
 block discarded – undo
340 415
 			    <?php
341 416
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
342 417
 			    ?>
343
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
418
+			    <option value="offline"<?php if ($MapType == 'offline') {
419
+	print ' selected';
420
+}
421
+?>>Natural Earth (local)</option>
344 422
 			    <?php
345 423
 				} else {
346 424
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
347 425
 			    ?>
348
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
426
+			    <option value="offline"<?php if ($MapType == 'offline') {
427
+	print ' selected';
428
+}
429
+?>>Natural Earth (local)</option>
349 430
 			    <?php
350 431
 				    }
351 432
 			    ?>
352
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
353
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
354
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
433
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
434
+	print ' selected';
435
+}
436
+?>>ArcGIS Streetmap</option>
437
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
438
+	print ' selected';
439
+}
440
+?>>ArcGIS Satellite</option>
441
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') {
442
+	print ' selected';
443
+}
444
+?>>ArcGIS Ocean</option>
355 445
 			    <?php
356 446
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
357 447
 			    ?>
358
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
359
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
360
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
448
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
449
+	print ' selected';
450
+}
451
+?>>Bing-Aerial</option>
452
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
453
+	print ' selected';
454
+}
455
+?>>Bing-Hybrid</option>
456
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
457
+	print ' selected';
458
+}
459
+?>>Bing-Road</option>
361 460
 			    <?php
362 461
 				    }
363 462
 			    ?>
@@ -367,59 +466,143 @@  discard block
 block discarded – undo
367 466
 			    <?php
368 467
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
369 468
 			    ?>
370
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
371
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
372
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
469
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
470
+	print ' selected';
471
+}
472
+?>>Here-Aerial</option>
473
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
474
+	print ' selected';
475
+}
476
+?>>Here-Hybrid</option>
477
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
478
+	print ' selected';
479
+}
480
+?>>Here-Road</option>
373 481
 			    <?php
374 482
 					}
375 483
 			    ?>
376 484
 			    <?php
377 485
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
378 486
 			    ?>
379
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
380
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
381
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
382
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
487
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
488
+	print ' selected';
489
+}
490
+?>>Google Roadmap</option>
491
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
492
+	print ' selected';
493
+}
494
+?>>Google Satellite</option>
495
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
496
+	print ' selected';
497
+}
498
+?>>Google Hybrid</option>
499
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
500
+	print ' selected';
501
+}
502
+?>>Google Terrain</option>
383 503
 			    <?php
384 504
 					}
385 505
 			    ?>
386 506
 			    <?php
387 507
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
388 508
 			    ?>
389
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
390
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
391
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
509
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
510
+	print ' selected';
511
+}
512
+?>>MapQuest-OSM</option>
513
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
514
+	print ' selected';
515
+}
516
+?>>MapQuest-Aerial</option>
517
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
518
+	print ' selected';
519
+}
520
+?>>MapQuest-Hybrid</option>
392 521
 			    <?php
393 522
 					}
394 523
 			    ?>
395
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
396
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
524
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
525
+	print ' selected';
526
+}
527
+?>>Yandex</option>
528
+			    <option value="offline"<?php if ($MapType == 'offline') {
529
+	print ' selected';
530
+}
531
+?>>Natural Earth</option>
397 532
 			    <?php
398 533
 				    }
399 534
 			    ?>
400
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
535
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
536
+	print ' selected';
537
+}
538
+?>>National Geographic Street</option>
401 539
 			    <?php
402 540
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
403
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
404
-					else $MapBoxId = $_COOKIE['MapTypeId'];
541
+					if (!isset($_COOKIE['MapTypeId'])) {
542
+						$MapBoxId = 'default';
543
+					} else {
544
+						$MapBoxId = $_COOKIE['MapTypeId'];
545
+					}
405 546
 			    ?>
406
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
407
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
408
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
409
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
410
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
411
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
412
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
413
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
414
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
415
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
416
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
417
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
418
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
547
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
548
+	print ' selected';
549
+}
550
+?>>Mapbox GL</option>
551
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
552
+	print ' selected';
553
+}
554
+?>>Mapbox default</option>
555
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
556
+	print ' selected';
557
+}
558
+?>>Mapbox streets</option>
559
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
560
+	print ' selected';
561
+}
562
+?>>Mapbox light</option>
563
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
564
+	print ' selected';
565
+}
566
+?>>Mapbox dark</option>
567
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
568
+	print ' selected';
569
+}
570
+?>>Mapbox satellite</option>
571
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
572
+	print ' selected';
573
+}
574
+?>>Mapbox streets-satellite</option>
575
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
576
+	print ' selected';
577
+}
578
+?>>Mapbox streets-basic</option>
579
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
580
+	print ' selected';
581
+}
582
+?>>Mapbox comic</option>
583
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
584
+	print ' selected';
585
+}
586
+?>>Mapbox outdoors</option>
587
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
588
+	print ' selected';
589
+}
590
+?>>Mapbox pencil</option>
591
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
592
+	print ' selected';
593
+}
594
+?>>Mapbox pirates</option>
595
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
596
+	print ' selected';
597
+}
598
+?>>Mapbox emerald</option>
419 599
 			    <?php
420 600
 				    }
421 601
 			    ?>
422
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
602
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
603
+	print ' selected';
604
+}
605
+?>>OpenStreetMap</option>
423 606
 			    <?php
424 607
 				}
425 608
 			    ?>
@@ -430,10 +613,22 @@  discard block
 block discarded – undo
430 613
 ?>
431 614
 		    <li><?php echo _("Type of Terrain:"); ?>
432 615
 			<select  class="selectpicker" onchange="terrainType(this);">
433
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
434
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
435
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
436
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
616
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
617
+	print ' selected';
618
+}
619
+?>>stk terrain</option>
620
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
621
+	print ' selected';
622
+}
623
+?>>ellipsoid</option>
624
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
625
+	print ' selected';
626
+}
627
+?>>vr terrain</option>
628
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
629
+	print ' selected';
630
+}
631
+?>>ArticDEM</option>
437 632
 			</select>
438 633
 		    </li>
439 634
 <?php
@@ -443,59 +638,116 @@  discard block
 block discarded – undo
443 638
 <?php
444 639
     if (isset($globalMap3D) && $globalMap3D) {
445 640
 ?>
446
-		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
641
+		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') {
642
+	print 'checked';
643
+}
644
+?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
447 645
 <?php
448 646
     }
449 647
 ?>
450 648
 <?php
451 649
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
452 650
 ?>
453
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
651
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
652
+	print 'checked';
653
+}
654
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
454 655
 
455 656
 <?php
456 657
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
457 658
 ?>
458
-		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
459
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
460
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
461
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
462
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
659
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
660
+	print 'checked';
661
+}
662
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
663
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
664
+	print 'checked';
665
+}
666
+?> ><?php echo _("Display flight path"); ?></label></div></li>
667
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) {
668
+	print 'checked';
669
+}
670
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
671
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
672
+	print 'checked';
673
+}
674
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
675
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
676
+	print 'checked';
677
+}
678
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
463 679
 <?php
464 680
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
465 681
 ?>
466
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
682
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
683
+	print 'checked';
684
+}
685
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
467 686
 <?php
468 687
 	}
469 688
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
470 689
 ?>
471
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
690
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
691
+	print 'checked';
692
+}
693
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
472 694
 <?php
473 695
 	}
474 696
     }
475 697
 ?>
476
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
477
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
478
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
479
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
698
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
699
+	print 'checked';
700
+}
701
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
702
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
703
+	print 'checked';
704
+}
705
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
706
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
707
+	print 'checked';
708
+}
709
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
710
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
711
+	print 'checked';
712
+}
713
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
480 714
 <?php
481 715
 	if (isset($globalFires) && $globalFires) {
482 716
 ?>
483
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
717
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
718
+	print 'checked';
719
+}
720
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
484 721
 <?php
485 722
 	}
486 723
 	if (isset($globalMap3D) && $globalMap3D) {
487 724
 ?>
488
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
725
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) {
726
+	print 'checked';
727
+}
728
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
489 729
 <?php
490 730
 	}
491 731
 ?>
492 732
 <?php
493 733
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
494 734
 ?>
495
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
496
-		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
497
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
498
-		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
735
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
736
+	print 'checked';
737
+}
738
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
739
+		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) {
740
+	print 'checked';
741
+}
742
+?> ><?php echo _("Use shadows"); ?></label></div></li>
743
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
744
+	print 'checked';
745
+}
746
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
747
+		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) {
748
+	print 'checked';
749
+}
750
+?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
499 751
 <?php
500 752
     }
501 753
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -508,17 +760,25 @@  discard block
 block discarded – undo
508 760
 			if (function_exists('array_column')) {
509 761
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
510 762
 		    ?>
511
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
763
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
764
+	print 'checked';
765
+}
766
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
512 767
 		    <?php
513 768
 			    }
514 769
 			} elseif (isset($globalSources)) {
515 770
 			    $dispolar = false;
516 771
 			    foreach ($globalSources as $testsource) {
517
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
772
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
773
+			        	$dispolar = true;
774
+			        }
518 775
 			    }
519 776
 			    if ($dispolar) {
520 777
 		    ?>
521
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
778
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
779
+	print 'checked';
780
+}
781
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
522 782
 		    <?php
523 783
 			    }
524 784
 		        }
@@ -531,11 +791,21 @@  discard block
 block discarded – undo
531 791
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
532 792
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
533 793
 		    ?>
534
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
794
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
795
+	print 'checked';
796
+}
797
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
535 798
 		    <?php 
536 799
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
537 800
 		    ?>
538
-			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
801
+			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
802
+	print $_COOKIE['IconColor'];
803
+} elseif (isset($globalAircraftIconColor)) {
804
+	print $globalAircraftIconColor;
805
+} else {
806
+	print '1a3151';
807
+}
808
+?>"></li>
539 809
 		    <?php
540 810
 				}
541 811
 			    }
@@ -546,7 +816,14 @@  discard block
 block discarded – undo
546 816
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
547 817
 		    ?>
548 818
 		    <li><?php echo _("Marine icon color:"); ?>
549
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
819
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
820
+	print $_COOKIE['MarineIconColor'];
821
+} elseif (isset($globalMarineIconColor)) {
822
+	print $globalMarineIconColor;
823
+} else {
824
+	print '1a3151';
825
+}
826
+?>">
550 827
 		    </li>
551 828
 		    <?php
552 829
 			    }
@@ -557,7 +834,14 @@  discard block
 block discarded – undo
557 834
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
558 835
 		    ?>
559 836
 		    <li><?php echo _("Tracker icon color:"); ?>
560
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
837
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
838
+	print $_COOKIE['TrackerIconColor'];
839
+} elseif (isset($globalTrackerIconColor)) {
840
+	print $globalTrackerIconColor;
841
+} else {
842
+	print '1a3151';
843
+}
844
+?>">
561 845
 		    </li>
562 846
 		    <?php
563 847
 			    }
@@ -568,8 +852,22 @@  discard block
 block discarded – undo
568 852
 		    ?>
569 853
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
570 854
 			<div class="range">
571
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
572
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
855
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
856
+	print $_COOKIE['AirportZoom'];
857
+} elseif (isset($globalAirportZoom)) {
858
+	print $globalAirportZoom;
859
+} else {
860
+	print '7';
861
+}
862
+?>">
863
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
864
+	print $_COOKIE['AirportZoom'];
865
+} elseif (isset($globalAirportZoom)) {
866
+	print $globalAirportZoom;
867
+} else {
868
+	print '7';
869
+}
870
+?></output>
573 871
 			</div>
574 872
 		    </li>
575 873
 		    <?php
@@ -580,17 +878,40 @@  discard block
 block discarded – undo
580 878
 ?>
581 879
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
582 880
 			<div class="range">
583
-			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>">
584
-			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output>
881
+			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) {
882
+	print $_COOKIE['resolutionScale'];
883
+} else {
884
+	print '1';
885
+}
886
+?>">
887
+			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) {
888
+	print $_COOKIE['resolutionScale'];
889
+} else {
890
+	print '1';
891
+}
892
+?></output>
585 893
 			</div>
586 894
 		    </li>
587 895
 <?php
588 896
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
589 897
 ?>
590
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li>
591
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
898
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
899
+	print 'checked';
900
+}
901
+?> > <?php echo _("Use airlines liveries"); ?></li>
902
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
903
+	print 'checked';
904
+}
905
+?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
592 906
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
593
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
907
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
908
+	print $_COOKIE['IconColor'];
909
+} elseif (isset($globalAircraftIconColor)) {
910
+	print $globalAircraftIconColor;
911
+} else {
912
+	print 'ff0000';
913
+}
914
+?>">
594 915
 		    </li>
595 916
 <?php
596 917
 	}
@@ -598,9 +919,19 @@  discard block
 block discarded – undo
598 919
 <?php
599 920
 	if (isset($globalMarine) && $globalMarine === TRUE) {
600 921
 ?>
601
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
922
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
923
+	print 'checked';
924
+}
925
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
602 926
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
603
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
927
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
928
+	print $_COOKIE['MarineIconColor'];
929
+} elseif (isset($globalMarineIconColor)) {
930
+	print $globalMarineIconColor;
931
+} else {
932
+	print 'ff0000';
933
+}
934
+?>">
604 935
 		    </li>
605 936
 <?php
606 937
 	}
@@ -608,9 +939,19 @@  discard block
 block discarded – undo
608 939
 <?php
609 940
 	if (isset($globalTracker) && $globalTracker === TRUE) {
610 941
 ?>
611
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
942
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
943
+	print 'checked';
944
+}
945
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
612 946
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
613
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
947
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
948
+	print $_COOKIE['TrackerIconColor'];
949
+} elseif (isset($globalTrackerIconColor)) {
950
+	print $globalTrackerIconColor;
951
+} else {
952
+	print 'ff0000';
953
+}
954
+?>">
614 955
 		    </li>
615 956
 <?php
616 957
 	}
@@ -618,29 +959,62 @@  discard block
 block discarded – undo
618 959
 ?>
619 960
 		    <li><?php echo _("Distance unit:"); ?>
620 961
 			<select class="selectpicker" onchange="unitdistance(this);">
621
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
622
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
623
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
962
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
963
+	echo ' selected';
964
+}
965
+?>>km</option>
966
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
967
+	echo ' selected';
968
+}
969
+?>>nm</option>
970
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
971
+	echo ' selected';
972
+}
973
+?>>mi</option>
624 974
 		        </select>
625 975
 		    </li>
626 976
 		    <li><?php echo _("Altitude unit:"); ?>
627 977
 			<select class="selectpicker" onchange="unitaltitude(this);">
628
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
629
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
978
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
979
+	echo ' selected';
980
+}
981
+?>>m</option>
982
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
983
+	echo ' selected';
984
+}
985
+?>>feet</option>
630 986
 		        </select>
631 987
 		    </li>
632 988
 		    <li><?php echo _("Speed unit:"); ?>
633 989
 			<select class="selectpicker" onchange="unitspeed(this);">
634
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
635
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
636
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
990
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
991
+	echo ' selected';
992
+}
993
+?>>km/h</option>
994
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
995
+	echo ' selected';
996
+}
997
+?>>mph</option>
998
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
999
+	echo ' selected';
1000
+}
1001
+?>>knots</option>
637 1002
 		        </select>
638 1003
 		    </li>
639 1004
 		    <li><?php echo _("Coordinate unit:"); ?>
640 1005
 			<select class="selectpicker" onchange="unitcoordinate(this);">
641
-			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) echo ' selected'; ?>>DD</option>
642
-			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) echo ' selected'; ?>>DMS</option>
643
-			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) echo ' selected'; ?>>DM</option>
1006
+			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) {
1007
+	echo ' selected';
1008
+}
1009
+?>>DD</option>
1010
+			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) {
1011
+	echo ' selected';
1012
+}
1013
+?>>DMS</option>
1014
+			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) {
1015
+	echo ' selected';
1016
+}
1017
+?>>DM</option>
644 1018
 		        </select>
645 1019
 		    </li>
646 1020
 
@@ -658,9 +1032,18 @@  discard block
 block discarded – undo
658 1032
 		    <?php
659 1033
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
660 1034
 		    ?>
661
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
662
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
663
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
1035
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) {
1036
+	print 'checked';
1037
+}
1038
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
1039
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) {
1040
+	print 'checked';
1041
+}
1042
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
1043
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) {
1044
+	print 'checked';
1045
+}
1046
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
664 1047
 		    <?php
665 1048
 			}
666 1049
 		    ?>
@@ -668,12 +1051,21 @@  discard block
 block discarded – undo
668 1051
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
669 1052
 		    ?>
670 1053
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
671
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
1054
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) {
1055
+	print 'checked';
1056
+}
1057
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
672 1058
 			<?php } ?>
673 1059
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
674
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
1060
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) {
1061
+	print 'checked';
1062
+}
1063
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
675 1064
 			<?php } ?>
676
-			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
1065
+			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
1066
+	print 'checked';
1067
+}
1068
+?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
677 1069
 		    <?php
678 1070
 			}
679 1071
 		    ?>
@@ -689,7 +1081,9 @@  discard block
 block discarded – undo
689 1081
 				}
690 1082
 				foreach($allairlinenames as $airline) {
691 1083
 					$airline_name = $airline['airline_name'];
692
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
1084
+					if (strlen($airline_name) > 30) {
1085
+						$airline_name = substr($airline_name,0,30).'...';
1086
+					}
693 1087
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
694 1088
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
695 1089
 					} else {
@@ -707,7 +1101,10 @@  discard block
 block discarded – undo
707 1101
 		    <li><?php echo _("Display alliance:"); ?>
708 1102
 		    <br/>
709 1103
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
710
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
1104
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
1105
+	echo ' selected';
1106
+}
1107
+?>><?php echo _("All"); ?></option>
711 1108
 			    <?php
712 1109
 				foreach($allalliancenames as $alliance) {
713 1110
 					$alliance_name = $alliance['alliance'];
@@ -766,10 +1163,22 @@  discard block
 block discarded – undo
766 1163
 		    ?>
767 1164
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
768 1165
 			<select class="selectpicker" onchange="airlinestype(this);">
769
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
770
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
771
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
772
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1166
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1167
+	echo ' selected';
1168
+}
1169
+?>><?php echo _("All"); ?></option>
1170
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1171
+	echo ' selected';
1172
+}
1173
+?>><?php echo _("Passenger"); ?></option>
1174
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1175
+	echo ' selected';
1176
+}
1177
+?>><?php echo _("Cargo"); ?></option>
1178
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1179
+	echo ' selected';
1180
+}
1181
+?>><?php echo _("Military"); ?></option>
773 1182
 			</select>
774 1183
 		    </li>
775 1184
 		    <?php
@@ -783,7 +1192,10 @@  discard block
 block discarded – undo
783 1192
 		    ?>
784 1193
 		    <li>
785 1194
 			<?php echo _("Display vessels with MMSI:"); ?>
786
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1195
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1196
+	print $_COOKIE['filter_mmsi'];
1197
+}
1198
+?>" />
787 1199
 		    </li>
788 1200
 			<?php
789 1201
 				if (isset($globalVM) && $globalVM) {
@@ -814,7 +1226,10 @@  discard block
 block discarded – undo
814 1226
 		    ?>
815 1227
 		    <li>
816 1228
 			<?php echo _("Display with ident:"); ?>
817
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1229
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1230
+	print $_COOKIE['filter_ident'];
1231
+}
1232
+?>" />
818 1233
 		    </li>
819 1234
 		</ul>
820 1235
 	    </form>
@@ -830,7 +1245,10 @@  discard block
 block discarded – undo
830 1245
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
831 1246
 	    <form>
832 1247
 		<ul>
833
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1248
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1249
+	print 'checked';
1250
+}
1251
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
834 1252
 		    <li><?php echo _("Type:"); ?>
835 1253
 			<select class="selectpicker" multiple onchange="sattypes(this);">
836 1254
 			    <?php
@@ -838,25 +1256,45 @@  discard block
 block discarded – undo
838 1256
 				$types = $Satellite->get_tle_types();
839 1257
 				foreach ($types as $type) {
840 1258
 					$type_name = $type['tle_type'];
841
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
842
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
843
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
844
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
845
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
846
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
847
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
848
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
849
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
850
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
851
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
852
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
853
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
854
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
855
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
856
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
857
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
858
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
859
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1259
+					if ($type_name == 'musson') {
1260
+						$type_name = 'Russian LEO Navigation';
1261
+					} else if ($type_name == 'nnss') {
1262
+						$type_name = 'Navi Navigation Satellite System';
1263
+					} else if ($type_name == 'sbas') {
1264
+						$type_name = 'Satellite-Based Augmentation System';
1265
+					} else if ($type_name == 'glo-ops') {
1266
+						$type_name = 'Glonass Operational';
1267
+					} else if ($type_name == 'gps-ops') {
1268
+						$type_name = 'GPS Operational';
1269
+					} else if ($type_name == 'argos') {
1270
+						$type_name = 'ARGOS Data Collection System';
1271
+					} else if ($type_name == 'tdrss') {
1272
+						$type_name = 'Tracking and Data Relay Satellite System';
1273
+					} else if ($type_name == 'sarsat') {
1274
+						$type_name = 'Search & Rescue';
1275
+					} else if ($type_name == 'dmc') {
1276
+						$type_name = 'Disaster Monitoring';
1277
+					} else if ($type_name == 'resource') {
1278
+						$type_name = 'Earth Resources';
1279
+					} else if ($type_name == 'stations') {
1280
+						$type_name = 'Space Stations';
1281
+					} else if ($type_name == 'geo') {
1282
+						$type_name = 'Geostationary';
1283
+					} else if ($type_name == 'amateur') {
1284
+						$type_name = 'Amateur Radio';
1285
+					} else if ($type_name == 'x-comm') {
1286
+						$type_name = 'Experimental';
1287
+					} else if ($type_name == 'other-comm') {
1288
+						$type_name = 'Other Comm';
1289
+					} else if ($type_name == 'science') {
1290
+						$type_name = 'Space & Earth Science';
1291
+					} else if ($type_name == 'military') {
1292
+						$type_name = 'Miscellaneous Military';
1293
+					} else if ($type_name == 'radar') {
1294
+						$type_name = 'Radar Calibration';
1295
+					} else if ($type_name == 'tle-new') {
1296
+						$type_name = 'Last 30 days launches';
1297
+					}
860 1298
 					
861 1299
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
862 1300
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.