Completed
Push — master ( d0d974...d44f1f )
by Yannick
16:44
created
install/class.update_db.php 1 patch
Spacing   +278 added lines, -278 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
24 24
 		fclose($fp);
25 25
 	}
26 26
 
27
-	public static function gunzip($in_file,$out_file_name = '') {
27
+	public static function gunzip($in_file, $out_file_name = '') {
28 28
 		//echo $in_file.' -> '.$out_file_name."\n";
29 29
 		$buffer_size = 4096; // read 4kb at a time
30 30
 		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
31 31
 		if ($in_file != '' && file_exists($in_file)) {
32 32
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
33
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
34
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
33
+			if (function_exists('gzopen')) $file = gzopen($in_file, 'rb');
34
+			elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb');
35 35
 			else {
36 36
 				echo 'gzopen not available';
37 37
 				die;
38 38
 			}
39 39
 			$out_file = fopen($out_file_name, 'wb'); 
40
-			while(!gzeof($file)) {
40
+			while (!gzeof($file)) {
41 41
 				fwrite($out_file, gzread($file, $buffer_size));
42 42
 			}  
43 43
 			fclose($out_file);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		try {
62 62
 			self::$db_sqlite = new PDO('sqlite:'.$database);
63 63
 			self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
64
-		} catch(PDOException $e) {
64
+		} catch (PDOException $e) {
65 65
 			return "error : ".$e->getMessage();
66 66
 		}
67 67
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			//$Connection = new Connection();
77 77
 			$sth = $Connection->db->prepare($query);
78 78
                         $sth->execute(array(':source' => $database_file));
79
-                } catch(PDOException $e) {
79
+                } catch (PDOException $e) {
80 80
                         return "error : ".$e->getMessage();
81 81
                 }
82 82
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		try {
88 88
                         $sth = update_db::$db_sqlite->prepare($query);
89 89
                         $sth->execute();
90
-                } catch(PDOException $e) {
90
+                } catch (PDOException $e) {
91 91
                         return "error : ".$e->getMessage();
92 92
                 }
93 93
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 			if ($globalTransaction) $Connection->db->beginTransaction();
99 99
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
100 100
 				//$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);
101
-				$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);
101
+				$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);
102 102
 				$sth_dest->execute($query_dest_values);
103 103
             		}
104 104
 			if ($globalTransaction) $Connection->db->commit();
105
-		} catch(PDOException $e) {
105
+		} catch (PDOException $e) {
106 106
 			if ($globalTransaction) $Connection->db->rollBack(); 
107 107
 			return "error : ".$e->getMessage();
108 108
 		}
@@ -118,26 +118,26 @@  discard block
 block discarded – undo
118 118
 			//$Connection = new Connection();
119 119
 			$sth = $Connection->db->prepare($query);
120 120
                         $sth->execute(array(':source' => 'oneworld'));
121
-                } catch(PDOException $e) {
121
+                } catch (PDOException $e) {
122 122
                         return "error : ".$e->getMessage();
123 123
                 }
124 124
 
125 125
     		if ($globalDebug) echo " - Add routes to DB -";
126 126
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
127 127
 		$Spotter = new Spotter();
128
-		if ($fh = fopen($database_file,"r")) {
128
+		if ($fh = fopen($database_file, "r")) {
129 129
 			$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)';
130 130
 			$Connection = new Connection();
131 131
 			$sth_dest = $Connection->db->prepare($query_dest);
132 132
 			if ($globalTransaction) $Connection->db->beginTransaction();
133 133
 			while (!feof($fh)) {
134
-				$line = fgetcsv($fh,9999,',');
134
+				$line = fgetcsv($fh, 9999, ',');
135 135
 				if ($line[0] != '') {
136 136
 					if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) {
137 137
 						try {
138
-							$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');
138
+							$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');
139 139
 							$sth_dest->execute($query_dest_values);
140
-						} catch(PDOException $e) {
140
+						} catch (PDOException $e) {
141 141
 							if ($globalTransaction) $Connection->db->rollBack(); 
142 142
 							return "error : ".$e->getMessage();
143 143
 						}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			//$Connection = new Connection();
160 160
 			$sth = $Connection->db->prepare($query);
161 161
                         $sth->execute(array(':source' => 'skyteam'));
162
-                } catch(PDOException $e) {
162
+                } catch (PDOException $e) {
163 163
                         return "error : ".$e->getMessage();
164 164
                 }
165 165
 
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
 
168 168
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
169 169
 		$Spotter = new Spotter();
170
-		if ($fh = fopen($database_file,"r")) {
170
+		if ($fh = fopen($database_file, "r")) {
171 171
 			$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)';
172 172
 			$Connection = new Connection();
173 173
 			$sth_dest = $Connection->db->prepare($query_dest);
174 174
 			try {
175 175
 				if ($globalTransaction) $Connection->db->beginTransaction();
176 176
 				while (!feof($fh)) {
177
-					$line = fgetcsv($fh,9999,',');
177
+					$line = fgetcsv($fh, 9999, ',');
178 178
 					if ($line[0] != '') {
179
-						$datebe = explode('  -  ',$line[2]);
179
+						$datebe = explode('  -  ', $line[2]);
180 180
 						if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) {
181
-							$query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam');
181
+							$query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam');
182 182
 							$sth_dest->execute($query_dest_values);
183 183
 						}
184 184
 					}
185 185
 				}
186 186
 				if ($globalTransaction) $Connection->db->commit();
187
-			} catch(PDOException $e) {
187
+			} catch (PDOException $e) {
188 188
 				if ($globalTransaction) $Connection->db->rollBack(); 
189 189
 				return "error : ".$e->getMessage();
190 190
 			}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			$Connection = new Connection();
200 200
 			$sth = $Connection->db->prepare($query);
201 201
                         $sth->execute(array(':source' => $database_file));
202
-                } catch(PDOException $e) {
202
+                } catch (PDOException $e) {
203 203
                         return "error : ".$e->getMessage();
204 204
                 }
205 205
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 			$Connection = new Connection();
208 208
 			$sth = $Connection->db->prepare($query);
209 209
                         $sth->execute(array(':source' => $database_file));
210
-                } catch(PDOException $e) {
210
+                } catch (PDOException $e) {
211 211
                         return "error : ".$e->getMessage();
212 212
                 }
213 213
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		try {
217 217
                         $sth = update_db::$db_sqlite->prepare($query);
218 218
                         $sth->execute();
219
-                } catch(PDOException $e) {
219
+                } catch (PDOException $e) {
220 220
                         return "error : ".$e->getMessage();
221 221
                 }
222 222
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
 			//$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']);
234 234
 				if ($values['UserString4'] == 'M') $type = 'military';
235 235
 				else $type = null;
236
-				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
236
+				$query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type);
237 237
 				$sth_dest->execute($query_dest_values);
238 238
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
239
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
239
+				    $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']);
240 240
 				    $sth_dest_owner->execute($query_dest_owner_values);
241 241
 				}
242 242
             		}
243 243
 			if ($globalTransaction) $Connection->db->commit();
244
-		} catch(PDOException $e) {
244
+		} catch (PDOException $e) {
245 245
 			return "error : ".$e->getMessage();
246 246
 		}
247 247
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			$Connection = new Connection();
252 252
 			$sth = $Connection->db->prepare($query);
253 253
                         $sth->execute(array(':source' => $database_file));
254
-                } catch(PDOException $e) {
254
+                } catch (PDOException $e) {
255 255
                         return "error : ".$e->getMessage();
256 256
                 }
257 257
 		return '';
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 			$Connection = new Connection();
267 267
 			$sth = $Connection->db->prepare($query);
268 268
                         $sth->execute(array(':source' => $database_file));
269
-                } catch(PDOException $e) {
269
+                } catch (PDOException $e) {
270 270
                         return "error : ".$e->getMessage();
271 271
                 }
272 272
 		
273
-		if ($fh = fopen($database_file,"r")) {
273
+		if ($fh = fopen($database_file, "r")) {
274 274
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
275 275
 			$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)';
276 276
 		
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
 				if ($globalTransaction) $Connection->db->beginTransaction();
281 281
             			while (!feof($fh)) {
282 282
             				$values = array();
283
-            				$line = $Common->hex2str(fgets($fh,9999));
283
+            				$line = $Common->hex2str(fgets($fh, 9999));
284 284
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
285
-            				$values['ModeS'] = substr($line,0,6);
286
-            				$values['Registration'] = trim(substr($line,69,6));
287
-            				$aircraft_name = trim(substr($line,48,6));
285
+            				$values['ModeS'] = substr($line, 0, 6);
286
+            				$values['Registration'] = trim(substr($line, 69, 6));
287
+            				$aircraft_name = trim(substr($line, 48, 6));
288 288
             				// Check if we can find ICAO, else set it to GLID
289
-            				$aircraft_name_split = explode(' ',$aircraft_name);
289
+            				$aircraft_name_split = explode(' ', $aircraft_name);
290 290
             				$search_more = '';
291 291
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
292 292
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -298,20 +298,20 @@  discard block
 block discarded – undo
298 298
 	            				if (isset($result['icao']) && $result['icao'] != '') {
299 299
 	            				    $values['ICAOTypeCode'] = $result['icao'];
300 300
 	            				} 
301
-					} catch(PDOException $e) {
301
+					} catch (PDOException $e) {
302 302
 						return "error : ".$e->getMessage();
303 303
 					}
304 304
 					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
305 305
 					// Add data to db
306 306
 					if ($values['Registration'] != '' && $values['Registration'] != '0000') {
307 307
 						//$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']);
308
-						$query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file);
308
+						$query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file);
309 309
 						//print_r($query_dest_values);
310 310
 						$sth_dest->execute($query_dest_values);
311 311
 					}
312 312
 				}
313 313
 				if ($globalTransaction) $Connection->db->commit();
314
-			} catch(PDOException $e) {
314
+			} catch (PDOException $e) {
315 315
 				return "error : ".$e->getMessage();
316 316
 			}
317 317
 		}
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			$Connection = new Connection();
322 322
 			$sth = $Connection->db->prepare($query);
323 323
                         $sth->execute(array(':source' => $database_file));
324
-                } catch(PDOException $e) {
324
+                } catch (PDOException $e) {
325 325
                         return "error : ".$e->getMessage();
326 326
                 }
327 327
 		return '';
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 			$Connection = new Connection();
336 336
 			$sth = $Connection->db->prepare($query);
337 337
                         $sth->execute(array(':source' => $database_file));
338
-                } catch(PDOException $e) {
338
+                } catch (PDOException $e) {
339 339
                         return "error : ".$e->getMessage();
340 340
                 }
341 341
 		
342
-		if ($fh = fopen($database_file,"r")) {
342
+		if ($fh = fopen($database_file, "r")) {
343 343
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
344 344
 			$query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source)';
345 345
 		
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
 			$sth_dest = $Connection->db->prepare($query_dest);
348 348
 			try {
349 349
 				if ($globalTransaction) $Connection->db->beginTransaction();
350
-				$tmp = fgetcsv($fh,9999,',',"'");
350
+				$tmp = fgetcsv($fh, 9999, ',', "'");
351 351
             			while (!feof($fh)) {
352
-            				$line = fgetcsv($fh,9999,',',"'");
352
+            				$line = fgetcsv($fh, 9999, ',', "'");
353 353
             				
354 354
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
355 355
 					//print_r($line);
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             				$values['Registration'] = $line[3];
358 358
             				$aircraft_name = $line[2];
359 359
             				// Check if we can find ICAO, else set it to GLID
360
-            				$aircraft_name_split = explode(' ',$aircraft_name);
360
+            				$aircraft_name_split = explode(' ', $aircraft_name);
361 361
             				$search_more = '';
362 362
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
363 363
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -366,20 +366,20 @@  discard block
 block discarded – undo
366 366
                                     		$sth_search->execute();
367 367
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
368 368
 	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
369
-					} catch(PDOException $e) {
369
+					} catch (PDOException $e) {
370 370
 						return "error : ".$e->getMessage();
371 371
 					}
372 372
 					//if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
373 373
 					// Add data to db
374 374
 					if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') {
375 375
 						//$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']);
376
-						$query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file);
376
+						$query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file);
377 377
 						//print_r($query_dest_values);
378 378
 						$sth_dest->execute($query_dest_values);
379 379
 					}
380 380
 				}
381 381
 				if ($globalTransaction) $Connection->db->commit();
382
-			} catch(PDOException $e) {
382
+			} catch (PDOException $e) {
383 383
 				return "error : ".$e->getMessage();
384 384
 			}
385 385
 		}
@@ -389,13 +389,13 @@  discard block
 block discarded – undo
389 389
 			$Connection = new Connection();
390 390
 			$sth = $Connection->db->prepare($query);
