Completed
Push — master ( 4b9f50...005bcb )
by Yannick
28:37
created
install/class.update_db.php 2 patches
Doc Comments   +48 added lines patch added patch discarded remove patch
@@ -10,6 +10,9 @@  discard block
 block discarded – undo
10 10
 class update_db {
11 11
 	public static $db_sqlite;
12 12
 
13
+	/**
14
+	 * @param string $file
15
+	 */
13 16
 	public static function download($url, $file, $referer = '') {
14 17
 		//$file = str_replace('/',DIRECTORY_SEPARATOR,$file);
15 18
 		$fp = fopen($file, 'w+');
@@ -25,6 +28,9 @@  discard block
 block discarded – undo
25 28
 		fclose($fp);
26 29
 	}
27 30
 
31
+	/**
32
+	 * @param string $in_file
33
+	 */
28 34
 	public static function gunzip($in_file,$out_file_name = '') {
29 35
 		//echo $in_file.' -> '.$out_file_name."\n";
30 36
 		$buffer_size = 4096; // read 4kb at a time
@@ -46,6 +52,9 @@  discard block
 block discarded – undo
46 52
 		}
47 53
 	}
48 54
 
55
+	/**
56
+	 * @param string $in_file
57
+	 */
49 58
 	public static function unzip($in_file) {
50 59
 		if ($in_file != '' && file_exists($in_file)) {
51 60
 			$path = pathinfo(realpath($in_file), PATHINFO_DIRNAME);
@@ -67,6 +76,9 @@  discard block
 block discarded – undo
67 76
 		}
68 77
 	}
69 78
 	
79
+	/**
80
+	 * @param string $database_file
81
+	 */
70 82
 	public static function retrieve_route_sqlite_to_dest($database_file) {
71 83
 		global $globalDebug, $globalTransaction;
72 84
 		//$query = 'TRUNCATE TABLE routes';
@@ -109,6 +121,10 @@  discard block
 block discarded – undo
109 121
 		}
110 122
                 return '';
111 123
 	}
124
+
125
+	/**
126
+	 * @param string $database_file
127
+	 */
112 128
 	public static function retrieve_route_oneworld($database_file) {
113 129
 		global $globalDebug, $globalTransaction;
114 130
 		//$query = 'TRUNCATE TABLE routes';
@@ -150,6 +166,9 @@  discard block
 block discarded – undo
150 166
                 return '';
151 167
 	}
152 168
 	
169
+	/**
170
+	 * @param string $database_file
171
+	 */
153 172
 	public static function retrieve_route_skyteam($database_file) {
154 173
 		global $globalDebug, $globalTransaction;
155 174
 		//$query = 'TRUNCATE TABLE routes';
@@ -192,6 +211,10 @@  discard block
 block discarded – undo
192 211
 		}
193 212
                 return '';
194 213
 	}
214
+
215
+	/**
216
+	 * @param string $database_file
217
+	 */
195 218
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
196 219
 		global $globalTransaction;
197 220
 		//$query = 'TRUNCATE TABLE aircraft_modes';
@@ -258,6 +281,9 @@  discard block
 block discarded – undo
258 281
 		return '';
259 282
 	}
260 283
 
284
+	/**
285
+	 * @param string $database_file
286
+	 */
261 287
 	public static function retrieve_modes_flarmnet($database_file) {
262 288
 		global $globalTransaction;
263 289
 		$Common = new Common();
@@ -328,6 +354,9 @@  discard block
 block discarded – undo
328 354
 		return '';
329 355
 	}
330 356
 
357
+	/**
358
+	 * @param string $database_file
359
+	 */
331 360
 	public static function retrieve_modes_ogn($database_file) {
332 361
 		global $globalTransaction;
333 362
 		//$query = 'TRUNCATE TABLE aircraft_modes';
@@ -397,6 +426,9 @@  discard block
 block discarded – undo
397 426
 		return '';
398 427
 	}
399 428
 
429
+	/**
430
+	 * @param string $database_file
431
+	 */
400 432
 	public static function retrieve_owner($database_file,$country = 'F') {
401 433
 		global $globalTransaction, $globalMasterSource;
402 434
 		//$query = 'TRUNCATE TABLE aircraft_modes';
@@ -1332,6 +1364,10 @@  discard block
 block discarded – undo
1332 1364
 		return '';
1333 1365
         }
1334 1366
 
1367
+	/**
1368
+	 * @param string $filename
1369
+	 * @param string $tletype
1370
+	 */
1335 1371
 	public static function tle($filename,$tletype) {
1336 1372
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1337 1373
 		global $tmp_dir, $globalTransaction;
@@ -1381,6 +1417,9 @@  discard block
 block discarded – undo
1381 1417
 		return '';
1382 1418
         }
1383 1419
 
1420
+	/**
1421
+	 * @param string $filename
1422
+	 */
1384 1423
 	public static function satellite_ucsdb($filename) {
1385 1424
 		global $tmp_dir, $globalTransaction;
1386 1425
 		$query = "DELETE FROM satellite";
@@ -1428,6 +1467,9 @@  discard block
 block discarded – undo
1428 1467
 		return '';
1429 1468
 	}
1430 1469
 
1470
+	/**
1471
+	 * @param string $filename
1472
+	 */
1431 1473
 	public static function satellite_celestrak($filename) {
1432 1474
 		global $tmp_dir, $globalTransaction;
1433 1475
 		$satcat_sources = array(
@@ -1743,6 +1785,9 @@  discard block
 block discarded – undo
1743 1785
 
1744 1786
 	}
1745 1787
 */
1788
+	/**
1789
+	 * @param string $filename
1790
+	 */
1746 1791
 	public static function waypoints($filename) {
1747 1792
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1748 1793
 		global $tmp_dir, $globalTransaction;
@@ -1790,6 +1835,9 @@  discard block
 block discarded – undo
1790 1835
 		return '';
1791 1836
         }
1792 1837
 
1838
+	/**
1839
+	 * @param string $filename
1840
+	 */
1793 1841
 	public static function ivao_airlines($filename) {
1794 1842
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1795 1843
 		global $tmp_dir, $globalTransaction;
Please login to merge, or discard this patch.
Braces   +1026 added lines, -356 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 		curl_setopt($ch, CURLOPT_URL, $url);
18 18
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
19 19
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
20
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
20
+		if ($referer != '') {
21
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
22
+		}
21 23
 		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');
22 24
 		curl_setopt($ch, CURLOPT_FILE, $fp);
23 25
 		curl_exec($ch);
@@ -28,12 +30,16 @@  discard block
 block discarded – undo
28 30
 	public static function gunzip($in_file,$out_file_name = '') {
29 31
 		//echo $in_file.' -> '.$out_file_name."\n";
30 32
 		$buffer_size = 4096; // read 4kb at a time
31
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
33
+		if ($out_file_name == '') {
34
+			$out_file_name = str_replace('.gz', '', $in_file);
35
+		}
32 36
 		if ($in_file != '' && file_exists($in_file)) {
33 37
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
34
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
35
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
36
-			else {
38
+			if (function_exists('gzopen')) {
39
+				$file = gzopen($in_file,'rb');
40
+			} elseif (function_exists('gzopen64')) {
41
+				$file = gzopen64($in_file,'rb');
42
+			} else {
37 43
 				echo 'gzopen not available';
38 44
 				die;
39 45
 			}
@@ -54,8 +60,12 @@  discard block
 block discarded – undo
54 60
 			if ($res === TRUE) {
55 61
 				$zip->extractTo($path);
56 62
 				$zip->close();
57
-			} else return false;
58
-		} else return false;
63
+			} else {
64
+				return false;
65
+			}
66
+		} else {
67
+			return false;
68
+		}
59 69
 	}
60 70
 	
61 71
 	public static function connect_sqlite($database) {
@@ -70,7 +80,9 @@  discard block
 block discarded – undo
70 80
 	public static function retrieve_route_sqlite_to_dest($database_file) {
71 81
 		global $globalDebug, $globalTransaction;
72 82
 		//$query = 'TRUNCATE TABLE routes';
73
-		if ($globalDebug) echo " - Delete previous routes from DB -";
83
+		if ($globalDebug) {
84
+			echo " - Delete previous routes from DB -";
85
+		}
74 86
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
75 87
 		$Connection = new Connection();
76 88
 		try {
@@ -81,7 +93,9 @@  discard block
 block discarded – undo
81 93
                         return "error : ".$e->getMessage();
82 94
                 }
83 95
 
84
-    		if ($globalDebug) echo " - Add routes to DB -";
96
+    		if ($globalDebug) {
97
+    			echo " - Add routes to DB -";
98
+    		}
85 99
     		update_db::connect_sqlite($database_file);
86 100
 		//$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';
87 101
 		$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";
@@ -96,15 +110,21 @@  discard block
 block discarded – undo
96 110
 		$Connection = new Connection();
97 111
 		$sth_dest = $Connection->db->prepare($query_dest);
98 112
 		try {
99
-			if ($globalTransaction) $Connection->db->beginTransaction();
113
+			if ($globalTransaction) {
114
+				$Connection->db->beginTransaction();
115
+			}
100 116
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
101 117
 				//$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);
102 118
 				$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);
103 119
 				$sth_dest->execute($query_dest_values);
104 120
             		}
105
-			if ($globalTransaction) $Connection->db->commit();
121
+			if ($globalTransaction) {
122
+				$Connection->db->commit();
123
+			}
106 124
 		} catch(PDOException $e) {
107
-			if ($globalTransaction) $Connection->db->rollBack(); 
125
+			if ($globalTransaction) {
126
+				$Connection->db->rollBack();
127
+			}
108 128
 			return "error : ".$e->getMessage();
109 129
 		}
110 130
                 return '';
@@ -112,7 +132,9 @@  discard block
 block discarded – undo
112 132
 	public static function retrieve_route_oneworld($database_file) {
113 133
 		global $globalDebug, $globalTransaction;
114 134
 		//$query = 'TRUNCATE TABLE routes';
115
-		if ($globalDebug) echo " - Delete previous routes from DB -";
135
+		if ($globalDebug) {
136
+			echo " - Delete previous routes from DB -";
137
+		}
116 138
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
117 139
 		$Connection = new Connection();
118 140
 		try {
@@ -123,14 +145,18 @@  discard block
 block discarded – undo
123 145
                         return "error : ".$e->getMessage();
124 146
                 }
125 147
 
126
-    		if ($globalDebug) echo " - Add routes to DB -";
148
+    		if ($globalDebug) {
149
+    			echo " - Add routes to DB -";
150
+    		}
127 151
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
128 152
 		$Spotter = new Spotter();
129 153
 		if ($fh = fopen($database_file,"r")) {
130 154
 			$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)';
131 155
 			$Connection = new Connection();
132 156
 			$sth_dest = $Connection->db->prepare($query_dest);
133
-			if ($globalTransaction) $Connection->db->beginTransaction();
157
+			if ($globalTransaction) {
158
+				$Connection->db->beginTransaction();
159
+			}
134 160
 			while (!feof($fh)) {
135 161
 				$line = fgetcsv($fh,9999,',');
136 162
 				if ($line[0] != '') {
@@ -139,13 +165,17 @@  discard block
 block discarded – undo
139 165
 							$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');
140 166
 							$sth_dest->execute($query_dest_values);
141 167
 						} catch(PDOException $e) {
142
-							if ($globalTransaction) $Connection->db->rollBack(); 
168
+							if ($globalTransaction) {
169
+								$Connection->db->rollBack();
170
+							}
143 171
 							return "error : ".$e->getMessage();
144 172
 						}
145 173
 					}
146 174
 				}
147 175
 			}
148
-			if ($globalTransaction) $Connection->db->commit();
176
+			if ($globalTransaction) {
177
+				$Connection->db->commit();
178
+			}
149 179
 		}
150 180
                 return '';
151 181
 	}
@@ -153,7 +183,9 @@  discard block
 block discarded – undo
153 183
 	public static function retrieve_route_skyteam($database_file) {
154 184
 		global $globalDebug, $globalTransaction;
155 185
 		//$query = 'TRUNCATE TABLE routes';
156
-		if ($globalDebug) echo " - Delete previous routes from DB -";
186
+		if ($globalDebug) {
187
+			echo " - Delete previous routes from DB -";
188
+		}
157 189
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
158 190
 		$Connection = new Connection();
159 191
 		try {
@@ -164,7 +196,9 @@  discard block
 block discarded – undo
164 196
                         return "error : ".$e->getMessage();
165 197
                 }
166 198
 
167
-    		if ($globalDebug) echo " - Add routes to DB -";
199
+    		if ($globalDebug) {
200
+    			echo " - Add routes to DB -";
201
+    		}
168 202
 
169 203
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
170 204
 		$Spotter = new Spotter();
@@ -173,7 +207,9 @@  discard block
 block discarded – undo
173 207
 			$Connection = new Connection();
174 208
 			$sth_dest = $Connection->db->prepare($query_dest);
175 209
 			try {
176
-				if ($globalTransaction) $Connection->db->beginTransaction();
210
+				if ($globalTransaction) {
211
+					$Connection->db->beginTransaction();
212
+				}
177 213
 				while (!feof($fh)) {
178 214
 					$line = fgetcsv($fh,9999,',');
179 215
 					if ($line[0] != '') {
@@ -184,9 +220,13 @@  discard block
 block discarded – undo
184 220
 						}
185 221
 					}
186 222
 				}
187
-				if ($globalTransaction) $Connection->db->commit();
223
+				if ($globalTransaction) {
224
+					$Connection->db->commit();
225
+				}
188 226
 			} catch(PDOException $e) {
189
-				if ($globalTransaction) $Connection->db->rollBack(); 
227
+				if ($globalTransaction) {
228
+					$Connection->db->rollBack();
229
+				}
190 230
 				return "error : ".$e->getMessage();
191 231
 			}
192 232
 		}
@@ -229,11 +269,16 @@  discard block
 block discarded – undo
229 269
 		$sth_dest = $Connection->db->prepare($query_dest);
230 270
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
231 271
 		try {
232
-			if ($globalTransaction) $Connection->db->beginTransaction();
272
+			if ($globalTransaction) {
273
+				$Connection->db->beginTransaction();
274
+			}
233 275
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
234 276
 			//$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']);
235
-				if ($values['UserString4'] == 'M') $type = 'military';
236
-				else $type = null;
277
+				if ($values['UserString4'] == 'M') {
278
+					$type = 'military';
279
+				} else {
280
+					$type = null;
281
+				}
237 282
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
238 283
 				$sth_dest->execute($query_dest_values);
239 284
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
@@ -241,7 +286,9 @@  discard block
 block discarded – undo
241 286
 				    $sth_dest_owner->execute($query_dest_owner_values);
242 287
 				}
243 288
             		}
244
-			if ($globalTransaction) $Connection->db->commit();
289
+			if ($globalTransaction) {
290
+				$Connection->db->commit();
291
+			}
245 292
 		} catch(PDOException $e) {
246 293
 			return "error : ".$e->getMessage();
247 294
 		}
@@ -278,7 +325,9 @@  discard block
 block discarded – undo
278 325
 			$Connection = new Connection();
279 326
 			$sth_dest = $Connection->db->prepare($query_dest);
280 327
 			try {
281
-				if ($globalTransaction) $Connection->db->beginTransaction();
328
+				if ($globalTransaction) {
329
+					$Connection->db->beginTransaction();
330
+				}
282 331
             			while (!feof($fh)) {
283 332
             				$values = array();
284 333
             				$line = $Common->hex2str(fgets($fh,9999));
@@ -289,7 +338,9 @@  discard block
 block discarded – undo
289 338
             				// Check if we can find ICAO, else set it to GLID
290 339
             				$aircraft_name_split = explode(' ',$aircraft_name);
291 340
             				$search_more = '';
292
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
341
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
342
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
343
+            				}
293 344
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
294 345
             				$sth_search = $Connection->db->prepare($query_search);
295 346
 					try {
@@ -302,7 +353,9 @@  discard block
 block discarded – undo
302 353
 					} catch(PDOException $e) {
303 354
 						return "error : ".$e->getMessage();
304 355
 					}
305
-					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
356
+					if (!isset($values['ICAOTypeCode'])) {
357
+						$values['ICAOTypeCode'] = 'GLID';
358
+					}
306 359
 					// Add data to db
307 360
 					if ($values['Registration'] != '' && $values['Registration'] != '0000') {
308 361
 						//$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']);
@@ -311,7 +364,9 @@  discard block
 block discarded – undo
311 364
 						$sth_dest->execute($query_dest_values);
312 365
 					}
313 366
 				}
314
-				if ($globalTransaction) $Connection->db->commit();
367
+				if ($globalTransaction) {
368
+					$Connection->db->commit();
369
+				}
315 370
 			} catch(PDOException $e) {
316 371
 				return "error : ".$e->getMessage();
317 372
 			}
@@ -347,7 +402,9 @@  discard block
 block discarded – undo
347 402
 			$Connection = new Connection();
348 403
 			$sth_dest = $Connection->db->prepare($query_dest);
349 404
 			try {
350
-				if ($globalTransaction) $Connection->db->beginTransaction();
405
+				if ($globalTransaction) {
406
+					$Connection->db->beginTransaction();
407
+				}
351 408
 				$tmp = fgetcsv($fh,9999,',',"'");
352 409
             			while (!feof($fh)) {
353 410
             				$line = fgetcsv($fh,9999,',',"'");
@@ -361,13 +418,17 @@  discard block
 block discarded – undo
361 418
             				// Check if we can find ICAO, else set it to GLID
362 419
             				$aircraft_name_split = explode(' ',$aircraft_name);
363 420
             				$search_more = '';
364
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
421
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
422
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
423
+            				}
365 424
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
366 425
             				$sth_search = $Connection->db->prepare($query_search);
367 426
 					try {
368 427
                                     		$sth_search->execute();
369 428
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
370
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
429
+	            				if (isset($result['icao']) && $result['icao'] != '') {
430
+	            					$values['ICAOTypeCode'] = $result['icao'];
431
+	            				}
371 432
 					} catch(PDOException $e) {
372 433
 						return "error : ".$e->getMessage();
373 434
 					}
@@ -380,7 +441,9 @@  discard block
 block discarded – undo
380 441
 						$sth_dest->execute($query_dest_values);
381 442
 					}
382 443
 				}
383
-				if ($globalTransaction) $Connection->db->commit();
444
+				if ($globalTransaction) {
445
+					$Connection->db->commit();
446
+				}
384 447
 			} catch(PDOException $e) {
385 448
 				return "error : ".$e->getMessage();
386 449
 			}
@@ -419,7 +482,9 @@  discard block
 block discarded – undo
419 482
 			$sth_dest = $Connection->db->prepare($query_dest);
420 483
 			$sth_modes = $Connection->db->prepare($query_modes);
