Completed
Push — master ( f9d220...2c14f3 )
by Yannick
44:26 queued 16:04
created
install/class.update_db.php 2 patches
Indentation   +387 added lines, -387 removed lines patch added patch discarded remove patch
@@ -76,38 +76,38 @@  discard block
 block discarded – undo
76 76
 		try {
77 77
 			//$Connection = new Connection();
78 78
 			$sth = $Connection->db->prepare($query);
79
-                        $sth->execute(array(':source' => $database_file));
80
-                } catch(PDOException $e) {
81
-                        return "error : ".$e->getMessage();
82
-                }
79
+						$sth->execute(array(':source' => $database_file));
80
+				} catch(PDOException $e) {
81
+						return "error : ".$e->getMessage();
82
+				}
83 83
 
84
-    		if ($globalDebug) echo " - Add routes to DB -";
85
-    		update_db::connect_sqlite($database_file);
84
+			if ($globalDebug) echo " - Add routes to DB -";
85
+			update_db::connect_sqlite($database_file);
86 86
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
87 87
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
88 88
 		try {
89
-                        $sth = update_db::$db_sqlite->prepare($query);
90
-                        $sth->execute();
91
-                } catch(PDOException $e) {
92
-                        return "error : ".$e->getMessage();
93
-                }
89
+						$sth = update_db::$db_sqlite->prepare($query);
90
+						$sth->execute();
91
+				} catch(PDOException $e) {
92
+						return "error : ".$e->getMessage();
93
+				}
94 94
 		//$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)';
95 95
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
96 96
 		$Connection = new Connection();
97 97
 		$sth_dest = $Connection->db->prepare($query_dest);
98 98
 		try {
99 99
 			if ($globalTransaction) $Connection->db->beginTransaction();
100
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
100
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
101 101
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
102 102
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
103 103
 				$sth_dest->execute($query_dest_values);
104
-            		}
104
+					}
105 105
 			if ($globalTransaction) $Connection->db->commit();
106 106
 		} catch(PDOException $e) {
107 107
 			if ($globalTransaction) $Connection->db->rollBack(); 
108 108
 			return "error : ".$e->getMessage();
109 109
 		}
110
-                return '';
110
+				return '';
111 111
 	}
112 112
 	public static function retrieve_route_oneworld($database_file) {
113 113
 		global $globalDebug, $globalTransaction;
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
 		try {
119 119
 			//$Connection = new Connection();
120 120
 			$sth = $Connection->db->prepare($query);
121
-                        $sth->execute(array(':source' => 'oneworld'));
122
-                } catch(PDOException $e) {
123
-                        return "error : ".$e->getMessage();
124
-                }
121
+						$sth->execute(array(':source' => 'oneworld'));
122
+				} catch(PDOException $e) {
123
+						return "error : ".$e->getMessage();
124
+				}
125 125
 
126
-    		if ($globalDebug) echo " - Add routes to DB -";
126
+			if ($globalDebug) echo " - Add routes to DB -";
127 127
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
128 128
 		$Spotter = new Spotter();
129 129
 		if ($fh = fopen($database_file,"r")) {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			}
148 148
 			if ($globalTransaction) $Connection->db->commit();
149 149
 		}
150
-                return '';
150
+				return '';
151 151
 	}
152 152
 	
153 153
 	public static function retrieve_route_skyteam($database_file) {
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
 		try {
160 160
 			//$Connection = new Connection();
161 161
 			$sth = $Connection->db->prepare($query);
162
-                        $sth->execute(array(':source' => 'skyteam'));
163
-                } catch(PDOException $e) {
164
-                        return "error : ".$e->getMessage();
165
-                }
162
+						$sth->execute(array(':source' => 'skyteam'));
163
+				} catch(PDOException $e) {
164
+						return "error : ".$e->getMessage();
165
+				}
166 166
 
167
-    		if ($globalDebug) echo " - Add routes to DB -";
167
+			if ($globalDebug) echo " - Add routes to DB -";
168 168
 
169 169
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
170 170
 		$Spotter = new Spotter();
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				return "error : ".$e->getMessage();
191 191
 			}
192 192
 		}
193
-                return '';
193
+				return '';
194 194
 	}
195 195
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
196 196
 		global $globalTransaction;
@@ -199,27 +199,27 @@  discard block
 block discarded – undo
199 199
 		try {
200 200
 			$Connection = new Connection();
201 201
 			$sth = $Connection->db->prepare($query);
202
-                        $sth->execute(array(':source' => $database_file));
203
-                } catch(PDOException $e) {
204
-                        return "error : ".$e->getMessage();
205
-                }
202
+						$sth->execute(array(':source' => $database_file));
203
+				} catch(PDOException $e) {
204
+						return "error : ".$e->getMessage();
205
+				}
206 206
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
207 207
 		try {
208 208
 			$Connection = new Connection();
209 209
 			$sth = $Connection->db->prepare($query);
210
-                        $sth->execute(array(':source' => $database_file));
211
-                } catch(PDOException $e) {
212
-                        return "error : ".$e->getMessage();
213
-                }
210
+						$sth->execute(array(':source' => $database_file));
211
+				} catch(PDOException $e) {
212
+						return "error : ".$e->getMessage();
213
+				}
214 214
 
215
-    		update_db::connect_sqlite($database_file);
215
+			update_db::connect_sqlite($database_file);
216 216
 		$query = 'select * from Aircraft';
217 217
 		try {
218
-                        $sth = update_db::$db_sqlite->prepare($query);
219
-                        $sth->execute();
220
-                } catch(PDOException $e) {
221
-                        return "error : ".$e->getMessage();
222
-                }
218
+						$sth = update_db::$db_sqlite->prepare($query);
219
+						$sth->execute();
220
+				} catch(PDOException $e) {
221
+						return "error : ".$e->getMessage();
222
+				}
223 223
 		//$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)';
224 224
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
225 225
 		
@@ -230,17 +230,17 @@  discard block
 block discarded – undo
230 230
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
231 231
 		try {
232 232
 			if ($globalTransaction) $Connection->db->beginTransaction();
233
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
233
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
234 234
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
235 235
 				if ($values['UserString4'] == 'M') $type = 'military';
236 236
 				else $type = null;
237 237
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
238 238
 				$sth_dest->execute($query_dest_values);
239 239
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
240
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
241
-				    $sth_dest_owner->execute($query_dest_owner_values);
240
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
241
+					$sth_dest_owner->execute($query_dest_owner_values);
242 242
 				}
243
-            		}
243
+					}
244 244
 			if ($globalTransaction) $Connection->db->commit();
245 245
 		} catch(PDOException $e) {
246 246
 			return "error : ".$e->getMessage();
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
 		try {
252 252
 			$Connection = new Connection();
253 253
 			$sth = $Connection->db->prepare($query);
254
-                        $sth->execute(array(':source' => $database_file));
255
-                } catch(PDOException $e) {
256
-                        return "error : ".$e->getMessage();
257
-                }
254
+						$sth->execute(array(':source' => $database_file));
255
+				} catch(PDOException $e) {
256
+						return "error : ".$e->getMessage();
257
+				}
258 258
 		return '';
259 259
 	}
260 260
 
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 		try {
267 267
 			$Connection = new Connection();
268 268
 			$sth = $Connection->db->prepare($query);
269
-                        $sth->execute(array(':source' => $database_file));
270
-                } catch(PDOException $e) {
271
-                        return "error : ".$e->getMessage();
272
-                }
269
+						$sth->execute(array(':source' => $database_file));
270
+				} catch(PDOException $e) {
271
+						return "error : ".$e->getMessage();
272
+				}
273 273
 		