391 391
                         $sth->execute(array(':source' => $database_file));
392
-                } catch(PDOException $e) {
392
+                } catch (PDOException $e) {
393 393
                         return "error : ".$e->getMessage();
394 394
                 }
395 395
 		return '';
396 396
 	}
397 397
 
398
-	public static function retrieve_owner($database_file,$country = 'F') {
398
+	public static function retrieve_owner($database_file, $country = 'F') {
399 399
 		global $globalTransaction;
400 400
 		//$query = 'TRUNCATE TABLE aircraft_modes';
401 401
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 			$Connection = new Connection();
404 404
 			$sth = $Connection->db->prepare($query);
405 405
                         $sth->execute(array(':source' => $database_file));
406
-                } catch(PDOException $e) {
406
+                } catch (PDOException $e) {
407 407
                         return "error : ".$e->getMessage();
408 408
                 }
409 409
 		
410
-		if ($fh = fopen($database_file,"r")) {
410
+		if ($fh = fopen($database_file, "r")) {
411 411
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
412 412
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
413 413
 		
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 			$sth_dest = $Connection->db->prepare($query_dest);
416 416
 			try {
417 417
 				if ($globalTransaction) $Connection->db->beginTransaction();
418
-				$tmp = fgetcsv($fh,9999,',','"');
418
+				$tmp = fgetcsv($fh, 9999, ',', '"');
419 419
             			while (!feof($fh)) {
420
-            				$line = fgetcsv($fh,9999,',','"');
420
+            				$line = fgetcsv($fh, 9999, ',', '"');
421 421
             				$values = array();
422 422
             				//print_r($line);
423 423
             				if ($country == 'F') {
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
             				    $values['base'] = $line[4];
426 426
             				    $values['owner'] = $line[5];
427 427
             				    if ($line[6] == '') $values['date_first_reg'] = null;
428
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
428
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
429 429
 					    $values['cancel'] = $line[7];
430 430
 					} elseif ($country == 'EI') {
431 431
 					    // TODO : add modeS & reg to aircraft_modes
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
             				    $values['base'] = $line[3];
434 434
             				    $values['owner'] = $line[2];
435 435
             				    if ($line[1] == '') $values['date_first_reg'] = null;
436
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
436
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1]));
437 437
 					    $values['cancel'] = '';
438 438
 					} elseif ($country == 'HB') {
439 439
 					    // TODO : add modeS & reg to aircraft_modes
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
             				    $values['base'] = null;
449 449
             				    $values['owner'] = $line[5];
450 450
             				    if ($line[18] == '') $values['date_first_reg'] = null;
451
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
451
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18]));
452 452
 					    $values['cancel'] = '';
453 453
 					} elseif ($country == 'VH') {
454 454
 					    // TODO : add modeS & reg to aircraft_modes
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
             				    $values['base'] = null;
457 457
             				    $values['owner'] = $line[12];
458 458
             				    if ($line[28] == '') $values['date_first_reg'] = null;
459
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
459
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28]));
460 460
 
461 461
 					    $values['cancel'] = $line[39];
462 462
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -476,28 +476,28 @@  discard block
 block discarded – undo
476 476
             				    $values['base'] = null;
477 477
             				    $values['owner'] = $line[8];
478 478
             				    if ($line[7] == '') $values['date_first_reg'] = null;
479
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
479
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
480 480
 					    $values['cancel'] = '';
481 481
 					} elseif ($country == 'PP') {
482 482
             				    $values['registration'] = $line[0];
483 483
             				    $values['base'] = null;
484 484
             				    $values['owner'] = $line[4];
485 485
             				    if ($line[6] == '') $values['date_first_reg'] = null;
486
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
486
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
487 487
 					    $values['cancel'] = $line[7];
488 488
 					} elseif ($country == 'E7') {
489 489
             				    $values['registration'] = $line[0];
490 490
             				    $values['base'] = null;
491 491
             				    $values['owner'] = $line[4];
492 492
             				    if ($line[5] == '') $values['date_first_reg'] = null;
493
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
493
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5]));
494 494
 					    $values['cancel'] = '';
495 495
 					} elseif ($country == '8Q') {
496 496
             				    $values['registration'] = $line[0];
497 497
             				    $values['base'] = null;
498 498
             				    $values['owner'] = $line[3];
499 499
             				    if ($line[7] == '') $values['date_first_reg'] = null;
500
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
500
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
501 501
 					    $values['cancel'] = '';
502 502
 					} elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') {
503 503
             				    $values['registration'] = $line[0];
@@ -507,12 +507,12 @@  discard block
 block discarded – undo
507 507
 					    $values['cancel'] = '';
508 508
 					}
509 509
 					if ($values['cancel'] == '' && $values['registration'] != null) {
510
-						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
510
+						$query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file);
511 511
 						$sth_dest->execute($query_dest_values);
512 512
 					}
513 513
 				}
514 514
 				if ($globalTransaction) $Connection->db->commit();
515
-			} catch(PDOException $e) {
515
+			} catch (PDOException $e) {
516 516
 				return "error : ".$e->getMessage();
517 517
 			}
518 518
 		}
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 			$Connection = new Connection();
628 628
 			$sth = $Connection->db->prepare($query);
629 629
                         $sth->execute();
630
-                } catch(PDOException $e) {
630
+                } catch (PDOException $e) {
631 631
                         return "error : ".$e->getMessage();
632 632
                 }
633 633
 
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 			$Connection = new Connection();
638 638
 			$sth = $Connection->db->prepare($query);
639 639
                         $sth->execute();
640
-                } catch(PDOException $e) {
640
+                } catch (PDOException $e) {
641 641
                         return "error : ".$e->getMessage();
642 642
                 }
643 643
 
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 		if ($globalTransaction) $Connection->db->beginTransaction();
649 649
   
650 650
 		$i = 0;
651
-		while($row = sparql_fetch_array($result))
651
+		while ($row = sparql_fetch_array($result))
652 652
 		{
653 653
 			if ($i >= 1) {
654 654
 			//print_r($row);
@@ -668,31 +668,31 @@  discard block
 block discarded – undo
668 668
 				$row['image'] = '';
669 669
 				$row['image_thumb'] = '';
670 670
 			} else {
671
-				$image = str_replace(' ','_',$row['image']);
671
+				$image = str_replace(' ', '_', $row['image']);
672 672
 				$digest = md5($image);
673
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image;
674
-				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder;
675
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image;
676
-				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder;
673
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image;
674
+				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder;
675
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image;
676
+				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder;
677 677
 			}
678 678
 			
679
-			$country = explode('-',$row['country']);
679
+			$country = explode('-', $row['country']);
680 680
 			$row['country'] = $country[0];
681 681
 			
682 682
 			$row['type'] = trim($row['type']);
683
-			if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) {
683
+			if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) {
684 684
 				$row['type'] = 'Military';
685 685
 			} elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') {
686 686
 				$row['type'] = 'small_airport';
687 687
 			}
688 688
 			
689
-			$row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city'])));
690
-			$query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']);
689
+			$row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city'])));
690
+			$query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $row['altitude'], ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']);
691 691
 			//print_r($query_dest_values);
692 692
 			
693 693
 			try {
694 694
 				$sth_dest->execute($query_dest_values);
695
-			} catch(PDOException $e) {
695
+			} catch (PDOException $e) {
696 696
 				return "error : ".$e->getMessage();
697 697
 			}
698 698
 			}
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 			$Connection = new Connection();
707 707
 			$sth = $Connection->db->prepare($query);
708 708
                         $sth->execute();
709
-                } catch(PDOException $e) {
709
+                } catch (PDOException $e) {
710 710
                         return "error : ".$e->getMessage();
711 711
                 }
712 712
 
@@ -714,12 +714,12 @@  discard block
 block discarded – undo
714 714
 		if ($globalDebug) echo "Insert Not available Airport...\n";
715 715
 		$query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`)
716 716
 		    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)";
717
-		$query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => '');
717
+		$query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => '');
718 718
 		try {
719 719
 			$Connection = new Connection();
720 720
 			$sth = $Connection->db->prepare($query);
721 721
                         $sth->execute($query_values);
722
-                } catch(PDOException $e) {
722
+                } catch (PDOException $e) {
723 723
                         return "error : ".$e->getMessage();
724 724
                 }
725 725
 		$i++;
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		echo "Download data from ourairports.com...\n";
738 738
 		$delimiter = ',';
739 739
 		$out_file = $tmp_dir.'airports.csv';
740
-		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
740
+		update_db::download('http://ourairports.com/data/airports.csv', $out_file);
741 741
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
742 742
 		echo "Add data from ourairports.com...\n";
743 743
 
@@ -748,32 +748,32 @@  discard block
 block discarded – undo
748 748
 			//$Connection->db->beginTransaction();
749 749
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
750 750
 			{
751
-				if(!$header) $header = $row;
751
+				if (!$header) $header = $row;
752 752
 				else {
753 753
 					$data = array();
754 754
 					$data = array_combine($header, $row);
755 755
 					try {
756 756
 						$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao');
757 757
 						$sth->execute(array(':icao' => $data['gps_code']));
758
-					} catch(PDOException $e) {
758
+					} catch (PDOException $e) {
759 759
 						return "error : ".$e->getMessage();
760 760
 					}
761 761
 					if ($sth->fetchColumn() > 0) {
762 762
 						$query = 'UPDATE airport SET `type` = :type WHERE icao = :icao';
763 763
 						try {
764 764
 							$sth = $Connection->db->prepare($query);
765
-							$sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type']));
766
-						} catch(PDOException $e) {
765
+							$sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type']));
766
+						} catch (PDOException $e) {
767 767
 							return "error : ".$e->getMessage();
768 768
 						}
769 769
 					} else {
770 770
 						$query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`)
771 771
 						    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)";
772
-						$query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']);
772
+						$query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']);
773 773
 						try {
774 774
 							$sth = $Connection->db->prepare($query);
775 775
 							$sth->execute($query_values);
776
-						} catch(PDOException $e) {
776
+						} catch (PDOException $e) {
777 777
 							return "error : ".$e->getMessage();
778 778
 						}
779 779
 						$i++;
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 
787 787
 		echo "Download data from another free database...\n";
788 788
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
789
-		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
789
+		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file);
790 790
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
791 791
 		update_db::unzip($out_file);
792 792
 		$header = NULL;
@@ -798,15 +798,15 @@  discard block
 block discarded – undo
798 798
 			//$Connection->db->beginTransaction();
799 799
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
800 800
 			{
801
-				if(!$header) $header = $row;
801
+				if (!$header) $header = $row;
802 802
 				else {
803 803
 					$data = $row;
804 804
 
805 805
 					$query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao';
806 806
 					try {
807 807
 						$sth = $Connection->db->prepare($query);
808
-						$sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4]))));
809
-					} catch(PDOException $e) {
808
+						$sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4]))));
809
+					} catch (PDOException $e) {
810 810
 						return "error : ".$e->getMessage();
811 811
 					}
812 812
 				}
@@ -820,15 +820,15 @@  discard block
 block discarded – undo
820 820
 		try {
821 821
 			$sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'");
822 822
 			$sth->execute();
823
-		} catch(PDOException $e) {
823
+		} catch (PDOException $e) {
824 824
 			return "error : ".$e->getMessage();
825 825
 		}
826 826
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
827 827
 			$query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao';
828 828
 			try {
829 829
 				$sth2 = $Connection->db->prepare($query2);
830
-				$sth2->execute(array(':icao' => $row['icao'],':type' => 'military'));
831
-			} catch(PDOException $e) {
830
+				$sth2->execute(array(':icao' => $row['icao'], ':type' => 'military'));
831
+			} catch (PDOException $e) {
832 832
 				return "error : ".$e->getMessage();
833 833
 			}
834 834
 		}
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 			$Connection = new Connection();
853 853
 			$sth = $Connection->db->prepare($query);
854 854
                         $sth->execute(array(':source' => 'translation.csv'));
855
-                } catch(PDOException $e) {
855
+                } catch (PDOException $e) {
856 856
                         return "error : ".$e->getMessage();
857 857
                 }
858 858
 
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
870 870
 			{
871 871
 				$i++;
872
-				if($i > 12) {
872
+				if ($i > 12) {
873 873
 					$data = $row;
874 874
 					$operator = $data[2];
875 875
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
                                                 //echo substr($operator, 0, 2)."\n";;
878 878
                                                 if (count($airline_array) > 0) {
879 879
 							//print_r($airline_array);
880
-							$operator = $airline_array[0]['icao'].substr($operator,2);
880
+							$operator = $airline_array[0]['icao'].substr($operator, 2);
881 881
                                                 }
882 882
                                         }
883 883
 					
@@ -885,14 +885,14 @@  discard block
 block discarded – undo
885 885
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
886 886
                                                 $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
887 887
                                                 if (count($airline_array) > 0) {
888
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
888
+                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2);
889 889
                                             	}
890 890
                                         }
