Completed
Push — master ( ef15cd...5b4de3 )
by Yannick
07:21
created
install/class.update_db.php 1 patch
Indentation   +305 added lines, -305 removed lines patch added patch discarded remove patch
@@ -70,38 +70,38 @@  discard block
 block discarded – undo
70 70
 		try {
71 71
 			//$Connection = new Connection();
72 72
 			$sth = $Connection->db->prepare($query);
73
-                        $sth->execute(array(':source' => $database_file));
74
-                } catch(PDOException $e) {
75
-                        return "error : ".$e->getMessage();
76
-                }
73
+						$sth->execute(array(':source' => $database_file));
74
+				} catch(PDOException $e) {
75
+						return "error : ".$e->getMessage();
76
+				}
77 77
 
78
-    		if ($globalDebug) echo " - Add routes to DB -";
79
-    		update_db::connect_sqlite($database_file);
78
+			if ($globalDebug) echo " - Add routes to DB -";
79
+			update_db::connect_sqlite($database_file);
80 80
 		//$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';
81 81
 		$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";
82 82
 		try {
83
-                        $sth = update_db::$db_sqlite->prepare($query);
84
-                        $sth->execute();
85
-                } catch(PDOException $e) {
86
-                        return "error : ".$e->getMessage();
87
-                }
83
+						$sth = update_db::$db_sqlite->prepare($query);
84
+						$sth->execute();
85
+				} catch(PDOException $e) {
86
+						return "error : ".$e->getMessage();
87
+				}
88 88
 		//$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)';
89 89
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
90 90
 		$Connection = new Connection();
91 91
 		$sth_dest = $Connection->db->prepare($query_dest);
92 92
 		try {
93 93
 			if ($globalTransaction) $Connection->db->beginTransaction();
94
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
94
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
95 95
 				//$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);
96 96
 				$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);
97 97
 				$sth_dest->execute($query_dest_values);
98
-            		}
98
+					}
99 99
 			if ($globalTransaction) $Connection->db->commit();
100 100
 		} catch(PDOException $e) {
101 101
 			if ($globalTransaction) $Connection->db->rollBack(); 
102 102
 			return "error : ".$e->getMessage();
103 103
 		}
104
-                return '';
104
+				return '';
105 105
 	}
106 106
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
107 107
 		global $globalTransaction;
@@ -110,27 +110,27 @@  discard block
 block discarded – undo
110 110
 		try {
111 111
 			$Connection = new Connection();
112 112
 			$sth = $Connection->db->prepare($query);
113
-                        $sth->execute(array(':source' => $database_file));
114
-                } catch(PDOException $e) {
115
-                        return "error : ".$e->getMessage();
116
-                }
113
+						$sth->execute(array(':source' => $database_file));
114
+				} catch(PDOException $e) {
115
+						return "error : ".$e->getMessage();
116
+				}
117 117
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
118 118
 		try {
119 119
 			$Connection = new Connection();
120 120
 			$sth = $Connection->db->prepare($query);
121
-                        $sth->execute(array(':source' => $database_file));
122
-                } catch(PDOException $e) {
123
-                        return "error : ".$e->getMessage();
124
-                }
121
+						$sth->execute(array(':source' => $database_file));
122
+				} catch(PDOException $e) {
123
+						return "error : ".$e->getMessage();
124
+				}
125 125
 
126
-    		update_db::connect_sqlite($database_file);
126
+			update_db::connect_sqlite($database_file);
127 127
 		$query = 'select * from Aircraft';
128 128
 		try {
129
-                        $sth = update_db::$db_sqlite->prepare($query);
130
-                        $sth->execute();
131
-                } catch(PDOException $e) {
132
-                        return "error : ".$e->getMessage();
133
-                }
129
+						$sth = update_db::$db_sqlite->prepare($query);
130
+						$sth->execute();
131
+				} catch(PDOException $e) {
132
+						return "error : ".$e->getMessage();
133
+				}
134 134
 		//$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)';
135 135
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
136 136
 		
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
142 142
 		try {
143 143
 			if ($globalTransaction) $Connection->db->beginTransaction();
144
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
144
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
145 145
 			//$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']);
146 146
 				if ($values['UserString4'] == 'M') $type = 'military';
147 147
 				else $type = null;
148 148
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
149 149
 				$sth_dest->execute($query_dest_values);
150 150
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
151
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
152
-				    $sth_dest_owner->execute($query_dest_owner_values);
151
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
152
+					$sth_dest_owner->execute($query_dest_owner_values);
153 153
 				}