274 274
 		if ($fh = fopen($database_file,"r")) {
275 275
 			//$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)';
@@ -279,26 +279,26 @@  discard block
 block discarded – undo
279 279
 			$sth_dest = $Connection->db->prepare($query_dest);
280 280
 			try {
281 281
 				if ($globalTransaction) $Connection->db->beginTransaction();
282
-            			while (!feof($fh)) {
283
-            				$values = array();
284
-            				$line = $Common->hex2str(fgets($fh,9999));
282
+						while (!feof($fh)) {
283
+							$values = array();
284
+							$line = $Common->hex2str(fgets($fh,9999));
285 285
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
286
-            				$values['ModeS'] = substr($line,0,6);
287
-            				$values['Registration'] = trim(substr($line,69,6));
288
-            				$aircraft_name = trim(substr($line,48,6));
289
-            				// Check if we can find ICAO, else set it to GLID
290
-            				$aircraft_name_split = explode(' ',$aircraft_name);
291
-            				$search_more = '';
292
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
293
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
294
-            				$sth_search = $Connection->db->prepare($query_search);
286
+							$values['ModeS'] = substr($line,0,6);
287
+							$values['Registration'] = trim(substr($line,69,6));
288
+							$aircraft_name = trim(substr($line,48,6));
289
+							// Check if we can find ICAO, else set it to GLID
290
+							$aircraft_name_split = explode(' ',$aircraft_name);
291
+							$search_more = '';
292
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
293
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
294
+							$sth_search = $Connection->db->prepare($query_search);
295 295
 					try {
296
-                                    		$sth_search->execute();
297
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
298
-	            				//if (count($result) > 0) {
299
-	            				if (isset($result['icao']) && $result['icao'] != '') {
300
-	            				    $values['ICAOTypeCode'] = $result['icao'];
301
-	            				} 
296
+											$sth_search->execute();
297
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
298
+								//if (count($result) > 0) {
299
+								if (isset($result['icao']) && $result['icao'] != '') {
300
+									$values['ICAOTypeCode'] = $result['icao'];
301
+								} 
302 302
 					} catch(PDOException $e) {
303 303
 						return "error : ".$e->getMessage();
304 304
 					}
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 		try {
322 322
 			$Connection = new Connection();
323 323
 			$sth = $Connection->db->prepare($query);
324
-                        $sth->execute(array(':source' => $database_file));
325
-                } catch(PDOException $e) {
326
-                        return "error : ".$e->getMessage();
327
-                }
324
+						$sth->execute(array(':source' => $database_file));
325
+				} catch(PDOException $e) {
326
+						return "error : ".$e->getMessage();
327
+				}
328 328
 		return '';
329 329
 	}
330 330
 
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 		try {
336 336
 			$Connection = new Connection();
337 337
 			$sth = $Connection->db->prepare($query);
338
-                        $sth->execute(array(':source' => $database_file));
339
-                } catch(PDOException $e) {
340
-                        return "error : ".$e->getMessage();
341
-                }
338
+						$sth->execute(array(':source' => $database_file));
339
+				} catch(PDOException $e) {
340
+						return "error : ".$e->getMessage();
341
+				}
342 342
 		
343 343
 		if ($fh = fopen($database_file,"r")) {
344 344
 			//$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)';
@@ -349,25 +349,25 @@  discard block
 block discarded – undo
349 349
 			try {
350 350
 				if ($globalTransaction) $Connection->db->beginTransaction();
351 351
 				$tmp = fgetcsv($fh,9999,',',"'");
352
-            			while (!feof($fh)) {
353
-            				$line = fgetcsv($fh,9999,',',"'");
352
+						while (!feof($fh)) {
353
+							$line = fgetcsv($fh,9999,',',"'");
354 354
             				
355 355
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
356 356
 					//print_r($line);
357
-            				$values['ModeS'] = $line[1];
358
-            				$values['Registration'] = $line[3];
359
-            				$values['ICAOTypeCode'] = '';
360
-            				$aircraft_name = $line[2];
361
-            				// Check if we can find ICAO, else set it to GLID
362
-            				$aircraft_name_split = explode(' ',$aircraft_name);
363
-            				$search_more = '';
364
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
365
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
366
-            				$sth_search = $Connection->db->prepare($query_search);
357
+							$values['ModeS'] = $line[1];
358
+							$values['Registration'] = $line[3];
359
+							$values['ICAOTypeCode'] = '';
360
+							$aircraft_name = $line[2];
361
+							// Check if we can find ICAO, else set it to GLID
362
+							$aircraft_name_split = explode(' ',$aircraft_name);
363
+							$search_more = '';
364
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
365
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
366
+							$sth_search = $Connection->db->prepare($query_search);
367 367
 					try {
368
-                                    		$sth_search->execute();
369
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
370
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
368
+											$sth_search->execute();
369
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
370
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
371 371
 					} catch(PDOException $e) {
372 372
 						return "error : ".$e->getMessage();
373 373
 					}
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
 		try {
391 391
 			$Connection = new Connection();
392 392
 			$sth = $Connection->db->prepare($query);
393
-                        $sth->execute(array(':source' => $database_file));
394
-                } catch(PDOException $e) {
395
-                        return "error : ".$e->getMessage();
396
-                }
393
+						$sth->execute(array(':source' => $database_file));
394
+				} catch(PDOException $e) {
395
+						return "error : ".$e->getMessage();
396
+				}
397 397
 		return '';
398 398
 	}
399 399
 
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 		try {
405 405
 			$Connection = new Connection();
406 406
 			$sth = $Connection->db->prepare($query);
407
-                        $sth->execute(array(':source' => $database_file));
408
-                } catch(PDOException $e) {
409
-                        return "error : ".$e->getMessage();
410
-                }
407
+						$sth->execute(array(':source' => $database_file));
408
+				} catch(PDOException $e) {
409
+						return "error : ".$e->getMessage();
410
+				}
411 411
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
412 412
 		$Spotter = new Spotter();
413 413
 		if ($fh = fopen($database_file,"r")) {
414 414
 			//$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)';
415 415
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
416
-		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
416
+				$query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
417 417
 		        
418 418
 			$Connection = new Connection();
419 419
 			$sth_dest = $Connection->db->prepare($query_dest);
@@ -421,126 +421,126 @@  discard block
 block discarded – undo
421 421
 			try {
422 422
 				if ($globalTransaction) $Connection->db->beginTransaction();
423 423
 				$tmp = fgetcsv($fh,9999,',','"');
424
-            			while (!feof($fh)) {
425
-            				$line = fgetcsv($fh,9999,',','"');
426
-            				$values = array();
427
-            				//print_r($line);
428
-            				if ($country == 'F') {
429
-            				    $values['registration'] = $line[0];
430
-            				    $values['base'] = $line[4];
431
-            				    $values['owner'] = $line[5];
432
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
433
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
434
-					    $values['cancel'] = $line[7];
424
+						while (!feof($fh)) {
425
+							$line = fgetcsv($fh,9999,',','"');
426
+							$values = array();
427
+							//print_r($line);
428
+							if ($country == 'F') {
429
+								$values['registration'] = $line[0];
430
+								$values['base'] = $line[4];
431
+								$values['owner'] = $line[5];
432
+								if ($line[6] == '') $values['date_first_reg'] = null;
433
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
434
+						$values['cancel'] = $line[7];
435 435
 					} elseif ($country == 'EI') {
436
-					    // TODO : add modeS & reg to aircraft_modes
437
-            				    $values['registration'] = $line[0];
438
-            				    $values['base'] = $line[3];
439
-            				    $values['owner'] = $line[2];
440
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
441
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
442
-					    $values['cancel'] = '';
443
-					    $values['modes'] = $line[7];
444
-					    $values['icao'] = $line[8];
436
+						// TODO : add modeS & reg to aircraft_modes
437
+								$values['registration'] = $line[0];
438
+								$values['base'] = $line[3];
439
+								$values['owner'] = $line[2];
440
+								if ($line[1] == '') $values['date_first_reg'] = null;
441
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
442
+						$values['cancel'] = '';
443
+						$values['modes'] = $line[7];
444
+						$values['icao'] = $line[8];
445 445
 					    
446 446
 					} elseif ($country == 'HB') {
447
-					    // TODO : add modeS & reg to aircraft_modes
448
-            				    $values['registration'] = $line[0];
449
-            				    $values['base'] = null;
450
-            				    $values['owner'] = $line[5];
451
-            				    $values['date_first_reg'] = null;
452
-					    $values['cancel'] = '';
453
-					    $values['modes'] = $line[4];
454
-					    $values['icao'] = $line[7];
447
+						// TODO : add modeS & reg to aircraft_modes
448
+								$values['registration'] = $line[0];
449
+								$values['base'] = null;
450
+								$values['owner'] = $line[5];
451
+								$values['date_first_reg'] = null;
452
+						$values['cancel'] = '';
453
+						$values['modes'] = $line[4];
454
+						$values['icao'] = $line[7];
455 455
 					} elseif ($country == 'OK') {
456
-					    // TODO : add modeS & reg to aircraft_modes
457
-            				    $values['registration'] = $line[3];
458
-            				    $values['base'] = null;
459
-            				    $values['owner'] = $line[5];
460
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
461
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
462
-					    $values['cancel'] = '';
456
+						// TODO : add modeS & reg to aircraft_modes
457
+								$values['registration'] = $line[3];
458
+								$values['base'] = null;
459
+								$values['owner'] = $line[5];
460
+								if ($line[18] == '') $values['date_first_reg'] = null;
461
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
462
+						$values['cancel'] = '';
463 463
 					} elseif ($country == 'VH') {
464
-					    // TODO : add modeS & reg to aircraft_modes
465
-            				    $values['registration'] = $line[0];
466
-            				    $values['base'] = null;
467
-            				    $values['owner'] = $line[12];
468
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
469
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
470
-
471
-					    $values['cancel'] = $line[39];
464
+						// TODO : add modeS & reg to aircraft_modes
465
+								$values['registration'] = $line[0];
466
+								$values['base'] = null;
467
+								$values['owner'] = $line[12];
468
+								if ($line[28] == '') $values['date_first_reg'] = null;
469
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
470
+
471
+						$values['cancel'] = $line[39];
472 472
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
473
-            				    $values['registration'] = $line[0];
474
-            				    $values['base'] = null;
475
-            				    $values['owner'] = $line[4];
476
-            				    $values['date_first_reg'] = null;
477
-					    $values['cancel'] = '';
473
+								$values['registration'] = $line[0];
474
+								$values['base'] = null;
475
+								$values['owner'] = $line[4];
476
+								$values['date_first_reg'] = null;
477
+						$values['cancel'] = '';
478 478
 					} elseif ($country == 'CC') {
479
-            				    $values['registration'] = $line[0];
480
-            				    $values['base'] = null;
481
-            				    $values['owner'] = $line[6];
482
-            				    $values['date_first_reg'] = null;
483
-					    $values['cancel'] = '';
479
+								$values['registration'] = $line[0];
480
+								$values['base'] = null;
481
+								$values['owner'] = $line[6];
482
+								$values['date_first_reg'] = null;
483
+						$values['cancel'] = '';
484 484
 					} elseif ($country == 'HJ') {
485
-            				    $values['registration'] = $line[0];
486
-            				    $values['base'] = null;
487
-            				    $values['owner'] = $line[8];
488
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
489
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
490
-					    $values['cancel'] = '';
485
+								$values['registration'] = $line[0];
486
+								$values['base'] = null;
487
+								$values['owner'] = $line[8];
488
+								if ($line[7] == '') $values['date_first_reg'] = null;
489
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
490
+						$values['cancel'] = '';
491 491
 					} elseif ($country == 'PP') {
492
-            				    $values['registration'] = $line[0];
493
-            				    $values['base'] = null;
494
-            				    $values['owner'] = $line[4];
495
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
496
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
497
-					    $values['cancel'] = $line[7];
492
+								$values['registration'] = $line[0];
493
+								$values['base'] = null;
494
+								$values['owner'] = $line[4];
495
+								if ($line[6] == '') $values['date_first_reg'] = null;
496
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
497
+						$values['cancel'] = $line[7];
498 498
 					} elseif ($country == 'E7') {
499
-            				    $values['registration'] = $line[0];
500
-            				    $values['base'] = null;
501
-            				    $values['owner'] = $line[4];
502
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
503
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
504
-					    $values['cancel'] = '';
499
+								$values['registration'] = $line[0];
500
+								$values['base'] = null;
501
+								$values['owner'] = $line[4];
502
+								if ($line[5] == '') $values['date_first_reg'] = null;
503
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
504
+						$values['cancel'] = '';
505 505
 					} elseif ($country == '8Q') {
506
-            				    $values['registration'] = $line[0];
507
-            				    $values['base'] = null;
508
-            				    $values['owner'] = $line[3];
509
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
510
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
511
-					    $values['cancel'] = '';
506
+								$values['registration'] = $line[0];
507
+								$values['base'] = null;
508
+								$values['owner'] = $line[3];
509
+								if ($line[7] == '') $values['date_first_reg'] = null;
510
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
511
+						$values['cancel'] = '';
512 512
 					} elseif ($country == 'ZK') {
513
-            				    $values['registration'] = $line[0];
514
-            				    $values['base'] = null;
515
-            				    $values['owner'] = $line[3];
516
-            				    $values['date_first_reg'] = null;
517
-					    $values['cancel'] = '';
518
-					    $values['modes'] = $line[5];
519
-					    $values['icao'] = $line[9];
513
+								$values['registration'] = $line[0];
514
+								$values['base'] = null;
515
+								$values['owner'] = $line[3];
516
+								$values['date_first_reg'] = null;
517
+						$values['cancel'] = '';
518
+						$values['modes'] = $line[5];
519
+						$values['icao'] = $line[9];
520 520
 					} elseif ($country == 'M') {
521
-            				    $values['registration'] = $line[0];
522
-            				    $values['base'] = null;
523
-            				    $values['owner'] = $line[6];
524
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
525
-					    $values['cancel'] = date("Y-m-d",strtotime($line[8]));
526
-					    $values['modes'] = $line[4];
527
-					    $values['icao'] = $line[10];
521
+								$values['registration'] = $line[0];
522
+								$values['base'] = null;
523
+								$values['owner'] = $line[6];
524
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
525
+						$values['cancel'] = date("Y-m-d",strtotime($line[8]));
526
+						$values['modes'] = $line[4];
527
+						$values['icao'] = $line[10];
528 528
 					} elseif ($country == 'OY') {
529
-            				    $values['registration'] = $line[0];
530
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
531
-					    $values['modes'] = $line[5];
532
-					    $values['icao'] = $line[6];
529
+								$values['registration'] = $line[0];
530
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
531
+						$values['modes'] = $line[5];
532
+						$values['icao'] = $line[6];
533 533
 					} elseif ($country == 'PH') {
534
-            				    $values['registration'] = $line[0];
535
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
536
-					    $values['modes'] = $line[4];
537
-					    $values['icao'] = $line[5];
534
+								$values['registration'] = $line[0];
535
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
536
+						$values['modes'] = $line[4];
537
+						$values['icao'] = $line[5];
538 538
 					} elseif ($country == 'OM' || $country == 'TF') {
539
-            				    $values['registration'] = $line[0];
540
-            				    $values['base'] = null;
541
-            				    $values['owner'] = $line[3];
542
-            				    $values['date_first_reg'] = null;
543
-					    $values['cancel'] = '';
539
+								$values['registration'] = $line[0];
540
+								$values['base'] = null;
541
+								$values['owner'] = $line[3];
542
+								$values['date_first_reg'] = null;
543
+						$values['cancel'] = '';
544 544
 					}
545 545
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
546 546
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
                         return "error : ".$e->getMessage();
674 674
                 }
675 675
                 */
676
-                /*
676
+				/*
677 677
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
678 678
 		try {
679 679
 			$Connection = new Connection();
@@ -918,10 +918,10 @@  discard block
 block discarded – undo
918 918
 		try {
919 919
 			$Connection = new Connection();
920 920
 			$sth = $Connection->db->prepare($query);
921
-                        $sth->execute(array(':source' => 'translation.csv'));
922
-                } catch(PDOException $e) {
923
-                        return "error : ".$e->getMessage();
924
-                }
921
+						$sth->execute(array(':source' => 'translation.csv'));
922
+				} catch(PDOException $e) {
923
+						return "error : ".$e->getMessage();
924
+				}
925 925
 
926 926
 		
927 927
 		//update_db::unzip($out_file);
@@ -940,21 +940,21 @@  discard block
 block discarded – undo
940 940
 					$data = $row;
941 941
 					$operator = $data[2];
942 942
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
943
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
944
-                                                //echo substr($operator, 0, 2)."\n";;
945
-                                                if (count($airline_array) > 0) {
943
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
944
+												//echo substr($operator, 0, 2)."\n";;
945
+												if (count($airline_array) > 0) {
946 946
 							//print_r($airline_array);
947 947
 							$operator = $airline_array[0]['icao'].substr($operator,2);
948
-                                                }
949
-                                        }
948
+												}
949
+										}
950 950
 					
951 951
 					$operator_correct = $data[3];
952 952
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
953
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
954
-                                                if (count($airline_array) > 0) {
955
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
956
-                                            	}
957
-                                        }
953
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
954
+												if (count($airline_array) > 0) {
955
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
956
+												}
957
+										}
958 958
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
959 959
 					try {
960 960
 						$sth = $Connection->db->prepare($query);
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 			//$Connection->db->commit();
969 969
 		}
970 970
 		return '';
971
-        }
971
+		}
972 972
 	
973 973
 	public static function translation_fam() {
974 974
 		global $tmp_dir, $globalTransaction;
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 			//$Connection->db->commit();
1007 1007
 		}
1008 1008
 		return '';
1009
-        }
1009
+		}
1010 1010
 
1011 1011
 	/*
1012 1012
 	* This function use FAA public data.
@@ -1018,19 +1018,19 @@  discard block
 block discarded – undo
1018 1018
 		try {
1019 1019
 			$Connection = new Connection();
1020 1020
 			$sth = $Connection->db->prepare($query);
1021
-                        $sth->execute(array(':source' => 'website_faa'));
1022
-                } catch(PDOException $e) {
1023
-                        return "error : ".$e->getMessage();
1024
-                }
1021
+						$sth->execute(array(':source' => 'website_faa'));
1022
+				} catch(PDOException $e) {
1023
+						return "error : ".$e->getMessage();
1024
+				}
1025 1025
 
1026 1026
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source";
1027 1027
 		try {
1028 1028
 			$Connection = new Connection();
1029 1029
 			$sth = $Connection->db->prepare($query);
1030
-                        $sth->execute(array(':source' => 'website_faa'));
1031
-                } catch(PDOException $e) {
1032
-                        return "error : ".$e->getMessage();
1033
-                }
1030
+						$sth->execute(array(':source' => 'website_faa'));
1031
+				} catch(PDOException $e) {
1032
+						return "error : ".$e->getMessage();
1033
+				}
1034 1034
 
1035 1035
 		$delimiter = ",";
1036 1036
 		$mfr = array();
@@ -1106,17 +1106,17 @@  discard block
 block discarded – undo
1106 1106
 		}
1107 1107
 		//print_r($mfr);
1108 1108
 		return '';
1109
-        }
1109
+		}
1110 1110
 	public static function modes_fam() {
1111 1111
 		global $tmp_dir, $globalTransaction;
1112 1112
 		$query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source";
1113 1113
 		try {
1114 1114
 			$Connection = new Connection();
1115 1115
 			$sth = $Connection->db->prepare($query);
1116
-                        $sth->execute(array(':source' => 'website_fam'));
1117
-                } catch(PDOException $e) {
1118
-                        return "error : ".$e->getMessage();
1119
-                }
1116
+						$sth->execute(array(':source' => 'website_fam'));
1117
+				} catch(PDOException $e) {
1118
+						return "error : ".$e->getMessage();
1119
+				}
1120 1120
 
1121 1121
 		
1122 1122
 		//update_db::unzip($out_file);
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 			if ($globalTransaction) $Connection->db->commit();
1147 1147
 		}
1148 1148
 		return '';
1149
-        }
1149
+		}
1150 1150
         
1151 1151
 	public static function owner_fam() {
1152 1152
 		global $tmp_dir, $globalTransaction;
@@ -1154,10 +1154,10 @@  discard block
 block discarded – undo
1154 1154
 		try {
1155 1155
 			$Connection = new Connection();
1156 1156
 			$sth = $Connection->db->prepare($query);
1157
-                        $sth->execute(array(':source' => 'website_fam'));
1158
-                } catch(PDOException $e) {
1159
-                        return "error : ".$e->getMessage();
1160
-                }
1157
+						$sth->execute(array(':source' => 'website_fam'));
1158
+				} catch(PDOException $e) {
1159
+						return "error : ".$e->getMessage();
1160
+				}
1161 1161
 
1162 1162
 		$delimiter = "\t";
1163 1163
 		$Connection = new Connection();
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 			if ($globalTransaction) $Connection->db->commit();
1184 1184
 		}
1185 1185
 		return '';
1186
-        }
1186
+		}
1187 1187
 
1188 1188
 	public static function routes_fam() {
1189 1189
 		global $tmp_dir, $globalTransaction, $globalDebug;
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 			if ($globalTransaction) $Connection->db->commit();
1219 1219
 		}
1220 1220
 		return '';
1221
-        }
1221
+		}
1222 1222
 
1223 1223
 	public static function marine_identity_fam() {
1224 1224
 		global $tmp_dir, $globalTransaction;
@@ -1226,10 +1226,10 @@  discard block
 block discarded – undo
1226 1226
 		try {
1227 1227
 			$Connection = new Connection();
1228 1228
 			$sth = $Connection->db->prepare($query);
1229
-                        $sth->execute();
1230
-                } catch(PDOException $e) {
1231
-                        return "error : ".$e->getMessage();
1232
-                }
1229
+						$sth->execute();
1230
+				} catch(PDOException $e) {
1231
+						return "error : ".$e->getMessage();
1232
+				}
1233 1233
 
1234 1234
 		
1235 1235
 		//update_db::unzip($out_file);
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 			if ($globalTransaction) $Connection->db->commit();
1260 1260
 		}
1261 1261
 		return '';
1262
-        }
1262
+		}
1263 1263
 
1264 1264
 	public static function satellite_fam() {
1265 1265
 		global $tmp_dir, $globalTransaction;
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 			if ($globalTransaction) $Connection->db->commit();
1331 1331
 		}
1332 1332
 		return '';
1333
-        }
1333
+		}
1334 1334
 
1335 1335
 	public static function tle($filename,$tletype) {
1336 1336
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1341,10 +1341,10 @@  discard block
 block discarded – undo
1341 1341
 		try {
1342 1342
 			$Connection = new Connection();
1343 1343
 			$sth = $Connection->db->prepare($query);
1344
-                        $sth->execute(array(':source' => $filename));
1345
-                } catch(PDOException $e) {
1346
-                        return "error : ".$e->getMessage();
1347
-                }
1344
+						$sth->execute(array(':source' => $filename));
1345
+				} catch(PDOException $e) {
1346
+						return "error : ".$e->getMessage();
1347
+				}
1348 1348
 		
1349 1349
 		$Connection = new Connection();
1350 1350
 		if (($handle = fopen($filename, 'r')) !== FALSE)
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 			//$Connection->db->commit();
1380 1380
 		}
1381 1381
 		return '';
1382
-        }
1382
+		}
1383 1383
 
1384 1384
 	public static function satellite_ucsdb($filename) {
1385 1385
 		global $tmp_dir, $globalTransaction;
@@ -1628,11 +1628,11 @@  discard block
 block discarded – undo
1628 1628
 							try {
1629 1629
 								$sth = $Connection->db->prepare($query);
1630 1630
 								$sth->execute(array(
1631
-								    ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1632
-								    ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1633
-								    ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1634
-								    ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1635
-								    )
1631
+									':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1632
+									':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1633
+									':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1634
+									':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1635
+									)
1636 1636
 								);
1637 1637
 							} catch(PDOException $e) {
1638 1638
 								return "error : ".$e->getMessage();
@@ -1656,13 +1656,13 @@  discard block
 block discarded – undo
1656 1656
 			//$Connection->db->commit();
1657 1657
 		}
1658 1658
 		return '';
1659
-        }
1659
+		}
1660 1660
 
1661 1661
 	/**
1662
-        * Convert a HTML table to an array
1663
-        * @param String $data HTML page
1664
-        * @return Array array of the tables in HTML page
1665
-        */
1662
+	 * Convert a HTML table to an array
1663
+	 * @param String $data HTML page
1664
+	 * @return Array array of the tables in HTML page
1665
+	 */
1666 1666
 /*
1667 1667
         private static function table2array($data) {
1668 1668
                 $html = str_get_html($data);
@@ -1692,11 +1692,11 @@  discard block
 block discarded – undo
1692 1692
                 return(array_filter($tabledata));
1693 1693
         }
1694 1694
 */
1695
-       /**
1696
-        * Get data from form result
1697
-        * @param String $url form URL
1698
-        * @return String the result
1699
-        */
1695
+	   /**
1696
+	    * Get data from form result
1697
+	    * @param String $url form URL
1698
+	    * @return String the result
1699
+	    */
1700 1700
 /*
1701 1701
         private static function getData($url) {
1702 1702
                 $ch = curl_init();
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
 			if ($globalTransaction) $Connection->db->commit();
1790 1790
 		}
1791 1791
 		return '';
1792
-        }
1792
+		}
1793 1793
 
1794 1794
 	public static function ivao_airlines($filename) {
1795 1795
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1799,10 +1799,10 @@  discard block
 block discarded – undo
1799 1799
 		try {
1800 1800
 			$Connection = new Connection();
1801 1801
 			$sth = $Connection->db->prepare($query);
1802
-                        $sth->execute();
1803
-                } catch(PDOException $e) {
1804
-                        return "error : ".$e->getMessage();
1805
-                }
1802
+						$sth->execute();
1803
+				} catch(PDOException $e) {
1804
+						return "error : ".$e->getMessage();
1805
+				}
1806 1806
 
1807 1807
 		$header = NULL;
1808 1808
 		$delimiter = ':';
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
 			if ($globalTransaction) $Connection->db->commit();
1827 1827
 		}
1828 1828
 		return '';
1829
-        }
1829
+		}
1830 1830
 	
1831 1831
 	public static function update_airspace() {
1832 1832
 		global $tmp_dir, $globalDBdriver;
@@ -1836,11 +1836,11 @@  discard block
 block discarded – undo
1836 1836
 			$query = 'DROP TABLE airspace';
1837 1837
 			try {
1838 1838
 				$sth = $Connection->db->prepare($query);
1839
-                    		$sth->execute();
1840
-	                } catch(PDOException $e) {
1839
+							$sth->execute();
1840
+					} catch(PDOException $e) {
1841 1841
 				return "error : ".$e->getMessage();
1842
-	                }
1843
-	        }
1842
+					}
1843
+			}
1844 1844
 
1845 1845
 
1846 1846
 		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
@@ -1895,10 +1895,10 @@  discard block
 block discarded – undo
1895 1895
 			$query = 'DROP TABLE countries';
1896 1896
 			try {
1897 1897
 				$sth = $Connection->db->prepare($query);
1898
-            	        	$sth->execute();
1899
-	                } catch(PDOException $e) {
1900
-    	                	echo "error : ".$e->getMessage();
1901
-	                }
1898
+							$sth->execute();
1899
+					} catch(PDOException $e) {
1900
+							echo "error : ".$e->getMessage();
1901
+					}
1902 1902
 		}
1903 1903
 		if ($globalDBdriver == 'mysql') {
1904 1904
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -2453,11 +2453,11 @@  discard block
 block discarded – undo
2453 2453
 						$query = 'DROP TABLE airspace';
2454 2454
 						try {
2455 2455
 							$sth = $Connection->db->prepare($query);
2456
-    	    	    					$sth->execute();
2457
-			            		} catch(PDOException $e) {
2456
+										$sth->execute();
2457
+								} catch(PDOException $e) {
2458 2458
 							return "error : ".$e->getMessage();
2459
-		            			}
2460
-		    			}
2459
+								}
2460
+						}
2461 2461
 					$error = create_db::import_file($tmp_dir.'airspace.sql');
2462 2462
 					update_db::insert_airspace_version($airspace_md5);
2463 2463
 				} else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed.";
@@ -2667,12 +2667,12 @@  discard block
 block discarded – undo
2667 2667
 		echo $data;
2668 2668
 		*/
2669 2669
 		if (file_exists($tmp_dir.'aircrafts.html')) {
2670
-		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2671
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
2672
-		    $result = fread($fh,100000000);
2673
-		    //echo $result;
2674
-		    //var_dump(str_get_html($result));
2675
-		    //print_r(self::table2array($result));
2670
+			//var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2671
+			$fh = fopen($tmp_dir.'aircrafts.html',"r");
2672
+			$result = fread($fh,100000000);
2673
+			//echo $result;
2674
+			//var_dump(str_get_html($result));
2675
+			//print_r(self::table2array($result));
2676 2676
 		}
2677 2677
 
2678 2678
 	}
@@ -2686,10 +2686,10 @@  discard block
 block discarded – undo
2686 2686
 		try {
2687 2687
 			$Connection = new Connection();
2688 2688
 			$sth = $Connection->db->prepare($query);
2689
-                        $sth->execute();
2690
-                } catch(PDOException $e) {
2691
-                        return "error : ".$e->getMessage();
2692
-                }
2689
+						$sth->execute();
2690
+				} catch(PDOException $e) {
2691
+						return "error : ".$e->getMessage();
2692
+				}
2693 2693
 
2694 2694
 		$error = '';
2695 2695
 		if ($globalDebug) echo "Notam : Download...";
@@ -2745,8 +2745,8 @@  discard block
 block discarded – undo
2745 2745
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2746 2746
 					$data['permanent'] = 0;
2747 2747
 				} else {
2748
-				    $data['date_end'] = NULL;
2749
-				    $data['permanent'] = 1;
2748
+					$data['date_end'] = NULL;
2749
+					$data['permanent'] = 1;
2750 2750
 				}
2751 2751
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2752 2752
 				$NOTAM = new NOTAM();
@@ -2820,13 +2820,13 @@  discard block
 block discarded – undo
2820 2820
 		try {
2821 2821
 			$Connection = new Connection();
2822 2822
 			$sth = $Connection->db->prepare($query);
2823
-                        $sth->execute();
2824
-                } catch(PDOException $e) {
2825
-                        return "error : ".$e->getMessage();
2826
-                }
2827
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2828
-                if ($row['nb'] > 0) return false;
2829
-                else return true;
2823
+						$sth->execute();
2824
+				} catch(PDOException $e) {
2825
+						return "error : ".$e->getMessage();
2826
+				}
2827
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2828
+				if ($row['nb'] > 0) return false;
2829
+				else return true;
2830 2830
 	}
2831 2831
 
2832 2832
 	public static function insert_last_update() {
@@ -2835,10 +2835,10 @@  discard block
 block discarded – undo
2835 2835
 		try {
2836 2836
 			$Connection = new Connection();
2837 2837
 			$sth = $Connection->db->prepare($query);
2838
-                        $sth->execute();
2839
-                } catch(PDOException $e) {
2840
-                        return "error : ".$e->getMessage();
2841
-                }
2838
+						$sth->execute();
2839
+				} catch(PDOException $e) {
2840
+						return "error : ".$e->getMessage();
2841
+				}
2842 2842
 	}