891 891
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
892 892
 					try {
893 893
 						$sth = $Connection->db->prepare($query);
894
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
895
-					} catch(PDOException $e) {
894
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
895
+					} catch (PDOException $e) {
896 896
 						return "error : ".$e->getMessage();
897 897
 					}
898 898
 				}
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 			$Connection = new Connection();
913 913
 			$sth = $Connection->db->prepare($query);
914 914
                         $sth->execute(array(':source' => 'website_fam'));
915
-                } catch(PDOException $e) {
915
+                } catch (PDOException $e) {
916 916
                         return "error : ".$e->getMessage();
917 917
                 }
918 918
 
@@ -932,8 +932,8 @@  discard block
 block discarded – undo
932 932
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
933 933
 					try {
934 934
 						$sth = $Connection->db->prepare($query);
935
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam'));
936
-					} catch(PDOException $e) {
935
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam'));
936
+					} catch (PDOException $e) {
937 937
 						return "error : ".$e->getMessage();
938 938
 					}
939 939
 				}
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			$Connection = new Connection();
957 957
 			$sth = $Connection->db->prepare($query);
958 958
                         $sth->execute(array(':source' => 'website_faa'));
959
-                } catch(PDOException $e) {
959
+                } catch (PDOException $e) {
960 960
                         return "error : ".$e->getMessage();
961 961
                 }
962 962
 
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 			$Connection = new Connection();
966 966
 			$sth = $Connection->db->prepare($query);
967 967
                         $sth->execute(array(':source' => 'website_faa'));
968
-                } catch(PDOException $e) {
968
+                } catch (PDOException $e) {
969 969
                         return "error : ".$e->getMessage();
970 970
                 }
971 971
 
@@ -982,8 +982,8 @@  discard block
 block discarded – undo
982 982
 					$query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1';
983 983
 					try {
984 984
 						$sths = $Connection->db->prepare($query_search);
985
-						$sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa'));
986
-					} catch(PDOException $e) {
985
+						$sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa'));
986
+					} catch (PDOException $e) {
987 987
 						return "error s : ".$e->getMessage();
988 988
 					}
989 989
 					$result_search = $sths->fetchAll(PDO::FETCH_ASSOC);
@@ -996,8 +996,8 @@  discard block
 block discarded – undo
996 996
 							//}
997 997
 						try {
998 998
 							$sthi = $Connection->db->prepare($queryi);
999
-							$sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode']));
1000
-						} catch(PDOException $e) {
999
+							$sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode']));
1000
+						} catch (PDOException $e) {
1001 1001
 							return "error u : ".$e->getMessage();
1002 1002
 						}
1003 1003
 					} else {
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 						try {
1006 1006
 							$sthsm = $Connection->db->prepare($query_search_mfr);
1007 1007
 							$sthsm->execute(array(':mfr' => $data[2]));
1008
-						} catch(PDOException $e) {
1008
+						} catch (PDOException $e) {
1009 1009
 							return "error mfr : ".$e->getMessage();
1010 1010
 						}
1011 1011
 						$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC);
@@ -1015,8 +1015,8 @@  discard block
 block discarded – undo
1015 1015
 							$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)';
1016 1016
 							try {
1017 1017
 								$sthf = $Connection->db->prepare($queryf);
1018
-								$sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa'));
1019
-							} catch(PDOException $e) {
1018
+								$sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa'));
1019
+							} catch (PDOException $e) {
1020 1020
 								return "error f : ".$e->getMessage();
1021 1021
 							}
1022 1022
 						}
@@ -1026,13 +1026,13 @@  discard block
 block discarded – undo
1026 1026
 						$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
1027 1027
 						try {
1028 1028
 							$sth = $Connection->db->prepare($query);
1029
-							$sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa'));
1030
-						} catch(PDOException $e) {
1029
+							$sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa'));
1030
+						} catch (PDOException $e) {
1031 1031
 							return "error i : ".$e->getMessage();
1032 1032
 						}
1033 1033
 					}
1034 1034
 				}
1035
-				if ($i % 90 == 0) {
1035
+				if ($i%90 == 0) {
1036 1036
 					if ($globalTransaction) $Connection->db->commit();
1037 1037
 					if ($globalTransaction) $Connection->db->beginTransaction();
1038 1038
 				}
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 			$Connection = new Connection();
1052 1052
 			$sth = $Connection->db->prepare($query);
1053 1053
                         $sth->execute(array(':source' => 'website_fam'));
1054
-                } catch(PDOException $e) {
1054
+                } catch (PDOException $e) {
1055 1055
                         return "error : ".$e->getMessage();
1056 1056
                 }
1057 1057
 
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
 					$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)';
1072 1072
 					try {
1073 1073
 						$sth = $Connection->db->prepare($query);
1074
-						$sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam'));
1075
-					} catch(PDOException $e) {
1074
+						$sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam'));
1075
+					} catch (PDOException $e) {
1076 1076
 						return "error : ".$e->getMessage();
1077 1077
 					}
1078 1078
 				}
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 			$Connection = new Connection();
1092 1092
 			$sth = $Connection->db->prepare($query);
1093 1093
                         $sth->execute(array(':source' => 'website_fam'));
1094
-                } catch(PDOException $e) {
1094
+                } catch (PDOException $e) {
1095 1095
                         return "error : ".$e->getMessage();
1096 1096
                 }
1097 1097
 
@@ -1107,8 +1107,8 @@  discard block
 block discarded – undo
1107 1107
 					$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)';
1108 1108
 					try {
1109 1109
 						$sth = $Connection->db->prepare($query);
1110
-						$sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam'));
1111
-					} catch(PDOException $e) {
1110
+						$sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam'));
1111
+					} catch (PDOException $e) {
1112 1112
 						print_r($data);
1113 1113
 						return "error : ".$e->getMessage();
1114 1114
 					}
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 			$Connection = new Connection();
1129 1129
 			$sth = $Connection->db->prepare($query);
1130 1130
                         $sth->execute(array(':source' => 'website_fam'));
1131
-                } catch(PDOException $e) {
1131
+                } catch (PDOException $e) {
1132 1132
                         return "error : ".$e->getMessage();
1133 1133
                 }
1134 1134
 
@@ -1148,8 +1148,8 @@  discard block
 block discarded – undo
1148 1148
 					$query = '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)';
1149 1149
 					try {
1150 1150
 						$sth = $Connection->db->prepare($query);
1151
-						$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'));
1152
-					} catch(PDOException $e) {
1151
+						$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'));
1152
+					} catch (PDOException $e) {
1153 1153
 						return "error : ".$e->getMessage();
1154 1154
 					}
1155 1155
 				}
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 			$Connection = new Connection();
1169 1169
 			$sth = $Connection->db->prepare($query);
1170 1170
 			$sth->execute();
1171
-		} catch(PDOException $e) {
1171
+		} catch (PDOException $e) {
1172 1172
 			return "error : ".$e->getMessage();
1173 1173
 		}
1174 1174
 
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 				try {
1184 1184
 					$sth = $Connection->db->prepare($query);
1185 1185
 					$sth->execute(array(':icao' => $icao));
1186
-				} catch(PDOException $e) {
1186
+				} catch (PDOException $e) {
1187 1187
 					return "error : ".$e->getMessage();
1188 1188
 				}
1189 1189
 			}
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
 		return '';
1194 1194
         }
1195 1195
 
1196
-	public static function tle($filename,$tletype) {
1196
+	public static function tle($filename, $tletype) {
1197 1197
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1198 1198
 		global $tmp_dir, $globalTransaction;
1199 1199
 		//$Spotter = new Spotter();
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
 			$Connection = new Connection();
1204 1204
 			$sth = $Connection->db->prepare($query);
1205 1205
                         $sth->execute(array(':source' => $filename));
1206
-                } catch(PDOException $e) {
1206
+                } catch (PDOException $e) {
1207 1207
                         return "error : ".$e->getMessage();
1208 1208
                 }
1209 1209
 		
@@ -1228,8 +1228,8 @@  discard block
 block discarded – undo
1228 1228
 					$query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)';
1229 1229
 					try {
1230 1230
 						$sth = $Connection->db->prepare($query);
1231
-						$sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename));
1232
-					} catch(PDOException $e) {
1231
+						$sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename));
1232
+					} catch (PDOException $e) {
1233 1233
 						return "error : ".$e->getMessage();
1234 1234
 					}
1235 1235
 
@@ -1249,28 +1249,28 @@  discard block
 block discarded – undo
1249 1249
         */
1250 1250
         private static function table2array($data) {
1251 1251
                 $html = str_get_html($data);
1252
-                $tabledata=array();
1253
-                foreach($html->find('tr') as $element)
1252
+                $tabledata = array();
1253
+                foreach ($html->find('tr') as $element)
1254 1254
                 {
1255 1255
                         $td = array();
1256
-                        foreach( $element->find('th') as $row)
1256
+                        foreach ($element->find('th') as $row)
1257 1257
                         {
1258 1258
                                 $td [] = trim($row->plaintext);
1259 1259
                         }
1260
-                        $td=array_filter($td);
1260
+                        $td = array_filter($td);
1261 1261
                         $tabledata[] = $td;
1262 1262
 
1263 1263
                         $td = array();
1264 1264
                         $tdi = array();
1265
-                        foreach( $element->find('td') as $row)
1265
+                        foreach ($element->find('td') as $row)
1266 1266
                         {
1267 1267
                                 $td [] = trim($row->plaintext);
1268 1268
                                 $tdi [] = trim($row->innertext);
1269 1269
                         }
1270
-                        $td=array_filter($td);
1271
-                        $tdi=array_filter($tdi);
1270
+                        $td = array_filter($td);
1271
+                        $tdi = array_filter($tdi);
1272 1272
                     //    $tabledata[]=array_merge($td,$tdi);
1273
-                        $tabledata[]=$td;
1273
+                        $tabledata[] = $td;
1274 1274
                 }
1275 1275
                 return(array_filter($tabledata));
1276 1276
         }
@@ -1343,13 +1343,13 @@  discard block
 block discarded – undo
1343 1343
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1344 1344
 			{
1345 1345
 				$i++;
1346
-				if($i > 3 && count($row) > 2) {
1346
+				if ($i > 3 && count($row) > 2) {
1347 1347
 					$data = array_values(array_filter($row));
1348 1348
 					$cntdata = count($data);
1349 1349
 					if ($cntdata > 10) {
1350 1350
 						$value = $data[9];
1351 1351
 						
1352
-						for ($i =10;$i < $cntdata;$i++) {
1352
+						for ($i = 10; $i < $cntdata; $i++) {
1353 1353
 							$value .= ' '.$data[$i];
1354 1354
 						}
1355 1355
 						$data[9] = $value;
@@ -1359,8 +1359,8 @@  discard block
 block discarded – undo
1359 1359
 						$query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)';
1360 1360
 						try {
1361 1361
 							$sth = $Connection->db->prepare($query);
1362
-							$sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9]));
1363
-						} catch(PDOException $e) {
1362
+							$sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9]));
1363
+						} catch (PDOException $e) {
1364 1364
 							return "error : ".$e->getMessage();
1365 1365
 						}
1366 1366
 					}
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
 			$Connection = new Connection();
1382 1382
 			$sth = $Connection->db->prepare($query);
1383 1383
                         $sth->execute();
1384
-                } catch(PDOException $e) {
1384
+                } catch (PDOException $e) {
1385 1385
                         return "error : ".$e->getMessage();
1386 1386
                 }
1387 1387
 
@@ -1393,12 +1393,12 @@  discard block
 block discarded – undo
1393 1393
 			if ($globalTransaction) $Connection->db->beginTransaction();
