Completed
Push — master ( ba7640...942f65 )
by Yannick
07:46
created
install/class.update_db.php 1 patch
Indentation   +462 added lines, -462 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
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -978,10 +978,10 @@  discard block
 block discarded – undo
978 978
 		try {
979 979
 			$Connection = new Connection();
980 980
 			$sth = $Connection->db->prepare($query);
981
-                        $sth->execute(array(':source' => 'website_fam'));
982
-                } catch(PDOException $e) {
983
-                        return "error : ".$e->getMessage();
984
-                }
981
+						$sth->execute(array(':source' => 'website_fam'));
982
+				} catch(PDOException $e) {
983
+						return "error : ".$e->getMessage();
984
+				}
985 985
 
986 986
 		
987 987
 		//update_db::unzip($out_file);
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 			//$Connection->db->commit();
1011 1011
 		}
1012 1012
 		return '';
1013
-        }
1013
+		}
1014 1014
 
1015 1015
 	/*
1016 1016
 	* This function use FAA public data.
@@ -1022,19 +1022,19 @@  discard block
 block discarded – undo
1022 1022
 		try {
1023 1023
 			$Connection = new Connection();
1024 1024
 			$sth = $Connection->db->prepare($query);
1025
-                        $sth->execute(array(':source' => 'website_faa'));
1026
-                } catch(PDOException $e) {
1027
-                        return "error : ".$e->getMessage();
1028
-                }
1025
+						$sth->execute(array(':source' => 'website_faa'));
1026
+				} catch(PDOException $e) {
1027
+						return "error : ".$e->getMessage();
1028
+				}
1029 1029
 
1030 1030
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source";
1031 1031
 		try {
1032 1032
 			$Connection = new Connection();
1033 1033
 			$sth = $Connection->db->prepare($query);
1034
-                        $sth->execute(array(':source' => 'website_faa'));
1035
-                } catch(PDOException $e) {
1036
-                        return "error : ".$e->getMessage();
1037
-                }
1034
+						$sth->execute(array(':source' => 'website_faa'));
1035
+				} catch(PDOException $e) {
1036
+						return "error : ".$e->getMessage();
1037
+				}
1038 1038
 
1039 1039
 		$delimiter = ",";
1040 1040
 		$mfr = array();
@@ -1110,17 +1110,17 @@  discard block
 block discarded – undo
1110 1110
 		}
1111 1111
 		print_r($mfr);
1112 1112
 		return '';
1113
-        }
1113
+		}
1114 1114
 	public static function modes_fam() {
1115 1115
 		global $tmp_dir, $globalTransaction;
1116 1116
 		$query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source";
1117 1117
 		try {
1118 1118
 			$Connection = new Connection();
1119 1119
 			$sth = $Connection->db->prepare($query);
1120
-                        $sth->execute(array(':source' => 'website_fam'));
1121
-                } catch(PDOException $e) {
1122
-                        return "error : ".$e->getMessage();
1123
-                }
1120
+						$sth->execute(array(':source' => 'website_fam'));
1121
+				} catch(PDOException $e) {
1122
+						return "error : ".$e->getMessage();
1123
+				}
1124 1124
 
1125 1125
 		
1126 1126
 		//update_db::unzip($out_file);
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 			if ($globalTransaction) $Connection->db->commit();
1151 1151
 		}
1152 1152
 		return '';
1153
-        }
1153
+		}
1154 1154
         
1155 1155
 	public static function owner_fam() {
1156 1156
 		global $tmp_dir, $globalTransaction;
@@ -1158,10 +1158,10 @@  discard block
 block discarded – undo
1158 1158
 		try {
1159 1159
 			$Connection = new Connection();
1160 1160
 			$sth = $Connection->db->prepare($query);
1161
-                        $sth->execute(array(':source' => 'website_fam'));
1162
-                } catch(PDOException $e) {
1163
-                        return "error : ".$e->getMessage();
1164
-                }
1161
+						$sth->execute(array(':source' => 'website_fam'));
1162
+				} catch(PDOException $e) {
1163
+						return "error : ".$e->getMessage();
1164
+				}
1165 1165
 
1166 1166
 		$delimiter = "\t";
1167 1167
 		$Connection = new Connection();
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
 			if ($globalTransaction) $Connection->db->commit();
1188 1188
 		}
1189 1189
 		return '';
1190
-        }
1190
+		}
1191 1191
 
1192 1192
 	public static function routes_fam() {
1193 1193
 		global $tmp_dir, $globalTransaction;
@@ -1195,10 +1195,10 @@  discard block
 block discarded – undo
1195 1195
 		try {
1196 1196
 			$Connection = new Connection();
1197 1197
 			$sth = $Connection->db->prepare($query);
1198
-                        $sth->execute(array(':source' => 'website_fam'));
1199
-                } catch(PDOException $e) {
1200
-                        return "error : ".$e->getMessage();
1201
-                }
1198
+						$sth->execute(array(':source' => 'website_fam'));
1199
+				} catch(PDOException $e) {
1200
+						return "error : ".$e->getMessage();
1201
+				}
1202 1202
 
1203 1203
 		
1204 1204
 		//update_db::unzip($out_file);
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			if ($globalTransaction) $Connection->db->commit();
1228 1228
 		}
1229 1229
 		return '';
1230
-        }
1230
+		}
1231 1231
 
1232 1232
 	public static function marine_identity_fam() {
1233 1233
 		global $tmp_dir, $globalTransaction;
@@ -1235,10 +1235,10 @@  discard block
 block discarded – undo
1235 1235
 		try {
1236 1236
 			$Connection = new Connection();
1237 1237
 			$sth = $Connection->db->prepare($query);
1238
-                        $sth->execute();
1239
-                } catch(PDOException $e) {
1240
-                        return "error : ".$e->getMessage();
1241
-                }
1238
+						$sth->execute();
1239
+				} catch(PDOException $e) {
1240
+						return "error : ".$e->getMessage();
1241
+				}
1242 1242
 
1243 1243
 		
1244 1244
 		//update_db::unzip($out_file);
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
 			if ($globalTransaction) $Connection->db->commit();
1269 1269
 		}
1270 1270
 		return '';
1271
-        }
1271
+		}
1272 1272
 
1273 1273
 	public static function banned_fam() {
1274 1274
 		global $tmp_dir, $globalTransaction;
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 			if ($globalTransaction) $Connection->db->commit();
1303 1303
 		}
1304 1304
 		return '';
1305
-        }
1305
+		}
1306 1306
 
1307 1307
 	public static function tle($filename,$tletype) {
1308 1308
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1313,10 +1313,10 @@  discard block
 block discarded – undo
1313 1313
 		try {
1314 1314
 			$Connection = new Connection();
1315 1315
 			$sth = $Connection->db->prepare($query);
1316
-                        $sth->execute(array(':source' => $filename));
1317
-                } catch(PDOException $e) {
1318
-                        return "error : ".$e->getMessage();
1319
-                }
1316
+						$sth->execute(array(':source' => $filename));
1317
+				} catch(PDOException $e) {
1318
+						return "error : ".$e->getMessage();
1319
+				}
1320 1320
 		
1321 1321
 		$Connection = new Connection();
1322 1322
 		if (($handle = fopen($filename, 'r')) !== FALSE)
@@ -1351,54 +1351,54 @@  discard block
 block discarded – undo
1351 1351
 			//$Connection->db->commit();
1352 1352
 		}
1353 1353
 		return '';
1354
-        }
1354
+		}
1355 1355
 
1356 1356
 	/**
1357
-        * Convert a HTML table to an array
1358
-        * @param String $data HTML page
1359
-        * @return Array array of the tables in HTML page
1360
-        */
1361
-        private static function table2array($data) {
1362
-                $html = str_get_html($data);
1363
-                $tabledata=array();
1364
-                foreach($html->find('tr') as $element)
1365
-                {
1366
-                        $td = array();
1367
-                        foreach( $element->find('th') as $row)
1368
-                        {
1369
-                                $td [] = trim($row->plaintext);
1370
-                        }
1371
-                        $td=array_filter($td);
1372
-                        $tabledata[] = $td;
1373
-
1374
-                        $td = array();
1375
-                        $tdi = array();
1376
-                        foreach( $element->find('td') as $row)
1377
-                        {
1378
-                                $td [] = trim($row->plaintext);
1379
-                                $tdi [] = trim($row->innertext);
1380
-                        }
1381
-                        $td=array_filter($td);
1382
-                        $tdi=array_filter($tdi);
1383
-                    //    $tabledata[]=array_merge($td,$tdi);
1384
-                        $tabledata[]=$td;
1385
-                }
1386
-                return(array_filter($tabledata));
1387
-        }
1388
-
1389
-       /**
1390
-        * Get data from form result
1391
-        * @param String $url form URL
1392
-        * @return String the result
1393
-        */
1394
-        private static function getData($url) {
1395
-                $ch = curl_init();
1396
-                curl_setopt($ch, CURLOPT_URL, $url);
1397
-                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1398
-                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
1399
-                curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
1400
-                return curl_exec($ch);
1401
-        }
1357
+	 * Convert a HTML table to an array
1358
+	 * @param String $data HTML page
1359
+	 * @return Array array of the tables in HTML page
1360
+	 */
1361
+		private static function table2array($data) {
1362
+				$html = str_get_html($data);
1363
+				$tabledata=array();
1364
+				foreach($html->find('tr') as $element)
1365
+				{
1366
+						$td = array();
1367
+						foreach( $element->find('th') as $row)
1368
+						{
1369
+								$td [] = trim($row->plaintext);
1370
+						}
1371
+						$td=array_filter($td);
1372
+						$tabledata[] = $td;
1373
+
1374
+						$td = array();
1375
+						$tdi = array();
1376
+						foreach( $element->find('td') as $row)
1377
+						{
1378
+								$td [] = trim($row->plaintext);
1379
+								$tdi [] = trim($row->innertext);
1380
+						}
1381
+						$td=array_filter($td);
1382
+						$tdi=array_filter($tdi);
1383
+					//    $tabledata[]=array_merge($td,$tdi);
1384
+						$tabledata[]=$td;
1385
+				}
1386
+				return(array_filter($tabledata));
1387
+		}
1388
+
1389
+	   /**
1390
+	    * Get data from form result
1391
+	    * @param String $url form URL
1392
+	    * @return String the result
1393
+	    */
1394
+		private static function getData($url) {
1395
+				$ch = curl_init();
1396
+				curl_setopt($ch, CURLOPT_URL, $url);
1397
+				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1398
+				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
1399
+				curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
1400
+				return curl_exec($ch);
1401
+		}
1402 1402
 /*
1403 1403
 	public static function waypoints() {
1404 1404
 		$data = update_db::getData('http://www.fallingrain.com/world/FR/waypoints.html');
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
 			if ($globalTransaction) $Connection->db->commit();
1482 1482
 		}
1483 1483
 		return '';
1484
-        }
1484
+		}
1485 1485
 
1486 1486
 	public static function ivao_airlines($filename) {
1487 1487
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1491,10 +1491,10 @@  discard block
 block discarded – undo
1491 1491
 		try {
1492 1492
 			$Connection = new Connection();
1493 1493
 			$sth = $Connection->db->prepare($query);
1494
-                        $sth->execute();
1495
-                } catch(PDOException $e) {
1496
-                        return "error : ".$e->getMessage();
1497
-                }
1494
+						$sth->execute();
1495
+				} catch(PDOException $e) {
1496
+						return "error : ".$e->getMessage();
1497
+				}
1498 1498
 
1499 1499
 		$header = NULL;
1500 1500
 		$delimiter = ':';
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
 			if ($globalTransaction) $Connection->db->commit();
1519 1519
 		}
1520 1520
 		return '';
1521
-        }
1521
+		}
1522 1522
 	
1523 1523
 	public static function update_airspace() {
1524 1524
 		global $tmp_dir, $globalDBdriver;
@@ -1528,11 +1528,11 @@  discard block
 block discarded – undo
1528 1528
 			$query = 'DROP TABLE airspace';
1529 1529
 			try {
1530 1530
 				$sth = $Connection->db->prepare($query);
1531
-                    		$sth->execute();
1532
-	                } catch(PDOException $e) {
1531
+							$sth->execute();
1532
+					} catch(PDOException $e) {
1533 1533
 				return "error : ".$e->getMessage();
1534
-	                }
1535
-	        }
1534
+					}
1535
+			}
1536 1536
 
1537 1537
 
1538 1538
 		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
@@ -1587,10 +1587,10 @@  discard block
 block discarded – undo
1587 1587
 			$query = 'DROP TABLE countries';
1588 1588
 			try {
1589 1589
 				$sth = $Connection->db->prepare($query);
1590
-            	        	$sth->execute();
1591
-	                } catch(PDOException $e) {
1592
-    	                	echo "error : ".$e->getMessage();
1593
-	                }
1590
+							$sth->execute();
1591
+					} catch(PDOException $e) {
1592
+							echo "error : ".$e->getMessage();
1593
+					}
1594 1594
 		}
1595 1595
 		if ($globalDBdriver == 'mysql') {
1596 1596
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -2119,11 +2119,11 @@  discard block
 block discarded – undo
2119 2119
 						$query = 'DROP TABLE airspace';
2120 2120
 						try {
2121 2121
 							$sth = $Connection->db->prepare($query);
2122
-    	    	    					$sth->execute();
2123
-			            		} catch(PDOException $e) {
2122
+										$sth->execute();
2123
+								} catch(PDOException $e) {
2124 2124
 							return "error : ".$e->getMessage();
2125
-		            			}
2126
-		    			}
2125
+								}
2126
+						}
2127 2127
 					$error = create_db::import_file($tmp_dir.'airspace.sql');
2128 2128
 					update_db::insert_airspace_version($airspace_md5);
2129 2129
 				} else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed.";
@@ -2303,12 +2303,12 @@  discard block
 block discarded – undo
2303 2303
 		echo $data;
2304 2304
 		*/