2843 2843
 
2844 2844
 	public static function check_airspace_version($version) {
@@ -2846,13 +2846,13 @@  discard block
 block discarded – undo
2846 2846
 		try {
2847 2847
 			$Connection = new Connection();
2848 2848
 			$sth = $Connection->db->prepare($query);
2849
-                        $sth->execute(array(':version' => $version));
2850
-                } catch(PDOException $e) {
2851
-                        return "error : ".$e->getMessage();
2852
-                }
2853
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2854
-                if ($row['nb'] > 0) return true;
2855
-                else return false;
2849
+						$sth->execute(array(':version' => $version));
2850
+				} catch(PDOException $e) {
2851
+						return "error : ".$e->getMessage();
2852
+				}
2853
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2854
+				if ($row['nb'] > 0) return true;
2855
+				else return false;
2856 2856
 	}
2857 2857
 
2858 2858
 	public static function check_geoid_version($version) {
@@ -2860,13 +2860,13 @@  discard block
 block discarded – undo
2860 2860
 		try {
2861 2861
 			$Connection = new Connection();
2862 2862
 			$sth = $Connection->db->prepare($query);
2863
-                        $sth->execute(array(':version' => $version));
2864
-                } catch(PDOException $e) {
2865
-                        return "error : ".$e->getMessage();
2866
-                }
2867
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2868
-                if ($row['nb'] > 0) return true;
2869
-                else return false;
2863
+						$sth->execute(array(':version' => $version));
2864
+				} catch(PDOException $e) {
2865
+						return "error : ".$e->getMessage();
2866
+				}
2867
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2868
+				if ($row['nb'] > 0) return true;
2869
+				else return false;
2870 2870
 	}
2871 2871
 
2872 2872
 	public static function check_marine_identity_version($version) {
@@ -2916,10 +2916,10 @@  discard block
 block discarded – undo
2916 2916
 		try {
2917 2917
 			$Connection = new Connection();
2918 2918
 			$sth = $Connection->db->prepare($query);
2919
-                        $sth->execute(array(':version' => $version));
2920
-                } catch(PDOException $e) {
2921
-                        return "error : ".$e->getMessage();
2922
-                }
2919
+						$sth->execute(array(':version' => $version));
2920
+				} catch(PDOException $e) {
2921
+						return "error : ".$e->getMessage();
2922
+				}
2923 2923
 	}
2924 2924
 
2925 2925
 	public static function insert_marine_identity_version($version) {
@@ -2956,13 +2956,13 @@  discard block
 block discarded – undo
2956 2956
 		try {
2957 2957
 			$Connection = new Connection();
2958 2958
 			$sth = $Connection->db->prepare($query);
2959
-                        $sth->execute();
2960
-                } catch(PDOException $e) {
2961
-                        return "error : ".$e->getMessage();
2962
-                }
2963
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2964
-                if ($row['nb'] > 0) return false;
2965
-                else return true;
2959
+						$sth->execute();
2960
+				} catch(PDOException $e) {
2961
+						return "error : ".$e->getMessage();
2962
+				}
2963
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2964
+				if ($row['nb'] > 0) return false;
2965
+				else return true;
2966 2966
 	}
2967 2967
 
2968 2968
 	public static function insert_last_notam_update() {
@@ -2971,10 +2971,10 @@  discard block
 block discarded – undo
2971 2971
 		try {
2972 2972
 			$Connection = new Connection();
2973 2973
 			$sth = $Connection->db->prepare($query);
2974
-                        $sth->execute();
2975
-                } catch(PDOException $e) {
2976
-                        return "error : ".$e->getMessage();
2977
-                }
2974
+						$sth->execute();
2975
+				} catch(PDOException $e) {
2976
+						return "error : ".$e->getMessage();
2977
+				}
2978 2978
 	}
2979 2979
 
2980 2980
 	public static function check_last_airspace_update() {
@@ -2987,13 +2987,13 @@  discard block
 block discarded – undo
2987 2987
 		try {
2988 2988
 			$Connection = new Connection();
2989 2989
 			$sth = $Connection->db->prepare($query);
2990
-                        $sth->execute();
2991
-                } catch(PDOException $e) {
2992
-                        return "error : ".$e->getMessage();
2993
-                }
2994
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2995
-                if ($row['nb'] > 0) return false;
2996
-                else return true;
2990
+						$sth->execute();
2991
+				} catch(PDOException $e) {
2992
+						return "error : ".$e->getMessage();
2993
+				}
2994
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2995
+				if ($row['nb'] > 0) return false;
2996
+				else return true;
2997 2997
 	}
2998 2998
 
2999 2999
 	public static function insert_last_airspace_update() {
@@ -3002,10 +3002,10 @@  discard block
 block discarded – undo
3002 3002
 		try {
3003 3003
 			$Connection = new Connection();
3004 3004
 			$sth = $Connection->db->prepare($query);
3005
-                        $sth->execute();
3006
-                } catch(PDOException $e) {
3007
-                        return "error : ".$e->getMessage();
3008
-                }
3005
+						$sth->execute();
3006
+				} catch(PDOException $e) {
3007
+						return "error : ".$e->getMessage();
3008
+				}
3009 3009
 	}
3010 3010
 
3011 3011
 	public static function check_last_geoid_update() {
@@ -3018,13 +3018,13 @@  discard block
 block discarded – undo
3018 3018
 		try {
3019 3019
 			$Connection = new Connection();
3020 3020
 			$sth = $Connection->db->prepare($query);
3021
-                        $sth->execute();
3022
-                } catch(PDOException $e) {
3023
-                        return "error : ".$e->getMessage();
3024
-                }
3025
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3026
-                if ($row['nb'] > 0) return false;
3027
-                else return true;
3021
+						$sth->execute();
3022
+				} catch(PDOException $e) {
3023
+						return "error : ".$e->getMessage();
3024
+				}
3025
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3026
+				if ($row['nb'] > 0) return false;
3027
+				else return true;
3028 3028
 	}
3029 3029
 
3030 3030
 	public static function insert_last_geoid_update() {
@@ -3033,10 +3033,10 @@  discard block
 block discarded – undo
3033 3033
 		try {
3034 3034
 			$Connection = new Connection();
3035 3035
 			$sth = $Connection->db->prepare($query);
3036
-                        $sth->execute();
3037
-                } catch(PDOException $e) {
3038
-                        return "error : ".$e->getMessage();
3039
-                }
3036
+						$sth->execute();
3037
+				} catch(PDOException $e) {
3038
+						return "error : ".$e->getMessage();
3039
+				}
3040 3040
 	}
3041 3041
 
3042 3042
 	public static function check_last_owner_update() {
@@ -3049,13 +3049,13 @@  discard block
 block discarded – undo
3049 3049
 		try {
3050 3050
 			$Connection = new Connection();
3051 3051
 			$sth = $Connection->db->prepare($query);
3052
-                        $sth->execute();
3053
-                } catch(PDOException $e) {
3054
-                        return "error : ".$e->getMessage();
3055
-                }
3056
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3057
-                if ($row['nb'] > 0) return false;
3058
-                else return true;
3052
+						$sth->execute();
3053
+				} catch(PDOException $e) {
3054
+						return "error : ".$e->getMessage();
3055
+				}
3056
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3057
+				if ($row['nb'] > 0) return false;
3058
+				else return true;
3059 3059
 	}
3060 3060
 
3061 3061
 	public static function insert_last_owner_update() {
@@ -3064,10 +3064,10 @@  discard block
 block discarded – undo
3064 3064
 		try {
3065 3065
 			$Connection = new Connection();
3066 3066
 			$sth = $Connection->db->prepare($query);
3067
-                        $sth->execute();
3068
-                } catch(PDOException $e) {
3069
-                        return "error : ".$e->getMessage();
3070
-                }
3067
+						$sth->execute();
3068
+				} catch(PDOException $e) {
3069
+						return "error : ".$e->getMessage();
3070
+				}
3071 3071
 	}
3072 3072
 	public static function check_last_schedules_update() {
3073 3073
 		global $globalDBdriver;
@@ -3079,13 +3079,13 @@  discard block
 block discarded – undo
3079 3079
 		try {
3080 3080
 			$Connection = new Connection();
3081 3081
 			$sth = $Connection->db->prepare($query);
3082
-                        $sth->execute();
3083
-                } catch(PDOException $e) {
3084
-                        return "error : ".$e->getMessage();
3085
-                }
3086
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3087
-                if ($row['nb'] > 0) return false;
3088
-                else return true;
3082
+						$sth->execute();
3083
+				} catch(PDOException $e) {
3084
+						return "error : ".$e->getMessage();
3085
+				}
3086
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3087
+				if ($row['nb'] > 0) return false;
3088
+				else return true;
3089 3089
 	}
3090 3090
 
3091 3091
 	public static function insert_last_schedules_update() {
@@ -3265,10 +3265,10 @@  discard block
 block discarded – undo
3265 3265
 		try {
3266 3266
 			$Connection = new Connection();
3267 3267
 			$sth = $Connection->db->prepare($query);
3268
-                        $sth->execute();
3269
-                } catch(PDOException $e) {
3270
-                        return "error : ".$e->getMessage();
3271
-                }
3268
+						$sth->execute();
3269
+				} catch(PDOException $e) {
3270
+						return "error : ".$e->getMessage();
3271
+				}
3272 3272
 	}
3273 3273
 	public static function delete_duplicateowner() {
3274 3274
 		global $globalDBdriver;
@@ -3280,10 +3280,10 @@  discard block
 block discarded – undo
3280 3280
 		try {
3281 3281
 			$Connection = new Connection();
3282 3282
 			$sth = $Connection->db->prepare($query);
3283
-                        $sth->execute();
3284
-                } catch(PDOException $e) {
3285
-                        return "error : ".$e->getMessage();
3286
-                }
3283
+						$sth->execute();
3284
+				} catch(PDOException $e) {
3285
+						return "error : ".$e->getMessage();
3286
+				}
3287 3287
 	}
3288 3288
 	
3289 3289
 	public static function update_all() {
Please login to merge, or discard this patch.
Spacing   +347 added lines, -347 removed lines patch added patch discarded remove patch
@@ -25,20 +25,20 @@  discard block
 block discarded – undo
25 25
 		fclose($fp);
26 26
 	}
27 27
 
28
-	public static function gunzip($in_file,$out_file_name = '') {
28
+	public static function gunzip($in_file, $out_file_name = '') {
29 29
 		//echo $in_file.' -> '.$out_file_name."\n";
30 30
 		$buffer_size = 4096; // read 4kb at a time
31 31
 		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
32 32
 		if ($in_file != '' && file_exists($in_file)) {
33 33
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
34
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
35
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
34
+			if (function_exists('gzopen')) $file = gzopen($in_file, 'rb');
35
+			elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb');
36 36
 			else {
37 37
 				echo 'gzopen not available';
38 38
 				die;
39 39
 			}
40 40
 			$out_file = fopen($out_file_name, 'wb'); 
41
-			while(!gzeof($file)) {
41
+			while (!gzeof($file)) {
42 42
 				fwrite($out_file, gzread($file, $buffer_size));
43 43
 			}  
44 44
 			fclose($out_file);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		try {
63 63
 			self::$db_sqlite = new PDO('sqlite:'.$database);
64 64
 			self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
65
-		} catch(PDOException $e) {
65
+		} catch (PDOException $e) {
66 66
 			return "error : ".$e->getMessage();
67 67
 		}
68 68
 	}
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			//$Connection = new Connection();
78 78
 			$sth = $Connection->db->prepare($query);
79 79
                         $sth->execute(array(':source' => $database_file));
80
-                } catch(PDOException $e) {
80
+                } catch (PDOException $e) {
81 81
                         return "error : ".$e->getMessage();
82 82
                 }
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		try {
89 89
                         $sth = update_db::$db_sqlite->prepare($query);
90 90
                         $sth->execute();
91
-                } catch(PDOException $e) {
91
+                } catch (PDOException $e) {
92 92
                         return "error : ".$e->getMessage();
93 93
                 }
94 94
 		//$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)';
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 			if ($globalTransaction) $Connection->db->beginTransaction();
100 100
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
101 101
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
102
-				$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
+				$query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file);
103 103
 				$sth_dest->execute($query_dest_values);
104 104
             		}
105 105
 			if ($globalTransaction) $Connection->db->commit();
106
-		} catch(PDOException $e) {
106
+		} catch (PDOException $e) {
107 107
 			if ($globalTransaction) $Connection->db->rollBack(); 
108 108
 			return "error : ".$e->getMessage();
109 109
 		}
@@ -119,26 +119,26 @@  discard block
 block discarded – undo
119 119
 			//$Connection = new Connection();
120 120
 			$sth = $Connection->db->prepare($query);
121 121
                         $sth->execute(array(':source' => 'oneworld'));
122
-                } catch(PDOException $e) {
122
+                } catch (PDOException $e) {
123 123
                         return "error : ".$e->getMessage();
124 124
                 }
125 125
 
126 126
     		if ($globalDebug) echo " - Add routes to DB -";
127 127
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
128 128
 		$Spotter = new Spotter();