421 484
 			try {
422
-				if ($globalTransaction) $Connection->db->beginTransaction();
485
+				if ($globalTransaction) {
486
+					$Connection->db->beginTransaction();
487
+				}
423 488
 				$tmp = fgetcsv($fh,9999,',','"');
424 489
             			while (!feof($fh)) {
425 490
             				$line = fgetcsv($fh,9999,',','"');
@@ -429,16 +494,22 @@  discard block
 block discarded – undo
429 494
             				    $values['registration'] = $line[0];
430 495
             				    $values['base'] = $line[4];
431 496
             				    $values['owner'] = $line[5];
432
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
433
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
497
+            				    if ($line[6] == '') {
498
+            				    	$values['date_first_reg'] = null;
499
+            				    } else {
500
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
501
+					    }
434 502
 					    $values['cancel'] = $line[7];
435 503
 					} elseif ($country == 'EI') {
436 504
 					    // TODO : add modeS & reg to aircraft_modes
437 505
             				    $values['registration'] = $line[0];
438 506
             				    $values['base'] = $line[3];
439 507
             				    $values['owner'] = $line[2];
440
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
441
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
508
+            				    if ($line[1] == '') {
509
+            				    	$values['date_first_reg'] = null;
510
+            				    } else {
511
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
512
+					    }
442 513
 					    $values['cancel'] = '';
443 514
 					    $values['modes'] = $line[7];
444 515
 					    $values['icao'] = $line[8];
@@ -457,16 +528,22 @@  discard block
 block discarded – undo
457 528
             				    $values['registration'] = $line[3];
458 529
             				    $values['base'] = null;
459 530
             				    $values['owner'] = $line[5];
460
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
461
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
531
+            				    if ($line[18] == '') {
532
+            				    	$values['date_first_reg'] = null;
533
+            				    } else {
534
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
535
+					    }
462 536
 					    $values['cancel'] = '';
463 537
 					} elseif ($country == 'VH') {
464 538
 					    // TODO : add modeS & reg to aircraft_modes
465 539
             				    $values['registration'] = $line[0];
466 540
             				    $values['base'] = null;
467 541
             				    $values['owner'] = $line[12];
468
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
469
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
542
+            				    if ($line[28] == '') {
543
+            				    	$values['date_first_reg'] = null;
544
+            				    } else {
545
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
546
+					    }
470 547
 
471 548
 					    $values['cancel'] = $line[39];
472 549
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -485,29 +562,41 @@  discard block
 block discarded – undo
485 562
             				    $values['registration'] = $line[0];
486 563
             				    $values['base'] = null;
487 564
             				    $values['owner'] = $line[8];
488
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
489
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
565
+            				    if ($line[7] == '') {
566
+            				    	$values['date_first_reg'] = null;
567
+            				    } else {
568
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
569
+					    }
490 570
 					    $values['cancel'] = '';
491 571
 					} elseif ($country == 'PP') {
492 572
             				    $values['registration'] = $line[0];
493 573
             				    $values['base'] = null;
494 574
             				    $values['owner'] = $line[4];
495
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
496
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
575
+            				    if ($line[6] == '') {
576
+            				    	$values['date_first_reg'] = null;
577
+            				    } else {
578
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
579
+					    }
497 580
 					    $values['cancel'] = $line[7];
498 581
 					} elseif ($country == 'E7') {
499 582
             				    $values['registration'] = $line[0];
500 583
             				    $values['base'] = null;
501 584
             				    $values['owner'] = $line[4];
502
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
503
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
585
+            				    if ($line[5] == '') {
586
+            				    	$values['date_first_reg'] = null;
587
+            				    } else {
588
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
589
+					    }
504 590
 					    $values['cancel'] = '';
505 591
 					} elseif ($country == '8Q') {
506 592
             				    $values['registration'] = $line[0];
507 593
             				    $values['base'] = null;
508 594
             				    $values['owner'] = $line[3];
509
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
510
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
595
+            				    if ($line[7] == '') {
596
+            				    	$values['date_first_reg'] = null;
597
+            				    } else {
598
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
599
+					    }
511 600
 					    $values['cancel'] = '';
512 601
 					} elseif ($country == 'ZK') {
513 602
             				    $values['registration'] = $line[0];
@@ -552,7 +641,9 @@  discard block
 block discarded – undo
552 641
 						$sth_modes->execute($query_modes_values);
553 642
 					}
554 643
 				}
555
-				if ($globalTransaction) $Connection->db->commit();
644
+				if ($globalTransaction) {
645
+					$Connection->db->commit();
646
+				}
556 647
 			} catch(PDOException $e) {
557 648
 				return "error : ".$e->getMessage();
558 649
 			}
@@ -688,25 +779,45 @@  discard block
 block discarded – undo
688 779
 		    VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)";
689 780
 		$Connection = new Connection();
690 781
 		$sth_dest = $Connection->db->prepare($query_dest);
691
-		if ($globalTransaction) $Connection->db->beginTransaction();
782
+		if ($globalTransaction) {
783
+			$Connection->db->beginTransaction();
784
+		}
692 785
   
693 786
 		$i = 0;
694 787
 		while($row = sparql_fetch_array($result))
695 788
 		{
696 789
 			if ($i >= 1) {
697 790
 			//print_r($row);
698
-			if (!isset($row['iata'])) $row['iata'] = '';
699
-			if (!isset($row['icao'])) $row['icao'] = '';
700
-			if (!isset($row['type'])) $row['type'] = '';
701
-			if (!isset($row['altitude'])) $row['altitude'] = '';
791
+			if (!isset($row['iata'])) {
792
+				$row['iata'] = '';
793
+			}
794
+			if (!isset($row['icao'])) {
795
+				$row['icao'] = '';
796
+			}
797
+			if (!isset($row['type'])) {
798
+				$row['type'] = '';
799
+			}
800
+			if (!isset($row['altitude'])) {
801
+				$row['altitude'] = '';
802
+			}
702 803
 			if (isset($row['city_bis'])) {
703 804
 				$row['city'] = $row['city_bis'];
704 805
 			}
705
-			if (!isset($row['city'])) $row['city'] = '';
706
-			if (!isset($row['country'])) $row['country'] = '';
707
-			if (!isset($row['homepage'])) $row['homepage'] = '';
708
-			if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = '';
709
-			if (!isset($row['name'])) continue;
806
+			if (!isset($row['city'])) {
807
+				$row['city'] = '';
808
+			}
809
+			if (!isset($row['country'])) {
810
+				$row['country'] = '';
811
+			}
812
+			if (!isset($row['homepage'])) {
813
+				$row['homepage'] = '';
814
+			}
815
+			if (!isset($row['wikipedia_page'])) {
816
+				$row['wikipedia_page'] = '';
817
+			}
818
+			if (!isset($row['name'])) {
819
+				continue;
820
+			}
710 821
 			if (!isset($row['image'])) {
711 822
 				$row['image'] = '';
712 823
 				$row['image_thumb'] = '';
@@ -762,7 +873,9 @@  discard block
 block discarded – undo
762 873
 
763 874
 			$i++;
764 875
 		}
765
-		if ($globalTransaction) $Connection->db->commit();
876
+		if ($globalTransaction) {
877
+			$Connection->db->commit();
878
+		}
766 879
 		/*
767 880
 		echo "Delete duplicate rows...\n";
768 881
 		$query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)';
@@ -805,7 +918,9 @@  discard block
 block discarded – undo
805 918
 		$delimiter = ',';
806 919
 		$out_file = $tmp_dir.'airports.csv';
807 920
 		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
808
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
921
+		if (!file_exists($out_file) || !is_readable($out_file)) {
922
+			return FALSE;
923
+		}
809 924
 		echo "Add data from ourairports.com...\n";
810 925
 
811 926
 		$header = NULL;
@@ -815,8 +930,9 @@  discard block
 block discarded – undo
815 930
 			//$Connection->db->beginTransaction();
816 931
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
817 932
 			{
818
-				if(!$header) $header = $row;
819
-				else {
933
+				if(!$header) {
934
+					$header = $row;
935
+				} else {
820 936
 					$data = array();
821 937
 					$data = array_combine($header, $row);
822 938
 					try {
@@ -857,7 +973,9 @@  discard block
 block discarded – undo
857 973
 		echo "Download data from another free database...\n";
858 974
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
859 975
 		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
860
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
976
+		if (!file_exists($out_file) || !is_readable($out_file)) {
977
+			return FALSE;
978
+		}
861 979
 		update_db::unzip($out_file);
862 980
 		$header = NULL;
863 981
 		echo "Add data from another free database...\n";
@@ -868,8 +986,9 @@  discard block
 block discarded – undo
868 986
 			//$Connection->db->beginTransaction();
869 987
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
870 988
 			{
871
-				if(!$header) $header = $row;
872
-				else {
989
+				if(!$header) {
990
+					$header = $row;
991
+				} else {
873 992
 					$data = $row;
874 993
 
875 994
 					$query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao';
@@ -1038,7 +1157,9 @@  discard block
 block discarded – undo
1038 1157
 		if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE)
1039 1158
 		{
1040 1159
 			$i = 0;
1041
-			if ($globalTransaction) $Connection->db->beginTransaction();
1160
+			if ($globalTransaction) {
1161
+				$Connection->db->beginTransaction();
1162
+			}
1042 1163
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1043 1164
 			{
1044 1165
 				if ($i > 0) {
@@ -1051,7 +1172,9 @@  discard block
 block discarded – undo
1051 1172
 					}
1052 1173
 					$result_search = $sths->fetchAll(PDO::FETCH_ASSOC);
1053 1174
 					if (!empty($result_search)) {
1054
-						if ($globalDebug) echo '.';
1175
+						if ($globalDebug) {
1176
+							echo '.';
1177
+						}
1055 1178
 							//if ($globalDBdriver == 'mysql') {
1056 1179
 							//	$queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao';
1057 1180
 							//} else {
@@ -1073,8 +1196,12 @@  discard block
 block discarded – undo
1073 1196
 						}
1074 1197
 						$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC);
1075 1198
 						if (!empty($result_search_mfr)) {
1076
-							if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23];
1077
-							if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15];
1199
+							if (trim($data[16]) == '' && trim($data[23]) != '') {
1200
+								$data[16] = $data[23];
1201
+							}
1202
+							if (trim($data[16]) == '' && trim($data[15]) != '') {
1203
+								$data[16] = $data[15];
1204
+							}
1078 1205
 							$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)';
1079 1206
 							try {
1080 1207
 								$sthf = $Connection->db->prepare($queryf);
@@ -1085,7 +1212,9 @@  discard block
 block discarded – undo
1085 1212
 						}
1086 1213
 					}
1087 1214
 					if (strtotime($data[29]) > time()) {
1088
-						if ($globalDebug) echo 'i';
1215
+						if ($globalDebug) {
1216
+							echo 'i';
1217
+						}
1089 1218
 						$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
1090 1219
 						try {
1091 1220
 							$sth = $Connection->db->prepare($query);
@@ -1096,13 +1225,19 @@  discard block
 block discarded – undo
1096 1225
 					}
1097 1226
 				}
1098 1227
 				if ($i % 90 == 0) {
1099
-					if ($globalTransaction) $Connection->db->commit();
1100
-					if ($globalTransaction) $Connection->db->beginTransaction();
1228
+					if ($globalTransaction) {
1229
+						$Connection->db->commit();
1230
+					}
1231
+					if ($globalTransaction) {
1232
+						$Connection->db->beginTransaction();
1233
+					}
1101 1234
 				}
1102 1235
 				$i++;
1103 1236
 			}
1104 1237
 			fclose($handle);
1105
-			if ($globalTransaction) $Connection->db->commit();
1238
+			if ($globalTransaction) {
1239
+				$Connection->db->commit();
1240
+			}
1106 1241
 		}
1107 1242
 		//print_r($mfr);
1108 1243
 		return '';
@@ -1127,11 +1262,15 @@  discard block
 block discarded – undo
1127 1262
 			$i = 0;
1128 1263
 			//$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
1129 1264
 			//$Connection->db->beginTransaction();
1130
-			if ($globalTransaction) $Connection->db->beginTransaction();
1265
+			if ($globalTransaction) {
1266
+				$Connection->db->beginTransaction();
1267
+			}
1131 1268
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1132 1269
 			{
1133 1270
 				if ($i > 0) {
1134
-					if ($data[1] == 'NULL') $data[1] = $data[0];
1271
+					if ($data[1] == 'NULL') {
1272
+						$data[1] = $data[0];
1273
+					}
1135 1274
 					$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)';
1136 1275
 					try {
1137 1276
 						$sth = $Connection->db->prepare($query);
@@ -1143,7 +1282,9 @@  discard block
 block discarded – undo
1143 1282
 				$i++;
1144 1283
 			}
1145 1284
 			fclose($handle);
1146
-			if ($globalTransaction) $Connection->db->commit();
1285
+			if ($globalTransaction) {
1286
+				$Connection->db->commit();
1287
+			}
1147 1288
 		}
1148 1289
 		return '';
1149 1290
         }
@@ -1164,7 +1305,9 @@  discard block
 block discarded – undo
1164 1305
 		if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE)
1165 1306
 		{
1166 1307
 			$i = 0;
1167
-			if ($globalTransaction) $Connection->db->beginTransaction();
1308
+			if ($globalTransaction) {
1309
+				$Connection->db->beginTransaction();
1310
+			}
1168 1311
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1169 1312
 			{
1170 1313
 				if ($i > 0) {
@@ -1180,7 +1323,9 @@  discard block
 block discarded – undo
1180 1323
 				$i++;
1181 1324
 			}
1182 1325
 			fclose($handle);
1183
-			if ($globalTransaction) $Connection->db->commit();
1326
+			if ($globalTransaction) {
1327
+				$Connection->db->commit();
1328
+			}
1184 1329
 		}
1185 1330
 		return '';
1186 1331
         }
@@ -1200,7 +1345,9 @@  discard block
 block discarded – undo
1200 1345
 		if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE)
1201 1346
 		{
1202 1347
 			$i = 0;
1203
-			if ($globalTransaction) $Connection->db->beginTransaction();
1348
+			if ($globalTransaction) {
1349
+				$Connection->db->beginTransaction();
1350
+			}
1204 1351
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1205 1352
 			{
1206 1353
 				if ($i > 0) {
@@ -1209,13 +1356,17 @@  discard block
 block discarded – undo
1209 1356
 						$sth = $Connection->db->prepare($query);
1210 1357
 						$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'));
1211 1358
 					} catch(PDOException $e) {
1212
-						if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1359
+						if ($globalDebug) {
1360
+							echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1361
+						}
1213 1362
 					}
1214 1363
 				}
1215 1364
 				$i++;
1216 1365
 			}
1217 1366
 			fclose($handle);
1218
-			if ($globalTransaction) $Connection->db->commit();
1367
+			if ($globalTransaction) {
1368
+				$Connection->db->commit();
1369
+			}
1219 1370
 		}
1220 1371
 		return '';
1221 1372
         }
@@ -1240,7 +1391,9 @@  discard block
 block discarded – undo
1240 1391
 			$i = 0;
1241 1392
 			//$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
1242 1393
 			//$Connection->db->beginTransaction();
1243
-			if ($globalTransaction) $Connection->db->beginTransaction();
1394
+			if ($globalTransaction) {
1395
+				$Connection->db->beginTransaction();
1396
+			}
1244 1397
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1245 1398
 			{
1246 1399
 				if ($i > 0) {
@@ -1256,7 +1409,9 @@  discard block
 block discarded – undo
1256 1409
 				$i++;
1257 1410
 			}
1258 1411
 			fclose($handle);
1259
-			if ($globalTransaction) $Connection->db->commit();
1412
+			if ($globalTransaction) {
1413
+				$Connection->db->commit();
1414
+			}
1260 1415
 		}
1261 1416
 		return '';
1262 1417
         }
@@ -1276,7 +1431,9 @@  discard block
 block discarded – undo
1276 1431
 		if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE)
1277 1432
 		{
1278 1433
 			$i = 0;
1279
-			if ($globalTransaction) $Connection->db->beginTransaction();
1434
+			if ($globalTransaction) {
1435
+				$Connection->db->beginTransaction();
1436
+			}
1280 1437
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1281 1438
 			{
1282 1439
 				if ($i > 0) {
@@ -1293,7 +1450,9 @@  discard block
 block discarded – undo
1293 1450
 				$i++;
1294 1451
 			}
1295 1452
 			fclose($handle);
1296
-			if ($globalTransaction) $Connection->db->commit();
1453
+			if ($globalTransaction) {
1454
+				$Connection->db->commit();
1455
+			}
1297 1456
 		}
1298 1457
 		return '';
1299 1458
 	}
@@ -1312,7 +1471,9 @@  discard block
 block discarded – undo
1312 1471
 		$Connection = new Connection();
1313 1472
 		if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE)
1314 1473
 		{
1315
-			if ($globalTransaction) $Connection->db->beginTransaction();
1474
+			if ($globalTransaction) {
1475
+				$Connection->db->beginTransaction();
1476
+			}
1316 1477
 			while (($data = fgetcsv($handle, 1000)) !== FALSE)
1317 1478
 			{
1318 1479
 				$query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL';
@@ -1327,7 +1488,9 @@  discard block
 block discarded – undo
1327 1488
 				}
1328 1489
 			}
1329 1490
 			fclose($handle);
1330
-			if ($globalTransaction) $Connection->db->commit();
1491
+			if ($globalTransaction) {
1492
+				$Connection->db->commit();
1493
+			}
1331 1494
 		}
1332 1495
 		return '';
1333 1496
         }
@@ -1404,9 +1567,14 @@  discard block
 block discarded – undo
1404 1567
 				if ($i > 0 && $data[0] != '') {
1405 1568
 					$sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]);
1406 1569
 					$period = str_replace(',','',$data[14]);
1407
-					if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60;
1408
-					if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18]));
1409
-					else $launch_date = NULL;
1570
+					if (!empty($period) && strpos($period,'days')) {
1571
+						$period = str_replace(' days','',$period)*24*60;
1572
+					}
1573
+					if ($data[18] != '') {
1574
+						$launch_date = date('Y-m-d',strtotime($data[18]));
1575
+					} else {
1576
+						$launch_date = NULL;
1577
+					}
1410 1578
 					$data = array_map(function($value) {
1411 1579
 						return trim($value) === '' ? null : $value;
1412 1580
 					}, $data);
@@ -1757,7 +1925,9 @@  discard block
 block discarded – undo
1757 1925
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1758 1926
 		{
1759 1927
 			$i = 0;
1760
-			if ($globalTransaction) $Connection->db->beginTransaction();
1928
+			if ($globalTransaction) {
1929
+				$Connection->db->beginTransaction();
1930
+			}
1761 1931
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1762 1932
 			{
1763 1933
 				$i++;
@@ -1785,7 +1955,9 @@  discard block
 block discarded – undo
1785 1955
 				}
1786 1956
 			}
1787 1957
 			fclose($handle);
1788
-			if ($globalTransaction) $Connection->db->commit();
1958
+			if ($globalTransaction) {
1959
+				$Connection->db->commit();
1960
+			}
1789 1961
 		}
1790 1962
 		return '';
1791 1963
         }
@@ -1808,7 +1980,9 @@  discard block
 block discarded – undo
1808 1980
 		$Connection = new Connection();
1809 1981
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1810 1982
 		{
1811
-			if ($globalTransaction) $Connection->db->beginTransaction();
1983
+			if ($globalTransaction) {
1984
+				$Connection->db->beginTransaction();
1985
+			}
1812 1986
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1813 1987
 			{
1814 1988
 				if(count($row) > 1) {
@@ -1822,7 +1996,9 @@  discard block
 block discarded – undo
1822 1996
 				}
1823 1997
 			}
1824 1998
 			fclose($handle);
1825
-			if ($globalTransaction) $Connection->db->commit();
1999
+			if ($globalTransaction) {
2000
+				$Connection->db->commit();
2001
+			}
1826 2002
 		}
1827 2003
 		return '';
1828 2004
         }
@@ -1842,8 +2018,9 @@  discard block
 block discarded – undo
1842 2018
 	        }
1843 2019
 
1844 2020
 
1845
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
1846
-		else {
2021
+		if ($globalDBdriver == 'mysql') {
2022
+			update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
2023
+		} else {
1847 2024
 			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
1848 2025
 			$query = "CREATE EXTENSION postgis";
1849 2026
 			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
@@ -1862,20 +2039,30 @@  discard block
 block discarded – undo
1862 2039
 		global $tmp_dir, $globalDebug;
1863 2040
 		include_once('class.create_db.php');
1864 2041
 		require_once(dirname(__FILE__).'/../require/class.NOTAM.php');
1865
-		if ($globalDebug) echo "NOTAM from FlightAirMap website : Download...";
2042
+		if ($globalDebug) {
2043
+			echo "NOTAM from FlightAirMap website : Download...";
2044
+		}
1866 2045
 		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz');
1867 2046
 		$error = '';
1868 2047
 		if (file_exists($tmp_dir.'notam.txt.gz')) {
1869
-			if ($globalDebug) echo "Gunzip...";
2048
+			if ($globalDebug) {
2049
+				echo "Gunzip...";
2050
+			}
1870 2051
 			update_db::gunzip($tmp_dir.'notam.txt.gz');
1871
-			if ($globalDebug) echo "Add to DB...";
2052
+			if ($globalDebug) {
2053
+				echo "Add to DB...";
2054
+			}
1872 2055
 			//$error = create_db::import_file($tmp_dir.'notam.sql');
1873 2056
 			$NOTAM = new NOTAM();
1874 2057
 			$NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt');
1875
-		} else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed.";
2058
+		} else {
2059
+			$error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed.";
2060
+		}
1876 2061
 		if ($error != '') {
1877 2062
 			return $error;
1878
-		} elseif ($globalDebug) echo "Done\n";
2063
+		} elseif ($globalDebug) {
2064
+			echo "Done\n";
2065
+		}
1879 2066
 		return '';
1880 2067
 	}
1881 2068
 
@@ -1929,67 +2116,111 @@  discard block
 block discarded – undo
1929 2116
 		//if ($globalDebug) echo "IVAO : Download...";
1930 2117
 		//update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip');
1931 2118
 		if (file_exists($tmp_dir.'ivae_feb2013.zip')) {
1932
-			if ($globalDebug) echo "Unzip...";
2119
+			if ($globalDebug) {
2120
+				echo "Unzip...";
2121
+			}
1933 2122
 			update_db::unzip($tmp_dir.'ivae_feb2013.zip');
1934
-			if ($globalDebug) echo "Add to DB...";
2123
+			if ($globalDebug) {
2124
+				echo "Add to DB...";
2125
+			}
1935 2126
 			update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
1936
-			if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
2127
+			if ($globalDebug) {
2128
+				echo "Copy airlines logos to airlines images directory...";
2129
+			}
1937 2130
 			if (is_writable(dirname(__FILE__).'/../images/airlines')) {
1938
-				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1939
-			} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
1940
-		} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
2131
+				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) {
2132
+					$error = "Failed to copy airlines logo.";
2133
+				}
2134
+			} else {
2135
+				$error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
2136
+			}
2137
+		} else {
2138
+			$error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
2139
+		}
1941 2140
 		if ($error != '') {
1942 2141
 			return $error;
1943
-		} elseif ($globalDebug) echo "Done\n";
2142
+		} elseif ($globalDebug) {
2143
+			echo "Done\n";
2144
+		}
1944 2145
 		return '';
1945 2146
 	}
1946 2147
 
1947 2148
 	public static function update_routes() {
1948 2149
 		global $tmp_dir, $globalDebug;
1949 2150
 		$error = '';
1950
-		if ($globalDebug) echo "Routes : Download...";
2151
+		if ($globalDebug) {
2152
+			echo "Routes : Download...";
2153
+		}
1951 2154
 		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
1952 2155
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
1953
-			if ($globalDebug) echo "Gunzip...";
2156
+			if ($globalDebug) {
2157
+				echo "Gunzip...";
2158
+			}
1954 2159
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
1955
-			if ($globalDebug) echo "Add to DB...";
2160
+			if ($globalDebug) {
2161
+				echo "Add to DB...";
2162
+			}
1956 2163
 			$error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb');
1957
-		} else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
2164
+		} else {
2165
+			$error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
2166
+		}
1958 2167
 		if ($error != '') {
1959 2168
 			return $error;
1960
-		} elseif ($globalDebug) echo "Done\n";
2169
+		} elseif ($globalDebug) {
2170
+			echo "Done\n";
2171
+		}
1961 2172
 		return '';
1962 2173
 	}
1963 2174
 	public static function update_oneworld() {
1964 2175
 		global $tmp_dir, $globalDebug;
1965 2176
 		$error = '';
1966
-		if ($globalDebug) echo "Schedules Oneworld : Download...";
2177
+		if ($globalDebug) {
2178
+			echo "Schedules Oneworld : Download...";
2179
+		}
1967 2180
 		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz');
1968 2181
 		if (file_exists($tmp_dir.'oneworld.csv.gz')) {
1969
-			if ($globalDebug) echo "Gunzip...";
2182
+			if ($globalDebug) {
2183
+				echo "Gunzip...";
2184
+			}
1970 2185
 			update_db::gunzip($tmp_dir.'oneworld.csv.gz');
1971
-			if ($globalDebug) echo "Add to DB...";
2186
+			if ($globalDebug) {
2187
+				echo "Add to DB...";
2188
+			}
1972 2189
 			$error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv');
1973
-		} else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed.";
2190
+		} else {
2191
+			$error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed.";
2192
+		}
1974 2193
 		if ($error != '') {
1975 2194
 			return $error;
1976
-		} elseif ($globalDebug) echo "Done\n";
2195
+		} elseif ($globalDebug) {
2196
+			echo "Done\n";
2197
+		}
1977 2198
 		return '';
1978 2199
 	}
1979 2200
 	public static function update_skyteam() {
1980 2201
 		global $tmp_dir, $globalDebug;
1981 2202
 		$error = '';
1982
-		if ($globalDebug) echo "Schedules Skyteam : Download...";
2203
+		if ($globalDebug) {
2204
+			echo "Schedules Skyteam : Download...";
2205
+		}
1983 2206
 		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz');
1984 2207
 		if (file_exists($tmp_dir.'skyteam.csv.gz')) {
1985
-			if ($globalDebug) echo "Gunzip...";
2208
+			if ($globalDebug) {
2209
+				echo "Gunzip...";
2210
+			}
1986 2211
 			update_db::gunzip($tmp_dir.'skyteam.csv.gz');
1987
-			if ($globalDebug) echo "Add to DB...";
2212
+			if ($globalDebug) {
2213
+				echo "Add to DB...";
2214
+			}
1988 2215
 			$error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv');
1989
-		} else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed.";
2216
+		} else {
2217
+			$error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed.";
2218
+		}
1990 2219
 		if ($error != '') {
1991 2220
 			return $error;
1992
-		} elseif ($globalDebug) echo "Done\n";
2221
+		} elseif ($globalDebug) {
2222
+			echo "Done\n";
2223
+		}
1993 2224
 		return '';
1994 2225
 	}
1995 2226
 	public static function update_ModeS() {
@@ -2006,355 +2237,619 @@  discard block
 block discarded – undo
2006 2237
 			exit;
2007 2238
 		} elseif ($globalDebug) echo "Done\n";
2008 2239
 */
2009
-		if ($globalDebug) echo "Modes : Download...";
2010
-//		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2240
+		if ($globalDebug) {
2241
+			echo "Modes : Download...";
2242
+		}
2243
+		//		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2011 2244
 		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz');
2012 2245
 
2013 2246
 //		if (file_exists($tmp_dir.'basestation_latest.zip')) {
2014 2247
 		if (file_exists($tmp_dir.'BaseStation.sqb.gz')) {
2015
-			if ($globalDebug) echo "Unzip...";
2016
-//			update_db::unzip($tmp_dir.'basestation_latest.zip');
2248
+			if ($globalDebug) {
2249
+				echo "Unzip...";
2250
+			}
2251
+			//			update_db::unzip($tmp_dir.'basestation_latest.zip');
2017 2252
 			update_db::gunzip($tmp_dir.'BaseStation.sqb.gz');
2018
-			if ($globalDebug) echo "Add to DB...";
2253
+			if ($globalDebug) {
2254
+				echo "Add to DB...";
2255
+			}
2019 2256
 			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb');
2020 2257
 //			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb');
2021
-		} else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
2258
+		} else {
2259
+			$error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
2260
+		}
2022 2261
 		if ($error != '') {
2023 2262
 			return $error;
2024
-		} elseif ($globalDebug) echo "Done\n";
2263
+		} elseif ($globalDebug) {
2264
+			echo "Done\n";
2265
+		}
2025 2266
 		return '';