2305 2305
 		if (file_exists($tmp_dir.'aircrafts.html')) {
2306
-		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2307
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
2308
-		    $result = fread($fh,100000000);
2309
-		    //echo $result;
2310
-		    //var_dump(str_get_html($result));
2311
-		    //print_r(self::table2array($result));
2306
+			//var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2307
+			$fh = fopen($tmp_dir.'aircrafts.html',"r");
2308
+			$result = fread($fh,100000000);
2309
+			//echo $result;
2310
+			//var_dump(str_get_html($result));
2311
+			//print_r(self::table2array($result));
2312 2312
 		}
2313 2313
 
2314 2314
 	}
@@ -2322,10 +2322,10 @@  discard block
 block discarded – undo
2322 2322
 		try {
2323 2323
 			$Connection = new Connection();
2324 2324
 			$sth = $Connection->db->prepare($query);
2325
-                        $sth->execute();
2326
-                } catch(PDOException $e) {
2327
-                        return "error : ".$e->getMessage();
2328
-                }
2325
+						$sth->execute();
2326
+				} catch(PDOException $e) {
2327
+						return "error : ".$e->getMessage();
2328
+				}
2329 2329
 
2330 2330
 		$error = '';
2331 2331
 		if ($globalDebug) echo "Notam : Download...";