129
-		if ($fh = fopen($database_file,"r")) {
129
+		if ($fh = fopen($database_file, "r")) {
130 130
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
131 131
 			$Connection = new Connection();
132 132
 			$sth_dest = $Connection->db->prepare($query_dest);
133 133
 			if ($globalTransaction) $Connection->db->beginTransaction();
134 134
 			while (!feof($fh)) {
135
-				$line = fgetcsv($fh,9999,',');
135
+				$line = fgetcsv($fh, 9999, ',');
136 136
 				if ($line[0] != '') {
137 137
 					if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) {
138 138
 						try {
139
-							$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
+							$query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld');
140 140
 							$sth_dest->execute($query_dest_values);
141
-						} catch(PDOException $e) {
141
+						} catch (PDOException $e) {
142 142
 							if ($globalTransaction) $Connection->db->rollBack(); 
143 143
 							return "error : ".$e->getMessage();
144 144
 						}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			//$Connection = new Connection();
161 161
 			$sth = $Connection->db->prepare($query);
162 162
                         $sth->execute(array(':source' => 'skyteam'));
163
-                } catch(PDOException $e) {
163
+                } catch (PDOException $e) {
164 164
                         return "error : ".$e->getMessage();
165 165
                 }
166 166
 
@@ -168,24 +168,24 @@  discard block
 block discarded – undo
168 168
 
169 169
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
170 170
 		$Spotter = new Spotter();
171
-		if ($fh = fopen($database_file,"r")) {
171
+		if ($fh = fopen($database_file, "r")) {
172 172
 			$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)';
173 173
 			$Connection = new Connection();
174 174
 			$sth_dest = $Connection->db->prepare($query_dest);
175 175
 			try {
176 176
 				if ($globalTransaction) $Connection->db->beginTransaction();
177 177
 				while (!feof($fh)) {
178
-					$line = fgetcsv($fh,9999,',');
178
+					$line = fgetcsv($fh, 9999, ',');
179 179
 					if ($line[0] != '') {
180
-						$datebe = explode('  -  ',$line[2]);
180
+						$datebe = explode('  -  ', $line[2]);
181 181
 						if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) {
182
-							$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
+							$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');
183 183
 							$sth_dest->execute($query_dest_values);
184 184
 						}
185 185
 					}
186 186
 				}
187 187
 				if ($globalTransaction) $Connection->db->commit();
188
-			} catch(PDOException $e) {
188
+			} catch (PDOException $e) {
189 189
 				if ($globalTransaction) $Connection->db->rollBack(); 
190 190
 				return "error : ".$e->getMessage();
191 191
 			}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			$Connection = new Connection();
201 201
 			$sth = $Connection->db->prepare($query);
202 202
                         $sth->execute(array(':source' => $database_file));
203
-                } catch(PDOException $e) {
203
+                } catch (PDOException $e) {
204 204
                         return "error : ".$e->getMessage();
205 205
                 }
206 206
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			$Connection = new Connection();
209 209
 			$sth = $Connection->db->prepare($query);
210 210
                         $sth->execute(array(':source' => $database_file));
211
-                } catch(PDOException $e) {
211
+                } catch (PDOException $e) {
212 212
                         return "error : ".$e->getMessage();
213 213
                 }
214 214
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		try {
218 218
                         $sth = update_db::$db_sqlite->prepare($query);
219 219
                         $sth->execute();
220
-                } catch(PDOException $e) {
220
+                } catch (PDOException $e) {
221 221
                         return "error : ".$e->getMessage();
222 222
                 }
223 223
 		//$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)';
@@ -234,15 +234,15 @@  discard block
 block discarded – undo
234 234
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
235 235
 				if ($values['UserString4'] == 'M') $type = 'military';
236 236
 				else $type = null;
237
-				$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
+				$query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type);
238 238
 				$sth_dest->execute($query_dest_values);
239 239
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
240
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
240
+				    $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']);
241 241
 				    $sth_dest_owner->execute($query_dest_owner_values);
242 242
 				}
243 243
             		}
244 244
 			if ($globalTransaction) $Connection->db->commit();
245
-		} catch(PDOException $e) {
245
+		} catch (PDOException $e) {
246 246
 			return "error : ".$e->getMessage();
247 247
 		}
248 248
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			$Connection = new Connection();
253 253
 			$sth = $Connection->db->prepare($query);
254 254
                         $sth->execute(array(':source' => $database_file));
255
-                } catch(PDOException $e) {
255
+                } catch (PDOException $e) {
256 256
                         return "error : ".$e->getMessage();
257 257
                 }
258 258
 		return '';
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 			$Connection = new Connection();
268 268
 			$sth = $Connection->db->prepare($query);
269 269
                         $sth->execute(array(':source' => $database_file));
270
-                } catch(PDOException $e) {
270
+                } catch (PDOException $e) {
271 271
                         return "error : ".$e->getMessage();
272 272
                 }
273 273
 		
274
-		if ($fh = fopen($database_file,"r")) {
274
+		if ($fh = fopen($database_file, "r")) {
275 275
 			//$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)';
276 276
 			$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)';
277 277
 		
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
 				if ($globalTransaction) $Connection->db->beginTransaction();
282 282
             			while (!feof($fh)) {
283 283
             				$values = array();
284
-            				$line = $Common->hex2str(fgets($fh,9999));
284
+            				$line = $Common->hex2str(fgets($fh, 9999));
285 285
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
286
-            				$values['ModeS'] = substr($line,0,6);
287
-            				$values['Registration'] = trim(substr($line,69,6));
288
-            				$aircraft_name = trim(substr($line,48,6));
286
+            				$values['ModeS'] = substr($line, 0, 6);
287
+            				$values['Registration'] = trim(substr($line, 69, 6));
288
+            				$aircraft_name = trim(substr($line, 48, 6));
289 289
             				// Check if we can find ICAO, else set it to GLID
290
-            				$aircraft_name_split = explode(' ',$aircraft_name);
290
+            				$aircraft_name_split = explode(' ', $aircraft_name);
291 291
             				$search_more = '';
292 292
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
293 293
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -299,20 +299,20 @@  discard block
 block discarded – undo
299 299
 	            				if (isset($result['icao']) && $result['icao'] != '') {
300 300
 	            				    $values['ICAOTypeCode'] = $result['icao'];
301 301
 	            				} 
302
-					} catch(PDOException $e) {
302
+					} catch (PDOException $e) {
303 303
 						return "error : ".$e->getMessage();
304 304
 					}
305 305
 					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
306 306
 					// Add data to db
307 307
 					if ($values['Registration'] != '' && $values['Registration'] != '0000') {
308 308
 						//$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']);
309
-						$query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm');
309
+						$query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm');
310 310
 						//print_r($query_dest_values);
311 311
 						$sth_dest->execute($query_dest_values);
312 312
 					}
313 313
 				}
314 314
 				if ($globalTransaction) $Connection->db->commit();
315
-			} catch(PDOException $e) {
315
+			} catch (PDOException $e) {
316 316
 				return "error : ".$e->getMessage();
317 317
 			}
318 318
 		}
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 			$Connection = new Connection();
323 323
 			$sth = $Connection->db->prepare($query);
324 324
                         $sth->execute(array(':source' => $database_file));
325
-                } catch(PDOException $e) {
325
+                } catch (PDOException $e) {
326 326
                         return "error : ".$e->getMessage();
327 327
                 }
328 328
 		return '';
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 			$Connection = new Connection();
337 337
 			$sth = $Connection->db->prepare($query);
338 338
                         $sth->execute(array(':source' => $database_file));
339
-                } catch(PDOException $e) {
339
+                } catch (PDOException $e) {
340 340
                         return "error : ".$e->getMessage();
341 341
                 }
342 342
 		
343
-		if ($fh = fopen($database_file,"r")) {
343
+		if ($fh = fopen($database_file, "r")) {
344 344
 			//$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)';
345 345
 			$query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)';
346 346
 		
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 			$sth_dest = $Connection->db->prepare($query_dest);
349 349
 			try {
350 350
 				if ($globalTransaction) $Connection->db->beginTransaction();
351
-				$tmp = fgetcsv($fh,9999,',',"'");
351
+				$tmp = fgetcsv($fh, 9999, ',', "'");
352 352
             			while (!feof($fh)) {
353
-            				$line = fgetcsv($fh,9999,',',"'");
353
+            				$line = fgetcsv($fh, 9999, ',', "'");
354 354
             				
355 355
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
356 356
 					//print_r($line);
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             				$values['ICAOTypeCode'] = '';
360 360
             				$aircraft_name = $line[2];
361 361
             				// Check if we can find ICAO, else set it to GLID
362
-            				$aircraft_name_split = explode(' ',$aircraft_name);
362
+            				$aircraft_name_split = explode(' ', $aircraft_name);
363 363
             				$search_more = '';
364 364
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
365 365
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -368,20 +368,20 @@  discard block
 block discarded – undo
368 368
                                     		$sth_search->execute();
369 369
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
370 370
 	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
371
-					} catch(PDOException $e) {
371
+					} catch (PDOException $e) {
372 372
 						return "error : ".$e->getMessage();
373 373
 					}
374 374
 					//if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
375 375
 					// Add data to db
376 376
 					if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') {
377 377
 						//$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']);
378
-						$query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm');
378
+						$query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm');
379 379
 						//print_r($query_dest_values);
380 380
 						$sth_dest->execute($query_dest_values);
381 381
 					}
382 382
 				}
383 383
 				if ($globalTransaction) $Connection->db->commit();
384
-			} catch(PDOException $e) {
384
+			} catch (PDOException $e) {
385 385
 				return "error : ".$e->getMessage();
386 386
 			}
387 387
 		}
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
 			$Connection = new Connection();
392 392
 			$sth = $Connection->db->prepare($query);
393 393
                         $sth->execute(array(':source' => $database_file));
394
-                } catch(PDOException $e) {
394
+                } catch (PDOException $e) {
395 395
                         return "error : ".$e->getMessage();
396 396
                 }
397 397
 		return '';
398 398
 	}
399 399
 
400
-	public static function retrieve_owner($database_file,$country = 'F') {
400
+	public static function retrieve_owner($database_file, $country = 'F') {
401 401
 		global $globalTransaction, $globalMasterSource;
402 402
 		//$query = 'TRUNCATE TABLE aircraft_modes';
403 403
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;";
@@ -405,12 +405,12 @@  discard block
 block discarded – undo
405 405
 			$Connection = new Connection();
406 406
 			$sth = $Connection->db->prepare($query);
407 407
                         $sth->execute(array(':source' => $database_file));
408
-                } catch(PDOException $e) {
408
+                } catch (PDOException $e) {
409 409
                         return "error : ".$e->getMessage();
410 410
                 }
411 411
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
412 412
 		$Spotter = new Spotter();
413
-		if ($fh = fopen($database_file,"r")) {
413
+		if ($fh = fopen($database_file, "r")) {
414 414
 			//$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)';
415 415
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
416 416
 		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
 			$sth_modes = $Connection->db->prepare($query_modes);
421 421
 			try {
422 422
 				if ($globalTransaction) $Connection->db->beginTransaction();
423
-				$tmp = fgetcsv($fh,9999,',','"');
423
+				$tmp = fgetcsv($fh, 9999, ',', '"');
424 424
             			while (!feof($fh)) {
425
-            				$line = fgetcsv($fh,9999,',','"');
425
+            				$line = fgetcsv($fh, 9999, ',', '"');
426 426
             				$values = array();
427 427
             				//print_r($line);
428 428
             				if ($country == 'F') {
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
             				    $values['base'] = $line[4];
431 431
             				    $values['owner'] = $line[5];
432 432
             				    if ($line[6] == '') $values['date_first_reg'] = null;
433
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
433
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
434 434
 					    $values['cancel'] = $line[7];
435 435
 					} elseif ($country == 'EI') {
436 436
 					    // TODO : add modeS & reg to aircraft_modes
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
             				    $values['base'] = $line[3];
439 439
             				    $values['owner'] = $line[2];
440 440
             				    if ($line[1] == '') $values['date_first_reg'] = null;
441
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
441
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1]));
442 442
 					    $values['cancel'] = '';
443 443
 					    $values['modes'] = $line[7];
444 444
 					    $values['icao'] = $line[8];
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
             				    $values['base'] = null;
459 459
             				    $values['owner'] = $line[5];
460 460
             				    if ($line[18] == '') $values['date_first_reg'] = null;
461
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
461
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18]));
462 462
 					    $values['cancel'] = '';
463 463
 					} elseif ($country == 'VH') {
464 464
 					    // TODO : add modeS & reg to aircraft_modes
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
             				    $values['base'] = null;
467 467
             				    $values['owner'] = $line[12];
468 468
             				    if ($line[28] == '') $values['date_first_reg'] = null;
469
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
469
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28]));
470 470
 
471 471
 					    $values['cancel'] = $line[39];
472 472
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -486,28 +486,28 @@  discard block
 block discarded – undo
486 486
             				    $values['base'] = null;
487 487
             				    $values['owner'] = $line[8];
488 488
             				    if ($line[7] == '') $values['date_first_reg'] = null;
489
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
489
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
490 490
 					    $values['cancel'] = '';
491 491
 					} elseif ($country == 'PP') {
492 492
             				    $values['registration'] = $line[0];
493 493
             				    $values['base'] = null;
494 494
             				    $values['owner'] = $line[4];
495 495
             				    if ($line[6] == '') $values['date_first_reg'] = null;
496
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
496
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
497 497
 					    $values['cancel'] = $line[7];
498 498
 					} elseif ($country == 'E7') {
499 499
             				    $values['registration'] = $line[0];
500 500
             				    $values['base'] = null;
501 501
             				    $values['owner'] = $line[4];
502 502
             				    if ($line[5] == '') $values['date_first_reg'] = null;
503
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
503
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5]));
504 504
 					    $values['cancel'] = '';
505 505
 					} elseif ($country == '8Q') {
506 506
             				    $values['registration'] = $line[0];
507 507
             				    $values['base'] = null;
508 508
             				    $values['owner'] = $line[3];
509 509
             				    if ($line[7] == '') $values['date_first_reg'] = null;
510
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
510
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
511 511
 					    $values['cancel'] = '';
512 512
 					} elseif ($country == 'ZK') {
513 513
             				    $values['registration'] = $line[0];
@@ -521,18 +521,18 @@  discard block
 block discarded – undo
521 521
             				    $values['registration'] = $line[0];
522 522
             				    $values['base'] = null;
523 523
             				    $values['owner'] = $line[6];
524
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
525
-					    $values['cancel'] = date("Y-m-d",strtotime($line[8]));
524
+            				    $values['date_first_reg'] = date("Y-m-d", strtotime($line[5]));
525
+					    $values['cancel'] = date("Y-m-d", strtotime($line[8]));
526 526
 					    $values['modes'] = $line[4];
527 527
 					    $values['icao'] = $line[10];
528 528
 					} elseif ($country == 'OY') {
529 529
             				    $values['registration'] = $line[0];
530
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
530
+            				    $values['date_first_reg'] = date("Y-m-d", strtotime($line[4]));
531 531
 					    $values['modes'] = $line[5];
532 532
 					    $values['icao'] = $line[6];
533 533
 					} elseif ($country == 'PH') {
534 534
             				    $values['registration'] = $line[0];
535
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
535
+            				    $values['date_first_reg'] = date("Y-m-d", strtotime($line[3]));
536 536
 					    $values['modes'] = $line[4];
537 537
 					    $values['icao'] = $line[5];
538 538
 					} elseif ($country == 'OM' || $country == 'TF') {
@@ -543,17 +543,17 @@  discard block
 block discarded – undo
543 543
 					    $values['cancel'] = '';
544 544
 					}
545 545
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
546
-						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
546
+						$query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file);
547 547
 						$sth_dest->execute($query_dest_values);
548 548
 					}
549 549
 					if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') {
550 550
 						$modescountry = $Spotter->countryFromAircraftRegistration($values['registration']);
551
-						$query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file);
551
+						$query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file);
552 552
 						$sth_modes->execute($query_modes_values);
553 553
 					}
554 554
 				}
555 555
 				if ($globalTransaction) $Connection->db->commit();
556
-			} catch(PDOException $e) {
556
+			} catch (PDOException $e) {
557 557
 				return "error : ".$e->getMessage();
558 558
 			}
559 559
 		}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 		if ($globalTransaction) $Connection->db->beginTransaction();
692 692
   
693 693
 		$i = 0;
694
-		while($row = sparql_fetch_array($result))
694
+		while ($row = sparql_fetch_array($result))
695 695
 		{
696 696
 			if ($i >= 1) {
697 697
 			//print_r($row);
@@ -711,33 +711,33 @@  discard block
 block discarded – undo
711 711
 				$row['image'] = '';
712 712
 				$row['image_thumb'] = '';
713 713
 			} else {
714
-				$image = str_replace(' ','_',$row['image']);
714
+				$image = str_replace(' ', '_', $row['image']);
715 715
 				$digest = md5($image);
716
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image;
717
-				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder;
718
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image;
719
-				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder;
716
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image;
717
+				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder;
718
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image;
719
+				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder;
720 720
 			}
721 721
 			
722
-			$country = explode('-',$row['country']);
722
+			$country = explode('-', $row['country']);
723 723
 			$row['country'] = $country[0];
724 724
 			
725 725
 			$row['type'] = trim($row['type']);
726
-			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'])) {
726
+			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'])) {
727 727
 				$row['type'] = 'military';
728 728
 			} 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') {
729 729
 				$row['type'] = 'small_airport';
730 730
 			}
731 731
 			