2026 2267
 	}
2027 2268
 
2028 2269
 	public static function update_ModeS_faa() {
2029 2270
 		global $tmp_dir, $globalDebug;
2030
-		if ($globalDebug) echo "Modes FAA: Download...";
2271
+		if ($globalDebug) {
2272
+			echo "Modes FAA: Download...";
2273
+		}
2031 2274
 		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip');
2032 2275
 		if (file_exists($tmp_dir.'ReleasableAircraft.zip')) {
2033
-			if ($globalDebug) echo "Unzip...";
2276
+			if ($globalDebug) {
2277
+				echo "Unzip...";
2278
+			}
2034 2279
 			update_db::unzip($tmp_dir.'ReleasableAircraft.zip');
2035
-			if ($globalDebug) echo "Add to DB...";
2280
+			if ($globalDebug) {
2281
+				echo "Add to DB...";
2282
+			}
2036 2283
 			$error = update_db::modes_faa();
2037
-		} else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed.";
2284
+		} else {
2285
+			$error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed.";
2286
+		}
2038 2287
 		if ($error != '') {
2039 2288
 			return $error;
2040
-		} elseif ($globalDebug) echo "Done\n";
2289
+		} elseif ($globalDebug) {
2290
+			echo "Done\n";
2291
+		}
2041 2292
 		return '';
2042 2293
 	}
2043 2294
 
2044 2295
 	public static function update_ModeS_flarm() {
2045 2296
 		global $tmp_dir, $globalDebug;
2046
-		if ($globalDebug) echo "Modes Flarmnet: Download...";
2297
+		if ($globalDebug) {
2298
+			echo "Modes Flarmnet: Download...";
2299
+		}
2047 2300
 		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
2048 2301
 		if (file_exists($tmp_dir.'data.fln')) {
2049
-			if ($globalDebug) echo "Add to DB...";
2302
+			if ($globalDebug) {
2303
+				echo "Add to DB...";
2304
+			}
2050 2305
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
2051
-		} else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
2306
+		} else {
2307
+			$error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
2308
+		}
2052 2309
 		if ($error != '') {
2053 2310
 			return $error;
2054
-		} elseif ($globalDebug) echo "Done\n";
2311
+		} elseif ($globalDebug) {
2312
+			echo "Done\n";
2313
+		}
2055 2314
 		return '';
2056 2315
 	}
2057 2316
 
2058 2317
 	public static function update_ModeS_ogn() {
2059 2318
 		global $tmp_dir, $globalDebug;
2060
-		if ($globalDebug) echo "Modes OGN: Download...";
2319
+		if ($globalDebug) {
2320
+			echo "Modes OGN: Download...";
2321
+		}
2061 2322
 		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
2062 2323
 		if (file_exists($tmp_dir.'ogn.csv')) {
2063
-			if ($globalDebug) echo "Add to DB...";
2324
+			if ($globalDebug) {
2325
+				echo "Add to DB...";
2326
+			}
2064 2327
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
2065
-		} else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
2328
+		} else {
2329
+			$error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
2330
+		}
2066 2331
 		if ($error != '') {
2067 2332
 			return $error;
2068
-		} elseif ($globalDebug) echo "Done\n";
2333
+		} elseif ($globalDebug) {
2334
+			echo "Done\n";
2335
+		}
2069 2336
 		return '';
2070 2337
 	}
2071 2338
 
2072 2339
 	public static function update_owner() {
2073 2340
 		global $tmp_dir, $globalDebug, $globalMasterSource;
2074 2341
 		
2075
-		if ($globalDebug) echo "Owner France: Download...";
2342
+		if ($globalDebug) {
2343
+			echo "Owner France: Download...";
2344
+		}
2076 2345
 		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
2077 2346
 		if (file_exists($tmp_dir.'owner_f.csv')) {
2078
-			if ($globalDebug) echo "Add to DB...";
2347
+			if ($globalDebug) {
2348
+				echo "Add to DB...";
2349
+			}
2079 2350
 			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
2080
-		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2351
+		} else {
2352
+			$error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2353
+		}
2081 2354
 		if ($error != '') {
2082 2355
 			return $error;
2083
-		} elseif ($globalDebug) echo "Done\n";
2356
+		} elseif ($globalDebug) {
2357
+			echo "Done\n";
2358
+		}
2084 2359
 		
2085
-		if ($globalDebug) echo "Owner Ireland: Download...";
2360
+		if ($globalDebug) {
2361
+			echo "Owner Ireland: Download...";
2362
+		}
2086 2363
 		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
2087 2364
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
2088
-			if ($globalDebug) echo "Add to DB...";
2365
+			if ($globalDebug) {
2366
+				echo "Add to DB...";
2367
+			}
2089 2368
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
2090
-		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2369
+		} else {
2370
+			$error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2371
+		}
2091 2372
 		if ($error != '') {
2092 2373
 			return $error;
2093
-		} elseif ($globalDebug) echo "Done\n";
2094
-		if ($globalDebug) echo "Owner Switzerland: Download...";
2374
+		} elseif ($globalDebug) {
2375
+			echo "Done\n";
2376
+		}
2377
+		if ($globalDebug) {
2378
+			echo "Owner Switzerland: Download...";
2379
+		}
2095 2380
 		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
2096 2381
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
2097
-			if ($globalDebug) echo "Add to DB...";
2382
+			if ($globalDebug) {
2383
+				echo "Add to DB...";
2384
+			}
2098 2385
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
2099
-		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2386
+		} else {
2387
+			$error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2388
+		}
2100 2389
 		if ($error != '') {
2101 2390
 			return $error;
2102
-		} elseif ($globalDebug) echo "Done\n";
2103
-		if ($globalDebug) echo "Owner Czech Republic: Download...";
2391
+		} elseif ($globalDebug) {
2392
+			echo "Done\n";
2393
+		}
2394
+		if ($globalDebug) {
2395
+			echo "Owner Czech Republic: Download...";
2396
+		}
2104 2397
 		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
2105 2398
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
2106
-			if ($globalDebug) echo "Add to DB...";
2399
+			if ($globalDebug) {
2400
+				echo "Add to DB...";
2401
+			}
2107 2402
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
2108
-		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2403
+		} else {
2404
+			$error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2405
+		}
2109 2406
 		if ($error != '') {
2110 2407
 			return $error;
2111
-		} elseif ($globalDebug) echo "Done\n";
2112
-		if ($globalDebug) echo "Owner Australia: Download...";
2408
+		} elseif ($globalDebug) {
2409
+			echo "Done\n";
2410
+		}
2411
+		if ($globalDebug) {
2412
+			echo "Owner Australia: Download...";
2413
+		}
2113 2414
 		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
2114 2415
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
2115
-			if ($globalDebug) echo "Add to DB...";
2416
+			if ($globalDebug) {
2417
+				echo "Add to DB...";
2418
+			}
2116 2419
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
2117
-		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2420
+		} else {
2421
+			$error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2422
+		}
2118 2423
 		if ($error != '') {
2119 2424
 			return $error;
2120
-		} elseif ($globalDebug) echo "Done\n";
2121
-		if ($globalDebug) echo "Owner Austria: Download...";
2425
+		} elseif ($globalDebug) {
2426
+			echo "Done\n";
2427
+		}
2428
+		if ($globalDebug) {
2429
+			echo "Owner Austria: Download...";
2430
+		}
2122 2431
 		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
2123 2432
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
2124
-			if ($globalDebug) echo "Add to DB...";
2433
+			if ($globalDebug) {
2434
+				echo "Add to DB...";
2435
+			}
2125 2436
 			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
2126
-		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2437
+		} else {
2438
+			$error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2439
+		}
2127 2440
 		if ($error != '') {
2128 2441
 			return $error;
2129
-		} elseif ($globalDebug) echo "Done\n";
2130
-		if ($globalDebug) echo "Owner Chile: Download...";
2442
+		} elseif ($globalDebug) {
2443
+			echo "Done\n";
2444
+		}
2445
+		if ($globalDebug) {
2446
+			echo "Owner Chile: Download...";
2447
+		}
2131 2448
 		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
2132 2449
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
2133
-			if ($globalDebug) echo "Add to DB...";
2450
+			if ($globalDebug) {
2451
+				echo "Add to DB...";
2452
+			}
2134 2453
 			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
2135
-		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2454
+		} else {
2455
+			$error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2456
+		}
2136 2457
 		if ($error != '') {
2137 2458
 			return $error;
2138
-		} elseif ($globalDebug) echo "Done\n";
2139
-		if ($globalDebug) echo "Owner Colombia: Download...";
2459
+		} elseif ($globalDebug) {
2460
+			echo "Done\n";
2461
+		}
2462
+		if ($globalDebug) {
2463
+			echo "Owner Colombia: Download...";
2464
+		}
2140 2465
 		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
2141 2466
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
2142
-			if ($globalDebug) echo "Add to DB...";
2467
+			if ($globalDebug) {
2468
+				echo "Add to DB...";
2469
+			}
2143 2470
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
2144
-		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2471
+		} else {
2472
+			$error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2473
+		}
2145 2474
 		if ($error != '') {
2146 2475
 			return $error;
2147
-		} elseif ($globalDebug) echo "Done\n";
2148
-		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
2476
+		} elseif ($globalDebug) {
2477
+			echo "Done\n";
2478
+		}
2479
+		if ($globalDebug) {
2480
+			echo "Owner Bosnia Herzegobina: Download...";
2481
+		}
2149 2482
 		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
2150 2483
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
2151
-			if ($globalDebug) echo "Add to DB...";
2484
+			if ($globalDebug) {
2485
+				echo "Add to DB...";
2486
+			}
2152 2487
 			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
2153
-		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2488
+		} else {
2489
+			$error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2490
+		}
2154 2491
 		if ($error != '') {
2155 2492
 			return $error;
2156
-		} elseif ($globalDebug) echo "Done\n";
2157
-		if ($globalDebug) echo "Owner Brazil: Download...";
2493
+		} elseif ($globalDebug) {
2494
+			echo "Done\n";
2495
+		}
2496
+		if ($globalDebug) {
2497
+			echo "Owner Brazil: Download...";
2498
+		}
2158 2499
 		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
2159 2500
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
2160
-			if ($globalDebug) echo "Add to DB...";
2501
+			if ($globalDebug) {
2502
+				echo "Add to DB...";
2503
+			}
2161 2504
 			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
2162
-		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2505
+		} else {
2506
+			$error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2507
+		}
2163 2508
 		if ($error != '') {
2164 2509
 			return $error;
2165
-		} elseif ($globalDebug) echo "Done\n";
2166
-		if ($globalDebug) echo "Owner Cayman Islands: Download...";
2510
+		} elseif ($globalDebug) {
2511
+			echo "Done\n";
2512
+		}
2513
+		if ($globalDebug) {
2514
+			echo "Owner Cayman Islands: Download...";
2515
+		}
2167 2516
 		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
2168 2517
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
2169
-			if ($globalDebug) echo "Add to DB...";
2518
+			if ($globalDebug) {
2519
+				echo "Add to DB...";
2520
+			}
2170 2521
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
2171
-		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2522
+		} else {
2523
+			$error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2524
+		}
2172 2525
 		if ($error != '') {
2173 2526
 			return $error;
2174
-		} elseif ($globalDebug) echo "Done\n";
2175
-		if ($globalDebug) echo "Owner Croatia: Download...";
2527
+		} elseif ($globalDebug) {
2528
+			echo "Done\n";
2529
+		}
2530
+		if ($globalDebug) {
2531
+			echo "Owner Croatia: Download...";
2532
+		}
2176 2533
 		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
2177 2534
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
2178
-			if ($globalDebug) echo "Add to DB...";
2535
+			if ($globalDebug) {
2536
+				echo "Add to DB...";
2537
+			}
2179 2538
 			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
2180
-		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2539
+		} else {
2540
+			$error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2541
+		}
2181 2542
 		if ($error != '') {
2182 2543
 			return $error;
2183
-		} elseif ($globalDebug) echo "Done\n";
2184
-		if ($globalDebug) echo "Owner Luxembourg: Download...";
2544
+		} elseif ($globalDebug) {
2545
+			echo "Done\n";
2546
+		}
2547
+		if ($globalDebug) {
2548
+			echo "Owner Luxembourg: Download...";
2549
+		}
2185 2550
 		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
2186 2551
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
2187
-			if ($globalDebug) echo "Add to DB...";
2552
+			if ($globalDebug) {
2553
+				echo "Add to DB...";
2554
+			}
2188 2555
 			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