@@ -2381,8 +2381,8 @@  discard block
 block discarded – undo
2381 2381
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2382 2382
 					$data['permanent'] = 0;
2383 2383
 				} else {
2384
-				    $data['date_end'] = NULL;
2385
-				    $data['permanent'] = 1;
2384
+					$data['date_end'] = NULL;
2385
+					$data['permanent'] = 1;
2386 2386
 				}
2387 2387
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2388 2388
 				$NOTAM = new NOTAM();
@@ -2456,13 +2456,13 @@  discard block
 block discarded – undo
2456 2456
 		try {
2457 2457
 			$Connection = new Connection();
2458 2458
 			$sth = $Connection->db->prepare($query);
2459
-                        $sth->execute();
2460
-                } catch(PDOException $e) {
2461
-                        return "error : ".$e->getMessage();
2462
-                }
2463
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2464
-                if ($row['nb'] > 0) return false;
2465
-                else return true;
2459
+						$sth->execute();
2460
+				} catch(PDOException $e) {
2461
+						return "error : ".$e->getMessage();
2462
+				}
2463
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2464
+				if ($row['nb'] > 0) return false;
2465
+				else return true;
2466 2466
 	}
2467 2467
 
2468 2468
 	public static function insert_last_update() {
@@ -2471,10 +2471,10 @@  discard block
 block discarded – undo
2471 2471
 		try {
2472 2472
 			$Connection = new Connection();
2473 2473
 			$sth = $Connection->db->prepare($query);
2474
-                        $sth->execute();
2475
-                } catch(PDOException $e) {
2476
-                        return "error : ".$e->getMessage();
2477
-                }
2474
+						$sth->execute();
2475
+				} catch(PDOException $e) {
2476
+						return "error : ".$e->getMessage();
2477
+				}
2478 2478
 	}