732
-			$row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city'])));
733
-			$query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($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']);
732
+			$row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city'])));
733
+			$query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($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']);
734 734
 			//print_r($query_dest_values);
735 735
 			
736 736
 			if ($row['icao'] != '') {
737 737
 				try {
738 738
 					$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao');
739 739
 					$sth->execute(array(':icao' => $row['icao']));
740
-				} catch(PDOException $e) {
740
+				} catch (PDOException $e) {
741 741
 					return "error : ".$e->getMessage();
742 742
 				}
743 743
 					if ($sth->fetchColumn() > 0) {
@@ -745,15 +745,15 @@  discard block
 block discarded – undo
745 745
 						$query = 'UPDATE airport SET type = :type WHERE icao = :icao';
746 746
 						try {
747 747
 							$sth = $Connection->db->prepare($query);
748
-							$sth->execute(array(':icao' => $row['icao'],':type' => $row['type']));
749
-						} catch(PDOException $e) {
748
+							$sth->execute(array(':icao' => $row['icao'], ':type' => $row['type']));
749
+						} catch (PDOException $e) {
750 750
 							return "error : ".$e->getMessage();
751 751
 						}
752 752
 						echo $row['icao'].' : '.$row['type']."\n";
753 753
 					} else {
754 754
 						try {
755 755
 							$sth_dest->execute($query_dest_values);
756
-						} catch(PDOException $e) {
756
+						} catch (PDOException $e) {
757 757
 							return "error : ".$e->getMessage();
758 758
 						}
759 759
 					}
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 		echo "Download data from ourairports.com...\n";
805 805
 		$delimiter = ',';
806 806
 		$out_file = $tmp_dir.'airports.csv';
807
-		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
807
+		update_db::download('http://ourairports.com/data/airports.csv', $out_file);
808 808
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
809 809
 		echo "Add data from ourairports.com...\n";
810 810
 
@@ -815,33 +815,33 @@  discard block
 block discarded – undo
815 815
 			//$Connection->db->beginTransaction();
816 816
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
817 817
 			{
818
-				if(!$header) $header = $row;
818
+				if (!$header) $header = $row;
819 819
 				else {
820 820
 					$data = array();
821 821
 					$data = array_combine($header, $row);
822 822
 					try {
823 823
 						$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao');
824 824
 						$sth->execute(array(':icao' => $data['ident']));
825
-					} catch(PDOException $e) {
825
+					} catch (PDOException $e) {
826 826
 						return "error : ".$e->getMessage();
827 827
 					}
828 828
 					if ($sth->fetchColumn() > 0) {
829 829
 						$query = 'UPDATE airport SET type = :type WHERE icao = :icao';
830 830
 						try {
831 831
 							$sth = $Connection->db->prepare($query);
832
-							$sth->execute(array(':icao' => $data['ident'],':type' => $data['type']));
833
-						} catch(PDOException $e) {
832
+							$sth->execute(array(':icao' => $data['ident'], ':type' => $data['type']));
833
+						} catch (PDOException $e) {
834 834
 							return "error : ".$e->getMessage();
835 835
 						}
836 836
 					} else {
837 837
 						if ($data['gps_code'] == $data['ident']) {
838 838
 						$query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link)
839 839
 						    VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)";
840
-						$query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']);
840
+						$query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']);
841 841
 						try {
842 842
 							$sth = $Connection->db->prepare($query);
843 843
 							$sth->execute($query_values);
844
-						} catch(PDOException $e) {
844
+						} catch (PDOException $e) {
845 845
 							return "error : ".$e->getMessage();
846 846
 						}
847 847
 						$i++;
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 		
857 857
 		echo "Download data from another free database...\n";
858 858
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
859
-		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
859
+		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file);
860 860
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
861 861
 		update_db::unzip($out_file);
862 862
 		$header = NULL;
@@ -868,15 +868,15 @@  discard block
 block discarded – undo
868 868
 			//$Connection->db->beginTransaction();
869 869
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
870 870
 			{
871
-				if(!$header) $header = $row;
871
+				if (!$header) $header = $row;
872 872
 				else {
873 873
 					$data = $row;
874 874
 
875 875
 					$query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao';
876 876
 					try {
877 877
 						$sth = $Connection->db->prepare($query);
878
-						$sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4]))));
879
-					} catch(PDOException $e) {
878
+						$sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4]))));
879
+					} catch (PDOException $e) {
880 880
 						return "error : ".$e->getMessage();
881 881
 					}
882 882
 				}
@@ -890,15 +890,15 @@  discard block
 block discarded – undo
890 890
 		try {
891 891
 			$sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'");
892 892
 			$sth->execute();
893
-		} catch(PDOException $e) {
893
+		} catch (PDOException $e) {
894 894
 			return "error : ".$e->getMessage();
895 895
 		}
896 896
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
897 897
 			$query2 = 'UPDATE airport SET type = :type WHERE icao = :icao';
898 898
 			try {
899 899
 				$sth2 = $Connection->db->prepare($query2);
900
-				$sth2->execute(array(':icao' => $row['icao'],':type' => 'military'));
901
-			} catch(PDOException $e) {
900
+				$sth2->execute(array(':icao' => $row['icao'], ':type' => 'military'));
901
+			} catch (PDOException $e) {
902 902
 				return "error : ".$e->getMessage();
903 903
 			}
904 904
 		}
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 			$Connection = new Connection();
920 920
 			$sth = $Connection->db->prepare($query);
921 921
                         $sth->execute(array(':source' => 'translation.csv'));
922
-                } catch(PDOException $e) {
922
+                } catch (PDOException $e) {
923 923
                         return "error : ".$e->getMessage();
924 924
                 }
925 925
 
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
937 937
 			{
938 938
 				$i++;
939
-				if($i > 12) {
939
+				if ($i > 12) {
940 940
 					$data = $row;
941 941
 					$operator = $data[2];
942 942
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
                                                 //echo substr($operator, 0, 2)."\n";;
945 945
                                                 if (count($airline_array) > 0) {
946 946
 							//print_r($airline_array);
947
-							$operator = $airline_array[0]['icao'].substr($operator,2);
947
+							$operator = $airline_array[0]['icao'].substr($operator, 2);
948 948
                                                 }
949 949
                                         }
950 950
 					
@@ -952,14 +952,14 @@  discard block
 block discarded – undo
952 952
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
953 953
                                                 $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
954 954
                                                 if (count($airline_array) > 0) {
955
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
955
+                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2);
956 956
                                             	}
957 957
                                         }
958 958
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
959 959
 					try {
960 960
 						$sth = $Connection->db->prepare($query);
961
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
962
-					} catch(PDOException $e) {
961
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
962
+					} catch (PDOException $e) {
963 963
 						return "error : ".$e->getMessage();
964 964
 					}
965 965
 				}
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 			$Connection = new Connection();
978 978
 			$sth = $Connection->db->prepare($query);
979 979
 			$sth->execute(array(':source' => 'website_fam'));
980
-		} catch(PDOException $e) {
980
+		} catch (PDOException $e) {
981 981
 			return "error : ".$e->getMessage();
982 982
 		}
983 983
 		//update_db::unzip($out_file);
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
996 996
 					try {
997 997
 						$sth = $Connection->db->prepare($query);
998
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam'));
999
-					} catch(PDOException $e) {
998
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam'));
999
+					} catch (PDOException $e) {
1000 1000
 						return "error : ".$e->getMessage();
1001 1001
 					}
1002 1002
 				}
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 			$Connection = new Connection();
1020 1020
 			$sth = $Connection->db->prepare($query);
1021 1021
                         $sth->execute(array(':source' => 'website_faa'));
1022
-                } catch(PDOException $e) {
1022
+                } catch (PDOException $e) {
1023 1023
                         return "error : ".$e->getMessage();
1024 1024
                 }
1025 1025
 
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 			$Connection = new Connection();
1029 1029
 			$sth = $Connection->db->prepare($query);
1030 1030
                         $sth->execute(array(':source' => 'website_faa'));
1031
-                } catch(PDOException $e) {
1031
+                } catch (PDOException $e) {
1032 1032
                         return "error : ".$e->getMessage();
1033 1033
                 }
1034 1034
 
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
 					$query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1';
1046 1046
 					try {
1047 1047
 						$sths = $Connection->db->prepare($query_search);
1048
-						$sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa'));
1049
-					} catch(PDOException $e) {
1048
+						$sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa'));
1049
+					} catch (PDOException $e) {
1050 1050
 						return "error s : ".$e->getMessage();
1051 1051
 					}
1052 1052
 					$result_search = $sths->fetchAll(PDO::FETCH_ASSOC);
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 							//}
1060 1060
 						try {
1061 1061
 							$sthi = $Connection->db->prepare($queryi);
1062
-							$sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode']));
1063
-						} catch(PDOException $e) {
1062
+							$sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode']));
1063
+						} catch (PDOException $e) {
1064 1064
 							return "error u : ".$e->getMessage();
1065 1065
 						}
1066 1066
 					} else {
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
 						try {
1069 1069
 							$sthsm = $Connection->db->prepare($query_search_mfr);
1070 1070
 							$sthsm->execute(array(':mfr' => $data[2]));
1071
-						} catch(PDOException $e) {
1071
+						} catch (PDOException $e) {
1072 1072
 							return "error mfr : ".$e->getMessage();
1073 1073
 						}
1074 1074
 						$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC);
@@ -1078,8 +1078,8 @@  discard block
 block discarded – undo
1078 1078
 							$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)';
1079 1079
 							try {
1080 1080
 								$sthf = $Connection->db->prepare($queryf);
1081
-								$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'));
1082
-							} catch(PDOException $e) {
1081
+								$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'));
1082
+							} catch (PDOException $e) {
1083 1083
 								return "error f : ".$e->getMessage();
1084 1084
 							}
1085 1085
 						}
@@ -1089,13 +1089,13 @@  discard block
 block discarded – undo
1089 1089
 						$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
1090 1090
 						try {
1091 1091
 							$sth = $Connection->db->prepare($query);
1092
-							$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'));
1093
-						} catch(PDOException $e) {
1092
+							$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'));
1093
+						} catch (PDOException $e) {
1094 1094
 							return "error i : ".$e->getMessage();
1095 1095
 						}
1096 1096
 					}
1097 1097
 				}
1098
-				if ($i % 90 == 0) {
1098
+				if ($i%90 == 0) {
1099 1099
 					if ($globalTransaction) $Connection->db->commit();
1100 1100
 					if ($globalTransaction) $Connection->db->beginTransaction();
1101 1101
 				}
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 			$Connection = new Connection();
1115 1115
 			$sth = $Connection->db->prepare($query);
1116 1116
                         $sth->execute(array(':source' => 'website_fam'));
1117
-                } catch(PDOException $e) {
1117
+                } catch (PDOException $e) {
1118 1118
                         return "error : ".$e->getMessage();
1119 1119
                 }
1120 1120
 
@@ -1135,8 +1135,8 @@  discard block
 block discarded – undo
1135 1135
 					$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)';
1136 1136
 					try {
1137 1137
 						$sth = $Connection->db->prepare($query);
1138
-						$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'));
1139
-					} catch(PDOException $e) {
1138
+						$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'));
1139
+					} catch (PDOException $e) {
1140 1140
 						return "error : ".$e->getMessage();
1141 1141
 					}
1142 1142
 				}
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 			$Connection = new Connection();
1156 1156
 			$sth = $Connection->db->prepare($query);
1157 1157
                         $sth->execute(array(':source' => 'website_fam'));
1158
-                } catch(PDOException $e) {
1158
+                } catch (PDOException $e) {
1159 1159
                         return "error : ".$e->getMessage();
1160 1160
                 }
1161 1161
 
@@ -1171,8 +1171,8 @@  discard block
 block discarded – undo
1171 1171
 					$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)';
1172 1172
 					try {
1173 1173
 						$sth = $Connection->db->prepare($query);
1174
-						$sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam'));
1175
-					} catch(PDOException $e) {
1174
+						$sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam'));
1175
+					} catch (PDOException $e) {
1176 1176
 						//print_r($data);
1177 1177
 						return "error : ".$e->getMessage();
1178 1178
 					}
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 			$Connection = new Connection();
1193 1193
 			$sth = $Connection->db->prepare($query);
1194 1194
 			$sth->execute(array(':source' => 'website_fam'));
1195
-		} catch(PDOException $e) {
1195
+		} catch (PDOException $e) {
1196 1196
 			return "error : ".$e->getMessage();
1197 1197
 		}
1198 1198
 		$delimiter = "\t";
@@ -1207,9 +1207,9 @@  discard block
 block discarded – undo
1207 1207
 					$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)';
1208 1208
 					try {
1209 1209
 						$sth = $Connection->db->prepare($query);
1210
-						$sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam'));
1211
-					} catch(PDOException $e) {
1212
-						if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1210
+						$sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam'));
1211
+					} catch (PDOException $e) {
1212
+						if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data);
1213 1213
 					}
1214 1214
 				}
1215 1215
 				$i++;
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			$Connection = new Connection();
1228 1228
 			$sth = $Connection->db->prepare($query);
1229 1229
                         $sth->execute();
1230
-                } catch(PDOException $e) {
1230
+                } catch (PDOException $e) {
1231 1231
                         return "error : ".$e->getMessage();
1232 1232
                 }
1233 1233
 
@@ -1248,8 +1248,8 @@  discard block
 block discarded – undo
1248 1248
 					$query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)';
1249 1249
 					try {
1250 1250
 						$sth = $Connection->db->prepare($query);
1251
-						$sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10]));
1252
-					} catch(PDOException $e) {
1251
+						$sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10]));
1252
+					} catch (PDOException $e) {
1253 1253
 						return "error : ".$e->getMessage();
1254 1254
 					}
1255 1255
 				}
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
 			$Connection = new Connection();
1269 1269
 			$sth = $Connection->db->prepare($query);
1270 1270
 			$sth->execute();
1271
-		} catch(PDOException $e) {
1271
+		} catch (PDOException $e) {
1272 1272
 			return "error : ".$e->getMessage();
1273 1273
 		}
1274 1274
 		$delimiter = "\t";
@@ -1285,8 +1285,8 @@  discard block
 block discarded – undo
1285 1285
 					    VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)';
1286 1286
 					try {
1287 1287
 						$sth = $Connection->db->prepare($query);
1288
-						$sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29]));
1289
-					} catch(PDOException $e) {
1288
+						$sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29]));
1289
+					} catch (PDOException $e) {
1290 1290
 						return "error : ".$e->getMessage();
1291 1291
 					}
1292 1292
 				}
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
 			$Connection = new Connection();
1306 1306
 			$sth = $Connection->db->prepare($query);
1307 1307
 			$sth->execute();
1308
-		} catch(PDOException $e) {
1308
+		} catch (PDOException $e) {
1309 1309
 			return "error : ".$e->getMessage();
1310 1310
 		}
1311 1311
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 					try {
1322 1322
 						$sth = $Connection->db->prepare($query);
1323 1323
 						$sth->execute(array(':icao' => $icao));
1324
-					} catch(PDOException $e) {
1324
+					} catch (PDOException $e) {
1325 1325
 						return "error : ".$e->getMessage();
1326 1326
 					}
1327 1327
 				}
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
 		return '';
1333 1333
         }
1334 1334
 
1335
-	public static function tle($filename,$tletype) {
1335
+	public static function tle($filename, $tletype) {
1336 1336
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1337 1337
 		global $tmp_dir, $globalTransaction;
1338 1338
 		//$Spotter = new Spotter();
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
 			$Connection = new Connection();
1343 1343
 			$sth = $Connection->db->prepare($query);
1344 1344
                         $sth->execute(array(':source' => $filename));
1345
-                } catch(PDOException $e) {
1345
+                } catch (PDOException $e) {
1346 1346
                         return "error : ".$e->getMessage();
1347 1347
                 }
1348 1348
 		
@@ -1367,8 +1367,8 @@  discard block
 block discarded – undo
1367 1367
 					$query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)';
1368 1368
 					try {
1369 1369
 						$sth = $Connection->db->prepare($query);
1370
-						$sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename));
1371
-					} catch(PDOException $e) {
1370
+						$sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename));
1371
+					} catch (PDOException $e) {
1372 1372
 						return "error : ".$e->getMessage();
1373 1373
 					}
1374 1374
 
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 			$Connection = new Connection();
1389 1389
 			$sth = $Connection->db->prepare($query);
1390 1390
 			$sth->execute(array(':source' => $filename));
1391
-		} catch(PDOException $e) {
1391
+		} catch (PDOException $e) {
1392 1392
 			return "error : ".$e->getMessage();
1393 1393
 		}
1394 1394
 		
@@ -1398,13 +1398,13 @@  discard block
 block discarded – undo
1398 1398
 			$i = 0;
1399 1399
 			//$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
1400 1400
 			//$Connection->db->beginTransaction();
1401
-			while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE)
1401
+			while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE)
1402 1402
 			{
1403 1403
 				if ($i > 0 && $data[0] != '') {
1404 1404
 					$sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]);
1405
-					$period = str_replace(',','',$data[14]);
1406
-					if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60;
1407
-					if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18]));
1405
+					$period = str_replace(',', '', $data[14]);
1406
+					if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60;
1407
+					if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18]));
1408 1408
 					else $launch_date = NULL;
1409 1409
 					$data = array_map(function($value) {
1410 1410
 						return trim($value) === '' ? null : $value;
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 					    VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)';
1415 1415
 					try {
1416 1416
 						$sth = $Connection->db->prepare($query);
1417
-						$sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources));
1418
-					} catch(PDOException $e) {
1417
+						$sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources));
1418
+					} catch (PDOException $e) {
1419 1419
 						return "error : ".$e->getMessage();
1420 1420
 					}
1421 1421
 				}
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 			'EGYP' => array('country' => 'Egypt', 'owner' => ''),
1456 1456
 			'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'),
1457 1457
 			'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'),
1458
-			'EST' => array('country' => 'Estonia','owner' => ''),
1458
+			'EST' => array('country' => 'Estonia', 'owner' => ''),
1459 1459
 			'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'),
1460 1460
 			'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'),
1461 1461
 			'FGER' => array('country' => 'France/Germany', 'owner' => ''),
@@ -1578,10 +1578,10 @@  discard block
 block discarded – undo
1578 1578
 			while (($data = fgets($handle, 1000)) !== FALSE)