154
-            		}
154
+					}
155 155
 			if ($globalTransaction) $Connection->db->commit();
156 156
 		} catch(PDOException $e) {
157 157
 			return "error : ".$e->getMessage();
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 		try {
162 162
 			$Connection = new Connection();
163 163
 			$sth = $Connection->db->prepare($query);
164
-                        $sth->execute(array(':source' => $database_file));
165
-                } catch(PDOException $e) {
166
-                        return "error : ".$e->getMessage();
167
-                }
164
+						$sth->execute(array(':source' => $database_file));
165
+				} catch(PDOException $e) {
166
+						return "error : ".$e->getMessage();
167
+				}
168 168
 		return '';
169 169
 	}
170 170
 
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 		try {
177 177
 			$Connection = new Connection();
178 178
 			$sth = $Connection->db->prepare($query);
179
-                        $sth->execute(array(':source' => $database_file));
180
-                } catch(PDOException $e) {
181
-                        return "error : ".$e->getMessage();
182
-                }
179
+						$sth->execute(array(':source' => $database_file));
180
+				} catch(PDOException $e) {
181
+						return "error : ".$e->getMessage();
182
+				}
183 183
 		
184 184
 		if ($fh = fopen($database_file,"r")) {
185 185
 			//$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)';
@@ -189,25 +189,25 @@  discard block
 block discarded – undo
189 189
 			$sth_dest = $Connection->db->prepare($query_dest);
190 190
 			try {
191 191
 				if ($globalTransaction) $Connection->db->beginTransaction();
192
-            			while (!feof($fh)) {
193
-            				$line = $Common->hex2str(fgets($fh,9999));
192
+						while (!feof($fh)) {
193
+							$line = $Common->hex2str(fgets($fh,9999));
194 194
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
195
-            				$values['ModeS'] = substr($line,0,6);
196
-            				$values['Registration'] = trim(substr($line,69,6));
197
-            				$aircraft_name = trim(substr($line,48,6));
198
-            				// Check if we can find ICAO, else set it to GLID
199
-            				$aircraft_name_split = explode(' ',$aircraft_name);
200
-            				$search_more = '';
201
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
202
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
203
-            				$sth_search = $Connection->db->prepare($query_search);
195
+							$values['ModeS'] = substr($line,0,6);
196
+							$values['Registration'] = trim(substr($line,69,6));
197
+							$aircraft_name = trim(substr($line,48,6));
198
+							// Check if we can find ICAO, else set it to GLID
199
+							$aircraft_name_split = explode(' ',$aircraft_name);
200
+							$search_more = '';
201
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
202
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
203
+							$sth_search = $Connection->db->prepare($query_search);
204 204
 					try {
205
-                                    		$sth_search->execute();
206
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
207
-	            				//if (count($result) > 0) {
208
-	            				if (isset($result['icao']) && $result['icao'] != '') {
209
-	            				    $values['ICAOTypeCode'] = $result['icao'];
210
-	            				} 
205
+											$sth_search->execute();
206
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
207
+								//if (count($result) > 0) {
208
+								if (isset($result['icao']) && $result['icao'] != '') {
209
+									$values['ICAOTypeCode'] = $result['icao'];
210
+								} 
211 211
 					} catch(PDOException $e) {
212 212
 						return "error : ".$e->getMessage();
213 213
 					}
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 		try {
231 231
 			$Connection = new Connection();
232 232
 			$sth = $Connection->db->prepare($query);
233
-                        $sth->execute(array(':source' => $database_file));
234
-                } catch(PDOException $e) {
235
-                        return "error : ".$e->getMessage();
236
-                }
233
+						$sth->execute(array(':source' => $database_file));
234
+				} catch(PDOException $e) {
235
+						return "error : ".$e->getMessage();
236
+				}
237 237
 		return '';
238 238
 	}
239 239
 
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 		try {
245 245
 			$Connection = new Connection();
246 246
 			$sth = $Connection->db->prepare($query);
247
-                        $sth->execute(array(':source' => $database_file));
248
-                } catch(PDOException $e) {
249
-                        return "error : ".$e->getMessage();
250
-                }
247
+						$sth->execute(array(':source' => $database_file));
248
+				} catch(PDOException $e) {
249
+						return "error : ".$e->getMessage();
250
+				}
251 251
 		
252 252
 		if ($fh = fopen($database_file,"r")) {
253 253
 			//$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)';
@@ -258,24 +258,24 @@  discard block
 block discarded – undo
258 258
 			try {
259 259
 				if ($globalTransaction) $Connection->db->beginTransaction();
260 260
 				$tmp = fgetcsv($fh,9999,',',"'");
261
-            			while (!feof($fh)) {
262
-            				$line = fgetcsv($fh,9999,',',"'");
261
+						while (!feof($fh)) {
262
+							$line = fgetcsv($fh,9999,',',"'");
263 263
             				
264 264
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
265 265
 					//print_r($line);
266
-            				$values['ModeS'] = $line[1];
267
-            				$values['Registration'] = $line[3];
268
-            				$aircraft_name = $line[2];
269
-            				// Check if we can find ICAO, else set it to GLID
270
-            				$aircraft_name_split = explode(' ',$aircraft_name);
271
-            				$search_more = '';
272
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
273
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
274
-            				$sth_search = $Connection->db->prepare($query_search);
266
+							$values['ModeS'] = $line[1];
267
+							$values['Registration'] = $line[3];
268
+							$aircraft_name = $line[2];
269
+							// Check if we can find ICAO, else set it to GLID
270
+							$aircraft_name_split = explode(' ',$aircraft_name);
271
+							$search_more = '';
272
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
273
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
274
+							$sth_search = $Connection->db->prepare($query_search);
275 275
 					try {
276
-                                    		$sth_search->execute();
277
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
278
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
276
+											$sth_search->execute();
277
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
278
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
279 279
 					} catch(PDOException $e) {
280 280
 						return "error : ".$e->getMessage();
281 281
 					}
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 		try {
299 299
 			$Connection = new Connection();
300 300
 			$sth = $Connection->db->prepare($query);
301
-                        $sth->execute(array(':source' => $database_file));
302
-                } catch(PDOException $e) {
303
-                        return "error : ".$e->getMessage();
304
-                }
301
+						$sth->execute(array(':source' => $database_file));
302
+				} catch(PDOException $e) {
303
+						return "error : ".$e->getMessage();
304
+				}
305 305
 		return '';
306 306
 	}
307 307
 
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 		try {
313 313
 			$Connection = new Connection();
314 314
 			$sth = $Connection->db->prepare($query);
315
-                        $sth->execute(array(':source' => $database_file));
316
-                } catch(PDOException $e) {
317
-                        return "error : ".$e->getMessage();
318
-                }
315
+						$sth->execute(array(':source' => $database_file));
316
+				} catch(PDOException $e) {
317
+						return "error : ".$e->getMessage();
318
+				}
319 319
 		
320 320
 		if ($fh = fopen($database_file,"r")) {
321 321
 			//$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)';
@@ -326,94 +326,94 @@  discard block
 block discarded – undo
326 326
 			try {
327 327
 				if ($globalTransaction) $Connection->db->beginTransaction();
328 328
 				$tmp = fgetcsv($fh,9999,',','"');
329
-            			while (!feof($fh)) {
330
-            				$line = fgetcsv($fh,9999,',','"');
331
-            				//print_r($line);
332
-            				if ($country == 'F') {
333
-            				    $values['registration'] = $line[0];
334
-            				    $values['base'] = $line[4];
335
-            				    $values['owner'] = $line[5];
336
-            				    if ($line[6] == '') $values['date_first_reg'] = '';
337
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
338
-					    $values['cancel'] = $line[7];
329
+						while (!feof($fh)) {
330
+							$line = fgetcsv($fh,9999,',','"');
331
+							//print_r($line);
332
+							if ($country == 'F') {
333
+								$values['registration'] = $line[0];
334
+								$values['base'] = $line[4];
335
+								$values['owner'] = $line[5];
336
+								if ($line[6] == '') $values['date_first_reg'] = '';
337
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
338
+						$values['cancel'] = $line[7];
339 339
 					} elseif ($country == 'EI') {
340
-					    // TODO : add modeS & reg to aircraft_modes
341
-            				    $values['registration'] = $line[0];
342
-            				    $values['base'] = $line[3];
343
-            				    $values['owner'] = $line[2];
344
-            				    if ($line[1] == '') $values['date_first_reg'] = '';
345
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
346
-					    $values['cancel'] = '';
340
+						// TODO : add modeS & reg to aircraft_modes
341
+								$values['registration'] = $line[0];
342
+								$values['base'] = $line[3];
343
+								$values['owner'] = $line[2];
344
+								if ($line[1] == '') $values['date_first_reg'] = '';
345
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
346
+						$values['cancel'] = '';
347 347
 					} elseif ($country == 'HB') {
348
-					    // TODO : add modeS & reg to aircraft_modes
349
-            				    $values['registration'] = $line[0];
350
-            				    $values['base'] = null;
351
-            				    $values['owner'] = $line[5];
352
-            				    $values['date_first_reg'] = '';
353
-					    $values['cancel'] = '';
348
+						// TODO : add modeS & reg to aircraft_modes
349
+								$values['registration'] = $line[0];
350
+								$values['base'] = null;
351
+								$values['owner'] = $line[5];
352
+								$values['date_first_reg'] = '';
353
+						$values['cancel'] = '';
354 354
 					} elseif ($country == 'OK') {
355
-					    // TODO : add modeS & reg to aircraft_modes
356
-            				    $values['registration'] = $line[3];
357
-            				    $values['base'] = null;
358
-            				    $values['owner'] = $line[5];
359
-            				    if ($line[18] == '') $values['date_first_reg'] = '';
360
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
361
-					    $values['cancel'] = '';
355
+						// TODO : add modeS & reg to aircraft_modes
356
+								$values['registration'] = $line[3];
357
+								$values['base'] = null;
358
+								$values['owner'] = $line[5];
359
+								if ($line[18] == '') $values['date_first_reg'] = '';
360
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
361
+						$values['cancel'] = '';
362 362
 					} elseif ($country == 'VH') {
363
-					    // TODO : add modeS & reg to aircraft_modes
364
-            				    $values['registration'] = $line[0];
365
-            				    $values['base'] = null;
366
-            				    $values['owner'] = $line[12];
367
-            				    if ($line[28] == '') $values['date_first_reg'] = '';
368
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
369
-
370
-					    $values['cancel'] = $line[39];
363
+						// TODO : add modeS & reg to aircraft_modes
364
+								$values['registration'] = $line[0];
365
+								$values['base'] = null;
366
+								$values['owner'] = $line[12];
367
+								if ($line[28] == '') $values['date_first_reg'] = '';
368
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
369
+
370
+						$values['cancel'] = $line[39];
371 371
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
372
-            				    $values['registration'] = $line[0];
373
-            				    $values['base'] = null;
374
-            				    $values['owner'] = $line[4];
375
-            				    $values['date_first_reg'] = null;
376
-					    $values['cancel'] = '';
372
+								$values['registration'] = $line[0];
373
+								$values['base'] = null;
374
+								$values['owner'] = $line[4];
375
+								$values['date_first_reg'] = null;
376
+						$values['cancel'] = '';
377 377
 					} elseif ($country == 'CC') {
378
-            				    $values['registration'] = $line[0];
379
-            				    $values['base'] = null;
380
-            				    $values['owner'] = $line[6];
381
-            				    $values['date_first_reg'] = null;
382
-					    $values['cancel'] = '';
378
+								$values['registration'] = $line[0];
379
+								$values['base'] = null;
380
+								$values['owner'] = $line[6];
381
+								$values['date_first_reg'] = null;
382
+						$values['cancel'] = '';
383 383
 					} elseif ($country == 'HJ') {
384
-            				    $values['registration'] = $line[0];
385
-            				    $values['base'] = null;
386
-            				    $values['owner'] = $line[8];
387
-            				    if ($line[7] == '') $values['date_first_reg'] = '';
388
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
389
-					    $values['cancel'] = '';
384
+								$values['registration'] = $line[0];
385
+								$values['base'] = null;
386
+								$values['owner'] = $line[8];
387
+								if ($line[7] == '') $values['date_first_reg'] = '';
388
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
389
+						$values['cancel'] = '';
390 390
 					} elseif ($country == 'PP') {
391
-            				    $values['registration'] = $line[0];
392
-            				    $values['base'] = null;
393
-            				    $values['owner'] = $line[4];
394
-            				    if ($line[6] == '') $values['date_first_reg'] = '';
395
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
396
-					    $values['cancel'] = $line[7];
391
+								$values['registration'] = $line[0];
392
+								$values['base'] = null;
393
+								$values['owner'] = $line[4];
394
+								if ($line[6] == '') $values['date_first_reg'] = '';
395
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
396
+						$values['cancel'] = $line[7];
397 397
 					} elseif ($country == 'E7') {
398
-            				    $values['registration'] = $line[0];
399
-            				    $values['base'] = null;
400
-            				    $values['owner'] = $line[4];
401
-            				    if ($line[5] == '') $values['date_first_reg'] = '';
402
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
403
-					    $values['cancel'] = '';
398
+								$values['registration'] = $line[0];
399
+								$values['base'] = null;
400
+								$values['owner'] = $line[4];
401
+								if ($line[5] == '') $values['date_first_reg'] = '';
402
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
403
+						$values['cancel'] = '';
404 404
 					} elseif ($country == '8Q') {
405
-            				    $values['registration'] = $line[0];
406
-            				    $values['base'] = null;
407
-            				    $values['owner'] = $line[3];
408
-            				    if ($line[7] == '') $values['date_first_reg'] = '';
409
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
410
-					    $values['cancel'] = '';
405
+								$values['registration'] = $line[0];
406
+								$values['base'] = null;
407
+								$values['owner'] = $line[3];
408
+								if ($line[7] == '') $values['date_first_reg'] = '';
409
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
410
+						$values['cancel'] = '';
411 411
 					} elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') {
412
-            				    $values['registration'] = $line[0];
413
-            				    $values['base'] = null;
414
-            				    $values['owner'] = $line[3];
415
-            				    $values['date_first_reg'] = '';
416
-					    $values['cancel'] = '';
412
+								$values['registration'] = $line[0];
413
+								$values['base'] = null;
414
+								$values['owner'] = $line[3];
415
+								$values['date_first_reg'] = '';
416
+						$values['cancel'] = '';
417 417
 					}
418 418
 					if ($values['cancel'] == '' && $values['registration'] != null) {
419 419
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -535,20 +535,20 @@  discard block
 block discarded – undo
535 535
 		try {
536 536
 			$Connection = new Connection();
537 537
 			$sth = $Connection->db->prepare($query);
538
-                        $sth->execute();
539
-                } catch(PDOException $e) {
540
-                        return "error : ".$e->getMessage();
541
-                }
538
+						$sth->execute();
539
+				} catch(PDOException $e) {
540
+						return "error : ".$e->getMessage();
541
+				}
542 542
 
543 543
 
544 544
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
545 545
 		try {
546 546
 			$Connection = new Connection();
547 547
 			$sth = $Connection->db->prepare($query);
548
-                        $sth->execute();
549
-                } catch(PDOException $e) {
550
-                        return "error : ".$e->getMessage();
551
-                }
548
+						$sth->execute();
549
+				} catch(PDOException $e) {
550
+						return "error : ".$e->getMessage();
551
+				}
552 552
 
553 553
 		$query_dest = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image_thumb`,`image`)
554 554
 		    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)";
@@ -614,10 +614,10 @@  discard block
 block discarded – undo
614 614
 		try {
615 615
 			$Connection = new Connection();
616 616
 			$sth = $Connection->db->prepare($query);
617
-                        $sth->execute();
618
-                } catch(PDOException $e) {
619
-                        return "error : ".$e->getMessage();
620
-                }
617
+						$sth->execute();
618
+				} catch(PDOException $e) {
619
+						return "error : ".$e->getMessage();
620
+				}
621 621
 
622 622
 
623 623
 		if ($globalDebug) echo "Insert Not available Airport...\n";
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 		try {
628 628
 			$Connection = new Connection();
629 629
 			$sth = $Connection->db->prepare($query);
630
-                        $sth->execute($query_values);
631
-                } catch(PDOException $e) {
632
-                        return "error : ".$e->getMessage();
633
-                }
630
+						$sth->execute($query_values);
631
+				} catch(PDOException $e) {
632
+						return "error : ".$e->getMessage();
633
+				}
634 634
 		$i++;
635 635
 /*
636 636
 		$query = 'DELETE FROM airport WHERE airport_id IN (SELECT * FROM (SELECT min(a.airport_id) FROM airport a GROUP BY a.icao) x)';
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 
745 745
 
746 746
 
747
-                return "success";
747
+				return "success";
748 748
 	}
749 749
 	
750 750
 	public static function translation() {
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
 		try {
761 761
 			$Connection = new Connection();
762 762
 			$sth = $Connection->db->prepare($query);
763
-                        $sth->execute(array(':source' => 'translation.csv'));
764
-                } catch(PDOException $e) {
765
-                        return "error : ".$e->getMessage();
766
-                }
763
+						$sth->execute(array(':source' => 'translation.csv'));
764
+				} catch(PDOException $e) {
765
+						return "error : ".$e->getMessage();
766
+				}
767 767
 
768 768
 		
769 769
 		//update_db::unzip($out_file);
@@ -782,21 +782,21 @@  discard block
 block discarded – undo
782 782
 					$data = $row;
783 783
 					$operator = $data[2];
784 784
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
785
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
786
-                                                //echo substr($operator, 0, 2)."\n";;
787
-                                                if (count($airline_array) > 0) {
785
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
786
+												//echo substr($operator, 0, 2)."\n";;
787
+												if (count($airline_array) > 0) {
788 788
 							//print_r($airline_array);
789 789
 							$operator = $airline_array[0]['icao'].substr($operator,2);
790
-                                                }
791
-                                        }
790
+												}
791
+										}
792 792
 					
793 793
 					$operator_correct = $data[3];
794 794
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
795
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
796
-                                                if (count($airline_array) > 0) {
797
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
798
-                                            	}
799
-                                        }
795
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
796
+												if (count($airline_array) > 0) {
797
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
798
+												}
799
+										}
800 800
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
801 801
 					try {
802 802
 						$sth = $Connection->db->prepare($query);
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 			//$Connection->db->commit();
811 811
 		}
812 812
 		return '';
813
-        }
813
+		}
814 814
 	
815 815
 	public static function translation_fam() {
816 816
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -820,10 +820,10 @@  discard block
 block discarded – undo
820 820
 		try {
821 821
 			$Connection = new Connection();
822 822
 			$sth = $Connection->db->prepare($query);
823
-                        $sth->execute(array(':source' => 'website_fam'));
824
-                } catch(PDOException $e) {
825
-                        return "error : ".$e->getMessage();
826
-                }
823
+						$sth->execute(array(':source' => 'website_fam'));
824
+				} catch(PDOException $e) {
825
+						return "error : ".$e->getMessage();
826
+				}
827 827
 
828 828
 		
829 829
 		//update_db::unzip($out_file);
@@ -852,54 +852,54 @@  discard block
 block discarded – undo
852 852
 			//$Connection->db->commit();
853 853
 		}
854 854
 		return '';
855
-        }
855
+		}
856 856
 
857 857
 	/**
858
-        * Convert a HTML table to an array
859
-        * @param String $data HTML page
860
-        * @return Array array of the tables in HTML page
861
-        */
862
-        private static function table2array($data) {
863
-                $html = str_get_html($data);
864
-                $tabledata=array();
865
-                foreach($html->find('tr') as $element)
866
-                {
867
-                        $td = array();
868
-                        foreach( $element->find('th') as $row)
869
-                        {
870
-                                $td [] = trim($row->plaintext);
871
-                        }
872
-                        $td=array_filter($td);
873
-                        $tabledata[] = $td;
874
-
875
-                        $td = array();
876
-                        $tdi = array();
877
-                        foreach( $element->find('td') as $row)
878
-                        {
879
-                                $td [] = trim($row->plaintext);
880
-                                $tdi [] = trim($row->innertext);
881
-                        }
882
-                        $td=array_filter($td);
883
-                        $tdi=array_filter($tdi);
884
-                    //    $tabledata[]=array_merge($td,$tdi);
885
-                        $tabledata[]=$td;
886
-                }
887
-                return(array_filter($tabledata));
888
-        }
889
-
890
-       /**
891
-        * Get data from form result
892
-        * @param String $url form URL
893
-        * @return String the result
894
-        */
895
-        private static function getData($url) {
896
-                $ch = curl_init();
897
-                curl_setopt($ch, CURLOPT_URL, $url);
898
-                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
899
-                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
900
-                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');
901
-                return curl_exec($ch);
902
-        }
858
+	 * Convert a HTML table to an array
859
+	 * @param String $data HTML page
860
+	 * @return Array array of the tables in HTML page
861
+	 */
862
+		private static function table2array($data) {
863
+				$html = str_get_html($data);
864
+				$tabledata=array();
865
+				foreach($html->find('tr') as $element)
866
+				{
867
+						$td = array();
868
+						foreach( $element->find('th') as $row)
869
+						{
870
+								$td [] = trim($row->plaintext);
871
+						}
872
+						$td=array_filter($td);
873
+						$tabledata[] = $td;
874
+
875
+						$td = array();
876
+						$tdi = array();
877
+						foreach( $element->find('td') as $row)
878
+						{
879
+								$td [] = trim($row->plaintext);
880
+								$tdi [] = trim($row->innertext);
881
+						}
882
+						$td=array_filter($td);
883
+						$tdi=array_filter($tdi);
884
+					//    $tabledata[]=array_merge($td,$tdi);
885
+						$tabledata[]=$td;
886
+				}
887
+				return(array_filter($tabledata));
888
+		}
889
+
890
+	   /**
891
+	    * Get data from form result
892
+	    * @param String $url form URL
893
+	    * @return String the result
894
+	    */
895
+		private static function getData($url) {
896
+				$ch = curl_init();
897
+				curl_setopt($ch, CURLOPT_URL, $url);
898
+				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
899
+				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
900
+				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');
901
+				return curl_exec($ch);
902
+		}
903 903
 /*
904 904
 	public static function waypoints() {
905 905
 		$data = update_db::getData('http://www.fallingrain.com/world/FR/waypoints.html');
@@ -949,10 +949,10 @@  discard block
 block discarded – undo
949 949
 		try {
950 950
 			$Connection = new Connection();
951 951
 			$sth = $Connection->db->prepare($query);
952
-                        $sth->execute();
953
-                } catch(PDOException $e) {
954
-                        return "error : ".$e->getMessage();
955
-                }
952
+						$sth->execute();
953
+				} catch(PDOException $e) {
954
+						return "error : ".$e->getMessage();
955
+				}
956 956
 
957 957
 		
958 958
 		//update_db::unzip($out_file);
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 			if ($globalTransaction) $Connection->db->commit();
994 994
 		}
995 995
 		return '';
996
-        }
996
+		}
997 997
 
998 998
 	public static function ivao_airlines($filename) {
999 999
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1002,10 +1002,10 @@  discard block
 block discarded – undo
1002 1002
 		try {
1003 1003
 			$Connection = new Connection();
1004 1004
 			$sth = $Connection->db->prepare($query);
1005
-                        $sth->execute();
1006
-                } catch(PDOException $e) {
1007
-                        return "error : ".$e->getMessage();
1008
-                }
1005
+						$sth->execute();
1006
+				} catch(PDOException $e) {
1007
+						return "error : ".$e->getMessage();
1008
+				}
1009 1009
 
1010 1010
 		$header = NULL;
1011 1011
 		$delimiter = ':';
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 			if ($globalTransaction) $Connection->db->commit();
1030 1030
 		}
1031 1031
 		return '';
1032
-        }
1032
+		}
1033 1033
 	
1034 1034
 	public static function update_airspace() {
1035 1035
 		global $tmp_dir, $globalDBdriver;
@@ -1064,10 +1064,10 @@  discard block
 block discarded – undo
1064 1064
 			$query = 'DROP TABLE countries';
1065 1065
 			try {
1066 1066
 				$sth = $Connection->db->prepare($query);
1067
-            	        	$sth->execute();
1068
-	                } catch(PDOException $e) {
1069
-    	                	echo "error : ".$e->getMessage();
1070
-	                }
1067
+							$sth->execute();
1068
+					} catch(PDOException $e) {
1069
+							echo "error : ".$e->getMessage();
1070
+					}
1071 1071
 		}
1072 1072
 		if ($globalDBdriver == 'mysql') {
1073 1073
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -1412,12 +1412,12 @@  discard block
 block discarded – undo
1412 1412
 		echo $data;
1413 1413
 		*/
1414 1414
 		if (file_exists($tmp_dir.'aircrafts.html')) {
1415
-		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
1416
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
1417
-		    $result = fread($fh,100000000);
1418
-		    //echo $result;
1419
-		    //var_dump(str_get_html($result));
1420
-		    //print_r(self::table2array($result));
1415
+			//var_dump(file_get_html($tmp_dir.'aircrafts.html'));
1416
+			$fh = fopen($tmp_dir.'aircrafts.html',"r");
1417
+			$result = fread($fh,100000000);
1418
+			//echo $result;
1419
+			//var_dump(str_get_html($result));
1420
+			//print_r(self::table2array($result));
1421 1421
 		}
1422 1422
 
1423 1423
 	}
@@ -1431,10 +1431,10 @@  discard block
 block discarded – undo
1431 1431
 		try {
1432 1432
 			$Connection = new Connection();
1433 1433
 			$sth = $Connection->db->prepare($query);
1434
-                        $sth->execute();
1435
-                } catch(PDOException $e) {
1436
-                        return "error : ".$e->getMessage();
1437
-                }
1434
+						$sth->execute();
1435
+				} catch(PDOException $e) {
1436
+						return "error : ".$e->getMessage();
1437
+				}
1438 1438
 
1439 1439
 		$error = '';
1440 1440
 		if ($globalDebug) echo "Notam : Download...";
@@ -1490,8 +1490,8 @@  discard block
 block discarded – undo
1490 1490
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
1491 1491
 					$data['permanent'] = 0;
1492 1492
 				} else {
1493
-				    $data['date_end'] = NULL;
1494
-				    $data['permanent'] = 1;
1493
+					$data['date_end'] = NULL;
1494
+					$data['permanent'] = 1;
1495 1495
 				}
1496 1496
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
1497 1497
 				$NOTAM = new NOTAM();
@@ -1515,13 +1515,13 @@  discard block
 block discarded – undo
1515 1515
 		try {
1516 1516
 			$Connection = new Connection();
1517 1517
 			$sth = $Connection->db->prepare($query);
1518
-                        $sth->execute();
1519
-                } catch(PDOException $e) {
1520
-                        return "error : ".$e->getMessage();
1521
-                }
1522
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
1523
-                if ($row['nb'] > 0) return false;
1524
-                else return true;
1518
+						$sth->execute();
1519
+				} catch(PDOException $e) {
1520
+						return "error : ".$e->getMessage();
1521
+				}
1522
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
1523
+				if ($row['nb'] > 0) return false;
1524
+				else return true;
1525 1525
 	}
1526 1526
 
1527 1527
 	public static function insert_last_update() {
@@ -1530,10 +1530,10 @@  discard block
 block discarded – undo
1530 1530
 		try {
1531 1531
 			$Connection = new Connection();
1532 1532
 			$sth = $Connection->db->prepare($query);
1533
-                        $sth->execute();
1534
-                } catch(PDOException $e) {
1535
-                        return "error : ".$e->getMessage();
1536
-                }
1533
+						$sth->execute();
1534
+				} catch(PDOException $e) {
1535
+						return "error : ".$e->getMessage();
1536
+				}
1537 1537
 	}
1538 1538
 
1539 1539
 	public static function check_last_notam_update() {
@@ -1546,13 +1546,13 @@  discard block
 block discarded – undo
1546 1546
 		try {
1547 1547
 			$Connection = new Connection();
1548 1548
 			$sth = $Connection->db->prepare($query);
1549
-                        $sth->execute();
1550
-                } catch(PDOException $e) {
1551
-                        return "error : ".$e->getMessage();
1552
-                }
1553
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
1554
-                if ($row['nb'] > 0) return false;
1555
-                else return true;
1549
+						$sth->execute();
1550
+				} catch(PDOException $e) {
1551
+						return "error : ".$e->getMessage();
1552
+				}
1553
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
1554
+				if ($row['nb'] > 0) return false;
1555
+				else return true;
1556 1556
 	}
1557 1557
 
1558 1558
 	public static function insert_last_notam_update() {
@@ -1561,10 +1561,10 @@  discard block
 block discarded – undo
1561 1561
 		try {
1562 1562
 			$Connection = new Connection();
1563 1563
 			$sth = $Connection->db->prepare($query);
1564
-                        $sth->execute();
1565
-                } catch(PDOException $e) {
1566
-                        return "error : ".$e->getMessage();
1567
-                }
1564
+						$sth->execute();
1565
+				} catch(PDOException $e) {
1566
+						return "error : ".$e->getMessage();
1567
+				}
1568 1568
 	}
1569 1569
 
1570 1570
 	public static function check_last_owner_update() {
@@ -1577,13 +1577,13 @@  discard block
 block discarded – undo
1577 1577
 		try {
1578 1578
 			$Connection = new Connection();
1579 1579
 			$sth = $Connection->db->prepare($query);
1580
-                        $sth->execute();
1581
-                } catch(PDOException $e) {
1582
-                        return "error : ".$e->getMessage();
1583
-                }
1584
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
1585
-                if ($row['nb'] > 0) return false;
1586
-                else return true;
1580
+						$sth->execute();
1581
+				} catch(PDOException $e) {
1582
+						return "error : ".$e->getMessage();
1583
+				}
1584
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
1585
+				if ($row['nb'] > 0) return false;
1586
+				else return true;
1587 1587
 	}
1588 1588
 
1589 1589
 	public static function insert_last_owner_update() {
@@ -1592,10 +1592,10 @@  discard block
 block discarded – undo
1592 1592
 		try {
1593 1593
 			$Connection = new Connection();
1594 1594
 			$sth = $Connection->db->prepare($query);
1595
-                        $sth->execute();
1596
-                } catch(PDOException $e) {
1597
-                        return "error : ".$e->getMessage();
1598
-                }
1595
+						$sth->execute();
1596
+				} catch(PDOException $e) {
1597
+						return "error : ".$e->getMessage();
1598
+				}
1599 1599
 	}
1600 1600
 	
1601 1601
 	public static function update_all() {
Please login to merge, or discard this patch.