2189
-		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2556
+		} else {
2557
+			$error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2558
+		}
2190 2559
 		if ($error != '') {
2191 2560
 			return $error;
2192
-		} elseif ($globalDebug) echo "Done\n";
2193
-		if ($globalDebug) echo "Owner Maldives: Download...";
2561
+		} elseif ($globalDebug) {
2562
+			echo "Done\n";
2563
+		}
2564
+		if ($globalDebug) {
2565
+			echo "Owner Maldives: Download...";
2566
+		}
2194 2567
 		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
2195 2568
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
2196
-			if ($globalDebug) echo "Add to DB...";
2569
+			if ($globalDebug) {
2570
+				echo "Add to DB...";
2571
+			}
2197 2572
 			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
2198
-		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2573
+		} else {
2574
+			$error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2575
+		}
2199 2576
 		if ($error != '') {
2200 2577
 			return $error;
2201
-		} elseif ($globalDebug) echo "Done\n";
2202
-		if ($globalDebug) echo "Owner New Zealand: Download...";
2578
+		} elseif ($globalDebug) {
2579
+			echo "Done\n";
2580
+		}
2581
+		if ($globalDebug) {
2582
+			echo "Owner New Zealand: Download...";
2583
+		}
2203 2584
 		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
2204 2585
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
2205
-			if ($globalDebug) echo "Add to DB...";
2586
+			if ($globalDebug) {
2587
+				echo "Add to DB...";
2588
+			}
2206 2589
 			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
2207
-		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2590
+		} else {
2591
+			$error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2592
+		}
2208 2593
 		if ($error != '') {
2209 2594
 			return $error;
2210
-		} elseif ($globalDebug) echo "Done\n";
2211
-		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
2595
+		} elseif ($globalDebug) {
2596
+			echo "Done\n";
2597
+		}
2598
+		if ($globalDebug) {
2599
+			echo "Owner Papua New Guinea: Download...";
2600
+		}
2212 2601
 		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
2213 2602
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
2214
-			if ($globalDebug) echo "Add to DB...";
2603
+			if ($globalDebug) {
2604
+				echo "Add to DB...";
2605
+			}
2215 2606
 			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
2216
-		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2607
+		} else {
2608
+			$error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2609
+		}
2217 2610
 		if ($error != '') {
2218 2611
 			return $error;
2219
-		} elseif ($globalDebug) echo "Done\n";
2220
-		if ($globalDebug) echo "Owner Slovakia: Download...";
2612
+		} elseif ($globalDebug) {
2613
+			echo "Done\n";
2614
+		}
2615
+		if ($globalDebug) {
2616
+			echo "Owner Slovakia: Download...";
2617
+		}
2221 2618
 		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
2222 2619
 		if (file_exists($tmp_dir.'owner_om.csv')) {
2223
-			if ($globalDebug) echo "Add to DB...";
2620
+			if ($globalDebug) {
2621
+				echo "Add to DB...";
2622
+			}
2224 2623
 			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
2225
-		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2624
+		} else {
2625
+			$error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2626
+		}
2226 2627
 		if ($error != '') {
2227 2628
 			return $error;
2228
-		} elseif ($globalDebug) echo "Done\n";
2229
-		if ($globalDebug) echo "Owner Ecuador: Download...";
2629
+		} elseif ($globalDebug) {
2630
+			echo "Done\n";
2631
+		}
2632
+		if ($globalDebug) {
2633
+			echo "Owner Ecuador: Download...";
2634
+		}
2230 2635
 		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
2231 2636
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
2232
-			if ($globalDebug) echo "Add to DB...";
2637
+			if ($globalDebug) {
2638
+				echo "Add to DB...";
2639
+			}
2233 2640
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
2234
-		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2641
+		} else {
2642
+			$error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2643
+		}
2235 2644
 		if ($error != '') {
2236 2645
 			return $error;
2237
-		} elseif ($globalDebug) echo "Done\n";
2238
-		if ($globalDebug) echo "Owner Iceland: Download...";
2646
+		} elseif ($globalDebug) {
2647
+			echo "Done\n";
2648
+		}
2649
+		if ($globalDebug) {
2650
+			echo "Owner Iceland: Download...";
2651
+		}
2239 2652
 		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
2240 2653
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
2241
-			if ($globalDebug) echo "Add to DB...";
2654
+			if ($globalDebug) {
2655
+				echo "Add to DB...";
2656
+			}
2242 2657
 			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
2243
-		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2658
+		} else {
2659
+			$error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2660
+		}
2244 2661
 		if ($error != '') {
2245 2662
 			return $error;
2246
-		} elseif ($globalDebug) echo "Done\n";
2247
-		if ($globalDebug) echo "Owner Isle of Man: Download...";
2663
+		} elseif ($globalDebug) {
2664
+			echo "Done\n";
2665
+		}
2666
+		if ($globalDebug) {
2667
+			echo "Owner Isle of Man: Download...";
2668
+		}
2248 2669
 		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv');
2249 2670
 		if (file_exists($tmp_dir.'owner_m.csv')) {
2250
-			if ($globalDebug) echo "Add to DB...";
2671
+			if ($globalDebug) {
2672
+				echo "Add to DB...";
2673
+			}
2251 2674
 			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M');
2252
-		} else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2675
+		} else {
2676
+			$error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2677
+		}
2253 2678
 		if ($error != '') {
2254 2679
 			return $error;
2255
-		} elseif ($globalDebug) echo "Done\n";
2680
+		} elseif ($globalDebug) {
2681
+			echo "Done\n";
2682
+		}
2256 2683
 		if ($globalMasterSource) {
2257
-			if ($globalDebug) echo "ModeS Netherlands: Download...";
2684
+			if ($globalDebug) {
2685
+				echo "ModeS Netherlands: Download...";
2686
+			}
2258 2687
 			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv');
2259 2688
 			if (file_exists($tmp_dir.'owner_ph.csv')) {
2260
-				if ($globalDebug) echo "Add to DB...";
2689
+				if ($globalDebug) {
2690
+					echo "Add to DB...";
2691
+				}
2261 2692
 				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH');
2262
-			} else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2693
+			} else {
2694
+				$error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2695
+			}
2263 2696
 			if ($error != '') {
2264 2697
 				return $error;
2265
-			} elseif ($globalDebug) echo "Done\n";
2266
-			if ($globalDebug) echo "ModeS Denmark: Download...";
2698
+			} elseif ($globalDebug) {
2699
+				echo "Done\n";
2700
+			}
2701
+			if ($globalDebug) {
2702
+				echo "ModeS Denmark: Download...";
2703
+			}
2267 2704
 			update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv');
2268 2705
 			if (file_exists($tmp_dir.'owner_oy.csv')) {
2269
-				if ($globalDebug) echo "Add to DB...";
2706
+				if ($globalDebug) {
2707
+					echo "Add to DB...";
2708
+				}
2270 2709
 				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY');
2271
-			} else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2710
+			} else {
2711
+				$error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2712
+			}
2272 2713
 			if ($error != '') {
2273 2714
 				return $error;
2274
-			} elseif ($globalDebug) echo "Done\n";
2275
-		} elseif ($globalDebug) echo "Done\n";
2715
+			} elseif ($globalDebug) {
2716
+				echo "Done\n";
2717
+			}
2718
+		} elseif ($globalDebug) {
2719
+			echo "Done\n";
2720
+		}
2276 2721
 		return '';
2277 2722
 	}
2278 2723
 
2279 2724
 	public static function update_translation() {
2280 2725
 		global $tmp_dir, $globalDebug;
2281 2726
 		$error = '';
2282
-		if ($globalDebug) echo "Translation : Download...";
2727
+		if ($globalDebug) {
2728
+			echo "Translation : Download...";
2729
+		}
2283 2730
 		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
2284 2731
 		if (file_exists($tmp_dir.'translation.zip')) {
2285
-			if ($globalDebug) echo "Unzip...";
2732
+			if ($globalDebug) {
2733
+				echo "Unzip...";
2734
+			}
2286 2735
 			update_db::unzip($tmp_dir.'translation.zip');
2287
-			if ($globalDebug) echo "Add to DB...";
2736
+			if ($globalDebug) {
2737
+				echo "Add to DB...";
2738
+			}
2288 2739
 			$error = update_db::translation();
2289
-		} else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
2740
+		} else {
2741
+			$error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
2742
+		}
2290 2743
 		if ($error != '') {
2291 2744
 			return $error;
2292
-		} elseif ($globalDebug) echo "Done\n";
2745
+		} elseif ($globalDebug) {
2746
+			echo "Done\n";
2747
+		}
2293 2748
 		return '';
2294 2749
 	}
2295 2750
 
2296 2751
 	public static function update_translation_fam() {
2297 2752
 		global $tmp_dir, $globalDebug;
2298
-		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
2753
+		if ($globalDebug) {
2754
+			echo "Translation from FlightAirMap website : Download...";
2755
+		}
2299 2756
 		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
2300 2757
 		if (file_exists($tmp_dir.'translation.tsv.gz')) {
2301
-			if ($globalDebug) echo "Gunzip...";
2758
+			if ($globalDebug) {
2759
+				echo "Gunzip...";
2760
+			}
2302 2761
 			update_db::gunzip($tmp_dir.'translation.tsv.gz');
2303
-			if ($globalDebug) echo "Add to DB...";
2762
+			if ($globalDebug) {
2763
+				echo "Add to DB...";
2764
+			}
2304 2765
 			$error = update_db::translation_fam();
2305
-		} else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
2766
+		} else {
2767
+			$error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
2768
+		}
2306 2769
 		if ($error != '') {
2307 2770
 			return $error;
2308
-		} elseif ($globalDebug) echo "Done\n";
2771
+		} elseif ($globalDebug) {
2772
+			echo "Done\n";
2773
+		}
2309 2774
 		return '';
2310 2775
 	}
2311 2776
 	public static function update_ModeS_fam() {
2312 2777
 		global $tmp_dir, $globalDebug;
2313
-		if ($globalDebug) echo "ModeS from FlightAirMap website : Download...";
2778
+		if ($globalDebug) {
2779
+			echo "ModeS from FlightAirMap website : Download...";
2780
+		}
2314 2781
 		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz');
2315 2782
 		if (file_exists($tmp_dir.'modes.tsv.gz')) {
2316
-			if ($globalDebug) echo "Gunzip...";
2783
+			if ($globalDebug) {
2784
+				echo "Gunzip...";
2785
+			}
2317 2786
 			update_db::gunzip($tmp_dir.'modes.tsv.gz');
2318
-			if ($globalDebug) echo "Add to DB...";
2787
+			if ($globalDebug) {
2788
+				echo "Add to DB...";
2789
+			}
2319 2790
 			$error = update_db::modes_fam();
2320
-		} else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed.";
2791
+		} else {
2792
+			$error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed.";
2793
+		}
2321 2794
 		if ($error != '') {
2322 2795
 			return $error;
2323
-		} elseif ($globalDebug) echo "Done\n";
2796
+		} elseif ($globalDebug) {
2797
+			echo "Done\n";
2798
+		}
2324 2799
 		return '';
2325 2800
 	}
2326 2801
 	public static function update_owner_fam() {
2327 2802
 		global $tmp_dir, $globalDebug, $globalOwner;
2328
-		if ($globalDebug) echo "owner from FlightAirMap website : Download...";
2803
+		if ($globalDebug) {
2804
+			echo "owner from FlightAirMap website : Download...";
2805
+		}
2329 2806
 		if ($globalOwner === TRUE) {
2330 2807
 			update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz');
2331 2808
 		} else {
2332 2809
 			update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz');
2333 2810
 		}
2334 2811
 		if (file_exists($tmp_dir.'owners.tsv.gz')) {
2335
-			if ($globalDebug) echo "Gunzip...";
2812
+			if ($globalDebug) {
2813
+				echo "Gunzip...";
2814
+			}
2336 2815
 			update_db::gunzip($tmp_dir.'owners.tsv.gz');
2337
-			if ($globalDebug) echo "Add to DB...";
2816
+			if ($globalDebug) {
2817
+				echo "Add to DB...";
2818
+			}
2338 2819
 			$error = update_db::owner_fam();
2339
-		} else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed.";
2820
+		} else {
2821
+			$error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed.";
2822
+		}
2340 2823
 		if ($error != '') {
2341 2824
 			return $error;
2342
-		} elseif ($globalDebug) echo "Done\n";
2825
+		} elseif ($globalDebug) {
2826
+			echo "Done\n";
2827
+		}
2343 2828
 		return '';
2344 2829
 	}
2345 2830
 	public static function update_routes_fam() {
2346 2831
 		global $tmp_dir, $globalDebug;
2347
-		if ($globalDebug) echo "Routes from FlightAirMap website : Download...";
2832
+		if ($globalDebug) {
2833
+			echo "Routes from FlightAirMap website : Download...";
2834
+		}
2348 2835
 		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz');
2349 2836
 		if (file_exists($tmp_dir.'routes.tsv.gz')) {
2350
-			if ($globalDebug) echo "Gunzip...";
2837
+			if ($globalDebug) {
2838
+				echo "Gunzip...";
2839
+			}
2351 2840
 			update_db::gunzip($tmp_dir.'routes.tsv.gz');
2352
-			if ($globalDebug) echo "Add to DB...";
2841
+			if ($globalDebug) {
2842
+				echo "Add to DB...";
2843
+			}
2353 2844
 			$error = update_db::routes_fam();
2354
-		} else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed.";
2845
+		} else {
2846
+			$error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed.";
2847
+		}
2355 2848
 		if ($error != '') {
2356 2849
 			return $error;
2357
-		} elseif ($globalDebug) echo "Done\n";
2850
+		} elseif ($globalDebug) {
2851
+			echo "Done\n";
2852
+		}
2358 2853
 		return '';
2359 2854
 	}
2360 2855
 	public static function update_marine_identity_fam() {
@@ -2364,14 +2859,22 @@  discard block
 block discarded – undo
2364 2859
 			$marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5'));
2365 2860
 			$marine_identity_md5 = $marine_identity_md5_file[0];
2366 2861
 			if (!update_db::check_marine_identity_version($marine_identity_md5)) {
2367
-				if ($globalDebug) echo "Marine identity from FlightAirMap website : Download...";
2862
+				if ($globalDebug) {
2863
+					echo "Marine identity from FlightAirMap website : Download...";
2864
+				}
2368 2865
 				update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz');
2369 2866
 				if (file_exists($tmp_dir.'marine_identity.tsv.gz')) {
2370
-					if ($globalDebug) echo "Gunzip...";
2867
+					if ($globalDebug) {
2868
+						echo "Gunzip...";
2869
+					}
2371 2870
 					update_db::gunzip($tmp_dir.'marine_identity.tsv.gz');
2372
-					if ($globalDebug) echo "Add to DB...";
2871
+					if ($globalDebug) {
2872
+						echo "Add to DB...";
2873
+					}
2373 2874
 					$error = update_db::marine_identity_fam();
2374
-				} else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed.";
2875
+				} else {
2876
+					$error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed.";
2877
+				}
2375 2878
 				if ($error != '') {
2376 2879
 					return $error;
2377 2880
 				} elseif ($globalDebug) {
@@ -2390,14 +2893,22 @@  discard block
 block discarded – undo
2390 2893
 			$satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5'));
2391 2894
 			$satellite_md5 = $satellite_md5_file[0];
2392 2895
 			if (!update_db::check_satellite_version($marine_identity_md5)) {
2393
-				if ($globalDebug) echo "Satellite from FlightAirMap website : Download...";
2896
+				if ($globalDebug) {
2897
+					echo "Satellite from FlightAirMap website : Download...";
2898
+				}
2394 2899
 				update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz');
2395 2900
 				if (file_exists($tmp_dir.'satellite.tsv.gz')) {
2396
-					if ($globalDebug) echo "Gunzip...";
2901
+					if ($globalDebug) {
2902
+						echo "Gunzip...";
2903
+					}
2397 2904
 					update_db::gunzip($tmp_dir.'satellite.tsv.gz');
2398
-					if ($globalDebug) echo "Add to DB...";
2905
+					if ($globalDebug) {
2906
+						echo "Add to DB...";
2907
+					}
2399 2908
 					$error = update_db::satellite_fam();
2400
-				} else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed.";
2909
+				} else {
2910
+					$error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed.";
2911
+				}
2401 2912
 				if ($error != '') {
2402 2913
 					return $error;
2403 2914
 				} elseif ($globalDebug) {
@@ -2410,17 +2921,25 @@  discard block
 block discarded – undo
2410 2921
 	}
2411 2922
 	public static function update_banned_fam() {
2412 2923
 		global $tmp_dir, $globalDebug;
2413
-		if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download...";
2924
+		if ($globalDebug) {
2925
+			echo "Banned airlines in Europe from FlightAirMap website : Download...";
2926
+		}
2414 2927
 		update_db::download('http://data.flightairmap.fr/data/ban-eu.csv',$tmp_dir.'ban_eu.csv');
2415 2928
 		if (file_exists($tmp_dir.'ban_eu.csv')) {
2416 2929
 			//if ($globalDebug) echo "Gunzip...";
2417 2930
 			//update_db::gunzip($tmp_dir.'ban_ue.csv');
2418
-			if ($globalDebug) echo "Add to DB...";
2931
+			if ($globalDebug) {
2932
+				echo "Add to DB...";
2933
+			}
2419 2934
 			$error = update_db::banned_fam();
2420
-		} else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed.";
2935
+		} else {
2936
+			$error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed.";
2937
+		}
2421 2938
 		if ($error != '') {
2422 2939
 			return $error;
2423
-		} elseif ($globalDebug) echo "Done\n";
2940
+		} elseif ($globalDebug) {
2941
+			echo "Done\n";
2942
+		}
2424 2943
 		return '';
2425 2944
 	}
2426 2945
 
@@ -2428,7 +2947,9 @@  discard block
 block discarded – undo
2428 2947
 		global $tmp_dir, $globalDebug, $globalDBdriver;
2429 2948
 		include_once('class.create_db.php');
2430 2949
 		$error = '';
2431
-		if ($globalDebug) echo "Airspace from FlightAirMap website : Download...";
2950
+		if ($globalDebug) {
2951
+			echo "Airspace from FlightAirMap website : Download...";
2952
+		}
2432 2953
 		if ($globalDBdriver == 'mysql') {
2433 2954
 			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2434 2955
 		} else {
@@ -2444,9 +2965,13 @@  discard block
 block discarded – undo
2444 2965
 					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz');
2445 2966
 				}
2446 2967
 				if (file_exists($tmp_dir.'airspace.sql.gz')) {
2447
-					if ($globalDebug) echo "Gunzip...";
2968
+					if ($globalDebug) {
2969
+						echo "Gunzip...";
2970
+					}
2448 2971
 					update_db::gunzip($tmp_dir.'airspace.sql.gz');
2449
-					if ($globalDebug) echo "Add to DB...";
2972
+					if ($globalDebug) {
2973
+						echo "Add to DB...";
2974
+					}
2450 2975
 					$Connection = new Connection();
2451 2976
 					if ($Connection->tableExists('airspace')) {
2452 2977
 						$query = 'DROP TABLE airspace';
@@ -2459,19 +2984,27 @@  discard block
 block discarded – undo
2459 2984
 		    			}
2460 2985
 					$error = create_db::import_file($tmp_dir.'airspace.sql');
2461 2986
 					update_db::insert_airspace_version($airspace_md5);
2462
-				} else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed.";
2987
+				} else {
2988
+					$error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed.";
2989
+				}
2463 2990
 			}
2464
-		} else $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed.";
2991
+		} else {
2992
+			$error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed.";
2993
+		}
2465 2994
 		if ($error != '') {
2466 2995
 			return $error;
2467
-		} elseif ($globalDebug) echo "Done\n";
2996
+		} elseif ($globalDebug) {
2997
+			echo "Done\n";
2998
+		}
2468 2999
 		return '';