1394 1394
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1395 1395
 			{
1396
-				if(count($row) > 1) {
1396
+				if (count($row) > 1) {
1397 1397
 					$query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')";
1398 1398
 					try {
1399 1399
 						$sth = $Connection->db->prepare($query);
1400
-						$sth->execute(array(':name' => $row[1],':icao' => $row[0]));
1401
-					} catch(PDOException $e) {
1400
+						$sth->execute(array(':name' => $row[1], ':icao' => $row[0]));
1401
+					} catch (PDOException $e) {
1402 1402
 						return "error : ".$e->getMessage();
1403 1403
 					}
1404 1404
 				}
@@ -1418,21 +1418,21 @@  discard block
 block discarded – undo
1418 1418
 			try {
1419 1419
 				$sth = $Connection->db->prepare($query);
1420 1420
                     		$sth->execute();
1421
-	                } catch(PDOException $e) {
1421
+	                } catch (PDOException $e) {
1422 1422
 				return "error : ".$e->getMessage();
1423 1423
 	                }
1424 1424
 	        }
1425 1425
 
1426 1426
 
1427
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
1427
+		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql');
1428 1428
 		else {
1429
-			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
1429
+			update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql');
1430 1430
 			$query = "CREATE EXTENSION postgis";
1431
-			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
1431
+			$Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']);
1432 1432
 			try {
1433 1433
 				$sth = $Connection->db->prepare($query);
1434 1434
 				$sth->execute();
1435
-			} catch(PDOException $e) {
1435
+			} catch (PDOException $e) {
1436 1436
 				return "error : ".$e->getMessage();
1437 1437
 			}
1438 1438
 		}
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 		include_once('class.create_db.php');
1446 1446
 		require_once(dirname(__FILE__).'/../require/class.NOTAM.php');
1447 1447
 		if ($globalDebug) echo "NOTAM from FlightAirMap website : Download...";
1448
-		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz');
1448
+		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz');
1449 1449
 		$error = '';
1450 1450
 		if (file_exists($tmp_dir.'notam.txt.gz')) {
1451 1451
 			if ($globalDebug) echo "Gunzip...";
@@ -1477,14 +1477,14 @@  discard block
 block discarded – undo
1477 1477
 			try {
1478 1478
 				$sth = $Connection->db->prepare($query);
1479 1479
             	        	$sth->execute();
1480
-	                } catch(PDOException $e) {
1480
+	                } catch (PDOException $e) {
1481 1481
     	                	echo "error : ".$e->getMessage();
1482 1482
 	                }
1483 1483
 		}
1484 1484
 		if ($globalDBdriver == 'mysql') {
1485
-			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
1485
+			update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql');
1486 1486
 		} else {
1487
-			update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql');
1487
+			update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql');
1488 1488
 		}
1489 1489
 		$error = create_db::import_file($tmp_dir.'countries.sql');
1490 1490
 		return $error;
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
 //		update_db::unzip($tmp_dir.'AptNav.zip');
1498 1498
 //		update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz');
1499 1499
 //		update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net');
1500
-		update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net');
1500
+		update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net');
1501 1501
 		update_db::gunzip($tmp_dir.'awy.dat.gz');
1502 1502
 		$error = update_db::waypoints($tmp_dir.'awy.dat');
1503 1503
 		return $error;
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
 			update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
1518 1518
 			if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
1519 1519
 			if (is_writable(dirname(__FILE__).'/../images/airlines')) {
1520
-				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1520
+				if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1521 1521
 			} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
1522 1522
 		} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