2479 2479
 
2480 2480
 	public static function check_airspace_version($version) {
@@ -2482,13 +2482,13 @@  discard block
 block discarded – undo
2482 2482
 		try {
2483 2483
 			$Connection = new Connection();
2484 2484
 			$sth = $Connection->db->prepare($query);
2485
-                        $sth->execute(array(':version' => $version));
2486
-                } catch(PDOException $e) {
2487
-                        return "error : ".$e->getMessage();
2488
-                }
2489
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2490
-                if ($row['nb'] > 0) return true;
2491
-                else return false;
2485
+						$sth->execute(array(':version' => $version));
2486
+				} catch(PDOException $e) {
2487
+						return "error : ".$e->getMessage();
2488
+				}
2489
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2490
+				if ($row['nb'] > 0) return true;
2491
+				else return false;
2492 2492
 	}
2493 2493
 
2494 2494
 	public static function check_geoid_version($version) {
@@ -2496,13 +2496,13 @@  discard block
 block discarded – undo
2496 2496
 		try {
2497 2497
 			$Connection = new Connection();
2498 2498
 			$sth = $Connection->db->prepare($query);
2499
-                        $sth->execute(array(':version' => $version));
2500
-                } catch(PDOException $e) {
2501
-                        return "error : ".$e->getMessage();
2502
-                }
2503
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2504
-                if ($row['nb'] > 0) return true;
2505
-                else return false;
2499
+						$sth->execute(array(':version' => $version));
2500
+				} catch(PDOException $e) {
2501
+						return "error : ".$e->getMessage();
2502
+				}
2503
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2504
+				if ($row['nb'] > 0) return true;
2505
+				else return false;
2506 2506
 	}