2469 3000
 	}
2470 3001
 
2471 3002
 	public static function update_geoid_fam() {
2472 3003
 		global $tmp_dir, $globalDebug, $globalGeoidSource;
2473 3004
 		$error = '';
2474
-		if ($globalDebug) echo "Geoid from FlightAirMap website : Download...";
3005
+		if ($globalDebug) {
3006
+			echo "Geoid from FlightAirMap website : Download...";
3007
+		}
2475 3008
 		update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5');
2476 3009
 		if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) {
2477 3010
 			$geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5'));
@@ -2479,75 +3012,113 @@  discard block
 block discarded – undo
2479 3012
 			if (!update_db::check_geoid_version($geoid_md5)) {
2480 3013
 				update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz');
2481 3014
 				if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) {
2482
-					if ($globalDebug) echo "Gunzip...";
3015
+					if ($globalDebug) {
3016
+						echo "Gunzip...";
3017
+					}
2483 3018
 					update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm');
2484 3019
 					if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) {
2485 3020
 						update_db::insert_geoid_version($geoid_md5);
2486 3021
 					}
2487
-				} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed.";
3022
+				} else {
3023
+					$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed.";
3024
+				}
2488 3025
 			}
2489
-		} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed.";
3026
+		} else {
3027
+			$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed.";
3028
+		}
2490 3029
 		if ($error != '') {
2491 3030
 			return $error;
2492
-		} elseif ($globalDebug) echo "Done\n";
3031
+		} elseif ($globalDebug) {
3032
+			echo "Done\n";
3033
+		}
2493 3034
 		return '';
2494 3035
 	}
2495 3036
 
2496 3037
 	public static function update_tle() {
2497 3038
 		global $tmp_dir, $globalDebug;
2498
-		if ($globalDebug) echo "Download TLE : Download...";
3039
+		if ($globalDebug) {
3040
+			echo "Download TLE : Download...";
3041
+		}
2499 3042
 		$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',
2500 3043
 		'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',
2501 3044
 		'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');
2502 3045
 		foreach ($alltle as $filename) {
2503
-			if ($globalDebug) echo "downloading ".$filename.'...';
3046
+			if ($globalDebug) {
3047
+				echo "downloading ".$filename.'...';
3048
+			}
2504 3049
 			update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename);
2505 3050
 			if (file_exists($tmp_dir.$filename)) {
2506
-				if ($globalDebug) echo "Add to DB ".$filename."...";
3051
+				if ($globalDebug) {
3052
+					echo "Add to DB ".$filename."...";
3053
+				}
2507 3054
 				$error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename));
2508
-			} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
3055
+			} else {
3056
+				$error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
3057
+			}
2509 3058
 			if ($error != '') {
2510 3059
 				echo $error."\n";
2511
-			} elseif ($globalDebug) echo "Done\n";
3060
+			} elseif ($globalDebug) {
3061
+				echo "Done\n";
3062
+			}
2512 3063
 		}
2513 3064
 		return '';
2514 3065
 	}
2515 3066
 
2516 3067
 	public static function update_ucsdb() {
2517 3068
 		global $tmp_dir, $globalDebug;
2518
-		if ($globalDebug) echo "Download UCS DB : Download...";
3069
+		if ($globalDebug) {
3070
+			echo "Download UCS DB : Download...";
3071
+		}
2519 3072
 		update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt');
2520 3073
 		if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) {
2521
-			if ($globalDebug) echo "Add to DB...";
3074
+			if ($globalDebug) {
3075
+				echo "Add to DB...";
3076
+			}
2522 3077
 			$error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt');
2523
-		} else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed.";
3078
+		} else {
3079
+			$error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed.";
3080
+		}
2524 3081
 		if ($error != '') {
2525 3082
 			echo $error."\n";
2526
-		} elseif ($globalDebug) echo "Done\n";
3083
+		} elseif ($globalDebug) {
3084
+			echo "Done\n";
3085
+		}
2527 3086
 		return '';
2528 3087
 	}
2529 3088
 
2530 3089
 	public static function update_celestrak() {
2531 3090
 		global $tmp_dir, $globalDebug;
2532
-		if ($globalDebug) echo "Download Celestrak DB : Download...";
3091
+		if ($globalDebug) {
3092
+			echo "Download Celestrak DB : Download...";
3093
+		}
2533 3094
 		update_db::download('https://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt');
2534 3095
 		if (file_exists($tmp_dir.'satcat.txt')) {
2535
-			if ($globalDebug) echo "Add to DB...";
3096
+			if ($globalDebug) {
3097
+				echo "Add to DB...";
3098
+			}
2536 3099
 			$error = update_db::satellite_celestrak($tmp_dir.'satcat.txt');
2537
-		} else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed.";
3100
+		} else {
3101
+			$error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed.";
3102
+		}
2538 3103
 		if ($error != '') {
2539 3104
 			echo $error."\n";
2540
-		} elseif ($globalDebug) echo "Done\n";
3105
+		} elseif ($globalDebug) {
3106
+			echo "Done\n";
3107
+		}
2541 3108
 		return '';
2542 3109
 	}
2543 3110
 
2544 3111
 	public static function update_models() {
2545 3112
 		global $tmp_dir, $globalDebug;
2546 3113
 		$error = '';
2547
-		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
3114
+		if ($globalDebug) {
3115
+			echo "Models from FlightAirMap website : Download...";
3116
+		}
2548 3117
 		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum');
2549 3118
 		if (file_exists($tmp_dir.'models.md5sum')) {
2550
-			if ($globalDebug) echo "Check files...\n";
3119
+			if ($globalDebug) {
3120
+				echo "Check files...\n";
3121
+			}
2551 3122
 			$newmodelsdb = array();
2552 3123
 			if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) {
2553 3124
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2566,25 +3137,35 @@  discard block
 block discarded – undo
2566 3137
 			}
2567 3138
 			$diff = array_diff($newmodelsdb,$modelsdb);
2568 3139
 			foreach ($diff as $key => $value) {
2569
-				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
3140
+				if ($globalDebug) {
3141
+					echo 'Downloading model '.$key.' ...'."\n";
3142
+				}
2570 3143
 				update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key);
2571 3144
 				
2572 3145
 			}
2573 3146
 			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum');
2574
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3147
+		} else {
3148
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3149
+		}
2575 3150
 		if ($error != '') {
2576 3151
 			return $error;
2577
-		} elseif ($globalDebug) echo "Done\n";
3152
+		} elseif ($globalDebug) {
3153
+			echo "Done\n";
3154
+		}
2578 3155
 		return '';
2579 3156
 	}
2580 3157
 
2581 3158
 	public static function update_space_models() {
2582 3159
 		global $tmp_dir, $globalDebug;
2583 3160
 		$error = '';
2584
-		if ($globalDebug) echo "Space models from FlightAirMap website : Download...";
3161
+		if ($globalDebug) {
3162
+			echo "Space models from FlightAirMap website : Download...";
3163
+		}
2585 3164
 		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum');
2586 3165
 		if (file_exists($tmp_dir.'space_models.md5sum')) {
2587
-			if ($globalDebug) echo "Check files...\n";
3166
+			if ($globalDebug) {
3167
+				echo "Check files...\n";
3168
+			}
2588 3169
 			$newmodelsdb = array();
2589 3170
 			if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) {
2590 3171
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2603,25 +3184,35 @@  discard block
 block discarded – undo
2603 3184
 			}
2604 3185
 			$diff = array_diff($newmodelsdb,$modelsdb);
2605 3186
 			foreach ($diff as $key => $value) {
2606
-				if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n";
3187
+				if ($globalDebug) {
3188
+					echo 'Downloading space model '.$key.' ...'."\n";
3189
+				}
2607 3190
 				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key);
2608 3191
 				
2609 3192
 			}
2610 3193
 			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum');
2611
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3194
+		} else {
3195
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3196
+		}
2612 3197
 		if ($error != '') {
2613 3198
 			return $error;
2614
-		} elseif ($globalDebug) echo "Done\n";
3199
+		} elseif ($globalDebug) {
3200
+			echo "Done\n";
3201
+		}
2615 3202
 		return '';
2616 3203
 	}
2617 3204
 
2618 3205
 	public static function update_vehicules_models() {
2619 3206
 		global $tmp_dir, $globalDebug;
2620 3207
 		$error = '';
2621
-		if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download...";
3208
+		if ($globalDebug) {
3209
+			echo "Vehicules models from FlightAirMap website : Download...";
3210
+		}
2622 3211
 		update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum');
2623 3212
 		if (file_exists($tmp_dir.'vehicules_models.md5sum')) {
2624
-			if ($globalDebug) echo "Check files...\n";
3213
+			if ($globalDebug) {
3214
+				echo "Check files...\n";
3215
+			}
2625 3216
 			$newmodelsdb = array();
2626 3217
 			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) {
2627 3218
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2640,15 +3231,21 @@  discard block
 block discarded – undo
2640 3231
 			}
2641 3232
 			$diff = array_diff($newmodelsdb,$modelsdb);
2642 3233
 			foreach ($diff as $key => $value) {
2643
-				if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n";
3234
+				if ($globalDebug) {
3235
+					echo 'Downloading vehicules model '.$key.' ...'."\n";
3236
+				}
2644 3237
 				update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key);
2645 3238
 				
2646 3239
 			}
2647 3240
 			update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
2648
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3241
+		} else {
3242
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3243
+		}
2649 3244
 		if ($error != '') {
2650 3245
 			return $error;
2651
-		} elseif ($globalDebug) echo "Done\n";
3246
+		} elseif ($globalDebug) {
3247
+			echo "Done\n";
3248
+		}
2652 3249
 		return '';
2653 3250
 	}
2654 3251
 
@@ -2691,7 +3288,9 @@  discard block
 block discarded – undo
2691 3288
                 }
2692 3289
 
2693 3290
 		$error = '';
2694
-		if ($globalDebug) echo "Notam : Download...";
3291
+		if ($globalDebug) {
3292
+			echo "Notam : Download...";
3293
+		}
2695 3294
 		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
2696 3295
 		if (file_exists($tmp_dir.'notam.rss')) {
2697 3296
 			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
@@ -2706,14 +3305,30 @@  discard block
 block discarded – undo
2706 3305
 				$data['fir'] = $q[0];
2707 3306
 				$data['code'] = $q[1];
2708 3307
 				$ifrvfr = $q[2];
2709
-				if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR';
2710
-				if ($ifrvfr == 'I') $data['rules'] = 'IFR';
2711
-				if ($ifrvfr == 'V') $data['rules'] = 'VFR';
2712
-				if ($q[4] == 'A') $data['scope'] = 'Airport warning';
2713
-				if ($q[4] == 'E') $data['scope'] = 'Enroute warning';
2714
-				if ($q[4] == 'W') $data['scope'] = 'Navigation warning';
2715
-				if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning';
2716
-				if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning';
3308
+				if ($ifrvfr == 'IV') {
3309
+					$data['rules'] = 'IFR/VFR';
3310
+				}
3311
+				if ($ifrvfr == 'I') {
3312
+					$data['rules'] = 'IFR';
3313
+				}
3314
+				if ($ifrvfr == 'V') {
3315
+					$data['rules'] = 'VFR';
3316
+				}
3317
+				if ($q[4] == 'A') {
3318
+					$data['scope'] = 'Airport warning';
3319
+				}
3320
+				if ($q[4] == 'E') {
3321
+					$data['scope'] = 'Enroute warning';
3322
+				}
3323
+				if ($q[4] == 'W') {
3324
+					$data['scope'] = 'Navigation warning';
3325
+				}
3326
+				if ($q[4] == 'AE') {
3327
+					$data['scope'] = 'Airport/Enroute warning';
3328
+				}
3329
+				if ($q[4] == 'AW') {
3330
+					$data['scope'] = 'Airport/Navigation warning';
3331
+				}
2717 3332
 				//$data['scope'] = $q[4];
2718 3333
 				$data['lower_limit'] = $q[5];
2719 3334
 				$data['upper_limit'] = $q[6];
@@ -2721,8 +3336,12 @@  discard block
 block discarded – undo
2721 3336
 				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
2722 3337
 				$latitude = $Common->convertDec($las,'latitude');
2723 3338
 				$longitude = $Common->convertDec($lns,'longitude');
2724
-				if ($lac == 'S') $latitude = '-'.$latitude;
2725
-				if ($lnc == 'W') $longitude = '-'.$longitude;
3339
+				if ($lac == 'S') {
3340
+					$latitude = '-'.$latitude;
3341
+				}
3342
+				if ($lnc == 'W') {
3343
+					$longitude = '-'.$longitude;
3344
+				}
2726 3345
 				$data['center_latitude'] = $latitude;
2727 3346
 				$data['center_longitude'] = $longitude;
2728 3347
 				$data['radius'] = intval($radius);
@@ -2752,10 +3371,14 @@  discard block
 block discarded – undo
2752 3371
 				$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']);
2753 3372
 				unset($data);
2754 3373
 			} 
2755
-		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
3374
+		} else {
3375
+			$error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
3376
+		}
2756 3377
 		if ($error != '') {
2757 3378
 			return $error;
2758
-		} elseif ($globalDebug) echo "Done\n";
3379
+		} elseif ($globalDebug) {
3380
+			echo "Done\n";
3381
+		}
2759 3382
 		return '';
2760 3383
 	}
2761 3384
 	
@@ -2780,7 +3403,9 @@  discard block
 block discarded – undo
2780 3403
 		$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json');
2781 3404
 		$airspace_json = json_decode($airspace_lst,true);
2782 3405
 		foreach ($airspace_json['records'] as $airspace) {
2783
-			if ($globalDebug) echo $airspace['name']."...\n";
3406
+			if ($globalDebug) {
3407
+				echo $airspace['name']."...\n";
3408
+			}
2784 3409
 			update_db::download($airspace['uri'],$tmp_dir.$airspace['name']);
2785 3410
 			if (file_exists($tmp_dir.$airspace['name'])) {
2786 3411
 				file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name'])));
@@ -2824,8 +3449,11 @@  discard block
 block discarded – undo
2824 3449
                         return "error : ".$e->getMessage();
2825 3450
                 }
2826 3451
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2827
-                if ($row['nb'] > 0) return false;
2828
-                else return true;
3452
+                if ($row['nb'] > 0) {
3453
+                	return false;
3454
+                } else {
3455
+                	return true;
3456
+                }
2829 3457
 	}
2830 3458
 
2831 3459
 	public static function insert_last_update() {
@@ -2850,8 +3478,11 @@  discard block
 block discarded – undo
2850 3478
                         return "error : ".$e->getMessage();
2851 3479
                 }
2852 3480
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2853
-                if ($row['nb'] > 0) return true;
2854
-                else return false;
3481
+                if ($row['nb'] > 0) {
3482
+                	return true;
3483
+                } else {
3484
+                	return false;
3485
+                }
2855 3486
 	}
2856 3487
 
2857 3488
 	public static function check_geoid_version($version) {
@@ -2864,8 +3495,11 @@  discard block
 block discarded – undo
2864 3495
                         return "error : ".$e->getMessage();
2865 3496
                 }
2866 3497
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2867
-                if ($row['nb'] > 0) return true;
2868
-                else return false;
3498
+                if ($row['nb'] > 0) {
3499
+                	return true;
3500
+                } else {
3501
+                	return false;
3502
+                }
2869 3503
 	}
2870 3504
 
2871 3505
 	public static function check_marine_identity_version($version) {
@@ -2878,8 +3512,11 @@  discard block
 block discarded – undo
2878 3512
 			return "error : ".$e->getMessage();
2879 3513
 		}
2880 3514
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2881
-		if ($row['nb'] > 0) return true;
2882
-		else return false;
3515
+		if ($row['nb'] > 0) {
3516
+			return true;
3517
+		} else {
3518
+			return false;
3519
+		}
2883 3520
 	}
2884 3521
 
2885 3522
 	public static function check_satellite_version($version) {
@@ -2892,8 +3529,11 @@  discard block
 block discarded – undo
2892 3529
 			return "error : ".$e->getMessage();
2893 3530
 		}
2894 3531
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2895
-		if ($row['nb'] > 0) return true;
2896
-		else return false;
3532
+		if ($row['nb'] > 0) {
3533
+			return true;
3534
+		} else {
3535
+			return false;
3536
+		}
2897 3537
 	}
2898 3538
 
2899 3539
 
@@ -2960,8 +3600,11 @@  discard block
 block discarded – undo
2960 3600
                         return "error : ".$e->getMessage();
2961 3601
                 }
2962 3602
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2963
-                if ($row['nb'] > 0) return false;
2964
-                else return true;
3603
+                if ($row['nb'] > 0) {
3604
+                	return false;
3605
+                } else {
3606
+                	return true;
3607
+                }
2965 3608
 	}
2966 3609
 
2967 3610
 	public static function insert_last_notam_update() {
@@ -2991,8 +3634,11 @@  discard block
 block discarded – undo
2991 3634
                         return "error : ".$e->getMessage();
2992 3635
                 }
2993 3636
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2994
-                if ($row['nb'] > 0) return false;
2995
-                else return true;
3637
+                if ($row['nb'] > 0) {
3638
+                	return false;
3639
+                } else {
3640
+                	return true;
3641
+                }
2996 3642
 	}
2997 3643
 
2998 3644
 	public static function insert_last_airspace_update() {
@@ -3022,8 +3668,11 @@  discard block
 block discarded – undo
3022 3668
                         return "error : ".$e->getMessage();
3023 3669
                 }
3024 3670
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3025
-                if ($row['nb'] > 0) return false;
3026
-                else return true;
3671
+                if ($row['nb'] > 0) {
3672
+                	return false;
3673
+                } else {
3674
+                	return true;
3675
+                }
3027 3676
 	}
3028 3677
 
3029 3678
 	public static function insert_last_geoid_update() {
@@ -3053,8 +3702,11 @@  discard block
 block discarded – undo
3053 3702
                         return "error : ".$e->getMessage();
3054 3703
                 }
3055 3704
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3056
-                if ($row['nb'] > 0) return false;
3057
-                else return true;
3705
+                if ($row['nb'] > 0) {
3706
+                	return false;
3707
+                } else {
3708
+                	return true;
3709
+                }
3058 3710
 	}
3059 3711
 
3060 3712
 	public static function insert_last_owner_update() {
@@ -3083,8 +3735,11 @@  discard block
 block discarded – undo
3083 3735
                         return "error : ".$e->getMessage();
3084 3736
                 }
3085 3737
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3086
-                if ($row['nb'] > 0) return false;
3087
-                else return true;
3738
+                if ($row['nb'] > 0) {
3739
+                	return false;
3740
+                } else {
3741
+                	return true;
3742
+                }
3088 3743
 	}
3089 3744
 
3090 3745
 	public static function insert_last_schedules_update() {
@@ -3114,8 +3769,11 @@  discard block
 block discarded – undo
3114 3769
 			return "error : ".$e->getMessage();
3115 3770
 		}
3116 3771
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3117
-		if ($row['nb'] > 0) return false;
3118
-		else return true;
3772
+		if ($row['nb'] > 0) {
3773
+			return false;
3774
+		} else {
3775
+			return true;
3776
+		}
3119 3777
 	}
3120 3778
 
3121 3779
 	public static function insert_last_tle_update() {
@@ -3145,8 +3803,11 @@  discard block
 block discarded – undo
3145 3803
 			return "error : ".$e->getMessage();
3146 3804
 		}
3147 3805
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3148
-		if ($row['nb'] > 0) return false;
3149
-		else return true;
3806
+		if ($row['nb'] > 0) {
3807
+			return false;
3808
+		} else {
3809
+			return true;
3810
+		}
3150 3811
 	}
3151 3812
 
3152 3813
 	public static function insert_last_ucsdb_update() {
@@ -3176,8 +3837,11 @@  discard block
 block discarded – undo
3176 3837
 			return "error : ".$e->getMessage();
3177 3838
 		}