1523 1523
 		if ($error != '') {
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
 		global $tmp_dir, $globalDebug;
1531 1531
 		$error = '';
1532 1532
 		if ($globalDebug) echo "Routes : Download...";
1533
-		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
1533
+		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz');
1534 1534
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
1535 1535
 			if ($globalDebug) echo "Gunzip...";
1536 1536
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 		global $tmp_dir, $globalDebug;
1547 1547
 		$error = '';
1548 1548
 		if ($globalDebug) echo "Schedules Oneworld : Download...";
1549
-		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz');
1549
+		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz');
1550 1550
 		if (file_exists($tmp_dir.'oneworld.csv.gz')) {
1551 1551
 			if ($globalDebug) echo "Gunzip...";
1552 1552
 			update_db::gunzip($tmp_dir.'oneworld.csv.gz');
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 		global $tmp_dir, $globalDebug;
1563 1563
 		$error = '';
1564 1564
 		if ($globalDebug) echo "Schedules Skyteam : Download...";
1565
-		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz');
1565
+		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz');
1566 1566
 		if (file_exists($tmp_dir.'skyteam.csv.gz')) {
1567 1567
 			if ($globalDebug) echo "Gunzip...";
1568 1568
 			update_db::gunzip($tmp_dir.'skyteam.csv.gz');
@@ -1590,7 +1590,7 @@  discard block
 block discarded – undo
1590 1590
 */
1591 1591
 		if ($globalDebug) echo "Modes : Download...";
1592 1592
 //		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
1593
-		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz');
1593
+		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz');
1594 1594
 
1595 1595
 //		if (file_exists($tmp_dir.'basestation_latest.zip')) {
1596 1596
 		if (file_exists($tmp_dir.'BaseStation.sqb.gz')) {
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 	public static function update_ModeS_faa() {
1611 1611
 		global $tmp_dir, $globalDebug;
1612 1612
 		if ($globalDebug) echo "Modes FAA: Download...";
1613
-		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip');
1613
+		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip');
1614 1614
 		if (file_exists($tmp_dir.'ReleasableAircraft.zip')) {
1615 1615
 			if ($globalDebug) echo "Unzip...";
1616 1616
 			update_db::unzip($tmp_dir.'ReleasableAircraft.zip');
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
 	public static function update_ModeS_flarm() {
1627 1627
 		global $tmp_dir, $globalDebug;
1628 1628
 		if ($globalDebug) echo "Modes Flarmnet: Download...";
1629
-		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
1629
+		update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln');
1630 1630
 		if (file_exists($tmp_dir.'data.fln')) {
1631 1631
 			if ($globalDebug) echo "Add to DB...";
1632 1632
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 	public static function update_ModeS_ogn() {
1641 1641
 		global $tmp_dir, $globalDebug;
1642 1642
 		if ($globalDebug) echo "Modes OGN: Download...";
1643
-		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
1643
+		update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv');
1644 1644
 		if (file_exists($tmp_dir.'ogn.csv')) {
1645 1645
 			if ($globalDebug) echo "Add to DB...";
1646 1646
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
@@ -1655,173 +1655,173 @@  discard block
 block discarded – undo
1655 1655
 		global $tmp_dir, $globalDebug;
1656 1656
 		
1657 1657
 		if ($globalDebug) echo "Owner France: Download...";
1658
-		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
1658
+		update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv');
1659 1659
 		if (file_exists($tmp_dir.'owner_f.csv')) {
1660 1660
 			if ($globalDebug) echo "Add to DB...";
1661
-			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
1661
+			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F');
1662 1662
 		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
1663 1663
 		if ($error != '') {
1664 1664
 			return $error;
1665 1665
 		} elseif ($globalDebug) echo "Done\n";
1666 1666
 		
1667 1667
 		if ($globalDebug) echo "Owner Ireland: Download...";
1668
-		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
1668
+		update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv');
1669 1669
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
1670 1670
 			if ($globalDebug) echo "Add to DB...";
1671
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
1671
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI');
1672 1672
 		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
1673 1673
 		if ($error != '') {
1674 1674
 			return $error;
1675 1675
 		} elseif ($globalDebug) echo "Done\n";
1676 1676
 		if ($globalDebug) echo "Owner Switzerland: Download...";
1677
-		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
1677
+		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv');
1678 1678
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
1679 1679
 			if ($globalDebug) echo "Add to DB...";
1680
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
1680
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB');
1681 1681
 		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
1682 1682
 		if ($error != '') {
1683 1683
 			return $error;
1684 1684
 		} elseif ($globalDebug) echo "Done\n";
1685 1685
 		if ($globalDebug) echo "Owner Czech Republic: Download...";
1686
-		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
1686
+		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv');
1687 1687
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
1688 1688
 			if ($globalDebug) echo "Add to DB...";
1689
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
1689
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK');
1690 1690
 		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
1691 1691
 		if ($error != '') {
1692 1692
 			return $error;
1693 1693
 		} elseif ($globalDebug) echo "Done\n";
1694 1694
 		if ($globalDebug) echo "Owner Australia: Download...";
1695
-		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
1695
+		update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv');
1696 1696
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
1697 1697
 			if ($globalDebug) echo "Add to DB...";
1698
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
1698
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH');
1699 1699
 		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
1700 1700
 		if ($error != '') {
1701 1701
 			return $error;
1702 1702
 		} elseif ($globalDebug) echo "Done\n";
1703 1703
 		if ($globalDebug) echo "Owner Austria: Download...";
1704
-		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
1704
+		update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv');
1705 1705
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
1706 1706
 			if ($globalDebug) echo "Add to DB...";
1707
-			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
1707
+			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE');
1708 1708
 		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
1709 1709
 		if ($error != '') {
1710 1710
 			return $error;
1711 1711
 		} elseif ($globalDebug) echo "Done\n";
1712 1712
 		if ($globalDebug) echo "Owner Chile: Download...";
1713
-		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
1713
+		update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv');
1714 1714
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
1715 1715
 			if ($globalDebug) echo "Add to DB...";
1716
-			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
1716
+			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC');
1717 1717
 		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
1718 1718
 		if ($error != '') {
1719 1719
 			return $error;
1720 1720
 		} elseif ($globalDebug) echo "Done\n";
1721 1721
 		if ($globalDebug) echo "Owner Colombia: Download...";
1722
-		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
1722
+		update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv');
1723 1723
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
1724 1724
 			if ($globalDebug) echo "Add to DB...";
1725
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
1725
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ');
1726 1726
 		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
1727 1727
 		if ($error != '') {
1728 1728
 			return $error;
1729 1729
 		} elseif ($globalDebug) echo "Done\n";
1730 1730
 		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
1731
-		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
1731
+		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv');
1732 1732
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
1733 1733
 			if ($globalDebug) echo "Add to DB...";
1734
-			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
1734
+			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7');
1735 1735
 		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
1736 1736
 		if ($error != '') {
1737 1737
 			return $error;
1738 1738
 		} elseif ($globalDebug) echo "Done\n";
1739 1739
 		if ($globalDebug) echo "Owner Brazil: Download...";
1740
-		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
1740
+		update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv');
1741 1741
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
1742 1742
 			if ($globalDebug) echo "Add to DB...";
1743
-			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
1743
+			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP');
1744 1744
 		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
1745 1745
 		if ($error != '') {
1746 1746
 			return $error;
1747 1747
 		} elseif ($globalDebug) echo "Done\n";
1748 1748
 		if ($globalDebug) echo "Owner Cayman Islands: Download...";
1749
-		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
1749
+		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv');
1750 1750
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
1751 1751
 			if ($globalDebug) echo "Add to DB...";
1752
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
1752
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP');
1753 1753
 		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
1754 1754
 		if ($error != '') {
1755 1755
 			return $error;
1756 1756
 		} elseif ($globalDebug) echo "Done\n";
1757 1757
 		if ($globalDebug) echo "Owner Croatia: Download...";
1758
-		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
1758
+		update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv');
1759 1759
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
1760 1760
 			if ($globalDebug) echo "Add to DB...";
1761
-			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
1761
+			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A');
1762 1762
 		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
1763 1763
 		if ($error != '') {
1764 1764
 			return $error;
1765 1765
 		} elseif ($globalDebug) echo "Done\n";
1766 1766
 		if ($globalDebug) echo "Owner Luxembourg: Download...";
1767
-		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
1767
+		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv');
1768 1768
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
1769 1769
 			if ($globalDebug) echo "Add to DB...";
1770
-			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
1770
+			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX');
1771 1771
 		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
1772 1772
 		if ($error != '') {
1773 1773
 			return $error;
1774 1774
 		} elseif ($globalDebug) echo "Done\n";
1775 1775
 		if ($globalDebug) echo "Owner Maldives: Download...";
1776
-		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
1776
+		update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv');
1777 1777
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
1778 1778
 			if ($globalDebug) echo "Add to DB...";
1779
-			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
1779
+			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q');
1780 1780
 		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
1781 1781
 		if ($error != '') {
1782 1782
 			return $error;
1783 1783
 		} elseif ($globalDebug) echo "Done\n";
1784 1784
 		if ($globalDebug) echo "Owner New Zealand: Download...";
1785
-		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
1785
+		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv');
1786 1786
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
1787 1787
 			if ($globalDebug) echo "Add to DB...";
1788
-			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
1788
+			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK');
1789 1789
 		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
1790 1790
 		if ($error != '') {
1791 1791
 			return $error;
1792 1792
 		} elseif ($globalDebug) echo "Done\n";
1793 1793
 		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
1794
-		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
1794
+		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv');
1795 1795
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
1796 1796
 			if ($globalDebug) echo "Add to DB...";
1797
-			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
1797
+			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2');
1798 1798
 		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
1799 1799
 		if ($error != '') {
1800 1800
 			return $error;
1801 1801
 		} elseif ($globalDebug) echo "Done\n";
1802 1802
 		if ($globalDebug) echo "Owner Slovakia: Download...";
1803
-		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
1803
+		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv');
1804 1804
 		if (file_exists($tmp_dir.'owner_om.csv')) {
1805 1805
 			if ($globalDebug) echo "Add to DB...";
1806
-			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
1806
+			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM');
1807 1807
 		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
1808 1808
 		if ($error != '') {
1809 1809
 			return $error;
1810 1810
 		} elseif ($globalDebug) echo "Done\n";
1811 1811
 		if ($globalDebug) echo "Owner Ecuador: Download...";
1812
-		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
1812
+		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv');
1813 1813
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
1814 1814
 			if ($globalDebug) echo "Add to DB...";
1815
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
1815
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC');
1816 1816
 		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
1817 1817
 		if ($error != '') {
1818 1818
 			return $error;
1819 1819
 		} elseif ($globalDebug) echo "Done\n";
1820 1820
 		if ($globalDebug) echo "Owner Iceland: Download...";
1821
-		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
1821
+		update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv');
1822 1822
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
1823 1823
 			if ($globalDebug) echo "Add to DB...";
1824
-			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
1824
+			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF');
1825 1825
 		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
1826 1826
 		if ($error != '') {
1827 1827
 			return $error;
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
 		global $tmp_dir, $globalDebug;
1834 1834
 		$error = '';
1835 1835
 		if ($globalDebug) echo "Translation : Download...";
1836
-		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
1836
+		update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip');
1837 1837
 		if (file_exists($tmp_dir.'translation.zip')) {
1838 1838
 			if ($globalDebug) echo "Unzip...";
1839 1839
 			update_db::unzip($tmp_dir.'translation.zip');
@@ -1849,7 +1849,7 @@  discard block
 block discarded – undo
1849 1849
 	public static function update_translation_fam() {
1850 1850
 		global $tmp_dir, $globalDebug;
1851 1851
 		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
1852
-		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
1852
+		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz');
1853 1853
 		if (file_exists($tmp_dir.'translation.tsv.gz')) {
1854 1854
 			if ($globalDebug) echo "Gunzip...";
1855 1855
 			update_db::gunzip($tmp_dir.'translation.tsv.gz');
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
 	public static function update_ModeS_fam() {
1865 1865
 		global $tmp_dir, $globalDebug;
1866 1866
 		if ($globalDebug) echo "ModeS from FlightAirMap website : Download...";
1867
-		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz');
1867
+		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz');
1868 1868
 		if (file_exists($tmp_dir.'modes.tsv.gz')) {
1869 1869
 			if ($globalDebug) echo "Gunzip...";
1870 1870
 			update_db::gunzip($tmp_dir.'modes.tsv.gz');
@@ -1880,9 +1880,9 @@  discard block
 block discarded – undo
1880 1880
 		global $tmp_dir, $globalDebug, $globalOwner;
1881 1881
 		if ($globalDebug) echo "owner from FlightAirMap website : Download...";
1882 1882
 		if ($globalOwner === TRUE) {
1883
-			update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz');
1883
+			update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz');
1884 1884
 		} else {
1885
-			update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz');
1885
+			update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz');
1886 1886
 		}
1887 1887
 		if (file_exists($tmp_dir.'owners.tsv.gz')) {
1888 1888
 			if ($globalDebug) echo "Gunzip...";
@@ -1898,7 +1898,7 @@  discard block
 block discarded – undo
1898 1898
 	public static function update_routes_fam() {
1899 1899
 		global $tmp_dir, $globalDebug;
1900 1900
 		if ($globalDebug) echo "Routes from FlightAirMap website : Download...";
1901
-		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz');
1901
+		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz');
1902 1902
 		if (file_exists($tmp_dir.'routes.tsv.gz')) {
1903 1903
 			if ($globalDebug) echo "Gunzip...";
1904 1904
 			update_db::gunzip($tmp_dir.'routes.tsv.gz');
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
 	public static function update_banned_fam() {
1914 1914
 		global $tmp_dir, $globalDebug;
1915 1915
 		if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download...";
1916
-		update_db::download('http://data.flightairmap.fr/data/ban_ue.csv',$tmp_dir.'ban_ue.csv');
1916
+		update_db::download('http://data.flightairmap.fr/data/ban_ue.csv', $tmp_dir.'ban_ue.csv');
1917 1917
 		if (file_exists($tmp_dir.'ban_ue.csv')) {
1918 1918
 			//if ($globalDebug) echo "Gunzip...";
1919 1919
 			//update_db::gunzip($tmp_dir.'ban_ue.csv');
@@ -1932,18 +1932,18 @@  discard block
 block discarded – undo
1932 1932
 		$error = '';
1933 1933
 		if ($globalDebug) echo "Airspace from FlightAirMap website : Download...";
1934 1934
 		if ($globalDBdriver == 'mysql') {
1935
-			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
1935
+			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
1936 1936
 		} else {
1937
-			update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
1937
+			update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
1938 1938
 		}
1939 1939
 		if (file_exists($tmp_dir.'airspace.sql.gz.md5')) {
1940
-			$airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
1940
+			$airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
1941 1941
 			$airspace_md5 = $airspace_md5_file[0];
1942 1942
 			if (!update_db::check_airspace_version($airspace_md5)) {
1943 1943
 				if ($globalDBdriver == 'mysql') {
1944
-					update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz');
1944
+					update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz');
1945 1945
 				} else {
1946
-					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz');
1946
+					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz');
1947 1947
 				}
1948 1948
 				if (file_exists($tmp_dir.'airspace.sql.gz')) {
1949 1949
 					if ($globalDebug) echo "Gunzip...";
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 						try {
1956 1956
 							$sth = $Connection->db->prepare($query);
1957 1957
     	    	    					$sth->execute();
1958
-			            		} catch(PDOException $e) {
1958
+			            		} catch (PDOException $e) {
1959 1959
 							return "error : ".$e->getMessage();
1960 1960
 		            			}
1961 1961
 		    			}
@@ -1973,15 +1973,15 @@  discard block
 block discarded – undo
1973 1973
 	public static function update_tle() {
1974 1974
 		global $tmp_dir, $globalDebug;
1975 1975
 		if ($globalDebug) echo "Download TLE : Download...";
1976
-		$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',
1977
-		'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',
1978
-		'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt');
1976
+		$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',
1977
+		'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',
1978
+		'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt');
1979 1979
 		foreach ($alltle as $filename) {
1980 1980
 			if ($globalDebug) echo "downloading ".$filename.'...';
1981
-			update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename);
1981
+			update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename);
1982 1982
 			if (file_exists($tmp_dir.$filename)) {
1983 1983
 				if ($globalDebug) echo "Add to DB ".$filename."...";
1984
-				$error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename));
1984
+				$error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename));
1985 1985
 			} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
1986 1986
 			if ($error != '') {
1987 1987
 				echo $error."\n";
@@ -1994,32 +1994,32 @@  discard block
 block discarded – undo
1994 1994
 		global $tmp_dir, $globalDebug;
1995 1995
 		$error = '';
1996 1996
 		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
1997
-		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum');
1997
+		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum');
1998 1998
 		if (file_exists($tmp_dir.'models.md5sum')) {
1999 1999
 			if ($globalDebug) echo "Check files...\n";
2000 2000
 			$newmodelsdb = array();
2001
-			if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) {
2002
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2001
+			if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) {
2002
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2003 2003
 					$model = trim($row[2]);
2004 2004
 					$newmodelsdb[$model] = trim($row[0]);
2005 2005
 				}
2006 2006
 			}
2007 2007
 			$modelsdb = array();
2008 2008
 			if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) {
2009
-				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) {
2010
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2009
+				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) {
2010
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2011 2011
 						$model = trim($row[2]);
2012 2012
 						$modelsdb[$model] = trim($row[0]);
2013 2013
 					}
2014 2014
 				}
2015 2015
 			}
2016
-			$diff = array_diff($newmodelsdb,$modelsdb);
2016
+			$diff = array_diff($newmodelsdb, $modelsdb);
2017 2017
 			foreach ($diff as $key => $value) {
2018 2018
 				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
2019
-				update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key);
2019
+				update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key);
2020 2020
 				
2021 2021
 			}
2022
-			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum');
2022
+			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum');
2023 2023
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2024 2024
 		if ($error != '') {
2025 2025
 			return $error;
@@ -2031,32 +2031,32 @@  discard block
 block discarded – undo
2031 2031
 		global $tmp_dir, $globalDebug;
2032 2032
 		$error = '';
2033 2033
 		if ($globalDebug) echo "Space models from FlightAirMap website : Download...";
2034
-		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum');
2034
+		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum');
2035 2035
 		if (file_exists($tmp_dir.'space_models.md5sum')) {
2036 2036
 			if ($globalDebug) echo "Check files...\n";
2037 2037
 			$newmodelsdb = array();
2038
-			if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) {
2039
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2038
+			if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) {
2039
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2040 2040
 					$model = trim($row[2]);
2041 2041
 					$newmodelsdb[$model] = trim($row[0]);
2042 2042
 				}
2043 2043
 			}
2044 2044
 			$modelsdb = array();
2045 2045
 			if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) {
2046
-				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) {
2047
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2046
+				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) {
2047
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2048 2048
 						$model = trim($row[2]);
2049 2049
 						$modelsdb[$model] = trim($row[0]);
2050 2050
 					}
2051 2051
 				}
2052 2052
 			}
2053
-			$diff = array_diff($newmodelsdb,$modelsdb);
2053
+			$diff = array_diff($newmodelsdb, $modelsdb);
2054 2054
 			foreach ($diff as $key => $value) {
2055 2055
 				if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n";
2056
-				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key);
2056
+				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key);
2057 2057
 				
2058 2058
 			}
2059
-			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum');
2059
+			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum');
2060 2060
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2061 2061
 		if ($error != '') {
2062 2062
 			return $error;
@@ -2079,8 +2079,8 @@  discard block
 block discarded – undo
2079 2079
 		*/
2080 2080
 		if (file_exists($tmp_dir.'aircrafts.html')) {
2081 2081
 		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2082
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
2083
-		    $result = fread($fh,100000000);
2082
+		    $fh = fopen($tmp_dir.'aircrafts.html', "r");
2083
+		    $result = fread($fh, 100000000);
2084 2084
 		    //echo $result;
2085 2085
 		    //var_dump(str_get_html($result));
2086 2086
 		    //print_r(self::table2array($result));
@@ -2098,23 +2098,23 @@  discard block
 block discarded – undo
2098 2098
 			$Connection = new Connection();
2099 2099
 			$sth = $Connection->db->prepare($query);
2100 2100
                         $sth->execute();
2101
-                } catch(PDOException $e) {
2101
+                } catch (PDOException $e) {
2102 2102
                         return "error : ".$e->getMessage();
2103 2103
                 }
2104 2104
 
2105 2105
 		$error = '';
2106 2106
 		if ($globalDebug) echo "Notam : Download...";
2107
-		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
2107
+		update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss');
2108 2108
 		if (file_exists($tmp_dir.'notam.rss')) {
2109
-			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
2109
+			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true);
2110 2110
 			foreach ($notams['channel']['item'] as $notam) {
2111
-				$title = explode(':',$notam['title']);
2111
+				$title = explode(':', $notam['title']);
2112 2112
 				$data['ref'] = trim($title[0]);
2113 2113
 				unset($title[0]);
2114
-				$data['title'] = trim(implode(':',$title));
2115
-				$description = strip_tags($notam['description'],'<pre>');
2116
-				preg_match(':^(.*?)<pre>:',$description,$match);
2117
-				$q = explode('/',$match[1]);
2114
+				$data['title'] = trim(implode(':', $title));
2115
+				$description = strip_tags($notam['description'], '<pre>');
2116
+				preg_match(':^(.*?)<pre>:', $description, $match);
2117
+				$q = explode('/', $match[1]);
2118 2118
 				$data['fir'] = $q[0];
2119 2119
 				$data['code'] = $q[1];
2120 2120
 				$ifrvfr = $q[2];
@@ -2130,30 +2130,30 @@  discard block
 block discarded – undo
2130 2130
 				$data['lower_limit'] = $q[5];
2131 2131
 				$data['upper_limit'] = $q[6];
2132 2132
 				$latlonrad = $q[7];
2133
-				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
2134
-				$latitude = $Common->convertDec($las,'latitude');
2135
-				$longitude = $Common->convertDec($lns,'longitude');
2133
+				sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius);
2134
+				$latitude = $Common->convertDec($las, 'latitude');
2135
+				$longitude = $Common->convertDec($lns, 'longitude');
2136 2136
 				if ($lac == 'S') $latitude = '-'.$latitude;
2137 2137
 				if ($lnc == 'W') $longitude = '-'.$longitude;
2138 2138
 				$data['center_latitude'] = $latitude;
2139 2139
 				$data['center_longitude'] = $longitude;
2140 2140
 				$data['radius'] = intval($radius);
2141 2141
 				
2142
-				preg_match(':<pre>(.*?)</pre>:',$description,$match);
2142
+				preg_match(':<pre>(.*?)</pre>:', $description, $match);
2143 2143
 				$data['text'] = $match[1];
2144
-				preg_match(':</pre>(.*?)$:',$description,$match);
2144
+				preg_match(':</pre>(.*?)$:', $description, $match);
2145 2145
 				$fromto = $match[1];
2146
-				preg_match('#FROM:(.*?)TO:#',$fromto,$match);
2146
+				preg_match('#FROM:(.*?)TO:#', $fromto, $match);
2147 2147
 				$fromall = trim($match[1]);
2148
-				preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match);
2148
+				preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match);
2149 2149
 				$from = trim($match[1]);
2150
-				$data['date_begin'] = date("Y-m-d H:i:s",strtotime($from));
2151
-				preg_match('#TO:(.*?)$#',$fromto,$match);
2150
+				$data['date_begin'] = date("Y-m-d H:i:s", strtotime($from));
2151
+				preg_match('#TO:(.*?)$#', $fromto, $match);
2152 2152
 				$toall = trim($match[1]);
2153
-				if (!preg_match(':Permanent:',$toall)) {
2154
-					preg_match('#^(.*?) \((.*?)\)#',$toall,$match);
2153
+				if (!preg_match(':Permanent:', $toall)) {
2154
+					preg_match('#^(.*?) \((.*?)\)#', $toall, $match);
2155 2155
 					$to = trim($match[1]);
2156
-					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2156
+					$data['date_end'] = date("Y-m-d H:i:s", strtotime($to));
2157 2157
 					$data['permanent'] = 0;
2158 2158
 				} else {
2159 2159
 				    $data['date_end'] = NULL;
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
 				}
2162 2162
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2163 2163
 				$NOTAM = new NOTAM();
2164
-				$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']);
2164
+				$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']);
2165 2165
 				unset($data);
2166 2166
 			} 
2167 2167
 		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
@@ -2184,16 +2184,16 @@  discard block
 block discarded – undo
2184 2184
 				$Connection = new Connection();
2185 2185
 				$sth = $Connection->db->prepare($query);
2186 2186
 				$sth->execute();
2187
-			} catch(PDOException $e) {
2187
+			} catch (PDOException $e) {
2188 2188
 				return "error : ".$e->getMessage();
2189 2189
 			}
2190 2190
 		}
2191 2191
 		$Common = new Common();
2192 2192
 		$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json');
2193
-		$airspace_json = json_decode($airspace_lst,true);
2193
+		$airspace_json = json_decode($airspace_lst, true);
2194 2194
 		foreach ($airspace_json['records'] as $airspace) {
2195 2195
 			if ($globalDebug) echo $airspace['name']."...\n";
2196
-			update_db::download($airspace['uri'],$tmp_dir.$airspace['name']);
2196
+			update_db::download($airspace['uri'], $tmp_dir.$airspace['name']);
2197 2197
 			if (file_exists($tmp_dir.$airspace['name'])) {
2198 2198
 				file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name'])));
2199 2199
 				//system('recode l9..utf8 '.$tmp_dir.$airspace['name']);
@@ -2217,7 +2217,7 @@  discard block
 block discarded – undo
2217 2217
 			$Connection = new Connection();
2218 2218
 			$sth = $Connection->db->prepare($query);
2219 2219
                         $sth->execute();
2220
-                } catch(PDOException $e) {
2220
+                } catch (PDOException $e) {
2221 2221
                         return "error : ".$e->getMessage();
2222 2222
                 }
2223 2223
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
 			$Connection = new Connection();
2233 2233
 			$sth = $Connection->db->prepare($query);
2234 2234
                         $sth->execute();
2235
-                } catch(PDOException $e) {
2235
+                } catch (PDOException $e) {
2236 2236
                         return "error : ".$e->getMessage();
2237 2237
                 }
2238 2238
 	}
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
 			$Connection = new Connection();
2244 2244
 			$sth = $Connection->db->prepare($query);
2245 2245
                         $sth->execute(array(':version' => $version));
2246
-                } catch(PDOException $e) {
2246
+                } catch (PDOException $e) {
2247 2247
                         return "error : ".$e->getMessage();
2248 2248
                 }
2249 2249
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2259,7 +2259,7 @@  discard block
 block discarded – undo
2259 2259
 			$Connection = new Connection();
2260 2260
 			$sth = $Connection->db->prepare($query);
2261 2261
                         $sth->execute(array(':version' => $version));
2262
-                } catch(PDOException $e) {
2262
+                } catch (PDOException $e) {
2263 2263
                         return "error : ".$e->getMessage();
2264 2264
                 }
2265 2265
 	}
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
 			$Connection = new Connection();
2276 2276
 			$sth = $Connection->db->prepare($query);
2277 2277
                         $sth->execute();
2278
-                } catch(PDOException $e) {
2278
+                } catch (PDOException $e) {
2279 2279
                         return "error : ".$e->getMessage();
2280 2280
                 }
2281 2281
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2290,7 +2290,7 @@  discard block
 block discarded – undo
2290 2290
 			$Connection = new Connection();
2291 2291
 			$sth = $Connection->db->prepare($query);
2292 2292
                         $sth->execute();
2293
-                } catch(PDOException $e) {
2293
+                } catch (PDOException $e) {
2294 2294
                         return "error : ".$e->getMessage();
2295 2295
                 }