1579 1579
 			{
1580 1580
 				$result = array();
1581
-				$result['cospar'] = trim(substr($data,0,11));
1582
-				$result['norad'] = trim(substr($data,13,6));
1583
-				$result['operational'] = trim(substr($data,21,1));
1584
-				$result['name'] = trim(substr($data,23,24));
1581
+				$result['cospar'] = trim(substr($data, 0, 11));
1582
+				$result['norad'] = trim(substr($data, 13, 6));
1583
+				$result['operational'] = trim(substr($data, 21, 1));
1584
+				$result['name'] = trim(substr($data, 23, 24));
1585 1585
 				/*
1586 1586
 				    * R/B(1) = Rocket body, first stage
1587 1587
 				    * R/B(2) = Rocket body, second stage
@@ -1593,20 +1593,20 @@  discard block
 block discarded – undo
1593 1593
 				    * An ampersand (&) indicates two or more objects are attached
1594 1594
 				*/
1595 1595
 				
1596
-				$owner_code = trim(substr($data,49,5));
1596
+				$owner_code = trim(substr($data, 49, 5));
1597 1597
 				if ($owner != 'TBD') {
1598 1598
 					$result['country_owner'] = $satcat_sources[$owner_code]['country'];
1599 1599
 					$result['owner'] = $satcat_sources[$owner_code]['owner'];
1600
-					$result['launch_date'] = trim(substr($data,56,10));
1601
-					$launch_site_code = trim(substr($data,68,5));
1600
+					$result['launch_date'] = trim(substr($data, 56, 10));
1601
+					$launch_site_code = trim(substr($data, 68, 5));
1602 1602
 					$result['launch_site'] = $satcat_launch_site[$launch_site_code];
1603
-					$result['lifetime'] = trim(substr($data,75,10));
1604
-					$result['period'] = trim(substr($data,87,7));
1605
-					$result['inclination'] = trim(substr($data,96,5));
1606
-					$result['apogee'] = trim(substr($data,103,6));
1607
-					$result['perigee'] = trim(substr($data,111,6));
1603
+					$result['lifetime'] = trim(substr($data, 75, 10));
1604
+					$result['period'] = trim(substr($data, 87, 7));
1605
+					$result['inclination'] = trim(substr($data, 96, 5));
1606
+					$result['apogee'] = trim(substr($data, 103, 6));
1607
+					$result['perigee'] = trim(substr($data, 111, 6));
1608 1608
 					//$result['radarcross'] = trim(substr($data,119,8));
1609
-					$result['status'] = trim(substr($data,129,3));
1609
+					$result['status'] = trim(substr($data, 129, 3));
1610 1610
 					//print_r($result);
1611 1611
 					$result = array_map(function($value) {
1612 1612
 						return trim($value) === '' ? null : $value;
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
 							$sth = $Connection->db->prepare($query);
1620 1620
 							$sth->execute(array(':cospar' => $result['cospar']));
1621 1621
 							$exist = $sth->fetchAll(PDO::FETCH_ASSOC);
1622
-						} catch(PDOException $e) {
1622
+						} catch (PDOException $e) {
1623 1623
 							return "error : ".$e->getMessage();
1624 1624
 						}
1625 1625
 						if (empty($exist)) {
@@ -1631,10 +1631,10 @@  discard block
 block discarded – undo
1631 1631
 								    ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1632 1632
 								    ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1633 1633
 								    ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1634
-								    ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1634
+								    ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1635 1635
 								    )
1636 1636
 								);
1637
-							} catch(PDOException $e) {
1637
+							} catch (PDOException $e) {
1638 1638
 								return "error : ".$e->getMessage();
1639 1639
 							}
1640 1640
 						} elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) {
@@ -1642,8 +1642,8 @@  discard block
 block discarded – undo
1642 1642
 							try {
1643 1643
 								$Connection = new Connection();
1644 1644
 								$sth = $Connection->db->prepare($query);
1645
-								$sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar']));
1646
-							} catch(PDOException $e) {
1645
+								$sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar']));
1646
+							} catch (PDOException $e) {
1647 1647
 								return "error : ".$e->getMessage();
1648 1648
 							}
1649 1649
 						}
@@ -1762,13 +1762,13 @@  discard block
 block discarded – undo
1762 1762
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1763 1763
 			{
1764 1764
 				$i++;
1765
-				if($i > 3 && count($row) > 2) {
1765
+				if ($i > 3 && count($row) > 2) {
1766 1766
 					$data = array_values(array_filter($row));
1767 1767
 					$cntdata = count($data);
1768 1768
 					if ($cntdata > 10) {
1769 1769
 						$value = $data[9];
1770 1770
 						
1771
-						for ($i =10;$i < $cntdata;$i++) {
1771
+						for ($i = 10; $i < $cntdata; $i++) {
1772 1772
 							$value .= ' '.$data[$i];
1773 1773
 						}
1774 1774
 						$data[9] = $value;
@@ -1778,8 +1778,8 @@  discard block
 block discarded – undo
1778 1778
 						$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)';
1779 1779
 						try {
1780 1780
 							$sth = $Connection->db->prepare($query);
1781
-							$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]));
1782
-						} catch(PDOException $e) {
1781
+							$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]));
1782
+						} catch (PDOException $e) {
1783 1783
 							return "error : ".$e->getMessage();
1784 1784
 						}
1785 1785
 					}
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 			$Connection = new Connection();
1801 1801
 			$sth = $Connection->db->prepare($query);
1802 1802
                         $sth->execute();
1803
-                } catch(PDOException $e) {
1803
+                } catch (PDOException $e) {
1804 1804
                         return "error : ".$e->getMessage();
1805 1805
                 }
1806 1806
 
@@ -1812,12 +1812,12 @@  discard block
 block discarded – undo
1812 1812
 			if ($globalTransaction) $Connection->db->beginTransaction();
1813 1813
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1814 1814
 			{
1815
-				if(count($row) > 1) {
1815
+				if (count($row) > 1) {
1816 1816
 					$query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')";
1817 1817
 					try {
1818 1818
 						$sth = $Connection->db->prepare($query);
1819
-						$sth->execute(array(':name' => $row[1],':icao' => $row[0]));
1820
-					} catch(PDOException $e) {
1819
+						$sth->execute(array(':name' => $row[1], ':icao' => $row[0]));
1820
+					} catch (PDOException $e) {
1821 1821
 						return "error : ".$e->getMessage();
1822 1822
 					}
1823 1823
 				}
@@ -1837,21 +1837,21 @@  discard block
 block discarded – undo
1837 1837
 			try {
1838 1838
 				$sth = $Connection->db->prepare($query);
1839 1839
                     		$sth->execute();
1840
-	                } catch(PDOException $e) {
1840
+	                } catch (PDOException $e) {
1841 1841
 				return "error : ".$e->getMessage();
1842 1842
 	                }
1843 1843
 	        }
1844 1844
 
1845 1845
 
1846
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
1846
+		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql');
1847 1847
 		else {
1848
-			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
1848
+			update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql');
1849 1849
 			$query = "CREATE EXTENSION postgis";
1850
-			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
1850
+			$Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']);
1851 1851
 			try {
1852 1852
 				$sth = $Connection->db->prepare($query);
1853 1853
 				$sth->execute();
1854
-			} catch(PDOException $e) {
1854
+			} catch (PDOException $e) {
1855 1855
 				return "error : ".$e->getMessage();
1856 1856
 			}
1857 1857
 		}
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
 		include_once('class.create_db.php');
1865 1865
 		require_once(dirname(__FILE__).'/../require/class.NOTAM.php');
1866 1866
 		if ($globalDebug) echo "NOTAM from FlightAirMap website : Download...";
1867
-		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz');
1867
+		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz');
1868 1868
 		$error = '';
1869 1869
 		if (file_exists($tmp_dir.'notam.txt.gz')) {
1870 1870
 			if ($globalDebug) echo "Gunzip...";
@@ -1896,14 +1896,14 @@  discard block
 block discarded – undo
1896 1896
 			try {
1897 1897
 				$sth = $Connection->db->prepare($query);
1898 1898
             	        	$sth->execute();
1899
-	                } catch(PDOException $e) {
1899
+	                } catch (PDOException $e) {
1900 1900
     	                	echo "error : ".$e->getMessage();
1901 1901
 	                }
1902 1902
 		}
1903 1903
 		if ($globalDBdriver == 'mysql') {
1904
-			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
1904
+			update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql');
1905 1905
 		} else {
1906
-			update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql');
1906
+			update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql');
1907 1907
 		}
1908 1908
 		$error = create_db::import_file($tmp_dir.'countries.sql');
1909 1909
 		return $error;
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
 //		update_db::unzip($tmp_dir.'AptNav.zip');
1917 1917
 //		update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz');
1918 1918
 //		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');
1919
-		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');
1919
+		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');
1920 1920
 		update_db::gunzip($tmp_dir.'awy.dat.gz');
1921 1921
 		$error = update_db::waypoints($tmp_dir.'awy.dat');
1922 1922
 		return $error;
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
 			update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
1937 1937
 			if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
1938 1938
 			if (is_writable(dirname(__FILE__).'/../images/airlines')) {
1939
-				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1939
+				if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1940 1940
 			} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
1941 1941
 		} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