3178 3839
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3179
-		if ($row['nb'] > 0) return false;
3180
-		else return true;
3840
+		if ($row['nb'] > 0) {
3841
+			return false;
3842
+		} else {
3843
+			return true;
3844
+		}
3181 3845
 	}
3182 3846
 
3183 3847
 	public static function insert_last_celestrak_update() {
@@ -3207,8 +3871,11 @@  discard block
 block discarded – undo
3207 3871
 			return "error : ".$e->getMessage();
3208 3872
 		}
3209 3873
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3210
-		if ($row['nb'] > 0) return false;
3211
-		else return true;
3874
+		if ($row['nb'] > 0) {
3875
+			return false;
3876
+		} else {
3877
+			return true;
3878
+		}
3212 3879
 	}
3213 3880
 
3214 3881
 	public static function check_last_satellite_update() {
@@ -3226,8 +3893,11 @@  discard block
 block discarded – undo
3226 3893
 			return "error : ".$e->getMessage();
3227 3894
 		}
3228 3895
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3229
-		if ($row['nb'] > 0) return false;
3230
-		else return true;
3896
+		if ($row['nb'] > 0) {
3897
+			return false;
3898
+		} else {
3899
+			return true;
3900
+		}
3231 3901
 	}
3232 3902
 
3233 3903
 	public static function insert_last_marine_identity_update() {
Please login to merge, or discard this patch.
require/class.Connection.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -6,6 +6,9 @@  discard block
 block discarded – undo
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 46;
8 8
 	
9
+	/**
10
+	 * @param string $dbname
11
+	 */
9 12
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10 13
 	    global $globalNoDB;
11 14
 	    if (isset($globalNoDB) && $globalNoDB === TRUE) {
@@ -142,6 +145,9 @@  discard block
 block discarded – undo
142 145
 		return true;
143 146
 	}
144 147
 
148
+	/**
149
+	 * @param string $table
150
+	 */
145 151
 	public function tableExists($table)
146 152
 	{
147 153
 		global $globalDBdriver, $globalDBname;
Please login to merge, or discard this patch.
Braces   +83 added lines, -32 removed lines patch added patch discarded remove patch
@@ -73,8 +73,11 @@  discard block
 block discarded – undo
73 73
 				$globalDBSname = $globalDBname;
74 74
 				$globalDBSuser = $globalDBuser;
75 75
 				$globalDBSpass = $globalDBpass;
76
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
77
-				else $globalDBSport = $globalDBport;
76
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
77
+					$globalDBSport = 3306;
78
+				} else {
79
+					$globalDBSport = $globalDBport;
80
+				}
78 81
 			} else {
79 82
 				$DBname = 'default';
80 83
 				$globalDBSdriver = $globalDBdriver;
@@ -82,8 +85,11 @@  discard block
 block discarded – undo
82 85
 				$globalDBSname = $globalDBname;
83 86
 				$globalDBSuser = $user;
84 87
 				$globalDBSpass = $pass;
85
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
86
-				else $globalDBSport = $globalDBport;
88
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
89
+					$globalDBSport = 3306;
90
+				} else {
91
+					$globalDBSport = $globalDBport;
92
+				}
87 93
 			}
88 94
 		} else {
89 95
 			$globalDBSdriver = $globalDB[$DBname]['driver'];
@@ -91,11 +97,16 @@  discard block
 block discarded – undo
91 97
 			$globalDBSname = $globalDB[$DBname]['name'];
92 98
 			$globalDBSuser = $globalDB[$DBname]['user'];
93 99
 			$globalDBSpass = $globalDB[$DBname]['pass'];
94
-			if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port'];
95
-			else $globalDBSport = 3306;
100
+			if (isset($globalDB[$DBname]['port'])) {
101
+				$globalDBSport = $globalDB[$DBname]['port'];
102
+			} else {
103
+				$globalDBSport = 3306;
104
+			}
96 105
 		}
97 106
 		// Set number of try to connect to DB
98
-		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5;
107
+		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) {
108
+			$globalDBretry = 5;
109
+		}
99 110
 		$i = 0;
100 111
 		while (true) {
101 112
 			try {
@@ -104,10 +115,16 @@  discard block
 block discarded – undo
104 115
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
105 116
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
106 117
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
107
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
108
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
109
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
110
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
118
+					if (!isset($globalDBTimeOut)) {
119
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
120
+					} else {
121
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
122
+					}
123
+					if (!isset($globalDBPersistent)) {
124
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
125
+					} else {
126
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
127
+					}
111 128
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
112 129
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
113 130
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -121,24 +138,36 @@  discard block
 block discarded – undo
121 138
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
122 139
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
123 140
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
124
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
125
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
126
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
127
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
141
+					if (!isset($globalDBTimeOut)) {
142
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
143
+					} else {
144
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
145
+					}
146
+					if (!isset($globalDBPersistent)) {
147
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
148
+					} else {
149
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
150
+					}
128 151
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
129 152
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
130 153
 				}
131 154
 				break;
132 155
 			} catch(PDOException $e) {
133 156
 				$i++;
134
-				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
157
+				if (isset($globalDebug) && $globalDebug) {
158
+					echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
159
+				}
135 160
 				//exit;
136 161
 				sleep(5);
137
-				if ($i > $globalDBretry) return false;
162
+				if ($i > $globalDBretry) {
163
+					return false;
164
+				}
138 165
 				//return false;
139 166
 			}
140 167
 		}
141
-		if ($DBname === 'default') $this->db = $this->dbs['default'];
168
+		if ($DBname === 'default') {
169
+			$this->db = $this->dbs['default'];
170
+		}
142 171
 		return true;
143 172
 	}
144 173
 
@@ -150,7 +179,9 @@  discard block
 block discarded – undo
150 179
 		} else {
151 180
 			$query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'";
152 181
 		}
153
-		if ($this->db == NULL) return false;
182
+		if ($this->db == NULL) {
183
+			return false;
184
+		}
154 185
 		try {
155 186
 			//$Connection = new Connection();
156 187
 			$results = $this->db->query($query);
@@ -159,22 +190,31 @@  discard block
 block discarded – undo
159 190
 		}
160 191
 		if($results->rowCount()>0) {
161 192
 		    return true; 
193
+		} else {
194
+			return false;
162 195
 		}
163
-		else return false;
164 196
 	}
165 197
 
166 198
 	public function connectionExists()
167 199
 	{
168 200
 		global $globalDBdriver, $globalDBCheckConnection, $globalNoDB;
169
-		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true;
170
-		if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
201
+		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) {
202
+			return true;
203
+		}
204
+		if (isset($globalNoDB) && $globalNoDB === TRUE) {
205
+			return true;
206
+		}
171 207
 		$query = "SELECT 1 + 1";
172
-		if ($this->db === null) return false;
208
+		if ($this->db === null) {
209
+			return false;
210
+		}
173 211
 		try {
174 212
 			$sum = @$this->db->query($query);
175 213
 			if ($sum instanceof \PDOStatement) {
176 214
 				$sum = $sum->fetchColumn(0);
177
-			} else $sum = 0;
215
+			} else {
216
+				$sum = 0;
217
+			}
178 218
 			if (intval($sum) !== 2) {
179 219
 			     return false;
180 220
 			}
@@ -209,8 +249,9 @@  discard block
 block discarded – undo
209 249
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
210 250
 		if($nb[0]['nb'] > 0) {
211 251
 			return true; 
252
+		} else {
253
+			return false;
212 254
 		}
213
-		else return false;
214 255
 	}
215 256
 
216 257
 	/*
@@ -260,9 +301,12 @@  discard block
 block discarded – undo
260 301
 			}
261 302
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
262 303
 			$sth->closeCursor();
263
-			if ($result['nb'] > 0) return true;
264
-			else return false;
265
-/*		} else {
304
+			if ($result['nb'] > 0) {
305
+				return true;
306
+			} else {
307
+				return false;
308
+			}
309
+			/*		} else {
266 310
 			$query = "SELECT * FROM ".$table." LIMIT 0";
267 311
 			try {
268 312
 				$results = $this->db->query($query);
@@ -301,7 +345,9 @@  discard block
 block discarded – undo
301 345
 				$sth->closeCursor();
302 346
 				return $result['value'];
303 347
 			}
304
-		} else return $version;
348
+		} else {
349
+			return $version;
350
+		}
305 351
 	}
306 352
 	
307 353
 	/*
@@ -310,9 +356,14 @@  discard block
 block discarded – undo
310 356
 	*/
311 357
 	public function latest() {
312 358
 	    global $globalNoDB;
313
-	    if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
314
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
315
-	    else return false;
359
+	    if (isset($globalNoDB) && $globalNoDB === TRUE) {
360
+	    	return true;
361
+	    }
362
+	    if ($this->check_schema_version() == $this->latest_schema) {
363
+	    	return true;
364
+	    } else {
365
+	    	return false;
366
+	    }
316 367
 	}
317 368
 
318 369
 }
Please login to merge, or discard this patch.
require/class.Satellite.php 1 patch
Braces   +55 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,8 +23,11 @@  discard block
 block discarded – undo
23 23
 			echo $e->getMessage();
24 24
 		}
25 25
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
26
-		if (isset($result[0])) return $result[0];
27
-		else return array();
26
+		if (isset($result[0])) {
27
+			return $result[0];
28
+		} else {
29
+			return array();
30
+		}
28 31
 	}
29 32
 	public function get_tle_types() {
30 33
 		$query = 'SELECT DISTINCT tle_type FROM tle ORDER BY tle_type';
@@ -35,8 +38,11 @@  discard block
 block discarded – undo
35 38
 			echo $e->getMessage();
36 39
 		}
37 40
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
38
-		if (isset($result[0])) return $result;
39
-		else return array();
41
+		if (isset($result[0])) {
42
+			return $result;
43
+		} else {
44
+			return array();
45
+		}
40 46
 	}
41 47
 	public function get_tle_names() {
42 48
 		$query = 'SELECT DISTINCT tle_name, tle_type FROM tle';
@@ -47,8 +53,11 @@  discard block
 block discarded – undo
47 53
 			echo $e->getMessage();
48 54
 		}
49 55
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
50
-		if (isset($result[0])) return $result;
51
-		else return array();
56
+		if (isset($result[0])) {
57
+			return $result;
58
+		} else {
59
+			return array();
60
+		}
52 61
 	}
53 62
 	public function get_tle_names_type($type) {
54 63
 		$query = 'SELECT tle_name, tle_type FROM tle WHERE tle_type = :type ORDER BY tle_name';
@@ -59,8 +68,11 @@  discard block
 block discarded – undo
59 68
 			echo $e->getMessage();
60 69
 		}
61 70
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
62
-		if (isset($result[0])) return $result;
63
-		else return array();
71
+		if (isset($result[0])) {
72
+			return $result;
73
+		} else {
74
+			return array();
75
+		}
64 76
 	}
65 77
 	
66 78
 	public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) {
@@ -94,7 +106,9 @@  discard block
 block discarded – undo
94 106
 		$sat = new Predict_Sat($tle);
95 107
 		$predict = new Predict();
96 108
 		//if ($timestamp == '') $now = Predict_Time::get_current_daynum();
97
-		if ($timestamp_begin == '') $timestamp_begin = time();
109
+		if ($timestamp_begin == '') {
110
+			$timestamp_begin = time();
111
+		}
98 112
 		if ($timestamp_end == '') {
99 113
 			$now = Predict_Time::unix2daynum($timestamp_begin);
100 114
 			$predict->predict_calc($sat,$qth,$now);
@@ -119,8 +133,11 @@  discard block
 block discarded – undo
119 133
 			echo $e->getMessage();
120 134
 		}
121 135
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
122
-		if (isset($result[0])) return $result[0];
123
-		else return array();
136
+		if (isset($result[0])) {
137
+			return $result[0];
138
+		} else {
139
+			return array();
140
+		}
124 141
 	}
125 142
 