2507 2507
 
2508 2508
 	public static function check_marine_identity_version($version) {
@@ -2510,13 +2510,13 @@  discard block
 block discarded – undo
2510 2510
 		try {
2511 2511
 			$Connection = new Connection();
2512 2512
 			$sth = $Connection->db->prepare($query);
2513
-                        $sth->execute(array(':version' => $version));
2514
-                } catch(PDOException $e) {
2515
-                        return "error : ".$e->getMessage();
2516
-                }
2517
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2518
-                if ($row['nb'] > 0) return true;
2519
-                else return false;
2513
+						$sth->execute(array(':version' => $version));
2514
+				} catch(PDOException $e) {
2515
+						return "error : ".$e->getMessage();
2516
+				}
2517
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2518
+				if ($row['nb'] > 0) return true;
2519
+				else return false;
2520 2520
 	}
2521 2521
 
2522 2522
 
@@ -2538,10 +2538,10 @@  discard block
 block discarded – undo
2538 2538
 		try {
2539 2539
 			$Connection = new Connection();
2540 2540
 			$sth = $Connection->db->prepare($query);
2541
-                        $sth->execute(array(':version' => $version));
2542
-                } catch(PDOException $e) {
2543
-                        return "error : ".$e->getMessage();
2544
-                }
2541
+						$sth->execute(array(':version' => $version));
2542
+				} catch(PDOException $e) {
2543
+						return "error : ".$e->getMessage();
2544
+				}
2545 2545
 	}