1942 1942
 		if ($error != '') {
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 		global $tmp_dir, $globalDebug;
1950 1950
 		$error = '';
1951 1951
 		if ($globalDebug) echo "Routes : Download...";
1952
-		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
1952
+		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz');
1953 1953
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
1954 1954
 			if ($globalDebug) echo "Gunzip...";
1955 1955
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
@@ -1965,7 +1965,7 @@  discard block
 block discarded – undo
1965 1965
 		global $tmp_dir, $globalDebug;
1966 1966
 		$error = '';
1967 1967
 		if ($globalDebug) echo "Schedules Oneworld : Download...";
1968
-		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz');
1968
+		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz');
1969 1969
 		if (file_exists($tmp_dir.'oneworld.csv.gz')) {
1970 1970
 			if ($globalDebug) echo "Gunzip...";
1971 1971
 			update_db::gunzip($tmp_dir.'oneworld.csv.gz');
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
 		global $tmp_dir, $globalDebug;
1982 1982
 		$error = '';
1983 1983
 		if ($globalDebug) echo "Schedules Skyteam : Download...";
1984
-		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz');
1984
+		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz');
1985 1985
 		if (file_exists($tmp_dir.'skyteam.csv.gz')) {
1986 1986
 			if ($globalDebug) echo "Gunzip...";
1987 1987
 			update_db::gunzip($tmp_dir.'skyteam.csv.gz');
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 */
2010 2010
 		if ($globalDebug) echo "Modes : Download...";
2011 2011
 //		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2012
-		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz');
2012
+		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz');
2013 2013
 
2014 2014
 //		if (file_exists($tmp_dir.'basestation_latest.zip')) {
2015 2015
 		if (file_exists($tmp_dir.'BaseStation.sqb.gz')) {
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
 	public static function update_ModeS_faa() {
2030 2030
 		global $tmp_dir, $globalDebug;
2031 2031
 		if ($globalDebug) echo "Modes FAA: Download...";
2032
-		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip');
2032
+		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip');
2033 2033
 		if (file_exists($tmp_dir.'ReleasableAircraft.zip')) {
2034 2034
 			if ($globalDebug) echo "Unzip...";
2035 2035
 			update_db::unzip($tmp_dir.'ReleasableAircraft.zip');
@@ -2045,7 +2045,7 @@  discard block
 block discarded – undo
2045 2045
 	public static function update_ModeS_flarm() {
2046 2046
 		global $tmp_dir, $globalDebug;
2047 2047
 		if ($globalDebug) echo "Modes Flarmnet: Download...";
2048
-		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
2048
+		update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln');
2049 2049
 		if (file_exists($tmp_dir.'data.fln')) {
2050 2050
 			if ($globalDebug) echo "Add to DB...";
2051 2051
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
@@ -2059,7 +2059,7 @@  discard block
 block discarded – undo
2059 2059
 	public static function update_ModeS_ogn() {
2060 2060
 		global $tmp_dir, $globalDebug;
2061 2061
 		if ($globalDebug) echo "Modes OGN: Download...";
2062
-		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
2062
+		update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv');
2063 2063
 		if (file_exists($tmp_dir.'ogn.csv')) {
2064 2064
 			if ($globalDebug) echo "Add to DB...";
2065 2065
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
@@ -2074,201 +2074,201 @@  discard block
 block discarded – undo
2074 2074
 		global $tmp_dir, $globalDebug, $globalMasterSource;
2075 2075
 		
2076 2076
 		if ($globalDebug) echo "Owner France: Download...";
2077
-		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
2077
+		update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv');
2078 2078
 		if (file_exists($tmp_dir.'owner_f.csv')) {
2079 2079
 			if ($globalDebug) echo "Add to DB...";
2080
-			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
2080
+			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F');
2081 2081
 		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2082 2082
 		if ($error != '') {
2083 2083
 			return $error;
2084 2084
 		} elseif ($globalDebug) echo "Done\n";
2085 2085
 		
2086 2086
 		if ($globalDebug) echo "Owner Ireland: Download...";
2087
-		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
2087
+		update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv');
2088 2088
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
2089 2089
 			if ($globalDebug) echo "Add to DB...";
2090
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
2090
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI');
2091 2091
 		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2092 2092
 		if ($error != '') {
2093 2093
 			return $error;
2094 2094
 		} elseif ($globalDebug) echo "Done\n";
2095 2095
 		if ($globalDebug) echo "Owner Switzerland: Download...";
2096
-		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
2096
+		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv');
2097 2097
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
2098 2098
 			if ($globalDebug) echo "Add to DB...";
2099
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
2099
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB');
2100 2100
 		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2101 2101
 		if ($error != '') {
2102 2102
 			return $error;
2103 2103
 		} elseif ($globalDebug) echo "Done\n";
2104 2104
 		if ($globalDebug) echo "Owner Czech Republic: Download...";
2105
-		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
2105
+		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv');
2106 2106
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
2107 2107
 			if ($globalDebug) echo "Add to DB...";
2108
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
2108
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK');
2109 2109
 		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2110 2110
 		if ($error != '') {
2111 2111
 			return $error;
2112 2112
 		} elseif ($globalDebug) echo "Done\n";
2113 2113
 		if ($globalDebug) echo "Owner Australia: Download...";
2114
-		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
2114
+		update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv');
2115 2115
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
2116 2116
 			if ($globalDebug) echo "Add to DB...";
2117
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
2117
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH');
2118 2118
 		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2119 2119
 		if ($error != '') {
2120 2120
 			return $error;
2121 2121
 		} elseif ($globalDebug) echo "Done\n";
2122 2122
 		if ($globalDebug) echo "Owner Austria: Download...";
2123
-		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
2123
+		update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv');
2124 2124
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
2125 2125
 			if ($globalDebug) echo "Add to DB...";
2126
-			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
2126
+			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE');
2127 2127
 		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2128 2128
 		if ($error != '') {
2129 2129
 			return $error;
2130 2130
 		} elseif ($globalDebug) echo "Done\n";
2131 2131
 		if ($globalDebug) echo "Owner Chile: Download...";
2132
-		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
2132
+		update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv');
2133 2133
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
2134 2134
 			if ($globalDebug) echo "Add to DB...";
2135
-			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
2135
+			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC');
2136 2136
 		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2137 2137
 		if ($error != '') {
2138 2138
 			return $error;
2139 2139
 		} elseif ($globalDebug) echo "Done\n";
2140 2140
 		if ($globalDebug) echo "Owner Colombia: Download...";
2141
-		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
2141
+		update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv');
2142 2142
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
2143 2143
 			if ($globalDebug) echo "Add to DB...";
2144
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
2144
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ');
2145 2145
 		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2146 2146
 		if ($error != '') {
2147 2147
 			return $error;
2148 2148
 		} elseif ($globalDebug) echo "Done\n";
2149 2149
 		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
2150
-		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
2150
+		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv');
2151 2151
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
2152 2152
 			if ($globalDebug) echo "Add to DB...";
2153
-			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
2153
+			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7');
2154 2154
 		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2155 2155
 		if ($error != '') {
2156 2156
 			return $error;
2157 2157
 		} elseif ($globalDebug) echo "Done\n";
2158 2158
 		if ($globalDebug) echo "Owner Brazil: Download...";
2159
-		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
2159
+		update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv');
2160 2160
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
2161 2161
 			if ($globalDebug) echo "Add to DB...";
2162
-			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
2162
+			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP');
2163 2163
 		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2164 2164
 		if ($error != '') {
2165 2165
 			return $error;
2166 2166
 		} elseif ($globalDebug) echo "Done\n";
2167 2167
 		if ($globalDebug) echo "Owner Cayman Islands: Download...";
2168
-		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
2168
+		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv');
2169 2169
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
2170 2170
 			if ($globalDebug) echo "Add to DB...";
2171
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
2171
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP');
2172 2172
 		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2173 2173
 		if ($error != '') {
2174 2174
 			return $error;
2175 2175
 		} elseif ($globalDebug) echo "Done\n";
2176 2176
 		if ($globalDebug) echo "Owner Croatia: Download...";
2177
-		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
2177
+		update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv');
2178 2178
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
2179 2179
 			if ($globalDebug) echo "Add to DB...";
2180
-			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
2180
+			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A');
2181 2181
 		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2182 2182
 		if ($error != '') {
2183 2183
 			return $error;
2184 2184
 		} elseif ($globalDebug) echo "Done\n";
2185 2185
 		if ($globalDebug) echo "Owner Luxembourg: Download...";
2186
-		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
2186
+		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv');
2187 2187
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
2188 2188
 			if ($globalDebug) echo "Add to DB...";
2189
-			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
2189
+			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX');
2190 2190
 		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2191 2191
 		if ($error != '') {
2192 2192
 			return $error;
2193 2193
 		} elseif ($globalDebug) echo "Done\n";
2194 2194
 		if ($globalDebug) echo "Owner Maldives: Download...";
2195
-		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
2195
+		update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv');
2196 2196
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
2197 2197
 			if ($globalDebug) echo "Add to DB...";
2198
-			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
2198
+			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q');
2199 2199
 		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2200 2200
 		if ($error != '') {
2201 2201
 			return $error;
2202 2202
 		} elseif ($globalDebug) echo "Done\n";
2203 2203
 		if ($globalDebug) echo "Owner New Zealand: Download...";
2204
-		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
2204
+		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv');
2205 2205
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
2206 2206
 			if ($globalDebug) echo "Add to DB...";
2207
-			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
2207
+			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK');
2208 2208
 		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2209 2209
 		if ($error != '') {
2210 2210
 			return $error;
2211 2211
 		} elseif ($globalDebug) echo "Done\n";
2212 2212
 		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
2213
-		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
2213
+		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv');
2214 2214
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
2215 2215
 			if ($globalDebug) echo "Add to DB...";
2216
-			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
2216
+			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2');
2217 2217
 		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2218 2218
 		if ($error != '') {
2219 2219
 			return $error;
2220 2220
 		} elseif ($globalDebug) echo "Done\n";
2221 2221
 		if ($globalDebug) echo "Owner Slovakia: Download...";
2222
-		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
2222
+		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv');
2223 2223
 		if (file_exists($tmp_dir.'owner_om.csv')) {
2224 2224
 			if ($globalDebug) echo "Add to DB...";
2225
-			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
2225
+			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM');
2226 2226
 		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2227 2227
 		if ($error != '') {
2228 2228
 			return $error;
2229 2229
 		} elseif ($globalDebug) echo "Done\n";
2230 2230
 		if ($globalDebug) echo "Owner Ecuador: Download...";
2231
-		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
2231
+		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv');
2232 2232
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
2233 2233
 			if ($globalDebug) echo "Add to DB...";
2234
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
2234
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC');
2235 2235
 		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2236 2236
 		if ($error != '') {
2237 2237
 			return $error;
2238 2238
 		} elseif ($globalDebug) echo "Done\n";
2239 2239
 		if ($globalDebug) echo "Owner Iceland: Download...";
2240
-		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
2240
+		update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv');
2241 2241
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
2242 2242
 			if ($globalDebug) echo "Add to DB...";
2243
-			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
2243
+			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF');
2244 2244
 		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2245 2245
 		if ($error != '') {
2246 2246
 			return $error;
2247 2247
 		} elseif ($globalDebug) echo "Done\n";
2248 2248
 		if ($globalDebug) echo "Owner Isle of Man: Download...";
2249
-		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv');
2249
+		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv');
2250 2250
 		if (file_exists($tmp_dir.'owner_m.csv')) {
2251 2251
 			if ($globalDebug) echo "Add to DB...";
2252
-			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M');
2252
+			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M');
2253 2253
 		} else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2254 2254
 		if ($error != '') {
2255 2255
 			return $error;
2256 2256
 		} elseif ($globalDebug) echo "Done\n";
2257 2257
 		if ($globalMasterSource) {
2258 2258
 			if ($globalDebug) echo "ModeS Netherlands: Download...";
2259
-			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv');
2259
+			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv');
2260 2260
 			if (file_exists($tmp_dir.'owner_ph.csv')) {
2261 2261
 				if ($globalDebug) echo "Add to DB...";
2262
-				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH');
2262
+				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH');
2263 2263
 			} else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2264 2264
 			if ($error != '') {
2265 2265
 				return $error;
2266 2266
 			} elseif ($globalDebug) echo "Done\n";
2267 2267
 			if ($globalDebug) echo "ModeS Denmark: Download...";
2268
-			update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv');
2268
+			update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv');
2269 2269
 			if (file_exists($tmp_dir.'owner_oy.csv')) {
2270 2270
 				if ($globalDebug) echo "Add to DB...";
2271
-				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY');
2271
+				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY');
2272 2272
 			} else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2273 2273
 			if ($error != '') {
2274 2274
 				return $error;
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
 		global $tmp_dir, $globalDebug;
2282 2282
 		$error = '';
2283 2283
 		if ($globalDebug) echo "Translation : Download...";
2284
-		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
2284
+		update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip');
2285 2285
 		if (file_exists($tmp_dir.'translation.zip')) {
2286 2286
 			if ($globalDebug) echo "Unzip...";
2287 2287
 			update_db::unzip($tmp_dir.'translation.zip');
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
 	public static function update_translation_fam() {
2298 2298
 		global $tmp_dir, $globalDebug;
2299 2299
 		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
2300
-		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
2300
+		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz');
2301 2301
 		if (file_exists($tmp_dir.'translation.tsv.gz')) {
2302 2302
 			if ($globalDebug) echo "Gunzip...";
2303 2303
 			update_db::gunzip($tmp_dir.'translation.tsv.gz');
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
 	public static function update_ModeS_fam() {
2313 2313
 		global $tmp_dir, $globalDebug;
2314 2314
 		if ($globalDebug) echo "ModeS from FlightAirMap website : Download...";
2315
-		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz');
2315
+		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz');
2316 2316
 		if (file_exists($tmp_dir.'modes.tsv.gz')) {
2317 2317
 			if ($globalDebug) echo "Gunzip...";
2318 2318
 			update_db::gunzip($tmp_dir.'modes.tsv.gz');
@@ -2328,9 +2328,9 @@  discard block
 block discarded – undo
2328 2328
 		global $tmp_dir, $globalDebug, $globalOwner;
2329 2329
 		if ($globalDebug) echo "owner from FlightAirMap website : Download...";
2330 2330
 		if ($globalOwner === TRUE) {
2331
-			update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz');
2331
+			update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz');
2332 2332
 		} else {
2333
-			update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz');
2333
+			update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz');
2334 2334
 		}
2335 2335
 		if (file_exists($tmp_dir.'owners.tsv.gz')) {
2336 2336
 			if ($globalDebug) echo "Gunzip...";
@@ -2346,7 +2346,7 @@  discard block
 block discarded – undo
2346 2346
 	public static function update_routes_fam() {
2347 2347
 		global $tmp_dir, $globalDebug;
2348 2348
 		if ($globalDebug) echo "Routes from FlightAirMap website : Download...";
2349
-		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz');
2349
+		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz');
2350 2350
 		if (file_exists($tmp_dir.'routes.tsv.gz')) {
2351 2351
 			if ($globalDebug) echo "Gunzip...";
2352 2352
 			update_db::gunzip($tmp_dir.'routes.tsv.gz');
@@ -2360,13 +2360,13 @@  discard block
 block discarded – undo
2360 2360
 	}
2361 2361
 	public static function update_marine_identity_fam() {
2362 2362
 		global $tmp_dir, $globalDebug;
2363
-		update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5');
2363
+		update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5');
2364 2364
 		if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) {
2365
-			$marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5'));
2365
+			$marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5'));
2366 2366
 			$marine_identity_md5 = $marine_identity_md5_file[0];
2367 2367
 			if (!update_db::check_marine_identity_version($marine_identity_md5)) {
2368 2368
 				if ($globalDebug) echo "Marine identity from FlightAirMap website : Download...";
2369
-				update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz');
2369
+				update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz');
2370 2370
 				if (file_exists($tmp_dir.'marine_identity.tsv.gz')) {
2371 2371
 					if ($globalDebug) echo "Gunzip...";
2372 2372
 					update_db::gunzip($tmp_dir.'marine_identity.tsv.gz');
@@ -2386,13 +2386,13 @@  discard block
 block discarded – undo
2386 2386
 
2387 2387
 	public static function update_satellite_fam() {
2388 2388
 		global $tmp_dir, $globalDebug;
2389
-		update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5');
2389
+		update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5');
2390 2390
 		if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) {
2391
-			$satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5'));
2391
+			$satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5'));
2392 2392
 			$satellite_md5 = $satellite_md5_file[0];
2393 2393
 			if (!update_db::check_satellite_version($satellite_md5)) {
2394 2394
 				if ($globalDebug) echo "Satellite from FlightAirMap website : Download...";
2395
-				update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz');
2395
+				update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz');
2396 2396
 				if (file_exists($tmp_dir.'satellite.tsv.gz')) {
2397 2397
 					if ($globalDebug) echo "Gunzip...";
2398 2398
 					update_db::gunzip($tmp_dir.'satellite.tsv.gz');
@@ -2412,7 +2412,7 @@  discard block
 block discarded – undo
2412 2412
 	public static function update_banned_fam() {
2413 2413
 		global $tmp_dir, $globalDebug;
2414 2414
 		if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download...";
2415
-		update_db::download('http://data.flightairmap.fr/data/ban-eu.csv',$tmp_dir.'ban_eu.csv');
2415
+		update_db::download('http://data.flightairmap.fr/data/ban-eu.csv', $tmp_dir.'ban_eu.csv');
2416 2416
 		if (file_exists($tmp_dir.'ban_eu.csv')) {
2417 2417
 			//if ($globalDebug) echo "Gunzip...";
2418 2418
 			//update_db::gunzip($tmp_dir.'ban_ue.csv');
@@ -2431,18 +2431,18 @@  discard block
 block discarded – undo
2431 2431
 		$error = '';
2432 2432
 		if ($globalDebug) echo "Airspace from FlightAirMap website : Download...";
2433 2433
 		if ($globalDBdriver == 'mysql') {
2434
-			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2434
+			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
2435 2435
 		} else {
2436
-			update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2436
+			update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
2437 2437
 		}
2438 2438
 		if (file_exists($tmp_dir.'airspace.sql.gz.md5')) {
2439
-			$airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
2439
+			$airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
2440 2440
 			$airspace_md5 = $airspace_md5_file[0];
2441 2441
 			if (!update_db::check_airspace_version($airspace_md5)) {
2442 2442
 				if ($globalDBdriver == 'mysql') {
2443
-					update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz');
2443
+					update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz');
2444 2444
 				} else {
2445
-					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz');
2445
+					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz');
2446 2446
 				}
2447 2447
 				if (file_exists($tmp_dir.'airspace.sql.gz')) {
2448 2448
 					if ($globalDebug) echo "Gunzip...";
@@ -2454,7 +2454,7 @@  discard block
 block discarded – undo
2454 2454
 						try {
2455 2455
 							$sth = $Connection->db->prepare($query);
2456 2456
     	    	    					$sth->execute();
2457
-			            		} catch(PDOException $e) {
2457
+			            		} catch (PDOException $e) {
2458 2458
 							return "error : ".$e->getMessage();
2459 2459
 		            			}
2460 2460
 		    			}
@@ -2473,15 +2473,15 @@  discard block
 block discarded – undo
2473 2473
 		global $tmp_dir, $globalDebug, $globalGeoidSource;
2474 2474
 		$error = '';
2475 2475
 		if ($globalDebug) echo "Geoid from FlightAirMap website : Download...";
2476
-		update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5');
2476
+		update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5');
2477 2477
 		if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) {
2478
-			$geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5'));
2478
+			$geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5'));
2479 2479
 			$geoid_md5 = $geoid_md5_file[0];
2480 2480
 			if (!update_db::check_geoid_version($geoid_md5)) {
2481
-				update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz');
2481
+				update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz');
2482 2482
 				if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) {
2483 2483
 					if ($globalDebug) echo "Gunzip...";
2484
-					update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm');
2484
+					update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm');
2485 2485
 					if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) {
2486 2486
 						update_db::insert_geoid_version($geoid_md5);
2487 2487
 					}
@@ -2497,15 +2497,15 @@  discard block
 block discarded – undo
2497 2497
 	public static function update_tle() {
2498 2498
 		global $tmp_dir, $globalDebug;
2499 2499
 		if ($globalDebug) echo "Download TLE : Download...";
2500
-		$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',
2501
-		'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',
2502
-		'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt');
2500
+		$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',
2501
+		'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',
2502
+		'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt', 'visual.txt', 'sarsat.txt', 'argos.txt', 'ses.txt', 'iridium-NEXT.txt', 'beidou.txt');
2503 2503
 		foreach ($alltle as $filename) {
2504 2504
 			if ($globalDebug) echo "downloading ".$filename.'...';
2505
-			update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename);
2505
+			update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename);
2506 2506
 			if (file_exists($tmp_dir.$filename)) {
2507 2507
 				if ($globalDebug) echo "Add to DB ".$filename."...";
2508
-				$error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename));
2508
+				$error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename));
2509 2509
 			} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
2510 2510
 			if ($error != '') {
2511 2511
 				echo $error."\n";
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 	public static function update_ucsdb() {
2518 2518
 		global $tmp_dir, $globalDebug;
2519 2519
 		if ($globalDebug) echo "Download UCS DB : Download...";
2520
-		update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt');
2520
+		update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt', $tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt');
2521 2521
 		if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) {
2522 2522
 			if ($globalDebug) echo "Add to DB...";
2523 2523
 			$error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt');
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
 	public static function update_celestrak() {
2532 2532
 		global $tmp_dir, $globalDebug;
2533 2533
 		if ($globalDebug) echo "Download Celestrak DB : Download...";
2534
-		update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt');
2534
+		update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt');
2535 2535
 		if (file_exists($tmp_dir.'satcat.txt')) {
2536 2536
 			if ($globalDebug) echo "Add to DB...";
2537 2537
 			$error = update_db::satellite_celestrak($tmp_dir.'satcat.txt');
@@ -2546,32 +2546,32 @@  discard block
 block discarded – undo
2546 2546
 		global $tmp_dir, $globalDebug;
2547 2547
 		$error = '';
2548 2548
 		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
2549
-		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum');
2549
+		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum');
2550 2550
 		if (file_exists($tmp_dir.'models.md5sum')) {
2551 2551
 			if ($globalDebug) echo "Check files...\n";
2552 2552
 			$newmodelsdb = array();
2553
-			if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) {
2554
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2553
+			if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) {
2554
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2555 2555
 					$model = trim($row[2]);
2556 2556
 					$newmodelsdb[$model] = trim($row[0]);
2557 2557
 				}
2558 2558
 			}
2559 2559
 			$modelsdb = array();
2560 2560
 			if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) {
2561
-				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) {
2562
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2561
+				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) {
2562
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2563 2563
 						$model = trim($row[2]);
2564 2564
 						$modelsdb[$model] = trim($row[0]);
2565 2565
 					}
2566 2566
 				}
2567 2567
 			}
2568
-			$diff = array_diff($newmodelsdb,$modelsdb);
2568
+			$diff = array_diff($newmodelsdb, $modelsdb);
2569 2569
 			foreach ($diff as $key => $value) {
2570 2570
 				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
2571
-				update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key);
2571
+				update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key);
2572 2572
 				
2573 2573
 			}
2574
-			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum');
2574
+			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum');
2575 2575
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2576 2576
 		if ($error != '') {
2577 2577
 			return $error;
@@ -2583,32 +2583,32 @@  discard block
 block discarded – undo
2583 2583
 		global $tmp_dir, $globalDebug;
2584 2584
 		$error = '';
2585 2585
 		if ($globalDebug) echo "Space models from FlightAirMap website : Download...";
2586
-		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum');
2586
+		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum');
2587 2587
 		if (file_exists($tmp_dir.'space_models.md5sum')) {
2588 2588
 			if ($globalDebug) echo "Check files...\n";
2589 2589
 			$newmodelsdb = array();
2590
-			if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) {
2591
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2590
+			if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) {
2591
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2592 2592
 					$model = trim($row[2]);
2593 2593
 					$newmodelsdb[$model] = trim($row[0]);
2594 2594
 				}
2595 2595
 			}
2596 2596
 			$modelsdb = array();
2597 2597
 			if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) {
2598
-				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) {
2599
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2598
+				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) {
2599
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2600 2600
 						$model = trim($row[2]);
2601 2601
 						$modelsdb[$model] = trim($row[0]);
2602 2602
 					}
2603 2603
 				}
2604 2604
 			}
2605
-			$diff = array_diff($newmodelsdb,$modelsdb);
2605
+			$diff = array_diff($newmodelsdb, $modelsdb);
2606 2606
 			foreach ($diff as $key => $value) {
2607 2607
 				if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n";
2608
-				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key);
2608
+				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key);
2609 2609
 				
2610 2610
 			}
2611
-			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum');
2611
+			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum');
2612 2612
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2613 2613
 		if ($error != '') {
2614 2614
 			return $error;
@@ -2620,32 +2620,32 @@  discard block
 block discarded – undo
2620 2620
 		global $tmp_dir, $globalDebug;
2621 2621
 		$error = '';
2622 2622
 		if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download...";
2623
-		update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum');
2623
+		update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum');
2624 2624
 		if (file_exists($tmp_dir.'vehicules_models.md5sum')) {
2625 2625
 			if ($globalDebug) echo "Check files...\n";
2626 2626
 			$newmodelsdb = array();
2627
-			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) {
2628
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2627
+			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) {
2628
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2629 2629
 					$model = trim($row[2]);
2630 2630
 					$newmodelsdb[$model] = trim($row[0]);
2631 2631
 				}
2632 2632
 			}
2633 2633
 			$modelsdb = array();
2634 2634
 			if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) {
2635
-				if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) {
2636
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2635
+				if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) {
2636
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2637 2637
 						$model = trim($row[2]);
2638 2638
 						$modelsdb[$model] = trim($row[0]);
2639 2639
 					}
2640 2640
 				}
2641 2641
 			}
2642
-			$diff = array_diff($newmodelsdb,$modelsdb);
2642
+			$diff = array_diff($newmodelsdb, $modelsdb);
2643 2643
 			foreach ($diff as $key => $value) {
2644 2644
 				if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n";
2645
-				update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key);
2645
+				update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key);
2646 2646
 				
2647 2647
 			}
2648
-			update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
2648
+			update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
2649 2649
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2650 2650
 		if ($error != '') {
2651 2651
 			return $error;
@@ -2668,8 +2668,8 @@  discard block
 block discarded – undo
2668 2668
 		*/
2669 2669
 		if (file_exists($tmp_dir.'aircrafts.html')) {
2670 2670
 		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2671
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
2672
-		    $result = fread($fh,100000000);
2671
+		    $fh = fopen($tmp_dir.'aircrafts.html', "r");
2672
+		    $result = fread($fh, 100000000);
2673 2673
 		    //echo $result;
2674 2674
 		    //var_dump(str_get_html($result));
2675 2675
 		    //print_r(self::table2array($result));
@@ -2687,23 +2687,23 @@  discard block
 block discarded – undo
2687 2687
 			$Connection = new Connection();
2688 2688
 			$sth = $Connection->db->prepare($query);
2689 2689
                         $sth->execute();
2690
-                } catch(PDOException $e) {
2690
+                } catch (PDOException $e) {
2691 2691
                         return "error : ".$e->getMessage();
2692 2692
                 }
2693 2693
 
2694 2694
 		$error = '';
2695 2695
 		if ($globalDebug) echo "Notam : Download...";
2696
-		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
2696
+		update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss');
2697 2697
 		if (file_exists($tmp_dir.'notam.rss')) {
2698
-			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
2698
+			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true);
2699 2699
 			foreach ($notams['channel']['item'] as $notam) {
2700
-				$title = explode(':',$notam['title']);
2700
+				$title = explode(':', $notam['title']);
2701 2701
 				$data['ref'] = trim($title[0]);
2702 2702
 				unset($title[0]);
2703
-				$data['title'] = trim(implode(':',$title));
2704
-				$description = strip_tags($notam['description'],'<pre>');
2705
-				preg_match(':^(.*?)<pre>:',$description,$match);
2706
-				$q = explode('/',$match[1]);
2703
+				$data['title'] = trim(implode(':', $title));
2704
+				$description = strip_tags($notam['description'], '<pre>');
2705
+				preg_match(':^(.*?)<pre>:', $description, $match);
2706
+				$q = explode('/', $match[1]);
2707 2707
 				$data['fir'] = $q[0];
2708 2708
 				$data['code'] = $q[1];
2709 2709
 				$ifrvfr = $q[2];
@@ -2719,30 +2719,30 @@  discard block
 block discarded – undo
2719 2719
 				$data['lower_limit'] = $q[5];
2720 2720
 				$data['upper_limit'] = $q[6];
2721 2721
 				$latlonrad = $q[7];
2722
-				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
2723
-				$latitude = $Common->convertDec($las,'latitude');
2724
-				$longitude = $Common->convertDec($lns,'longitude');
2722
+				sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius);
2723
+				$latitude = $Common->convertDec($las, 'latitude');
2724
+				$longitude = $Common->convertDec($lns, 'longitude');
2725 2725
 				if ($lac == 'S') $latitude = '-'.$latitude;
2726 2726
 				if ($lnc == 'W') $longitude = '-'.$longitude;
2727 2727
 				$data['center_latitude'] = $latitude;
2728 2728
 				$data['center_longitude'] = $longitude;
2729 2729
 				$data['radius'] = intval($radius);
2730 2730
 				
2731
-				preg_match(':<pre>(.*?)</pre>:',$description,$match);
2731
+				preg_match(':<pre>(.*?)</pre>:', $description, $match);
2732 2732
 				$data['text'] = $match[1];
2733
-				preg_match(':</pre>(.*?)$:',$description,$match);
2733
+				preg_match(':</pre>(.*?)$:', $description, $match);
2734 2734
 				$fromto = $match[1];
2735
-				preg_match('#FROM:(.*?)TO:#',$fromto,$match);
2735
+				preg_match('#FROM:(.*?)TO:#', $fromto, $match);
2736 2736
 				$fromall = trim($match[1]);
2737
-				preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match);
2737
+				preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match);
2738 2738
 				$from = trim($match[1]);
2739
-				$data['date_begin'] = date("Y-m-d H:i:s",strtotime($from));
2740
-				preg_match('#TO:(.*?)$#',$fromto,$match);
2739
+				$data['date_begin'] = date("Y-m-d H:i:s", strtotime($from));
2740
+				preg_match('#TO:(.*?)$#', $fromto, $match);
2741 2741
 				$toall = trim($match[1]);
2742
-				if (!preg_match(':Permanent:',$toall)) {
2743
-					preg_match('#^(.*?) \((.*?)\)#',$toall,$match);
2742
+				if (!preg_match(':Permanent:', $toall)) {
2743
+					preg_match('#^(.*?) \((.*?)\)#', $toall, $match);
2744 2744
 					$to = trim($match[1]);
2745
-					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2745
+					$data['date_end'] = date("Y-m-d H:i:s", strtotime($to));
2746 2746
 					$data['permanent'] = 0;
2747 2747
 				} else {
2748 2748
 				    $data['date_end'] = NULL;
@@ -2750,7 +2750,7 @@  discard block
 block discarded – undo
2750 2750
 				}
2751 2751
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2752 2752
 				$NOTAM = new NOTAM();
2753
-				$NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
2753
+				$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']);
2754 2754
 				unset($data);
2755 2755
 			} 
2756 2756
 		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
@@ -2773,16 +2773,16 @@  discard block
 block discarded – undo
2773 2773
 				$Connection = new Connection();
2774 2774
 				$sth = $Connection->db->prepare($query);
2775 2775
 				$sth->execute();
2776
-			} catch(PDOException $e) {
2776
+			} catch (PDOException $e) {
2777 2777
 				return "error : ".$e->getMessage();
2778 2778
 			}
2779 2779
 		}
2780 2780
 		$Common = new Common();
2781 2781
 		$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json');
2782
-		$airspace_json = json_decode($airspace_lst,true);
2782
+		$airspace_json = json_decode($airspace_lst, true);
2783 2783
 		foreach ($airspace_json['records'] as $airspace) {
2784 2784
 			if ($globalDebug) echo $airspace['name']."...\n";
2785
-			update_db::download($airspace['uri'],$tmp_dir.$airspace['name']);
2785
+			update_db::download($airspace['uri'], $tmp_dir.$airspace['name']);
2786 2786
 			if (file_exists($tmp_dir.$airspace['name'])) {
2787 2787
 				file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name'])));
2788 2788
 				//system('recode l9..utf8 '.$tmp_dir.$airspace['name']);
@@ -2804,7 +2804,7 @@  discard block
 block discarded – undo
2804 2804
 				$Connection = new Connection();
2805 2805
 				$sth = $Connection->db->prepare($query);
2806 2806
 				$sth->execute(array(':new' => $new, ':old' => $old));
2807
-			} catch(PDOException $e) {
2807
+			} catch (PDOException $e) {
2808 2808
 				return "error : ".$e->getMessage();
2809 2809
 			}
2810 2810
 		}
@@ -2821,7 +2821,7 @@  discard block
 block discarded – undo
2821 2821
 			$Connection = new Connection();
2822 2822
 			$sth = $Connection->db->prepare($query);
2823 2823
                         $sth->execute();
2824
-                } catch(PDOException $e) {
2824
+                } catch (PDOException $e) {
2825 2825
                         return "error : ".$e->getMessage();
2826 2826
                 }
2827 2827
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2836,7 +2836,7 @@  discard block
 block discarded – undo
2836 2836
 			$Connection = new Connection();
2837 2837
 			$sth = $Connection->db->prepare($query);
2838 2838
                         $sth->execute();
2839
-                } catch(PDOException $e) {
2839
+                } catch (PDOException $e) {
2840 2840
                         return "error : ".$e->getMessage();
2841 2841
                 }
2842 2842
 	}
@@ -2847,7 +2847,7 @@  discard block
 block discarded – undo
2847 2847
 			$Connection = new Connection();
2848 2848
 			$sth = $Connection->db->prepare($query);
2849 2849
                         $sth->execute(array(':version' => $version));
2850
-                } catch(PDOException $e) {
2850
+                } catch (PDOException $e) {
2851 2851
                         return "error : ".$e->getMessage();
2852 2852
                 }
2853 2853
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2861,7 +2861,7 @@  discard block
 block discarded – undo
2861 2861
 			$Connection = new Connection();
2862 2862
 			$sth = $Connection->db->prepare($query);
2863 2863
                         $sth->execute(array(':version' => $version));
2864
-                } catch(PDOException $e) {
2864
+                } catch (PDOException $e) {
2865 2865
                         return "error : ".$e->getMessage();
2866 2866
                 }
2867 2867
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2875,7 +2875,7 @@  discard block
 block discarded – undo
2875 2875
 			$Connection = new Connection();
2876 2876
 			$sth = $Connection->db->prepare($query);
2877 2877
 			$sth->execute(array(':version' => $version));
2878
-		} catch(PDOException $e) {
2878
+		} catch (PDOException $e) {
2879 2879
 			return "error : ".$e->getMessage();
2880 2880
 		}
2881 2881
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2889,7 +2889,7 @@  discard block
 block discarded – undo
2889 2889
 			$Connection = new Connection();
2890 2890
 			$sth = $Connection->db->prepare($query);
2891 2891
 			$sth->execute(array(':version' => $version));
2892
-		} catch(PDOException $e) {
2892
+		} catch (PDOException $e) {
2893 2893
 			return "error : ".$e->getMessage();
2894 2894
 		}
2895 2895
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
 			$Connection = new Connection();
2906 2906
 			$sth = $Connection->db->prepare($query);
2907 2907
 			$sth->execute(array(':version' => $version));
2908
-		} catch(PDOException $e) {
2908
+		} catch (PDOException $e) {
2909 2909
 			return "error : ".$e->getMessage();
2910 2910
 		}
2911 2911
 	}