126 143
 	/**
@@ -138,7 +155,9 @@  discard block
 block discarded – undo
138 155
 		    FROM satellite".$filter_query." satellite.launch_site <> '' AND satellite.launch_site IS NOT NULL";
139 156
 		$query_values = array();
140 157
 		$query .= " GROUP BY satellite.launch_site ORDER BY launch_site_count DESC";
141
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
158
+		if ($limit) {
159
+			$query .= " LIMIT 10 OFFSET 0";
160
+		}
142 161
 		$sth = $this->db->prepare($query);
143 162
 		$sth->execute($query_values);
144 163
 		$launch_site_array = array();
@@ -167,7 +186,9 @@  discard block
 block discarded – undo
167 186
 		    FROM satellite".$filter_query." satellite.owner <> '' AND satellite.owner IS NOT NULL";
168 187
 		$query_values = array();
169 188
 		$query .= " GROUP BY satellite.owner ORDER BY owner_count DESC";
170
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
189
+		if ($limit) {
190
+			$query .= " LIMIT 10 OFFSET 0";
191
+		}
171 192
 		$sth = $this->db->prepare($query);
172 193
 		$sth->execute($query_values);
173 194
 		$owner_array = array();
@@ -196,7 +217,9 @@  discard block
 block discarded – undo
196 217
 		    FROM satellite".$filter_query." satellite.country_owner <> '' AND satellite.country_owner IS NOT NULL";
197 218
 		$query_values = array();
198 219
 		$query .= " GROUP BY satellite.country_owner ORDER BY country_count DESC";
199
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
220
+		if ($limit) {
221
+			$query .= " LIMIT 10 OFFSET 0";
222
+		}
200 223
 		$sth = $this->db->prepare($query);
201 224
 		$sth->execute($query_values);
202 225
 		$owner_array = array();
@@ -223,20 +246,26 @@  discard block
 block discarded – undo
223 246
 			date_default_timezone_set($globalTimezone);
224 247
 			$datetime = new DateTime();
225 248
 			$offset = $datetime->format('P');
226
-		} else $offset = '+00:00';
249
+		} else {
250
+			$offset = '+00:00';
251
+		}
227 252
 		//$filter_query = $this->getFilter($filters,true,true);
228 253
 		$filter_query = ' WHERE';
229 254
 		if ($globalDBdriver == 'mysql') {
230 255
 			$query  = "SELECT MONTH(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS year_name, count(*) as date_count
231 256
 				FROM satellite".$filter_query." satellite.launch_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
232
-			if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'";
257
+			if ($sincedate != '') {
258
+				$query .= " AND satellite.launch_date > '".$sincedate."'";
259
+			}
233 260
 			$query .= " GROUP BY year_name, month_name
234 261
 				ORDER BY year_name, month_name ASC";
235 262
 			$query_data = array(':offset' => $offset);
236 263
 		} else {
237 264
 			$query  = "SELECT EXTRACT(MONTH FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS month_name, EXTRACT(YEAR FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS year_name, count(*) as date_count
238 265
 				FROM satellite".$filter_query." satellite.launch_date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 YEARS'";
239
-			if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'";
266
+			if ($sincedate != '') {
267
+				$query .= " AND satellite.launch_date > '".$sincedate."'";
268
+			}
240 269
 			$query .= " GROUP BY year_name, month_name
241 270
 				ORDER BY year_name, month_name ASC";
242 271
 			$query_data = array(':offset' => $offset);
@@ -268,20 +297,26 @@  discard block
 block discarded – undo
268 297
 			date_default_timezone_set($globalTimezone);
269 298
 			$datetime = new DateTime();
270 299
 			$offset = $datetime->format('P');
271
-		} else $offset = '+00:00';
300
+		} else {
301
+			$offset = '+00:00';
302
+		}
272 303
 		//$filter_query = $this->getFilter($filters,true,true);
273 304
 		$filter_query = ' WHERE';
274 305
 		if ($globalDBdriver == 'mysql') {
275 306
 			$query  = "SELECT YEAR(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS year_name, count(*) as date_count
276 307
 				FROM satellite".$filter_query." satellite.launch_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 YEAR)";
277
-			if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'";
308
+			if ($sincedate != '') {
309
+				$query .= " AND satellite.launch_date > '".$sincedate."'";
310
+			}
278 311
 			$query .= " GROUP BY year_name
279 312
 				ORDER BY year_name ASC";
280 313
 			$query_data = array(':offset' => $offset);
281 314
 		} else {
282 315
 			$query  = "SELECT EXTRACT(YEAR FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS year_name, count(*) as date_count
283 316
 				FROM satellite".$filter_query." satellite.launch_date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '10 YEARS'";
284
-			if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'";
317
+			if ($sincedate != '') {
318
+				$query .= " AND satellite.launch_date > '".$sincedate."'";
319
+			}
285 320
 			$query .= " GROUP BY year_name
286 321
 				ORDER BY year_name ASC";
287 322
 			$query_data = array(':offset' => $offset);
Please login to merge, or discard this patch.
space-data.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -81,10 +81,15 @@
 block discarded – undo
81 81
 //	$launch_date = '15 November 1974';
82 82
 } else {
83 83
 	$ident = $sat;
84
-	if (strpos($sat,'(')) $satname = $sat;
85
-	else $satname = str_replace(array(' '),'-',$sat);
84
+	if (strpos($sat,'(')) {
85
+		$satname = $sat;
86
+	} else {
87
+		$satname = str_replace(array(' '),'-',$sat);
88
+	}
89
+	}
90
+if (!isset($satname)) {
91
+	$satname = $sat;
86 92
 }
87
-if (!isset($satname)) $satname = $sat;
88 93
 $info = $Satellite->get_info(strtolower(trim($satname)));
89 94
 $position = $Satellite->position($sat);
90 95
 $ground_speed = $position['speed'];
Please login to merge, or discard this patch.
header.php 1 patch
Braces   +77 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,10 +3,15 @@  discard block
 block discarded – undo
3 3
 //gets the page file and stores it in a variable
4 4
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
5 5
 $current_page = $file_path['filename'];
6
-if ($globalTimezone == '') $globalTimezone = 'UTC';
6
+if ($globalTimezone == '') {
7
+	$globalTimezone = 'UTC';
8
+}
7 9
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
10
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
11
+	$MapType = $_COOKIE['MapType'];
12
+} else {
13
+	$MapType = $globalMapProvider;
14
+}
10 15
 if (isset($_GET['3d'])) {
11 16
 	setcookie('MapFormat','3d');
12 17
 } else if (isset($_GET['2d'])) {
@@ -231,7 +236,13 @@  discard block
 block discarded – undo
231 236
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
232 237
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
233 238
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
234
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
239
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
240
+	print '&latitude='.$latitude;
241
+}
242
+?><?php if(isset($longitude)) {
243
+	print '&longitude='.$longitude;
244
+}
245
+?>&<?php print time(); ?>"></script>
235 246
 <?php
236 247
 		if (!isset($type) || $type == 'aircraft') {
237 248
 ?>
@@ -300,7 +311,13 @@  discard block
 block discarded – undo
300 311
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
301 312
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
302 313
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
303
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
314
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
315
+	print '&latitude='.$latitude;
316
+}
317
+?><?php if(isset($longitude)) {
318
+	print '&longitude='.$longitude;
319
+}
320
+?>&<?php print time(); ?>"></script>
304 321
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
305 322
 <?php
306 323
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -381,7 +398,12 @@  discard block
 block discarded – undo
381 398
         <span class="icon-bar"></span>
382 399
       </button>
383 400
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
384
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
401
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
402
+	print '/';
403
+} else {
404
+	print $globalURL;
405
+}
406
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
385 407
     </div>
386 408
     <div class="collapse navbar-collapse">
387 409
 
@@ -420,7 +442,10 @@  discard block
 block discarded – undo
420 442
 <?php
421 443
     }
422 444
 ?>
423
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
445
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
446
+	echo 'right-';
447
+}
448
+?>caret"></b></a>
424 449
           <ul class="dropdown-menu">
425 450
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
426 451
 <?php
@@ -491,8 +516,14 @@  discard block
 block discarded – undo
491 516
         </li>
492 517
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
493 518
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
494
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
495
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
519
+        <li class="dropdown<?php if ($sub) {
520
+	echo '-submenu';
521
+}
522
+?>">
523
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
524
+	echo 'right-';
525
+}
526
+?>caret"></b></a>
496 527
           <ul class="dropdown-menu">
497 528
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
498 529
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -528,7 +559,10 @@  discard block
 block discarded – undo
528 559
 <?php
529 560
 	}
530 561
 ?>
531
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
562
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
563
+	echo 'right-';
564
+}
565
+?>caret"></b></a>
532 566
 		<ul class="dropdown-menu">
533 567
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
534 568
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -560,7 +594,10 @@  discard block
 block discarded – undo
560 594
 <?php
561 595
 	}
562 596
 ?>
563
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
597
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
598
+	echo 'right-';
599
+}
600
+?>caret"></b></a>
564 601
 		<ul class="dropdown-menu">
565 602
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
566 603
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -593,7 +630,10 @@  discard block
 block discarded – undo
593 630
 	}
594 631
 ?>
595 632
 <!--
596
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
633
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
634
+	echo 'right-';
635
+}
636
+?>caret"></b></a>
597 637
 		<ul class="dropdown-menu">
598 638
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
599 639
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -650,7 +690,9 @@  discard block
 block discarded – undo
650 690
   		        $alllang = $Language->getLanguages();
651 691
   		        foreach ($alllang as $key => $lang) {
652 692
   		            print '<option value="'.$key.'"';
653
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
693
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
694
+  		            	print ' selected ';
695
+  		            }
654 696
   		            print '>'.$lang[0].'</option>';
655 697
   		        }
656 698
   		    ?>
@@ -790,9 +832,24 @@  discard block
 block discarded – undo
790 832
 	$customid = $globalMapProvider;
791 833
 ?>
792 834
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
793
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
794
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
795
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
835
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
836
+	print $globalMapCustomLayer[$customid]['maxZoom'];
837
+} else {
838
+	print '18';
839
+}
840
+?>,
841
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
842
+	print $globalMapCustomLayer[$customid]['minZoom'];
843
+} else {
844
+	print '0';
845
+}
846
+?>,
847
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
848
+	print 'false';
849
+} else {
850
+	print 'true';
851
+}
852
+?>,
796 853
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
797 854
     }).addTo(map);
798 855
 <?php
@@ -815,4 +872,7 @@  discard block
 block discarded – undo
815 872
 
816 873
 ?>
817 874
 
818
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
875
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
876
+	print 'index ';
877
+}
878
+?>clear">
Please login to merge, or discard this patch.
statistics-sub-menu.php 1 patch
Braces   +110 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,7 +6,13 @@  discard block
 block discarded – undo
6 6
 	if (!isset($type) || $type != 'satellite') {
7 7
 ?>
8 8
 		<form id="changedate" method="post">
9
-			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
9
+			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
10
+	echo $year.'-';
11
+}
12
+?><?php if (isset($month) && $month != '') {
13
+	echo $month;
14
+}
15
+?>" />
10 16
 		</form>
11 17
 <?php
12 18
 	}
@@ -38,7 +44,9 @@  discard block
 block discarded – undo
38 44
 						print '<option disabled>──────────</option>';
39 45
 					}
40 46
 					$Stats = new Stats();
41
-					if (!isset($filter_name)) $filter_name = '';
47
+					if (!isset($filter_name)) {
48
+						$filter_name = '';
49
+					}
42 50
 					$airlines = $Stats->getAllAirlineNames($filter_name);
43 51
 					foreach($airlines as $airline) {
44 52
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
@@ -67,10 +75,22 @@  discard block
 block discarded – undo
67 75
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
68 76
 		    </a>
69 77
 		    <ul class="dropdown-menu">
70
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li>
71
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li>
72
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li>
73
-			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li>
78
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
79
+	echo '/'.$airline_icao;
80
+}
81
+?>"><?php echo _("Aircraft"); ?></a></li>
82
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
83
+	echo '/'.$airline_icao;
84
+}
85
+?>"><?php echo _("Registration"); ?></a></li>
86
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
87
+	echo '/'.$airline_icao;
88
+}
89
+?>"><?php echo _("Manufacturer"); ?></a></li>
90
+			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
91
+	echo '/'.$airline_icao;
92
+}
93
+?>"><?php echo _("Country"); ?></a></li>
74 94
 		    </ul>
75 95
 		</li>
76 96
 		<li class="dropdown">
@@ -81,12 +101,21 @@  discard block
 block discarded – undo
81 101
 <?php
82 102
 		if (!isset($airline_icao) || $airline_icao == 'all') {
83 103
 ?>
84
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li>
85
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li>
104
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
105
+	echo '/'.$airline_icao;
106
+}
107
+?>"><?php echo _("Airline"); ?></a></li>
108
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
109
+	echo '/'.$airline_icao;
110
+}
111
+?>"><?php echo _("Airline by Country"); ?></a></li>
86 112
 <?php
87 113
 		}
88 114
 ?>
89
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li>
115
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
116
+	echo '/'.$airline_icao;
117
+}
118
+?>"><?php echo _("Callsign"); ?></a></li>
90 119
 		    </ul>
91 120
 		</li>
92 121
 		<li class="dropdown">
@@ -94,10 +123,22 @@  discard block
 block discarded – undo
94 123
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
95 124
 		    </a>
96 125
 		    <ul class="dropdown-menu" role="menu">
97
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li>
98
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
99
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li>
100
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
126
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
127
+	echo '/'.$airline_icao;
128
+}
129
+?>"><?php echo _("Departure Airport"); ?></a></li>
130
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
131
+	echo '/'.$airline_icao;
132
+}
133
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
134
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
135
+	echo '/'.$airline_icao;
136
+}
137
+?>"><?php echo _("Arrival Airport"); ?></a></li>
138
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
139
+	echo '/'.$airline_icao;
140
+}
141
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
101 142
 		    </ul>
102 143
 		</li>
103 144
 		<li class="dropdown">
@@ -105,8 +146,14 @@  discard block
 block discarded – undo
105 146
 		      <?php echo _("Route"); ?> <span class="caret"></span>
106 147
 		    </a>
107 148
 		    <ul class="dropdown-menu" role="menu">
108
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li>
109
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li>
149
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
150
+	echo '/'.$airline_icao;
151
+}
152
+?>"><?php echo _("Route by Airport"); ?></a></li>
153
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
154
+	echo '/'.$airline_icao;
155
+}
156
+?>"><?php echo _("Route by Waypoint"); ?></a></li>
110 157
 		    </ul>
111 158
 		</li>
112 159
 		<li class="dropdown">
@@ -114,8 +161,14 @@  discard block
 block discarded – undo
114 161
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
115 162
 		    </a>
116 163
 		    <ul class="dropdown-menu" role="menu">
117
-		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li>
118
-			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li>
164
+		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
165
+	echo '/'.$airline_icao;
166
+}
167
+?>"><?php echo _("Date"); ?></a></li>
168
+			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
169
+	echo '/'.$airline_icao;
170
+}
171
+?>"><?php echo _("Time"); ?></a></li>
119 172
 		    </ul>
120 173
 		</li>
121 174
 		<?php
@@ -163,9 +216,18 @@  discard block
 block discarded – undo
163 216
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
164 217
 		    </a>
165 218
 		    <ul class="dropdown-menu">
166
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
167
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
168
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
219
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
220
+	echo '/'.$airline_icao;
221
+}
222
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
223
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
224
+	echo '/'.$airline_icao;
225
+}
226
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
227
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
228
+	echo '/'.$airline_icao;
229
+}
230
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
169 231
 			<!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> -->
170 232
 		    </ul>
171 233
 		</li>
@@ -177,12 +239,21 @@  discard block
 block discarded – undo
177 239
 <?php
178 240
 		if (!isset($airline_icao) || $airline_icao == 'all') {
179 241
 ?>
180
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
181
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
242
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
243
+	echo '/'.$airline_icao;
244
+}
245
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
246
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
247
+	echo '/'.$airline_icao;
248
+}
249
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
182 250
 <?php
183 251
 		}
184 252
 ?>
185
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
253
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
254
+	echo '/'.$airline_icao;
255
+}
256
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
186 257
 		    </ul>
187 258
 		</li>
188 259
 		<li class="dropdown">
@@ -190,10 +261,22 @@  discard block
 block discarded – undo
190 261
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
191 262
 		    </a>
192 263
 		    <ul class="dropdown-menu" role="menu">
193
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
194
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
195
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
196
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
264
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
265
+	echo '/'.$airline_icao;
266
+}
267
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
268
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
269
+	echo '/'.$airline_icao;
270
+}
271
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
272
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
273
+	echo '/'.$airline_icao;
274
+}
275
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
276
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
277
+	echo '/'.$airline_icao;
278
+}
279
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
197 280
 		    </ul>
198 281
 		</li>
199 282
 		<!--
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 1 patch
Braces   +24 added lines, -4 removed lines patch added patch discarded remove patch
@@ -257,7 +257,12 @@  discard block
 block discarded – undo
257 257
 //				viewer.dataSources.get(dsn).entities.remove(entity);
258 258
 //			}
259 259
 			//console.log(entity.lastupdate);
260
-			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
260
+			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
261
+	print $globalMapRefresh*2000;
262
+} else {
263
+	print '60000';
264
+}
265
+?>)) {
261 266
 //				console.log('Remove an entity date');
262 267
 				viewer.dataSources.get(dsn).entities.remove(entity);
263 268
 			} else {
@@ -544,7 +549,12 @@  discard block
 block discarded – undo
544 549
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
545 550
 ?>
546 551
 update_polarLayer();
547
-setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
552
+setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) {
553
+	print $globalMapRefresh*1000*2;
554
+} else {
555
+	print '60000';
556
+}
557
+?>);
548 558
 <?php
549 559
 		}
550 560
 ?>
@@ -642,7 +652,12 @@  discard block
 block discarded – undo
642 652
 				}
643 653
 			}
644 654
 		}
645
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
655
+	,<?php if (isset($globalMapRefresh)) {
656
+	print $globalMapRefresh*1000;
657
+} else {
658
+	print '30000';
659
+}
660
+?>);
646 661
 } else {
647 662
 	//var widget = new Cesium.CesiumWidget('archivebox');
648 663
 //	var timeline = new Cesium.Timeline(viewer);
@@ -661,7 +676,12 @@  discard block
 block discarded – undo
661 676
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
662 677
 ?>
663 678
 update_atcLayer();
664
-setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
679
+setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) {
680
+	print $globalMapRefresh*1000*2;
681
+} else {
682
+	print '60000';
683
+}
684
+?>);
665 685
 <?php
666 686
     }
667 687
 ?>
Please login to merge, or discard this patch.
js/map-satellite.3d.js.php 1 patch
Braces   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,12 @@
 block discarded – undo
52 52
 	} else {
53 53
 		for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) {
54 54
 			var entity = viewer.dataSources.get(dsn).entities.values[i];
55
-			if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
55
+			if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
56
+	print $globalMapRefresh*2000;
57
+} else {
58
+	print '60000';
59
+}
60
+?>)) {
56 61
 				viewer.dataSources.get(dsn).entities.remove(entity);
57 62
 			}
58 63
 		}
Please login to merge, or discard this patch.
install/index.php 1 patch
Braces   +506 added lines, -136 removed lines patch added patch discarded remove patch
@@ -131,45 +131,72 @@  discard block
 block discarded – undo
131 131
 			</div>
132 132
 			<p>
133 133
 				<label for="dbhost">Database hostname</label>
134
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
134
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
135
+	print $globalDBhost;
136
+}
137
+?>" />
135 138
 			</p>
136 139
 			<p>
137 140
 				<label for="dbport">Database port</label>
138
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
141
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
142
+	print $globalDBport;
143
+}
144
+?>" />
139 145
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
140 146
 			</p>
141 147
 			<p>
142 148
 				<label for="dbname">Database name</label>
143
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
149
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
150
+	print $globalDBname;
151
+}
152
+?>" />
144 153
 			</p>
145 154
 			<p>
146 155
 				<label for="dbuser">Database user</label>
147
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
156
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
157
+	print $globalDBuser;
158
+}
159
+?>" />
148 160
 			</p>
149 161
 			<p>
150 162
 				<label for="dbuserpass">Database user password</label>
151
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
163
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
164
+	print $globalDBpass;
165
+}
166
+?>" />
152 167
 			</p>
153 168
 		</fieldset>
154 169
 		<fieldset id="site">
155 170
 			<legend>Site configuration</legend>
156 171
 			<p>
157 172
 				<label for="sitename">Site name</label>
158
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
173
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
174
+	print $globalName;
175
+}
176
+?>" />
159 177
 			</p>
160 178
 			<p>
161 179
 				<label for="siteurl">Site directory</label>
162
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
180
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
181
+	print $globalURL;
182
+}
183
+?>" />
163 184
 				<p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
164 185
 			</p>
165 186
 			<p>
166 187
 				<label for="timezone">Timezone</label>
167
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
188
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
189
+	print $globalTimezone;
190
+}
191
+?>" />
168 192
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
169 193
 			</p>
170 194
 			<p>
171 195
 				<label for="language">Language</label>
172
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
196
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
197
+	print $globalLanguage;
198
+}
199
+?>" />
173 200
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
174 201
 			</p>
175 202
 		</fieldset>
@@ -190,11 +217,17 @@  discard block
 block discarded – undo
190 217
 			<div id="mapbox_data">
191 218
 				<p>
192 219
 					<label for="mapboxid">Mapbox id</label>
193
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
220
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
221
+	print $globalMapboxId;
222
+}
223
+?>" />
194 224
 				</p>
195 225
 				<p>
196 226
 					<label for="mapboxtoken">Mapbox token</label>
197
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
227
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
228
+	print $globalMapboxToken;
229
+}
230
+?>" />
198 231
 				</p>
199 232
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
200 233
 			</div>
@@ -202,7 +235,10 @@  discard block
 block discarded – undo
202 235
 			<div id="google_data">
203 236
 				<p>
204 237
 					<label for="googlekey">Google API key</label>
205
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
238
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
239
+	print $globalGoogleAPIKey;
240
+}
241
+?>" />
206 242
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
207 243
 				</p>
208 244
 			</div>
@@ -210,7 +246,10 @@  discard block
 block discarded – undo
210 246
 			<div id="bing_data">
211 247
 				<p>
212 248
 					<label for="bingkey">Bing Map key</label>
213
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
249
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
250
+	print $globalBingMapKey;
251
+}
252
+?>" />
214 253
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
215 254
 				</p>
216 255
 			</div>
@@ -218,7 +257,10 @@  discard block
 block discarded – undo
218 257
 			<div id="mapquest_data">
219 258
 				<p>
220 259
 					<label for="mapquestkey">MapQuest key</label>
221
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
260
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
261
+	print $globalMapQuestKey;
262
+}
263
+?>" />
222 264
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
223 265
 				</p>
224 266
 			</div>
@@ -226,11 +268,17 @@  discard block
 block discarded – undo
226 268
 			<div id="here_data">
227 269
 				<p>
228 270
 					<label for="hereappid">Here App_Id</label>
229
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
271
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
272
+	print $globalHereappId;
273
+}
274
+?>" />
230 275
 				</p>
231 276
 				<p>
232 277
 					<label for="hereappcode">Here App_Code</label>
233
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
278
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
279
+	print $globalHereappCode;
280
+}
281
+?>" />
234 282
 				</p>
235 283
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
236 284
 			</div>
@@ -238,7 +286,10 @@  discard block
 block discarded – undo
238 286
 			<div id="openweathermap_data">
239 287
 				<p>
240 288
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
241
-					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
289
+					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
290
+	print $globalOpenWeatherMapKey;
291
+}
292
+?>" />
242 293
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
243 294
 				</p>
244 295
 			</div>
@@ -248,42 +299,86 @@  discard block
 block discarded – undo
248 299
 			<legend>Coverage area</legend>
249 300
 			<p>
250 301
 				<label for="latitudemax">The maximum latitude (north)</label>
251
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
302
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
303
+	print $globalLatitudeMax;
304
+}
305
+?>" />
252 306
 			</p>
253 307
 			<p>
254 308
 				<label for="latitudemin">The minimum latitude (south)</label>
255
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
309
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
310
+	print $globalLatitudeMin;
311
+}
312
+?>" />
256 313
 			</p>
257 314
 			<p>
258 315
 				<label for="longitudemax">The maximum longitude (west)</label>
259
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
316
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
317
+	print $globalLongitudeMax;
318
+}
319
+?>" />
260 320
 			</p>
261 321
 			<p>
262 322
 				<label for="longitudemin">The minimum longitude (east)</label>
263
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
323
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
324
+	print $globalLongitudeMin;
325
+}
326
+?>" />
264 327
 			</p>
265 328
 			<p>
266 329
 				<label for="latitudecenter">The latitude center</label>
267
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
330
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
331
+	print $globalCenterLatitude;
332
+}
333
+?>" />
268 334
 			</p>
269 335
 			<p>
270 336
 				<label for="longitudecenter">The longitude center</label>
271
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
337
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
338
+	print $globalCenterLongitude;
339
+}
340
+?>" />
272 341
 			</p>
273 342
 			<p>
274 343
 				<label for="livezoom">Default Zoom on live map</label>
275
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
344
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
345
+	print $globalLiveZoom;
346
+} else {
347
+	print '9';
348
+}
349
+?>" />
276 350
 			</p>
277 351
 			<p>
278 352
 				<label for="squawk_country">Country for squawk usage</label>
279 353
 				<select name="squawk_country" id="squawk_country">
280
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
281
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
282
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
283
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
284
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
285
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
286
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
354
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
355
+	print ' selected ';
356
+}
357
+?>>UK</option>
358
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
359
+	print ' selected ';
360
+}
361
+?>>NZ</option>
362
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
363
+	print ' selected ';
364
+}
365
+?>>US</option>
366
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
367
+	print ' selected ';
368
+}
369
+?>>AU</option>
370
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
371
+	print ' selected ';
372
+}
373
+?>>NL</option>
374
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
375
+	print ' selected ';
376
+}
377
+?>>FR</option>
378
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
379
+	print ' selected ';
380
+}
381
+?>>TR</option>
287 382
 				</select>
288 383
 			</p>
289 384
 		</fieldset>
@@ -292,15 +387,24 @@  discard block
 block discarded – undo
292 387
 			<p><i>Only put in DB flights that are inside a circle</i></p>
293 388
 			<p>
294 389
 				<label for="latitude">Center latitude</label>
295
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
390
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
391
+	echo $globalDistanceIgnore['latitude'];
392
+}
393
+?>" />
296 394
 			</p>
297 395
 			<p>
298 396
 				<label for="longitude">Center longitude</label>
299
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
397
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
398
+	echo $globalDistanceIgnore['longitude'];
399
+}
400
+?>" />
300 401
 			</p>
301 402
 			<p>
302 403
 				<label for="Distance">Distance (in km)</label>
303
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
404
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
405
+	echo $globalDistanceIgnore['distance'];
406
+}
407
+?>" />
304 408
 			</p>
305 409
 		</fieldset>
306 410
 		<fieldset id="sourceloc">
@@ -411,11 +515,17 @@  discard block
 block discarded – undo
411 515
 			<div id="flightaware_data">
412 516
 				<p>
413 517
 					<label for="flightawareusername">FlightAware username</label>
414
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
518
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
519
+	print $globalFlightAwareUsername;
520
+}
521
+?>" />
415 522
 				</p>
416 523
 				<p>
417 524
 					<label for="flightawarepassword">FlightAware password/API key</label>
418
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
525
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
526
+	print $globalFlightAwarePassword;
527
+}
528
+?>" />
419 529
 				</p>
420 530
 			</div>
421 531
 -->
@@ -457,7 +567,10 @@  discard block
 block discarded – undo
457 567
 								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
458 568
 								?>
459 569
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
460
-								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
570
+								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) {
571
+	print $source['port'];
572
+}
573
+?>" /></td>
461 574
 								<?php
462 575
 								    } else {
463 576
 									$hostport = explode(':',$source['host']);
@@ -476,33 +589,102 @@  discard block
 block discarded – undo
476 589
 								?>
477 590
 								<td>
478 591
 									<select name="format[]" id="format">
479
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
480
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
481
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
482
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
483
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
484
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
485
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
486
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
487
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
488
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
489
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
490
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
491
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
492
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
493
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
494
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
495
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
496
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
497
-										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
498
-										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
592
+										<option value="auto" <?php if (!isset($source['format'])) {
593
+	print 'selected';
594
+}
595
+?>>Auto</option>
596
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
597
+	print 'selected';
598
+}
599
+?>>SBS</option>
600
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
601
+	print 'selected';
602
+}
603
+?>>TSV</option>
604
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
605
+	print 'selected';
606
+}
607
+?>>Raw</option>
608
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
609
+	print 'selected';
610
+}
611
+?>>APRS</option>
612
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
613
+	print 'selected';
614
+}
615
+?>>Radarcape deltadb.txt</option>
616
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
617
+	print 'selected';
618
+}
619
+?>>Vatsim</option>
620
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
621
+	print 'selected';
622
+}
623
+?>>Virtual Radar Server AircraftList.json</option>
624
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
625
+	print 'selected';
626
+}
627
+?>>Virtual Radar Server TCP</option>
628
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
629
+	print 'selected';
630
+}
631
+?>>phpVMS</option>
632
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
633
+	print 'selected';
634
+}
635
+?>>Virtual Airlines Manager</option>
636
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
637
+	print 'selected';
638
+}
639
+?>>IVAO</option>
640
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
641
+	print 'selected';
642
+}
643
+?>>FlightGear Multiplayer</option>
644
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
645
+	print 'selected';
646
+}
647
+?>>FlightGear Singleplayer</option>
648
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
649
+	print 'selected';
650
+}
651
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
652
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
653
+	print 'selected';
654
+}
655
+?>>ACARS SBS-3 over TCP</option>
656
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
657
+	print 'selected';
658
+}
659
+?>>NMEA AIS over TCP</option>
660
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
661
+	print 'selected';
662
+}
663
+?>>AirWhere website</option>
664
+										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') {
665
+	print 'selected';
666
+}
667
+?>>HidnSeek Callback</option>
668
+										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') {
669
+	print 'selected';
670
+}
671
+?>>Blitzortung</option>
499 672
 									</select>
500 673
 								</td>
501 674
 								<td>
502
-									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
675
+									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
676
+	print $source['name'];
677
+}
678
+?>" />
503 679
 								</td>
504
-								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
505
-								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td>
680
+								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) {
681
+	print 'checked';
682
+}
683
+?> /></td>
684
+								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
685
+	print 'checked';
686
+}
687
+?> /></td>
506 688
 								<td>
507 689
 									<select name="timezones[]" id="timezones">
508 690
 								<?php
@@ -512,7 +694,9 @@  discard block
 block discarded – undo
512 694
 											print '<option selected>'.$timezones.'</option>';
513 695
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
514 696
 											print '<option selected>'.$timezones.'</option>';
515
-										} else print '<option>'.$timezones.'</option>';
697
+										} else {
698
+											print '<option>'.$timezones.'</option>';
699
+										}
516 700
 									}
517 701
 								?>
518 702
 									</select>
@@ -562,7 +746,9 @@  discard block
 block discarded – undo
562 746
 									foreach($timezonelist as $timezones){
563 747
 										if ($timezones == 'UTC') {
564 748
 											print '<option selected>'.$timezones.'</option>';
565
-										} else print '<option>'.$timezones.'</option>';
749
+										} else {
750
+											print '<option>'.$timezones.'</option>';
751
+										}
566 752
 									}
567 753
 								?>
568 754
 									</select>
@@ -585,11 +771,17 @@  discard block
 block discarded – undo
585 771
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
586 772
 					<p>
587 773
 						<label for="acarshost">ACARS UDP host</label>
588
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
774
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
775
+	print $globalACARSHost;
776
+}
777
+?>" />
589 778
 					</p>
590 779
 					<p>
591 780
 						<label for="acarsport">ACARS UDP port</label>
592
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
781
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
782
+	print $globalACARSPort;
783
+}
784
+?>" />
593 785
 					</p>
594 786
 				</fieldset>
595 787
 			</div>
@@ -671,13 +863,19 @@  discard block
 block discarded – undo
671 863
 			<div id="schedules_options">
672 864
 				<p>
673 865
 					<label for="britishairways">British Airways API Key</label>
674
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
866
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
867
+	print $globalBritishAirwaysKey;
868
+}
869
+?>" />
675 870
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
676 871
 				</p>
677 872
 				<!--
678 873
 				<p>
679 874
 					<label for="transavia">Transavia Test API Consumer Key</label>
680
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
875
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
876
+	print $globalTransaviaKey;
877
+}
878
+?>" />
681 879
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
682 880
 				</p>
683 881
 				-->
@@ -686,10 +884,16 @@  discard block
 block discarded – undo
686 884
 						<b>Lufthansa API Key</b>
687 885
 						<p>
688 886
 							<label for="lufthansakey">Key</label>
689
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
887
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
888
+	print $globalLufthansaKey['key'];
889
+}
890
+?>" />
690 891
 						</p><p>
691 892
 							<label for="lufthansasecret">Secret</label>
692
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
893
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
894
+	print $globalLufthansaKey['secret'];
895
+}
896
+?>" />
693 897
 						</p>
694 898
 					</div>
695 899
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -709,7 +913,10 @@  discard block
 block discarded – undo
709 913
 			</p>
710 914
 			<p>
711 915
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
712
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
916
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
917
+	print $globalNOTAMSource;
918
+}
919
+?>" />
713 920
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
714 921
 			</p>
715 922
 			<br />
@@ -725,14 +932,20 @@  discard block
 block discarded – undo
725 932
 			<div id="metarsrc">
726 933
 				<p>
727 934
 					<label for="metarsource">URL of your METAR source</label>
728
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
935
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
936
+	print $globalMETARurl;
937
+}
938
+?>" />
729 939
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
730 940
 				</p>
731 941
 			</div>
732 942
 			<br />
733 943
 			<p>
734 944
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
735
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
945
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
946
+	print $globalBitlyAccessToken;
947
+}
948
+?>" />
736 949
 			</p>
737 950
 			<br />
738 951
 			<p>
@@ -748,11 +961,26 @@  discard block
 block discarded – undo
748 961
 			<p>
749 962
 				<label for="geoid_source">Geoid Source</label>
750 963
 				<select name="geoid_source" id="geoid_source">
751
-					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
752
-					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
753
-					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
754
-					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
755
-					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
964
+					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') {
965
+	print ' selected="selected"';
966
+}
967
+?>>EGM96 15' (2.1MB)</option>
968
+					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') {
969
+	print ' selected="selected"';
970
+}
971
+?>>EGM96 5' (19MB)</option>
972
+					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') {
973
+	print ' selected="selected"';
974
+}
975
+?>>EGM2008 5' (19MB)</option>
976
+					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') {
977
+	print ' selected="selected"';
978
+}
979
+?>>EGM2008 2.5' (75MB)</option>
980
+					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') {
981
+	print ' selected="selected"';
982
+}
983
+?>>EGM2008 1' (470MB)</option>
756 984
 				</select>
757 985
 				<p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
758 986
 			</p>
@@ -770,7 +998,12 @@  discard block
 block discarded – undo
770 998
 			</p>
771 999
 			<p>
772 1000
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
773
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1001
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
1002
+	print $globalArchiveMonths;
1003
+} else {
1004
+	echo '1';
1005
+}
1006
+?>" />
774 1007
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
775 1008
 			</p>
776 1009
 			<p>
@@ -780,12 +1013,22 @@  discard block
 block discarded – undo
780 1013
 			</p>
781 1014
 			<p>
782 1015
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
783
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1016
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
1017
+	print $globalArchiveKeepMonths;
1018
+} else {
1019
+	echo '1';
1020
+}
1021
+?>" />
784 1022
 				<p class="help-block">0 to disable</p>
785 1023
 			</p>
786 1024
 			<p>
787 1025
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
788
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1026
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
1027
+	print $globalArchiveKeepTrackMonths;
1028
+} else {
1029
+	echo '1';
1030
+}
1031
+?>" />
789 1032
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
790 1033
 			</p>
791 1034
 			<br />
@@ -795,7 +1038,12 @@  discard block
 block discarded – undo
795 1038
 				<p class="help-block">Uncheck if the script is running as cron job</p>
796 1039
 				<div id="cronends"> 
797 1040
 					<label for="cronend">Run script for xx seconds</label>
798
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1041
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
1042
+	print $globalCronEnd;
1043
+} else {
1044
+	print '0';
1045
+}
1046
+?>" />
799 1047
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
800 1048
 				</div>
801 1049
 			</p>
@@ -848,15 +1096,30 @@  discard block
 block discarded – undo
848 1096
 			<br />
849 1097
 			<p>
850 1098
 				<label for="refresh">Show flights detected since xxx seconds</label>
851
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1099
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1100
+	echo $globalLiveInterval;
1101
+} else {
1102
+	echo '200';
1103
+}
1104
+?>" />
852 1105
 			</p>
853 1106
 			<p>
854 1107
 				<label for="maprefresh">Live map refresh (in seconds)</label>
855
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1108
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1109
+	echo $globalMapRefresh;
1110
+} else {
1111
+	echo '30';
1112
+}
1113
+?>" />
856 1114
 			</p>
857 1115
 			<p>
858 1116
 				<label for="mapidle">Map idle timeout (in minutes)</label>
859
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1117
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1118
+	echo $globalMapIdleTimeout;
1119
+} else {
1120
+	echo '30';
1121
+}
1122
+?>" />
860 1123
 				<p class="help-block">0 to disable</p>
861 1124
 			</p>
862 1125
 			<p>
@@ -871,12 +1134,20 @@  discard block
 block discarded – undo
871 1134
 			<br />
872 1135
 			<p>
873 1136
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
874
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1137
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1138
+	echo $globalClosestMinDist;
1139
+} else {
1140
+	echo '50';
1141
+}
1142
+?>" />
875 1143
 			</p>
876 1144
 			<br />
877 1145
 			<p>
878 1146
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
879
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1147
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1148
+	echo $globalAircraftSize;
1149
+}
1150
+?>" />
880 1151
 			</p>
881 1152
 			<br />
882 1153
 			<p>
@@ -889,7 +1160,12 @@  discard block
 block discarded – undo
889 1160
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
890 1161
 			?>
891 1162
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
892
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1163
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1164
+	echo $globalAircraftIconColor;
1165
+} else {
1166
+	echo '1a3151';
1167
+}
1168
+?>" />
893 1169
 			<?php
894 1170
 				if (!is_writable('../cache')) {
895 1171
 			?>
@@ -907,14 +1183,27 @@  discard block
 block discarded – undo
907 1183
 			<p>
908 1184
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
909 1185
 				<div class="range">
910
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
911
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1186
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1187
+	echo $globalAirportZoom;
1188
+} else {
1189
+	echo '7';
1190
+}
1191
+?>" />
1192
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1193
+	echo $globalAirportZoom;
1194
+} else {
1195
+	echo '7';
1196
+}
1197
+?></output>
912 1198
 				</div>
913 1199
 			</p>
914 1200
 			<br />
915 1201
 			<p>
916 1202
 				<label for="customcss">Custom CSS web path</label>
917
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1203
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1204
+	echo $globalCustomCSS;
1205
+}
1206
+?>" />
918 1207
 			</p>
919 1208
 		</fieldset>
920 1209
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -941,8 +1230,12 @@  discard block
 block discarded – undo
941 1230
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
942 1231
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
943 1232
 
944
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
945
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1233
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1234
+		$error .= 'Mysql driver for PDO must be loaded';
1235
+	}
1236
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1237
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1238
+	}
946 1239
 	
947 1240
 	$_SESSION['database_root'] = $dbroot;
948 1241
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -1010,15 +1303,23 @@  discard block
 block discarded – undo
1010 1303
 	$source_city = $_POST['source_city'];
1011 1304
 	$source_country = $_POST['source_country'];
1012 1305
 	$source_ref = $_POST['source_ref'];
1013
-	if (isset($source_id)) $source_id = $_POST['source_id'];
1014
-	else $source_id = array();
1306
+	if (isset($source_id)) {
1307
+		$source_id = $_POST['source_id'];
1308
+	} else {
1309
+		$source_id = array();
1310
+	}
1015 1311
 	
1016 1312
 	$sources = array();
1017 1313
 	foreach ($source_name as $keys => $name) {
1018
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1019
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1314
+	    if (isset($source_id[$keys])) {
1315
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1316
+	    } else {
1317
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1318
+	    }
1319
+	}
1320
+	if (count($sources) > 0) {
1321
+		$_SESSION['sources'] = $sources;
1020 1322
 	}
1021
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1022 1323
 
1023 1324
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
1024 1325
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -1039,17 +1340,29 @@  discard block
 block discarded – undo
1039 1340
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1040 1341
 
1041 1342
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1042
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1043
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1343
+	if ($globalaircraft == 'aircraft') {
1344
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1345
+	} else {
1346
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1347
+	}
1044 1348
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1045
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1046
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1349
+	if ($globaltracker == 'tracker') {
1350
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1351
+	} else {
1352
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1353
+	}
1047 1354
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1048
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1049
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1355
+	if ($globalmarine == 'marine') {
1356
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1357
+	} else {
1358
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1359
+	}
1050 1360
 	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1051
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1052
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1361
+	if ($globalsatellite == 'satellite') {
1362
+		$settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1363
+	} else {
1364
+		$settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1365
+	}
1053 1366
 
1054 1367
 /*	
1055 1368
 	$globalSBS1Hosts = array();
@@ -1071,23 +1384,37 @@  discard block
 block discarded – undo
1071 1384
 	$name = $_POST['name'];
1072 1385
 	$format = $_POST['format'];
1073 1386
 	$timezones = $_POST['timezones'];
1074
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1075
-	else $sourcestats = array();
1076
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1077
-	else $noarchive = array();
1387
+	if (isset($_POST['sourcestats'])) {
1388
+		$sourcestats = $_POST['sourcestats'];
1389
+	} else {
1390
+		$sourcestats = array();
1391
+	}
1392
+	if (isset($_POST['noarchive'])) {
1393
+		$noarchive = $_POST['noarchive'];
1394
+	} else {
1395
+		$noarchive = array();
1396
+	}
1078 1397
 	$gSources = array();
1079 1398
 	$forcepilots = false;
1080 1399
 	foreach ($host as $key => $h) {
1081
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1082
-		else $cov = 'FALSE';
1083
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1084
-		else $arch = 'FALSE';
1400
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1401
+			$cov = 'TRUE';
1402
+		} else {
1403
+			$cov = 'FALSE';
1404
+		}
1405
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1406
+			$arch = 'TRUE';
1407
+		} else {
1408
+			$arch = 'FALSE';
1409
+		}
1085 1410
 		if (strpos($format[$key],'_callback')) {
1086 1411
 			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1087 1412
 		} elseif ($h != '' || $name[$key] != '') {
1088 1413
 			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1089 1414
 		}
1090
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1415
+		if ($format[$key] == 'airwhere') {
1416
+			$forcepilots = true;
1417
+		}
1091 1418
 	}
1092 1419
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1093 1420
 
@@ -1115,7 +1442,9 @@  discard block
 block discarded – undo
1115 1442
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1116 1443
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1117 1444
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1118
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1445
+	} else {
1446
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1447
+	}
1119 1448
 
1120 1449
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1121 1450
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1154,7 +1483,9 @@  discard block
 block discarded – undo
1154 1483
 
1155 1484
 	// Create in settings.php keys not yet configurable if not already here
1156 1485
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1157
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1486
+	if (!isset($globalDebug)) {
1487
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1488
+	}
1158 1489
 
1159 1490
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1160 1491
 	if ($resetyearstats == 'resetyearstats') {
@@ -1191,37 +1522,56 @@  discard block
 block discarded – undo
1191 1522
 	}
1192 1523
 */