2546 2546
 
2547 2547
 	public static function insert_marine_identity_version($version) {
@@ -2550,10 +2550,10 @@  discard block
 block discarded – undo
2550 2550
 		try {
2551 2551
 			$Connection = new Connection();
2552 2552
 			$sth = $Connection->db->prepare($query);
2553
-                        $sth->execute(array(':version' => $version));
2554
-                } catch(PDOException $e) {
2555
-                        return "error : ".$e->getMessage();
2556
-                }
2553
+						$sth->execute(array(':version' => $version));
2554
+				} catch(PDOException $e) {
2555
+						return "error : ".$e->getMessage();
2556
+				}
2557 2557
 	}
2558 2558
 
2559 2559
 	public static function check_last_notam_update() {
@@ -2566,13 +2566,13 @@  discard block
 block discarded – undo
2566 2566
 		try {
2567 2567
 			$Connection = new Connection();
2568 2568
 			$sth = $Connection->db->prepare($query);
2569
-                        $sth->execute();
2570
-                } catch(PDOException $e) {
2571
-                        return "error : ".$e->getMessage();
2572
-                }
2573
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2574
-                if ($row['nb'] > 0) return false;
2575
-                else return true;
2569
+						$sth->execute();
2570
+				} catch(PDOException $e) {
2571
+						return "error : ".$e->getMessage();
2572
+				}
2573
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2574
+				if ($row['nb'] > 0) return false;
2575
+				else return true;
2576 2576
 	}
2577 2577
 
2578 2578
 	public static function insert_last_notam_update() {
@@ -2581,10 +2581,10 @@  discard block
 block discarded – undo
2581 2581
 		try {
2582 2582
 			$Connection = new Connection();
2583 2583
 			$sth = $Connection->db->prepare($query);
2584
-                        $sth->execute();
2585
-                } catch(PDOException $e) {
2586
-                        return "error : ".$e->getMessage();
2587
-                }
2584
+						$sth->execute();
2585
+				} catch(PDOException $e) {
2586
+						return "error : ".$e->getMessage();
2587
+				}
2588 2588
 	}
2589 2589
 
2590 2590
 	public static function check_last_airspace_update() {
@@ -2597,13 +2597,13 @@  discard block
 block discarded – undo
2597 2597
 		try {
2598 2598
 			$Connection = new Connection();
2599 2599
 			$sth = $Connection->db->prepare($query);
2600
-                        $sth->execute();
2601
-                } catch(PDOException $e) {
2602
-                        return "error : ".$e->getMessage();
2603
-                }
2604
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2605
-                if ($row['nb'] > 0) return false;
2606
-                else return true;
2600
+						$sth->execute();
2601
+				} catch(PDOException $e) {
2602
+						return "error : ".$e->getMessage();
2603
+				}
2604
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2605
+				if ($row['nb'] > 0) return false;
2606
+				else return true;
2607 2607
 	}
2608 2608
 
2609 2609
 	public static function insert_last_airspace_update() {
@@ -2612,10 +2612,10 @@  discard block
 block discarded – undo
2612 2612
 		try {
2613 2613
 			$Connection = new Connection();
2614 2614
 			$sth = $Connection->db->prepare($query);
2615
-                        $sth->execute();
2616
-                } catch(PDOException $e) {
2617
-                        return "error : ".$e->getMessage();
2618
-                }
2615
+						$sth->execute();
2616
+				} catch(PDOException $e) {
2617
+						return "error : ".$e->getMessage();
2618
+				}
2619 2619
 	}
2620 2620
 
2621 2621
 	public static function check_last_geoid_update() {
@@ -2628,13 +2628,13 @@  discard block
 block discarded – undo
2628 2628
 		try {
2629 2629
 			$Connection = new Connection();
2630 2630
 			$sth = $Connection->db->prepare($query);
2631
-                        $sth->execute();
2632
-                } catch(PDOException $e) {
2633
-                        return "error : ".$e->getMessage();
2634
-                }
2635
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2636
-                if ($row['nb'] > 0) return false;
2637
-                else return true;
2631
+						$sth->execute();
2632
+				} catch(PDOException $e) {
2633
+						return "error : ".$e->getMessage();
2634
+				}
2635
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2636
+				if ($row['nb'] > 0) return false;
2637
+				else return true;
2638 2638
 	}