2296 2296
 	}
@@ -2305,7 +2305,7 @@  discard block
 block discarded – undo
2305 2305
 			$Connection = new Connection();
2306 2306
 			$sth = $Connection->db->prepare($query);
2307 2307
                         $sth->execute();
2308
-                } catch(PDOException $e) {
2308
+                } catch (PDOException $e) {
2309 2309
                         return "error : ".$e->getMessage();
2310 2310
                 }
2311 2311
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
 			$Connection = new Connection();
2321 2321
 			$sth = $Connection->db->prepare($query);
2322 2322
                         $sth->execute();
2323
-                } catch(PDOException $e) {
2323
+                } catch (PDOException $e) {
2324 2324
                         return "error : ".$e->getMessage();
2325 2325
                 }
2326 2326
 	}
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
 			$Connection = new Connection();
2337 2337
 			$sth = $Connection->db->prepare($query);
2338 2338
                         $sth->execute();
2339
-                } catch(PDOException $e) {
2339
+                } catch (PDOException $e) {
2340 2340
                         return "error : ".$e->getMessage();
2341 2341
                 }
2342 2342
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
 			$Connection = new Connection();
2352 2352
 			$sth = $Connection->db->prepare($query);
2353 2353
                         $sth->execute();
2354
-                } catch(PDOException $e) {
2354
+                } catch (PDOException $e) {
2355 2355
                         return "error : ".$e->getMessage();
2356 2356
                 }
2357 2357
 	}
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
 			$Connection = new Connection();
2367 2367
 			$sth = $Connection->db->prepare($query);
2368 2368
                         $sth->execute();
2369
-                } catch(PDOException $e) {
2369
+                } catch (PDOException $e) {
2370 2370
                         return "error : ".$e->getMessage();
2371 2371
                 }
2372 2372
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2381,7 +2381,7 @@  discard block
 block discarded – undo
2381 2381
 			$Connection = new Connection();
2382 2382
 			$sth = $Connection->db->prepare($query);
2383 2383
                         $sth->execute();
2384
-                } catch(PDOException $e) {
2384
+                } catch (PDOException $e) {
2385 2385
                         return "error : ".$e->getMessage();
2386 2386
                 }
2387 2387
 	}
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
 			$Connection = new Connection();
2397 2397
 			$sth = $Connection->db->prepare($query);
2398 2398
                         $sth->execute();
2399
-                } catch(PDOException $e) {
2399
+                } catch (PDOException $e) {
2400 2400
                         return "error : ".$e->getMessage();
2401 2401
                 }
2402 2402
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2411,7 +2411,7 @@  discard block
 block discarded – undo
2411 2411
 			$Connection = new Connection();
2412 2412
 			$sth = $Connection->db->prepare($query);
2413 2413
                         $sth->execute();
2414
-                } catch(PDOException $e) {
2414
+                } catch (PDOException $e) {
2415 2415
                         return "error : ".$e->getMessage();
2416 2416
                 }
2417 2417
 	}
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
 			$Connection = new Connection();
2427 2427
 			$sth = $Connection->db->prepare($query);
2428 2428
                         $sth->execute();
2429
-                } catch(PDOException $e) {
2429
+                } catch (PDOException $e) {
2430 2430
                         return "error : ".$e->getMessage();
2431 2431
                 }
2432 2432
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2441,7 +2441,7 @@  discard block
 block discarded – undo
2441 2441
 			$Connection = new Connection();
2442 2442
 			$sth = $Connection->db->prepare($query);
2443 2443
                         $sth->execute();
2444
-                } catch(PDOException $e) {
2444
+                } catch (PDOException $e) {
2445 2445
                         return "error : ".$e->getMessage();
2446 2446
                 }
2447 2447
 	}
@@ -2456,7 +2456,7 @@  discard block
 block discarded – undo
2456 2456
 			$Connection = new Connection();
2457 2457
 			$sth = $Connection->db->prepare($query);
2458 2458
                         $sth->execute();
2459
-                } catch(PDOException $e) {
2459
+                } catch (PDOException $e) {
2460 2460
                         return "error : ".$e->getMessage();
2461 2461
                 }
2462 2462
 	}
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 			$Connection = new Connection();
2472 2472
 			$sth = $Connection->db->prepare($query);
2473 2473
                         $sth->execute();
2474
-                } catch(PDOException $e) {
2474
+                } catch (PDOException $e) {
2475 2475
                         return "error : ".$e->getMessage();
2476 2476
                 }
2477 2477
 	}
Please login to merge, or discard this patch.
install/class.update_schema.php 1 patch
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection->indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412 412
     		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414 414
         	try {
415 415
             	    $sth = $Connection->db->prepare($query);
416 416
 		    $sth->execute();
417
-    		} catch(PDOException $e) {
417
+    		} catch (PDOException $e) {
418 418
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419 419
     		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421 421
         	try {
422 422
             	    $sth = $Connection->db->prepare($query);
423 423
 		    $sth->execute();
424
-    		} catch(PDOException $e) {
424
+    		} catch (PDOException $e) {
425 425
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426 426
     		}
427 427
     		if ($globalDBdriver == 'mysql') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		    try {
430 430
             		$sth = $Connection->db->prepare($query);
431 431
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
432
+    		    } catch (PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434 434
     		    }
435 435
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443 443
             	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445 445
             	    }
446 446
                 } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448 448
                 }
449 449
         	try {
450 450
             	    $sth = $Connection->db->prepare($query);
451 451
 		    $sth->execute();
452
-    		} catch(PDOException $e) {
452
+    		} catch (PDOException $e) {
453 453
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454 454
     		}
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         	try {
460 460
             	    $sth = $Connection->db->prepare($query);
461 461
 		    $sth->execute();
462
-    		} catch(PDOException $e) {
462
+    		} catch (PDOException $e) {
463 463
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
464 464
     		}
465 465
 		return $error;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         	try {
488 488
             	    $sth = $Connection->db->prepare($query);
489 489
 		    $sth->execute();
490
-    		} catch(PDOException $e) {
490
+    		} catch (PDOException $e) {
491 491
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
492 492
     		}
493 493
 		return $error;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 
496 496
 	private static function update_from_13() {
497 497
     		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+    		if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) {
499
+    			$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+	    		} catch (PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505 505
     			}
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         	try {
510 510
             	    $sth = $Connection->db->prepare($query);
511 511
 		    $sth->execute();
512
-    		} catch(PDOException $e) {
512
+    		} catch (PDOException $e) {
513 513
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
514 514
     		}
515 515
 		return $error;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         	try {
528 528
             	    $sth = $Connection->db->prepare($query);
529 529
 		    $sth->execute();
530
-    		} catch(PDOException $e) {
530
+    		} catch (PDOException $e) {
531 531
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
532 532
     		}
533 533
 		return $error;
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
     		$Connection = new Connection();
539 539
 		$error = '';
540 540
     		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
541
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542 542
         	try {
543 543
             	    $sth = $Connection->db->prepare($query);
544 544
 		    $sth->execute();
545
-    		} catch(PDOException $e) {
545
+    		} catch (PDOException $e) {
546 546
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 547
     		}
548 548
 		if ($error != '') return $error;
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         	try {
551 551
             	    $sth = $Connection->db->prepare($query);
552 552
 		    $sth->execute();
553
-    		} catch(PDOException $e) {
553
+    		} catch (PDOException $e) {
554 554
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
555 555
     		}