@@ -2917,7 +2917,7 @@  discard block
 block discarded – undo
2917 2917
 			$Connection = new Connection();
2918 2918
 			$sth = $Connection->db->prepare($query);
2919 2919
                         $sth->execute(array(':version' => $version));
2920
-                } catch(PDOException $e) {
2920
+                } catch (PDOException $e) {
2921 2921
                         return "error : ".$e->getMessage();
2922 2922
                 }
2923 2923
 	}
@@ -2929,7 +2929,7 @@  discard block
 block discarded – undo
2929 2929
 			$Connection = new Connection();
2930 2930
 			$sth = $Connection->db->prepare($query);
2931 2931
 			$sth->execute(array(':version' => $version));
2932
-		} catch(PDOException $e) {
2932
+		} catch (PDOException $e) {
2933 2933
 			return "error : ".$e->getMessage();
2934 2934
 		}
2935 2935
 	}
@@ -2941,7 +2941,7 @@  discard block
 block discarded – undo
2941 2941
 			$Connection = new Connection();
2942 2942
 			$sth = $Connection->db->prepare($query);
2943 2943
 			$sth->execute(array(':version' => $version));
2944
-		} catch(PDOException $e) {
2944
+		} catch (PDOException $e) {
2945 2945
 			return "error : ".$e->getMessage();
2946 2946
 		}
2947 2947
 	}
@@ -2957,7 +2957,7 @@  discard block
 block discarded – undo
2957 2957
 			$Connection = new Connection();
2958 2958
 			$sth = $Connection->db->prepare($query);
2959 2959
                         $sth->execute();
2960
-                } catch(PDOException $e) {
2960
+                } catch (PDOException $e) {
2961 2961
                         return "error : ".$e->getMessage();
2962 2962
                 }
2963 2963
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2972,7 +2972,7 @@  discard block
 block discarded – undo
2972 2972
 			$Connection = new Connection();
2973 2973
 			$sth = $Connection->db->prepare($query);
2974 2974
                         $sth->execute();
2975
-                } catch(PDOException $e) {
2975
+                } catch (PDOException $e) {
2976 2976
                         return "error : ".$e->getMessage();
2977 2977
                 }
2978 2978
 	}
@@ -2988,7 +2988,7 @@  discard block
 block discarded – undo
2988 2988
 			$Connection = new Connection();
2989 2989
 			$sth = $Connection->db->prepare($query);
2990 2990
                         $sth->execute();
2991
-                } catch(PDOException $e) {
2991
+                } catch (PDOException $e) {
2992 2992
                         return "error : ".$e->getMessage();
2993 2993
                 }
2994 2994
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
 			$Connection = new Connection();
3004 3004
 			$sth = $Connection->db->prepare($query);
3005 3005
                         $sth->execute();
3006
-                } catch(PDOException $e) {
3006
+                } catch (PDOException $e) {
3007 3007
                         return "error : ".$e->getMessage();
3008 3008
                 }
3009 3009
 	}
@@ -3019,7 +3019,7 @@  discard block
 block discarded – undo
3019 3019
 			$Connection = new Connection();
3020 3020
 			$sth = $Connection->db->prepare($query);
3021 3021
                         $sth->execute();
3022
-                } catch(PDOException $e) {
3022
+                } catch (PDOException $e) {
3023 3023
                         return "error : ".$e->getMessage();
3024 3024
                 }
3025 3025
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
 			$Connection = new Connection();
3035 3035
 			$sth = $Connection->db->prepare($query);
3036 3036
                         $sth->execute();
3037
-                } catch(PDOException $e) {
3037
+                } catch (PDOException $e) {
3038 3038
                         return "error : ".$e->getMessage();
3039 3039
                 }
3040 3040
 	}
@@ -3050,7 +3050,7 @@  discard block
 block discarded – undo
3050 3050
 			$Connection = new Connection();
3051 3051
 			$sth = $Connection->db->prepare($query);
3052 3052
                         $sth->execute();
3053
-                } catch(PDOException $e) {
3053
+                } catch (PDOException $e) {
3054 3054
                         return "error : ".$e->getMessage();
3055 3055
                 }
3056 3056
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3065,7 +3065,7 @@  discard block
 block discarded – undo
3065 3065
 			$Connection = new Connection();
3066 3066
 			$sth = $Connection->db->prepare($query);
3067 3067
                         $sth->execute();
3068
-                } catch(PDOException $e) {
3068
+                } catch (PDOException $e) {
3069 3069
                         return "error : ".$e->getMessage();
3070 3070
                 }
3071 3071
 	}
@@ -3080,7 +3080,7 @@  discard block
 block discarded – undo
3080 3080
 			$Connection = new Connection();
3081 3081
 			$sth = $Connection->db->prepare($query);
3082 3082
                         $sth->execute();
3083
-                } catch(PDOException $e) {
3083
+                } catch (PDOException $e) {
3084 3084
                         return "error : ".$e->getMessage();
3085 3085
                 }
3086 3086
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3095,7 +3095,7 @@  discard block
 block discarded – undo
3095 3095
 			$Connection = new Connection();
3096 3096
 			$sth = $Connection->db->prepare($query);
3097 3097
 			$sth->execute();
3098
-		} catch(PDOException $e) {
3098
+		} catch (PDOException $e) {
3099 3099
 			return "error : ".$e->getMessage();
3100 3100
 		}
3101 3101
 	}
@@ -3111,7 +3111,7 @@  discard block
 block discarded – undo
3111 3111
 			$Connection = new Connection();
3112 3112
 			$sth = $Connection->db->prepare($query);
3113 3113
 			$sth->execute();
3114
-		} catch(PDOException $e) {
3114
+		} catch (PDOException $e) {
3115 3115
 			return "error : ".$e->getMessage();
3116 3116
 		}
3117 3117
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3126,7 +3126,7 @@  discard block
 block discarded – undo
3126 3126
 			$Connection = new Connection();
3127 3127
 			$sth = $Connection->db->prepare($query);
3128 3128
 			$sth->execute();
3129
-		} catch(PDOException $e) {
3129
+		} catch (PDOException $e) {
3130 3130
 			return "error : ".$e->getMessage();
3131 3131
 		}
3132 3132
 	}
@@ -3142,7 +3142,7 @@  discard block
 block discarded – undo
3142 3142
 			$Connection = new Connection();
3143 3143
 			$sth = $Connection->db->prepare($query);
3144 3144
 			$sth->execute();
3145
-		} catch(PDOException $e) {
3145
+		} catch (PDOException $e) {
3146 3146
 			return "error : ".$e->getMessage();
3147 3147
 		}
3148 3148
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3157,7 +3157,7 @@  discard block
 block discarded – undo
3157 3157
 			$Connection = new Connection();
3158 3158
 			$sth = $Connection->db->prepare($query);
3159 3159
 			$sth->execute();
3160
-		} catch(PDOException $e) {
3160
+		} catch (PDOException $e) {
3161 3161
 			return "error : ".$e->getMessage();
3162 3162
 		}
3163 3163
 	}
@@ -3173,7 +3173,7 @@  discard block
 block discarded – undo
3173 3173
 			$Connection = new Connection();
3174 3174
 			$sth = $Connection->db->prepare($query);
3175 3175
 			$sth->execute();
3176
-		} catch(PDOException $e) {
3176
+		} catch (PDOException $e) {
3177 3177
 			return "error : ".$e->getMessage();
3178 3178
 		}
3179 3179
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3188,7 +3188,7 @@  discard block
 block discarded – undo
3188 3188
 			$Connection = new Connection();
3189 3189
 			$sth = $Connection->db->prepare($query);
3190 3190
 			$sth->execute();
3191
-		} catch(PDOException $e) {
3191
+		} catch (PDOException $e) {
3192 3192
 			return "error : ".$e->getMessage();
3193 3193
 		}
3194 3194
 	}
@@ -3204,7 +3204,7 @@  discard block
 block discarded – undo
3204 3204
 			$Connection = new Connection();
3205 3205
 			$sth = $Connection->db->prepare($query);
3206 3206
 			$sth->execute();
3207
-		} catch(PDOException $e) {
3207
+		} catch (PDOException $e) {
3208 3208
 			return "error : ".$e->getMessage();
3209 3209
 		}
3210 3210
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3223,7 +3223,7 @@  discard block
 block discarded – undo
3223 3223
 			$Connection = new Connection();
3224 3224
 			$sth = $Connection->db->prepare($query);
3225 3225
 			$sth->execute();
3226
-		} catch(PDOException $e) {
3226
+		} catch (PDOException $e) {
3227 3227
 			return "error : ".$e->getMessage();
3228 3228
 		}
3229 3229
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3238,7 +3238,7 @@  discard block
 block discarded – undo
3238 3238
 			$Connection = new Connection();
3239 3239
 			$sth = $Connection->db->prepare($query);
3240 3240
 			$sth->execute();
3241
-		} catch(PDOException $e) {
3241
+		} catch (PDOException $e) {
3242 3242
 			return "error : ".$e->getMessage();
3243 3243
 		}
3244 3244
 	}
@@ -3250,7 +3250,7 @@  discard block
 block discarded – undo
3250 3250
 			$Connection = new Connection();
3251 3251
 			$sth = $Connection->db->prepare($query);
3252 3252
 			$sth->execute();
3253
-		} catch(PDOException $e) {
3253
+		} catch (PDOException $e) {
3254 3254
 			return "error : ".$e->getMessage();
3255 3255
 		}
3256 3256
 	}
@@ -3266,7 +3266,7 @@  discard block
 block discarded – undo
3266 3266
 			$Connection = new Connection();
3267 3267
 			$sth = $Connection->db->prepare($query);
3268 3268
                         $sth->execute();
3269
-                } catch(PDOException $e) {
3269
+                } catch (PDOException $e) {
3270 3270
                         return "error : ".$e->getMessage();
3271 3271
                 }
3272 3272
 	}
@@ -3281,7 +3281,7 @@  discard block
 block discarded – undo
3281 3281
 			$Connection = new Connection();
3282 3282
 			$sth = $Connection->db->prepare($query);
3283 3283
                         $sth->execute();
3284
-                } catch(PDOException $e) {
3284
+                } catch (PDOException $e) {
3285 3285
                         return "error : ".$e->getMessage();
3286 3286
                 }
3287 3287
 	}
Please login to merge, or discard this patch.