2639 2639
 
2640 2640
 	public static function insert_last_geoid_update() {
@@ -2643,10 +2643,10 @@  discard block
 block discarded – undo
2643 2643
 		try {
2644 2644
 			$Connection = new Connection();
2645 2645
 			$sth = $Connection->db->prepare($query);
2646
-                        $sth->execute();
2647
-                } catch(PDOException $e) {
2648
-                        return "error : ".$e->getMessage();
2649
-                }
2646
+						$sth->execute();
2647
+				} catch(PDOException $e) {
2648
+						return "error : ".$e->getMessage();
2649
+				}
2650 2650
 	}
2651 2651
 
2652 2652
 	public static function check_last_owner_update() {
@@ -2659,13 +2659,13 @@  discard block
 block discarded – undo
2659 2659
 		try {
2660 2660
 			$Connection = new Connection();
2661 2661
 			$sth = $Connection->db->prepare($query);
2662
-                        $sth->execute();
2663
-                } catch(PDOException $e) {
2664
-                        return "error : ".$e->getMessage();
2665
-                }
2666
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2667
-                if ($row['nb'] > 0) return false;
2668
-                else return true;
2662
+						$sth->execute();
2663
+				} catch(PDOException $e) {
2664
+						return "error : ".$e->getMessage();
2665
+				}
2666
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2667
+				if ($row['nb'] > 0) return false;
2668
+				else return true;
2669 2669
 	}
2670 2670
 
2671 2671
 	public static function insert_last_owner_update() {
@@ -2674,10 +2674,10 @@  discard block
 block discarded – undo
2674 2674
 		try {
2675 2675
 			$Connection = new Connection();
2676 2676
 			$sth = $Connection->db->prepare($query);
2677
-                        $sth->execute();
2678
-                } catch(PDOException $e) {
2679
-                        return "error : ".$e->getMessage();
2680
-                }
2677
+						$sth->execute();
2678
+				} catch(PDOException $e) {
2679
+						return "error : ".$e->getMessage();
2680
+				}
2681 2681
 	}
2682 2682
 	public static function check_last_schedules_update() {
2683 2683
 		global $globalDBdriver;
@@ -2689,13 +2689,13 @@  discard block
 block discarded – undo
2689 2689
 		try {
2690 2690
 			$Connection = new Connection();
2691 2691
 			$sth = $Connection->db->prepare($query);
2692
-                        $sth->execute();
2693
-                } catch(PDOException $e) {
2694
-                        return "error : ".$e->getMessage();
2695
-                }
2696
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2697
-                if ($row['nb'] > 0) return false;
2698
-                else return true;
2692
+						$sth->execute();
2693
+				} catch(PDOException $e) {
2694
+						return "error : ".$e->getMessage();
2695
+				}
2696
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2697
+				if ($row['nb'] > 0) return false;
2698
+				else return true;
2699 2699
 	}
2700 2700
 
2701 2701
 	public static function insert_last_schedules_update() {
@@ -2704,10 +2704,10 @@  discard block
 block discarded – undo
2704 2704
 		try {
2705 2705
 			$Connection = new Connection();
2706 2706
 			$sth = $Connection->db->prepare($query);
2707
-                        $sth->execute();
2708
-                } catch(PDOException $e) {
2709
-                        return "error : ".$e->getMessage();
2710
-                }
2707
+						$sth->execute();
2708
+				} catch(PDOException $e) {
2709
+						return "error : ".$e->getMessage();
2710
+				}
2711 2711
 	}