556 556
 		return $error;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         	try {
572 572
             	    $sth = $Connection->db->prepare($query);
573 573
 		    $sth->execute();
574
-    		} catch(PDOException $e) {
574
+    		} catch (PDOException $e) {
575 575
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
576 576
     		}
577 577
 		return $error;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         	try {
590 590
             	    $sth = $Connection->db->prepare($query);
591 591
 		    $sth->execute();
592
-    		} catch(PDOException $e) {
592
+    		} catch (PDOException $e) {
593 593
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
594 594
     		}
595 595
 		return $error;
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
     		$Connection = new Connection();
599 599
 		$error = '';
600 600
     		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
601
+    		if (!$Connection->checkColumnName('stats_airport', 'airport_name')) {
602 602
     			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603 603
     	        	try {
604 604
 	            	    $sth = $Connection->db->prepare($query);
605 605
 			    $sth->execute();
606
-    			} catch(PDOException $e) {
606
+    			} catch (PDOException $e) {
607 607
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 608
     			}
609 609
     		}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         	try {
613 613
             	    $sth = $Connection->db->prepare($query);
614 614
 		    $sth->execute();
615
-    		} catch(PDOException $e) {
615
+    		} catch (PDOException $e) {
616 616
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
617 617
     		}
618 618
 		return $error;
@@ -629,73 +629,73 @@  discard block
 block discarded – undo
629 629
         	try {
630 630
             	    $sth = $Connection->db->prepare($query);
631 631
 		    $sth->execute();
632
-    		} catch(PDOException $e) {
632
+    		} catch (PDOException $e) {
633 633
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634 634
     		}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636 636
         	try {
637 637
             	    $sth = $Connection->db->prepare($query);
638 638
 		    $sth->execute();
639
-    		} catch(PDOException $e) {
639
+    		} catch (PDOException $e) {
640 640
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641 641
     		}
642
-		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
642
+		if (!$Connection->checkColumnName('spotter_archive', 'over_country')) {
643 643
 			// Add column over_country
644 644
     			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646 646
             			$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
650 650
 			}
651 651
 		}
652
-		if (!$Connection->checkColumnName('spotter_live','over_country')) {
652
+		if (!$Connection->checkColumnName('spotter_live', 'over_country')) {
653 653
 			// Add column over_country
654 654
     			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656 656
             			$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658
-			} catch(PDOException $e) {
658
+			} catch (PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
660 660
 			}
661 661
 		}
662
-		if (!$Connection->checkColumnName('spotter_output','source_name')) {
662
+		if (!$Connection->checkColumnName('spotter_output', 'source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664 664
     			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668
-			} catch(PDOException $e) {
668
+			} catch (PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670 670
     			}
671 671
     		}
672
-		if (!$Connection->checkColumnName('spotter_live','source_name')) {
672
+		if (!$Connection->checkColumnName('spotter_live', 'source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674 674
     			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678
-			} catch(PDOException $e) {
678
+			} catch (PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680 680
     			}
681 681
     		}
682
-		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
682
+		if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684 684
     			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688
-			} catch(PDOException $e) {
688
+			} catch (PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690 690
     			}
691 691
     		}
692
-		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
692
+		if (!$Connection->checkColumnName('spotter_archive', 'source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694 694
     			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698
-			} catch(PDOException $e) {
698
+			} catch (PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 700
     			}
701 701
     		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         	try {
705 705
             	    $sth = $Connection->db->prepare($query);
706 706
 		    $sth->execute();
707
-    		} catch(PDOException $e) {
707
+    		} catch (PDOException $e) {
708 708
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
709 709
     		}
710 710
 		return $error;
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722
-		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
722
+		if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) {
723 723
 			// Add column over_country
724 724
     			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725 725
         		try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728
-			} catch(PDOException $e) {
728
+			} catch (PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 730
     			}
731 731
     		}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         	try {
742 742
             	    $sth = $Connection->db->prepare($query);
743 743
 		    $sth->execute();
744
-    		} catch(PDOException $e) {
744
+    		} catch (PDOException $e) {
745 745
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
746 746
     		}
747 747
 		return $error;
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	private static function update_from_21() {
751 751
 		$Connection = new Connection();
752 752
 		$error = '';
753
-		if (!$Connection->checkColumnName('stats_airport','stats_type')) {
753
+		if (!$Connection->checkColumnName('stats_airport', 'stats_type')) {
754 754
 			// Rename type to stats_type
755 755
 			$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
756 756
 			try {
757 757
 				$sth = $Connection->db->prepare($query);
758 758
 				$sth->execute();
759
-			} catch(PDOException $e) {
759
+			} catch (PDOException $e) {
760 760
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 761
 			}
762 762
 			if ($error != '') return $error;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         	try {
766 766
             	    $sth = $Connection->db->prepare($query);
767 767
 		    $sth->execute();
768
-    		} catch(PDOException $e) {
768
+    		} catch (PDOException $e) {
769 769
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
770 770
     		}
771 771
 		return $error;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
         	try {
789 789
             	    $sth = $Connection->db->prepare($query);
790 790
 		    $sth->execute();
791
-    		} catch(PDOException $e) {
791
+    		} catch (PDOException $e) {
792 792
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
793 793
     		}
794 794
 		return $error;
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 			try {
816 816
 				$sth = $Connection->db->prepare($query);
817 817
 				$sth->execute();
818
-			} catch(PDOException $e) {
818
+			} catch (PDOException $e) {
819 819
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
820 820
 			}
821 821
 		}
822
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
822
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824 824
     			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828
-			} catch(PDOException $e) {
828
+			} catch (PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830 830
     			}
831 831
     		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		try {
835 835
 			$sth = $Connection->db->prepare($query);
836 836
 			$sth->execute();
837
-		} catch(PDOException $e) {
837
+		} catch (PDOException $e) {
838 838
 			return "error (update schema_version) : ".$e->getMessage()."\n";
839 839
 		}
840 840
 		return $error;
@@ -850,23 +850,23 @@  discard block
 block discarded – undo
850 850
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 851
 		}
852 852
 		if ($error != '') return 'Import airlines.sql : '.$error;
853
-		if (!$Connection->checkColumnName('airlines','forsource')) {
853
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
854 854
 			// Add forsource to airlines
855 855
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
856 856
 			try {
857 857
 				$sth = $Connection->db->prepare($query);
858 858
 				$sth->execute();
859
-			} catch(PDOException $e) {
859
+			} catch (PDOException $e) {
860 860
 				return "error (add forsource column) : ".$e->getMessage()."\n";
861 861
 			}
862 862
 		}
863
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
863
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
864 864
 			// Add forsource to airlines
865 865
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
866 866
 			try {
867 867
 				$sth = $Connection->db->prepare($query);
868 868
 				$sth->execute();
869
-			} catch(PDOException $e) {
869
+			} catch (PDOException $e) {
870 870
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
871 871
 			}
872 872
 			// Add unique key
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 			try {
879 879
 				$sth = $Connection->db->prepare($query);
880 880
 				$sth->execute();
881
-			} catch(PDOException $e) {
881
+			} catch (PDOException $e) {
882 882
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
883 883
 			}
884 884
 		}
885
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
885
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
886 886
 			// Add forsource to airlines
887 887
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
888 888
 			try {
889 889
 				$sth = $Connection->db->prepare($query);
890 890
 				$sth->execute();
891
-			} catch(PDOException $e) {
891
+			} catch (PDOException $e) {
892 892
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
893 893
 			}
894 894
 			// Add unique key
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 			try {
901 901
 				$sth = $Connection->db->prepare($query);
902 902
 				$sth->execute();
903
-			} catch(PDOException $e) {
903
+			} catch (PDOException $e) {
904 904
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
905 905
 			}
906 906
 		}
907
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
907
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
908 908
 			// Add forsource to airlines
909 909
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
910 910
 			try {
911 911
 				$sth = $Connection->db->prepare($query);
912 912
 				$sth->execute();
913
-			} catch(PDOException $e) {
913
+			} catch (PDOException $e) {
914 914
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
915 915
 			}
916 916
 			// Add unique key
@@ -922,36 +922,36 @@  discard block
 block discarded – undo
922 922
 			try {
923 923
 				$sth = $Connection->db->prepare($query);
924 924
 				$sth->execute();
925
-			} catch(PDOException $e) {
925
+			} catch (PDOException $e) {
926 926
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
927 927
 			}
928 928
 		}
929
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
929
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
930 930
 			// Add forsource to airlines
931 931
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
932 932
 			try {
933 933
 				$sth = $Connection->db->prepare($query);
934 934
 				$sth->execute();
935
-			} catch(PDOException $e) {
935
+			} catch (PDOException $e) {
936 936
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
937 937
 			}
938 938
 		}
939
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
939
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
940 940
 			// Add forsource to airlines
941 941
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
942 942
 			try {
943 943
 				$sth = $Connection->db->prepare($query);
944 944
 				$sth->execute();
945
-			} catch(PDOException $e) {
945
+			} catch (PDOException $e) {
946 946
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
947 947
 			}
948
-			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
948
+			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
949 949
 				// Add unique key
950 950
 				$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
951 951
 				try {
952 952
 					$sth = $Connection->db->prepare($query);
953 953
 					$sth->execute();
954
-				} catch(PDOException $e) {
954
+				} catch (PDOException $e) {
955 955
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
956 956
 				}
957 957
 			} else {
@@ -964,18 +964,18 @@  discard block
 block discarded – undo
964 964
 				try {
965 965
 					$sth = $Connection->db->prepare($query);
966 966
 					$sth->execute();
967
-				} catch(PDOException $e) {
967
+				} catch (PDOException $e) {
968 968
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
969 969
 				}
970 970
 			}
971 971
 		}
972
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
972
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
973 973
 			// Add forsource to airlines
974 974
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
975 975
 			try {
976 976
 				$sth = $Connection->db->prepare($query);
977 977
 				$sth->execute();
978
-			} catch(PDOException $e) {
978
+			} catch (PDOException $e) {
979 979
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
980 980
 			}
981 981
 			// Add unique key
@@ -987,17 +987,17 @@  discard block
 block discarded – undo
987 987
 			try {
988 988
 				$sth = $Connection->db->prepare($query);
989 989
 				$sth->execute();
990
-			} catch(PDOException $e) {
990
+			} catch (PDOException $e) {
991 991
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
992 992
 			}
993 993
 		}
994
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
994
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
995 995
 			// Add forsource to airlines
996 996
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
997 997
 			try {
998 998
 				$sth = $Connection->db->prepare($query);
999 999
 				$sth->execute();
1000
-			} catch(PDOException $e) {
1000
+			} catch (PDOException $e) {
1001 1001
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1002 1002
 			}
1003 1003
 			// Add unique key
@@ -1009,17 +1009,17 @@  discard block
 block discarded – undo
1009 1009
 			try {
1010 1010
 				$sth = $Connection->db->prepare($query);
1011 1011
 				$sth->execute();
1012
-			} catch(PDOException $e) {
1012
+			} catch (PDOException $e) {
1013 1013
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1014 1014
 			}
1015 1015
 		}
1016
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1016
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1017 1017
 			// Add forsource to airlines
1018 1018
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1019 1019
 			try {
1020 1020
 				$sth = $Connection->db->prepare($query);
1021 1021
 				$sth->execute();
1022
-			} catch(PDOException $e) {
1022
+			} catch (PDOException $e) {
1023 1023
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1024 1024
 			}
1025 1025
 			// Add unique key
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 			try {
1032 1032
 				$sth = $Connection->db->prepare($query);
1033 1033
 				$sth->execute();
1034
-			} catch(PDOException $e) {
1034
+			} catch (PDOException $e) {
1035 1035
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1036 1036
 			}
1037 1037
 		}
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 		try {
1041 1041
 			$sth = $Connection->db->prepare($query);
1042 1042
 			$sth->execute();
1043
-		} catch(PDOException $e) {
1043
+		} catch (PDOException $e) {
1044 1044
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1045 1045
 		}
1046 1046
 		return $error;
@@ -1050,13 +1050,13 @@  discard block
 block discarded – undo
1050 1050
 		global $globalDBdriver;
1051 1051
 		$Connection = new Connection();
1052 1052
 		$error = '';
1053
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1053
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1054 1054
 			// Add forsource to airlines
1055 1055
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1056 1056
 			try {
1057 1057
 				$sth = $Connection->db->prepare($query);
1058 1058
 				$sth->execute();
1059
-			} catch(PDOException $e) {
1059
+			} catch (PDOException $e) {
1060 1060
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1061 1061
 			}
1062 1062
 			// Add unique key
@@ -1068,17 +1068,17 @@  discard block
 block discarded – undo