1193 1524
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1194
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1195
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1196
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1197
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1525
+	if ($globalsbs == 'sbs') {
1526
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1527
+	} else {
1528
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1529
+	}
1530
+	if ($globalaprs == 'aprs') {
1531
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1532
+	} else {
1533
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1534
+	}
1198 1535
 	$va = false;
1199 1536
 	if ($globalivao == 'ivao') {
1200 1537
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1201 1538
 		$va = true;
1202
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1539
+	} else {
1540
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1541
+	}
1203 1542
 	if ($globalvatsim == 'vatsim') {
1204 1543
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1205 1544
 		$va = true;
1206
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1545
+	} else {
1546
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1547
+	}
1207 1548
 	if ($globalphpvms == 'phpvms') {
1208 1549
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1209 1550
 		$va = true;
1210
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1551
+	} else {
1552
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1553
+	}
1211 1554
 	if ($globalvam == 'vam') {
1212 1555
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1213 1556
 		$va = true;
1214
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1557
+	} else {
1558
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1559
+	}
1215 1560
 	if ($va) {
1216 1561
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1217
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1562
+	} else {
1563
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1564
+	}
1218 1565
 	if ($globalva == 'va' || $va) {
1219 1566
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1220 1567
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1221 1568
 	} else {
1222 1569
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1223
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1224
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1570
+		if ($forcepilots) {
1571
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1572
+		} else {
1573
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1574
+		}
1225 1575
 	}
1226 1576
 	
1227 1577
 	
@@ -1397,7 +1747,9 @@  discard block
 block discarded – undo
1397 1747
 		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1398 1748
 	}
1399 1749
 
1400
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1750
+	if (!isset($globalTransaction)) {
1751
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1752
+	}
1401 1753
 
1402 1754
 	// Set some defaults values...
1403 1755
 	if (!isset($globalAircraftImageSources)) {
@@ -1412,15 +1764,23 @@  discard block
 block discarded – undo
1412 1764
 
1413 1765
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1414 1766
 
1415
-	if ($error == '') settings::modify_settings($settings);
1416
-	if ($error == '') settings::comment_settings($settings_comment);
1767
+	if ($error == '') {
1768
+		settings::modify_settings($settings);
1769
+	}
1770
+	if ($error == '') {
1771
+		settings::comment_settings($settings_comment);
1772
+	}
1417 1773
 	if ($error != '') {
1418 1774
 		print '<div class="info column">'.$error.'</div>';
1419 1775
 		require('../footer.php');
1420 1776
 		exit;
1421 1777
 	} else {
1422
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1423
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
1778
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
1779
+			$_SESSION['waypoints'] = 1;
1780
+		}
1781
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
1782
+			$_SESSION['owner'] = 1;
1783
+		}
1424 1784
 		if (isset($_POST['createdb'])) {
1425 1785
 			$_SESSION['install'] = 'database_create';
1426 1786
 		} else {
@@ -1456,10 +1816,18 @@  discard block
 block discarded – undo
1456 1816
 	$popw = false;
1457 1817
 	foreach ($_SESSION['done'] as $done) {
1458 1818
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1459
-	    if ($done == 'Create database') $pop = true;
1460
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1461
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1462
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1819
+	    if ($done == 'Create database') {
1820
+	    	$pop = true;
1821
+	    }
1822
+	    if ($_SESSION['install'] == 'database_create') {
1823
+	    	$pop = true;
1824
+	    }
1825
+	    if ($_SESSION['install'] == 'database_import') {
1826
+	    	$popi = true;
1827
+	    }
1828
+	    if ($_SESSION['install'] == 'waypoints') {
1829
+	    	$popw = true;
1830
+	    }
1463 1831
 	}
1464 1832
 	if ($pop) {
1465 1833
 	    sleep(5);
@@ -1470,7 +1838,9 @@  discard block
 block discarded – undo
1470 1838
 	} else if ($popw) {
1471 1839
 	    sleep(5);
1472 1840
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1473
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1841
+	} else {
1842
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1843
+	}
1474 1844
 	print '</div></ul>';
1475 1845
 	print '<div id="error"></div>';
1476 1846
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.