2712 2712
 	public static function check_last_tle_update() {
2713 2713
 		global $globalDBdriver;
@@ -2719,13 +2719,13 @@  discard block
 block discarded – undo
2719 2719
 		try {
2720 2720
 			$Connection = new Connection();
2721 2721
 			$sth = $Connection->db->prepare($query);
2722
-                        $sth->execute();
2723
-                } catch(PDOException $e) {
2724
-                        return "error : ".$e->getMessage();
2725
-                }
2726
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2727
-                if ($row['nb'] > 0) return false;
2728
-                else return true;
2722
+						$sth->execute();
2723
+				} catch(PDOException $e) {
2724
+						return "error : ".$e->getMessage();
2725
+				}
2726
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2727
+				if ($row['nb'] > 0) return false;
2728
+				else return true;
2729 2729
 	}
2730 2730
 
2731 2731
 	public static function insert_last_tle_update() {
@@ -2734,10 +2734,10 @@  discard block
 block discarded – undo
2734 2734
 		try {
2735 2735
 			$Connection = new Connection();
2736 2736
 			$sth = $Connection->db->prepare($query);
2737
-                        $sth->execute();
2738
-                } catch(PDOException $e) {
2739
-                        return "error : ".$e->getMessage();
2740
-                }
2737
+						$sth->execute();
2738
+				} catch(PDOException $e) {
2739
+						return "error : ".$e->getMessage();
2740
+				}
2741 2741
 	}
2742 2742
 	public static function check_last_marine_identity_update() {
2743 2743
 		global $globalDBdriver;
@@ -2749,13 +2749,13 @@  discard block
 block discarded – undo
2749 2749
 		try {
2750 2750
 			$Connection = new Connection();
2751 2751
 			$sth = $Connection->db->prepare($query);
2752
-                        $sth->execute();
2753
-                } catch(PDOException $e) {
2754
-                        return "error : ".$e->getMessage();
2755
-                }
2756
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2757
-                if ($row['nb'] > 0) return false;
2758
-                else return true;
2752
+						$sth->execute();
2753
+				} catch(PDOException $e) {
2754
+						return "error : ".$e->getMessage();
2755
+				}
2756
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2757
+				if ($row['nb'] > 0) return false;
2758
+				else return true;
2759 2759
 	}
2760 2760
 
2761 2761
 	public static function insert_last_marine_identity_update() {
@@ -2764,10 +2764,10 @@  discard block
 block discarded – undo
2764 2764
 		try {
2765 2765
 			$Connection = new Connection();
2766 2766
 			$sth = $Connection->db->prepare($query);
2767
-                        $sth->execute();
2768
-                } catch(PDOException $e) {
2769
-                        return "error : ".$e->getMessage();
2770
-                }
2767
+						$sth->execute();
2768
+				} catch(PDOException $e) {
2769
+						return "error : ".$e->getMessage();
2770
+				}
2771 2771
 	}
2772 2772
 	public static function delete_duplicatemodes() {
2773 2773
 		global $globalDBdriver;
@@ -2779,10 +2779,10 @@  discard block
 block discarded – undo
2779 2779
 		try {
2780 2780
 			$Connection = new Connection();
2781 2781
 			$sth = $Connection->db->prepare($query);
2782
-                        $sth->execute();
2783
-                } catch(PDOException $e) {
2784
-                        return "error : ".$e->getMessage();
2785
-                }
2782
+						$sth->execute();
2783
+				} catch(PDOException $e) {
2784
+						return "error : ".$e->getMessage();
2785
+				}
2786 2786
 	}
2787 2787
 	public static function delete_duplicateowner() {
2788 2788
 		global $globalDBdriver;
@@ -2794,10 +2794,10 @@  discard block
 block discarded – undo
2794 2794
 		try {
2795 2795
 			$Connection = new Connection();
2796 2796
 			$sth = $Connection->db->prepare($query);
2797
-                        $sth->execute();
2798
-                } catch(PDOException $e) {
2799
-                        return "error : ".$e->getMessage();
2800
-                }
2797
+						$sth->execute();
2798
+				} catch(PDOException $e) {
2799
+						return "error : ".$e->getMessage();
2800
+				}
2801 2801
 	}
2802 2802
 	
2803 2803
 	public static function update_all() {
Please login to merge, or discard this patch.