1068 1068
 			try {
1069 1069
 				$sth = $Connection->db->prepare($query);
1070 1070
 				$sth->execute();
1071
-			} catch(PDOException $e) {
1071
+			} catch (PDOException $e) {
1072 1072
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1073 1073
 			}
1074 1074
 		}
1075
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1075
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1076 1076
 			// Add forsource to airlines
1077 1077
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1078 1078
 			try {
1079 1079
 				$sth = $Connection->db->prepare($query);
1080 1080
 				$sth->execute();
1081
-			} catch(PDOException $e) {
1081
+			} catch (PDOException $e) {
1082 1082
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1083 1083
 			}
1084 1084
 			// Add unique key
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			try {
1091 1091
 				$sth = $Connection->db->prepare($query);
1092 1092
 				$sth->execute();
1093
-			} catch(PDOException $e) {
1093
+			} catch (PDOException $e) {
1094 1094
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1095 1095
 			}
1096 1096
 		}
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 		try {
1099 1099
 			$sth = $Connection->db->prepare($query);
1100 1100
 			$sth->execute();
1101
-		} catch(PDOException $e) {
1101
+		} catch (PDOException $e) {
1102 1102
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1103 1103
 		}
1104 1104
 		return $error;
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
 		global $globalDBdriver;
1109 1109
 		$Connection = new Connection();
1110 1110
 		$error = '';
1111
-		if (!$Connection->checkColumnName('atc','format_source')) {
1111
+		if (!$Connection->checkColumnName('atc', 'format_source')) {
1112 1112
 			$query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL";
1113 1113
 			try {
1114 1114
 				$sth = $Connection->db->prepare($query);
1115 1115
 				$sth->execute();
1116
-			} catch(PDOException $e) {
1116
+			} catch (PDOException $e) {
1117 1117
 				return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n";
1118 1118
 			}
1119 1119
 		}
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 		try {
1122 1122
 			$sth = $Connection->db->prepare($query);
1123 1123
 			$sth->execute();
1124
-		} catch(PDOException $e) {
1124
+		} catch (PDOException $e) {
1125 1125
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1126 1126
 		}
1127 1127
 		return $error;
@@ -1131,13 +1131,13 @@  discard block
 block discarded – undo
1131 1131
 		global $globalDBdriver;
1132 1132
 		$Connection = new Connection();
1133 1133
 		$error = '';
1134
-		if (!$Connection->checkColumnName('stats_pilot','format_source')) {
1134
+		if (!$Connection->checkColumnName('stats_pilot', 'format_source')) {
1135 1135
 			// Add forsource to airlines
1136 1136
 			$query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''";
1137 1137
 			try {
1138 1138
 				$sth = $Connection->db->prepare($query);
1139 1139
 				$sth->execute();
1140
-			} catch(PDOException $e) {
1140
+			} catch (PDOException $e) {
1141 1141
 				return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n";
1142 1142
 			}
1143 1143
 			// Add unique key
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			try {
1150 1150
 				$sth = $Connection->db->prepare($query);
1151 1151
 				$sth->execute();
1152
-			} catch(PDOException $e) {
1152
+			} catch (PDOException $e) {
1153 1153
 				return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n";
1154 1154
 			}
1155 1155
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 		try {
1158 1158
 			$sth = $Connection->db->prepare($query);
1159 1159
 			$sth->execute();
1160
-		} catch(PDOException $e) {
1160
+		} catch (PDOException $e) {
1161 1161
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1162 1162
 		}
1163 1163
 		return $error;
@@ -1167,23 +1167,23 @@  discard block
 block discarded – undo
1167 1167
 		global $globalDBdriver;
1168 1168
 		$Connection = new Connection();
1169 1169
 		$error = '';
1170
-		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) {
1170
+		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) {
1171 1171
 			// Add unique key
1172 1172
 			$query = "alter table spotter_live add index(latitude,longitude)";
1173 1173
 			try {
1174 1174
 				$sth = $Connection->db->prepare($query);
1175 1175
 				$sth->execute();
1176
-			} catch(PDOException $e) {
1176
+			} catch (PDOException $e) {
1177 1177
 				return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n";
1178 1178
 			}
1179 1179
                 }
1180
-		if (!$Connection->checkColumnName('aircraft','mfr')) {
1180
+		if (!$Connection->checkColumnName('aircraft', 'mfr')) {
1181 1181
 			// Add mfr to aircraft
1182 1182
 			$query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL";
1183 1183
 			try {
1184 1184
 				$sth = $Connection->db->prepare($query);
1185 1185
 				$sth->execute();
1186
-			} catch(PDOException $e) {
1186
+			} catch (PDOException $e) {
1187 1187
 				return "error (add mfr column in aircraft) : ".$e->getMessage()."\n";
1188 1188
 			}
1189 1189
 		}
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		try {
1200 1200
 			$sth = $Connection->db->prepare($query);
1201 1201
 			$sth->execute();
1202
-		} catch(PDOException $e) {
1202
+		} catch (PDOException $e) {
1203 1203
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1204 1204
 		}
1205 1205
 		return $error;
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
 		global $globalDBdriver;
1210 1210
 		$Connection = new Connection();
1211 1211
 		$error = '';
1212
-		if ($Connection->checkColumnName('aircraft','mfr')) {
1212
+		if ($Connection->checkColumnName('aircraft', 'mfr')) {
1213 1213
 			// drop mfr to aircraft
1214 1214
 			$query = "ALTER TABLE aircraft DROP COLUMN mfr";
1215 1215
 			try {
1216 1216
 				$sth = $Connection->db->prepare($query);
1217 1217
 				$sth->execute();
1218
-			} catch(PDOException $e) {
1218
+			} catch (PDOException $e) {
1219 1219
 				return "error (drop mfr column in aircraft) : ".$e->getMessage()."\n";
1220 1220
 			}
1221 1221
 		}
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 		try {
1232 1232
 			$sth = $Connection->db->prepare($query);
1233 1233
 			$sth->execute();
1234
-		} catch(PDOException $e) {
1234
+		} catch (PDOException $e) {
1235 1235
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1236 1236
 		}
1237 1237
 		return $error;
@@ -1241,33 +1241,33 @@  discard block
 block discarded – undo
1241 1241
 		global $globalDBdriver;
1242 1242
 		$Connection = new Connection();
1243 1243
 		$error = '';
1244
-		if (!$Connection->indexExists('notam','ref_idx')) {
1244
+		if (!$Connection->indexExists('notam', 'ref_idx')) {
1245 1245
 			// Add index key
1246 1246
 			$query = "create index ref_idx on notam (ref)";
1247 1247
 			try {
1248 1248
 				$sth = $Connection->db->prepare($query);
1249 1249
 				$sth->execute();
1250
-			} catch(PDOException $e) {
1250
+			} catch (PDOException $e) {
1251 1251
 				return "error (add index ref on notam) : ".$e->getMessage()."\n";
1252 1252
 			}
1253 1253
                 }
1254
-		if (!$Connection->indexExists('accidents','registration_idx')) {
1254
+		if (!$Connection->indexExists('accidents', 'registration_idx')) {
1255 1255
 			// Add index key
1256 1256
 			$query = "create index registration_idx on accidents (registration)";
1257 1257
 			try {
1258 1258
 				$sth = $Connection->db->prepare($query);
1259 1259
 				$sth->execute();
1260
-			} catch(PDOException $e) {
1260
+			} catch (PDOException $e) {
1261 1261
 				return "error (add index registration on accidents) : ".$e->getMessage()."\n";
1262 1262
 			}
1263 1263
                 }
1264
-		if (!$Connection->indexExists('accidents','rdts')) {
1264
+		if (!$Connection->indexExists('accidents', 'rdts')) {
1265 1265
 			// Add index key
1266 1266
 			$query = "create index rdts on accidents (registration,date,type,source)";
1267 1267
 			try {
1268 1268
 				$sth = $Connection->db->prepare($query);
1269 1269
 				$sth->execute();
1270
-			} catch(PDOException $e) {
1270
+			} catch (PDOException $e) {
1271 1271
 				return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n";
1272 1272
 			}
1273 1273
                 }
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 		try {
1277 1277
 			$sth = $Connection->db->prepare($query);
1278 1278
 			$sth->execute();
1279
-		} catch(PDOException $e) {
1279
+		} catch (PDOException $e) {
1280 1280
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1281 1281
 		}
1282 1282
 		return $error;
@@ -1286,23 +1286,23 @@  discard block
 block discarded – undo
1286 1286
 		global $globalDBdriver;
1287 1287
 		$Connection = new Connection();
1288 1288
 		$error = '';
1289
-		if (!$Connection->checkColumnName('accidents','airline_name')) {
1289
+		if (!$Connection->checkColumnName('accidents', 'airline_name')) {
1290 1290
 			// Add airline_name to accidents
1291 1291
 			$query = "ALTER TABLE accidents ADD airline_name VARCHAR(255) NULL";
1292 1292
 			try {
1293 1293
 				$sth = $Connection->db->prepare($query);
1294 1294
 				$sth->execute();
1295
-			} catch(PDOException $e) {
1295
+			} catch (PDOException $e) {
1296 1296
 				return "error (add airline_name column in accidents) : ".$e->getMessage()."\n";
1297 1297
 			}
1298 1298
 		}
1299
-		if (!$Connection->checkColumnName('accidents','airline_icao')) {
1299
+		if (!$Connection->checkColumnName('accidents', 'airline_icao')) {
1300 1300
 			// Add airline_icao to accidents
1301 1301
 			$query = "ALTER TABLE accidents ADD airline_icao VARCHAR(10) NULL";
1302 1302
 			try {
1303 1303
 				$sth = $Connection->db->prepare($query);
1304 1304
 				$sth->execute();
1305
-			} catch(PDOException $e) {
1305
+			} catch (PDOException $e) {
1306 1306
 				return "error (add airline_icao column in accidents) : ".$e->getMessage()."\n";
1307 1307
 			}
1308 1308
 		}
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 		try {
1311 1311
 			$sth = $Connection->db->prepare($query);
1312 1312
 			$sth->execute();
1313
-		} catch(PDOException $e) {
1313
+		} catch (PDOException $e) {
1314 1314
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1315 1315
 		}
1316 1316
 		return $error;
@@ -1320,13 +1320,13 @@  discard block
 block discarded – undo
1320 1320
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1321 1321
 		$Connection = new Connection();
1322 1322
 		$error = '';
1323
-		if (!$Connection->checkColumnName('airlines','alliance')) {
1323
+		if (!$Connection->checkColumnName('airlines', 'alliance')) {
1324 1324
 			// Add alliance to airlines
1325 1325
 			$query = "ALTER TABLE airlines ADD alliance VARCHAR(255) NULL";
1326 1326
 			try {
1327 1327
 				$sth = $Connection->db->prepare($query);
1328 1328
 				$sth->execute();
1329
-			} catch(PDOException $e) {
1329
+			} catch (PDOException $e) {
1330 1330
 				return "error (add alliance column in airlines) : ".$e->getMessage()."\n";
1331 1331
 			}
1332 1332
 		}
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 		try {
1354 1354
 			$sth = $Connection->db->prepare($query);
1355 1355
 			$sth->execute();
1356
-		} catch(PDOException $e) {
1356
+		} catch (PDOException $e) {
1357 1357
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1358 1358
 		}
1359 1359
 		return $error;
@@ -1363,13 +1363,13 @@  discard block
 block discarded – undo
1363 1363
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1364 1364
 		$Connection = new Connection();
1365 1365
 		$error = '';
1366
-		if (!$Connection->checkColumnName('airlines','ban_eu')) {
1366
+		if (!$Connection->checkColumnName('airlines', 'ban_eu')) {
1367 1367
 			// Add ban_eu to airlines
1368 1368
 			$query = "ALTER TABLE airlines ADD ban_eu INTEGER NOT NULL DEFAULT '0'";
1369 1369
 			try {
1370 1370
 				$sth = $Connection->db->prepare($query);
1371 1371
 				$sth->execute();
1372
-			} catch(PDOException $e) {
1372
+			} catch (PDOException $e) {
1373 1373
 				return "error (add ban_eu column in airlines) : ".$e->getMessage()."\n";
1374 1374
 			}
1375 1375
 		}
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 		try {
1378 1378
 			$sth = $Connection->db->prepare($query);
1379 1379
 			$sth->execute();
1380
-		} catch(PDOException $e) {
1380
+		} catch (PDOException $e) {
1381 1381
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1382 1382
 		}
1383 1383
 		return $error;
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 		    try {
1400 1400
             		$sth = $Connection->db->prepare($query);
1401 1401
 		        $sth->execute();
1402
-		    } catch(PDOException $e) {
1402
+		    } catch (PDOException $e) {
1403 1403
 			return "error : ".$e->getMessage()."\n";
1404 1404
     		    }
1405 1405
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.