|
@@ -24,20 +24,20 @@ discard block |
|
|
block discarded – undo |
|
24
|
24
|
fclose($fp); |
|
25
|
25
|
} |
|
26
|
26
|
|
|
27
|
|
- public static function gunzip($in_file,$out_file_name = '') { |
|
|
27
|
+ public static function gunzip($in_file, $out_file_name = '') { |
|
28
|
28
|
//echo $in_file.' -> '.$out_file_name."\n"; |
|
29
|
29
|
$buffer_size = 4096; // read 4kb at a time |
|
30
|
30
|
if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
31
|
31
|
if ($in_file != '' && file_exists($in_file)) { |
|
32
|
32
|
// PHP version of Ubuntu use gzopen64 instead of gzopen |
|
33
|
|
- if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
34
|
|
- elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
|
33
|
+ if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
|
34
|
+ elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
35
|
35
|
else { |
|
36
|
36
|
echo 'gzopen not available'; |
|
37
|
37
|
die; |
|
38
|
38
|
} |
|
39
|
39
|
$out_file = fopen($out_file_name, 'wb'); |
|
40
|
|
- while(!gzeof($file)) { |
|
|
40
|
+ while (!gzeof($file)) { |
|
41
|
41
|
fwrite($out_file, gzread($file, $buffer_size)); |
|
42
|
42
|
} |
|
43
|
43
|
fclose($out_file); |
|
@@ -61,7 +61,7 @@ discard block |
|
|
block discarded – undo |
|
61
|
61
|
try { |
|
62
|
62
|
self::$db_sqlite = new PDO('sqlite:'.$database); |
|
63
|
63
|
self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
64
|
|
- } catch(PDOException $e) { |
|
|
64
|
+ } catch (PDOException $e) { |
|
65
|
65
|
return "error : ".$e->getMessage(); |
|
66
|
66
|
} |
|
67
|
67
|
} |
|
@@ -76,7 +76,7 @@ discard block |
|
|
block discarded – undo |
|
76
|
76
|
//$Connection = new Connection(); |
|
77
|
77
|
$sth = $Connection->db->prepare($query); |
|
78
|
78
|
$sth->execute(array(':source' => $database_file)); |
|
79
|
|
- } catch(PDOException $e) { |
|
|
79
|
+ } catch (PDOException $e) { |
|
80
|
80
|
return "error : ".$e->getMessage(); |
|
81
|
81
|
} |
|
82
|
82
|
|
|
@@ -87,7 +87,7 @@ discard block |
|
|
block discarded – undo |
|
87
|
87
|
try { |
|
88
|
88
|
$sth = update_db::$db_sqlite->prepare($query); |
|
89
|
89
|
$sth->execute(); |
|
90
|
|
- } catch(PDOException $e) { |
|
|
90
|
+ } catch (PDOException $e) { |
|
91
|
91
|
return "error : ".$e->getMessage(); |
|
92
|
92
|
} |
|
93
|
93
|
//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
|
@@ -98,11 +98,11 @@ discard block |
|
|
block discarded – undo |
|
98
|
98
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
99
|
99
|
while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
100
|
100
|
//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
101
|
|
- $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
|
101
|
+ $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
102
|
102
|
$sth_dest->execute($query_dest_values); |
|
103
|
103
|
} |
|
104
|
104
|
if ($globalTransaction) $Connection->db->commit(); |
|
105
|
|
- } catch(PDOException $e) { |
|
|
105
|
+ } catch (PDOException $e) { |
|
106
|
106
|
if ($globalTransaction) $Connection->db->rollBack(); |
|
107
|
107
|
return "error : ".$e->getMessage(); |
|
108
|
108
|
} |
|
@@ -118,26 +118,26 @@ discard block |
|
|
block discarded – undo |
|
118
|
118
|
//$Connection = new Connection(); |
|
119
|
119
|
$sth = $Connection->db->prepare($query); |
|
120
|
120
|
$sth->execute(array(':source' => 'oneworld')); |
|
121
|
|
- } catch(PDOException $e) { |
|
|
121
|
+ } catch (PDOException $e) { |
|
122
|
122
|
return "error : ".$e->getMessage(); |
|
123
|
123
|
} |
|
124
|
124
|
|
|
125
|
125
|
if ($globalDebug) echo " - Add routes to DB -"; |
|
126
|
126
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
|
127
|
127
|
$Spotter = new Spotter(); |
|
128
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
128
|
+ if ($fh = fopen($database_file, "r")) { |
|
129
|
129
|
$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
|
130
|
130
|
$Connection = new Connection(); |
|
131
|
131
|
$sth_dest = $Connection->db->prepare($query_dest); |
|
132
|
132
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
133
|
133
|
while (!feof($fh)) { |
|
134
|
|
- $line = fgetcsv($fh,9999,','); |
|
|
134
|
+ $line = fgetcsv($fh, 9999, ','); |
|
135
|
135
|
if ($line[0] != '') { |
|
136
|
136
|
if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
|
137
|
137
|
try { |
|
138
|
|
- $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
|
138
|
+ $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
139
|
139
|
$sth_dest->execute($query_dest_values); |
|
140
|
|
- } catch(PDOException $e) { |
|
|
140
|
+ } catch (PDOException $e) { |
|
141
|
141
|
if ($globalTransaction) $Connection->db->rollBack(); |
|
142
|
142
|
return "error : ".$e->getMessage(); |
|
143
|
143
|
} |
|
@@ -159,7 +159,7 @@ discard block |
|
|
block discarded – undo |
|
159
|
159
|
//$Connection = new Connection(); |
|
160
|
160
|
$sth = $Connection->db->prepare($query); |
|
161
|
161
|
$sth->execute(array(':source' => 'skyteam')); |
|
162
|
|
- } catch(PDOException $e) { |
|
|
162
|
+ } catch (PDOException $e) { |
|
163
|
163
|
return "error : ".$e->getMessage(); |
|
164
|
164
|
} |
|
165
|
165
|
|
|
@@ -167,24 +167,24 @@ discard block |
|
|
block discarded – undo |
|
167
|
167
|
|
|
168
|
168
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
|
169
|
169
|
$Spotter = new Spotter(); |
|
170
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
170
|
+ if ($fh = fopen($database_file, "r")) { |
|
171
|
171
|
$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
|
172
|
172
|
$Connection = new Connection(); |
|
173
|
173
|
$sth_dest = $Connection->db->prepare($query_dest); |
|
174
|
174
|
try { |
|
175
|
175
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
176
|
176
|
while (!feof($fh)) { |
|
177
|
|
- $line = fgetcsv($fh,9999,','); |
|
|
177
|
+ $line = fgetcsv($fh, 9999, ','); |
|
178
|
178
|
if ($line[0] != '') { |
|
179
|
|
- $datebe = explode(' - ',$line[2]); |
|
|
179
|
+ $datebe = explode(' - ', $line[2]); |
|
180
|
180
|
if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
|
181
|
|
- $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
|
181
|
+ $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
182
|
182
|
$sth_dest->execute($query_dest_values); |
|
183
|
183
|
} |
|
184
|
184
|
} |
|
185
|
185
|
} |
|
186
|
186
|
if ($globalTransaction) $Connection->db->commit(); |
|
187
|
|
- } catch(PDOException $e) { |
|
|
187
|
+ } catch (PDOException $e) { |
|
188
|
188
|
if ($globalTransaction) $Connection->db->rollBack(); |
|
189
|
189
|
return "error : ".$e->getMessage(); |
|
190
|
190
|
} |
|
@@ -199,7 +199,7 @@ discard block |
|
|
block discarded – undo |
|
199
|
199
|
$Connection = new Connection(); |
|
200
|
200
|
$sth = $Connection->db->prepare($query); |
|
201
|
201
|
$sth->execute(array(':source' => $database_file)); |
|
202
|
|
- } catch(PDOException $e) { |
|
|
202
|
+ } catch (PDOException $e) { |
|
203
|
203
|
return "error : ".$e->getMessage(); |
|
204
|
204
|
} |
|
205
|
205
|
$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
|
@@ -207,7 +207,7 @@ discard block |
|
|
block discarded – undo |
|
207
|
207
|
$Connection = new Connection(); |
|
208
|
208
|
$sth = $Connection->db->prepare($query); |
|
209
|
209
|
$sth->execute(array(':source' => $database_file)); |
|
210
|
|
- } catch(PDOException $e) { |
|
|
210
|
+ } catch (PDOException $e) { |
|
211
|
211
|
return "error : ".$e->getMessage(); |
|
212
|
212
|
} |
|
213
|
213
|
|
|
@@ -216,7 +216,7 @@ discard block |
|
|
block discarded – undo |
|
216
|
216
|
try { |
|
217
|
217
|
$sth = update_db::$db_sqlite->prepare($query); |
|
218
|
218
|
$sth->execute(); |
|
219
|
|
- } catch(PDOException $e) { |
|
|
219
|
+ } catch (PDOException $e) { |
|
220
|
220
|
return "error : ".$e->getMessage(); |
|
221
|
221
|
} |
|
222
|
222
|
//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
|
@@ -233,15 +233,15 @@ discard block |
|
|
block discarded – undo |
|
233
|
233
|
//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
|
234
|
234
|
if ($values['UserString4'] == 'M') $type = 'military'; |
|
235
|
235
|
else $type = null; |
|
236
|
|
- $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
|
236
|
+ $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
237
|
237
|
$sth_dest->execute($query_dest_values); |
|
238
|
238
|
if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
|
239
|
|
- $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
|
239
|
+ $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
240
|
240
|
$sth_dest_owner->execute($query_dest_owner_values); |
|
241
|
241
|
} |
|
242
|
242
|
} |
|
243
|
243
|
if ($globalTransaction) $Connection->db->commit(); |
|
244
|
|
- } catch(PDOException $e) { |
|
|
244
|
+ } catch (PDOException $e) { |
|
245
|
245
|
return "error : ".$e->getMessage(); |
|
246
|
246
|
} |
|
247
|
247
|
|
|
@@ -251,7 +251,7 @@ discard block |
|
|
block discarded – undo |
|
251
|
251
|
$Connection = new Connection(); |
|
252
|
252
|
$sth = $Connection->db->prepare($query); |
|
253
|
253
|
$sth->execute(array(':source' => $database_file)); |
|
254
|
|
- } catch(PDOException $e) { |
|
|
254
|
+ } catch (PDOException $e) { |
|
255
|
255
|
return "error : ".$e->getMessage(); |
|
256
|
256
|
} |
|
257
|
257
|
return ''; |
|
@@ -266,11 +266,11 @@ discard block |
|
|
block discarded – undo |
|
266
|
266
|
$Connection = new Connection(); |
|
267
|
267
|
$sth = $Connection->db->prepare($query); |
|
268
|
268
|
$sth->execute(array(':source' => $database_file)); |
|
269
|
|
- } catch(PDOException $e) { |
|
|
269
|
+ } catch (PDOException $e) { |
|
270
|
270
|
return "error : ".$e->getMessage(); |
|
271
|
271
|
} |
|
272
|
272
|
|
|
273
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
273
|
+ if ($fh = fopen($database_file, "r")) { |
|
274
|
274
|
//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
|
275
|
275
|
$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)'; |
|
276
|
276
|
|
|
@@ -280,13 +280,13 @@ discard block |
|
|
block discarded – undo |
|
280
|
280
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
281
|
281
|
while (!feof($fh)) { |
|
282
|
282
|
$values = array(); |
|
283
|
|
- $line = $Common->hex2str(fgets($fh,9999)); |
|
|
283
|
+ $line = $Common->hex2str(fgets($fh, 9999)); |
|
284
|
284
|
//FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
|
285
|
|
- $values['ModeS'] = substr($line,0,6); |
|
286
|
|
- $values['Registration'] = trim(substr($line,69,6)); |
|
287
|
|
- $aircraft_name = trim(substr($line,48,6)); |
|
|
285
|
+ $values['ModeS'] = substr($line, 0, 6); |
|
|
286
|
+ $values['Registration'] = trim(substr($line, 69, 6)); |
|
|
287
|
+ $aircraft_name = trim(substr($line, 48, 6)); |
|
288
|
288
|
// Check if we can find ICAO, else set it to GLID |
|
289
|
|
- $aircraft_name_split = explode(' ',$aircraft_name); |
|
|
289
|
+ $aircraft_name_split = explode(' ', $aircraft_name); |
|
290
|
290
|
$search_more = ''; |
|
291
|
291
|
if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
292
|
292
|
$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
@@ -298,20 +298,20 @@ discard block |
|
|
block discarded – undo |
|
298
|
298
|
if (isset($result['icao']) && $result['icao'] != '') { |
|
299
|
299
|
$values['ICAOTypeCode'] = $result['icao']; |
|
300
|
300
|
} |
|
301
|
|
- } catch(PDOException $e) { |
|
|
301
|
+ } catch (PDOException $e) { |
|
302
|
302
|
return "error : ".$e->getMessage(); |
|
303
|
303
|
} |
|
304
|
304
|
if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
305
|
305
|
// Add data to db |
|
306
|
306
|
if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
|
307
|
307
|
//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
|
308
|
|
- $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file); |
|
|
308
|
+ $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file); |
|
309
|
309
|
//print_r($query_dest_values); |
|
310
|
310
|
$sth_dest->execute($query_dest_values); |
|
311
|
311
|
} |
|
312
|
312
|
} |
|
313
|
313
|
if ($globalTransaction) $Connection->db->commit(); |
|
314
|
|
- } catch(PDOException $e) { |
|
|
314
|
+ } catch (PDOException $e) { |
|
315
|
315
|
return "error : ".$e->getMessage(); |
|
316
|
316
|
} |
|
317
|
317
|
} |
|
@@ -321,7 +321,7 @@ discard block |
|
|
block discarded – undo |
|
321
|
321
|
$Connection = new Connection(); |
|
322
|
322
|
$sth = $Connection->db->prepare($query); |
|
323
|
323
|
$sth->execute(array(':source' => $database_file)); |
|
324
|
|
- } catch(PDOException $e) { |
|
|
324
|
+ } catch (PDOException $e) { |
|
325
|
325
|
return "error : ".$e->getMessage(); |
|
326
|
326
|
} |
|
327
|
327
|
return ''; |
|
@@ -335,11 +335,11 @@ discard block |
|
|
block discarded – undo |
|
335
|
335
|
$Connection = new Connection(); |
|
336
|
336
|
$sth = $Connection->db->prepare($query); |
|
337
|
337
|
$sth->execute(array(':source' => $database_file)); |
|
338
|
|
- } catch(PDOException $e) { |
|
|
338
|
+ } catch (PDOException $e) { |
|
339
|
339
|
return "error : ".$e->getMessage(); |
|
340
|
340
|
} |
|
341
|
341
|
|
|
342
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
342
|
+ if ($fh = fopen($database_file, "r")) { |
|
343
|
343
|
//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
|
344
|
344
|
$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)'; |
|
345
|
345
|
|
|
@@ -347,9 +347,9 @@ discard block |
|
|
block discarded – undo |
|
347
|
347
|
$sth_dest = $Connection->db->prepare($query_dest); |
|
348
|
348
|
try { |
|
349
|
349
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
350
|
|
- $tmp = fgetcsv($fh,9999,',',"'"); |
|
|
350
|
+ $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
351
|
351
|
while (!feof($fh)) { |
|
352
|
|
- $line = fgetcsv($fh,9999,',',"'"); |
|
|
352
|
+ $line = fgetcsv($fh, 9999, ',', "'"); |
|
353
|
353
|
|
|
354
|
354
|
//FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
|
355
|
355
|
//print_r($line); |
|
@@ -357,7 +357,7 @@ discard block |
|
|
block discarded – undo |
|
357
|
357
|
$values['Registration'] = $line[3]; |
|
358
|
358
|
$aircraft_name = $line[2]; |
|
359
|
359
|
// Check if we can find ICAO, else set it to GLID |
|
360
|
|
- $aircraft_name_split = explode(' ',$aircraft_name); |
|
|
360
|
+ $aircraft_name_split = explode(' ', $aircraft_name); |
|
361
|
361
|
$search_more = ''; |
|
362
|
362
|
if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
363
|
363
|
$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
@@ -366,20 +366,20 @@ discard block |
|
|
block discarded – undo |
|
366
|
366
|
$sth_search->execute(); |
|
367
|
367
|
$result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
368
|
368
|
if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
369
|
|
- } catch(PDOException $e) { |
|
|
369
|
+ } catch (PDOException $e) { |
|
370
|
370
|
return "error : ".$e->getMessage(); |
|
371
|
371
|
} |
|
372
|
372
|
//if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
373
|
373
|
// Add data to db |
|
374
|
374
|
if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
|
375
|
375
|
//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
|
376
|
|
- $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file); |
|
|
376
|
+ $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file); |
|
377
|
377
|
//print_r($query_dest_values); |
|
378
|
378
|
$sth_dest->execute($query_dest_values); |
|
379
|
379
|
} |
|
380
|
380
|
} |
|
381
|
381
|
if ($globalTransaction) $Connection->db->commit(); |
|
382
|
|
- } catch(PDOException $e) { |
|
|
382
|
+ } catch (PDOException $e) { |
|
383
|
383
|
return "error : ".$e->getMessage(); |
|
384
|
384
|
} |
|
385
|
385
|
} |
|
@@ -389,13 +389,13 @@ discard block |
|
|
block discarded – undo |
|
389
|
389
|
$Connection = new Connection(); |
|
390
|
390
|
$sth = $Connection->db->prepare($query); |
|
391
|
391
|
$sth->execute(array(':source' => $database_file)); |
|
392
|
|
- } catch(PDOException $e) { |
|
|
392
|
+ } catch (PDOException $e) { |
|
393
|
393
|
return "error : ".$e->getMessage(); |
|
394
|
394
|
} |
|
395
|
395
|
return ''; |
|
396
|
396
|
} |
|
397
|
397
|
|
|
398
|
|
- public static function retrieve_owner($database_file,$country = 'F') { |
|
|
398
|
+ public static function retrieve_owner($database_file, $country = 'F') { |
|
399
|
399
|
global $globalTransaction; |
|
400
|
400
|
//$query = 'TRUNCATE TABLE aircraft_modes'; |
|
401
|
401
|
$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
|
@@ -403,11 +403,11 @@ discard block |
|
|
block discarded – undo |
|
403
|
403
|
$Connection = new Connection(); |
|
404
|
404
|
$sth = $Connection->db->prepare($query); |
|
405
|
405
|
$sth->execute(array(':source' => $database_file)); |
|
406
|
|
- } catch(PDOException $e) { |
|
|
406
|
+ } catch (PDOException $e) { |
|
407
|
407
|
return "error : ".$e->getMessage(); |
|
408
|
408
|
} |
|
409
|
409
|
|
|
410
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
410
|
+ if ($fh = fopen($database_file, "r")) { |
|
411
|
411
|
//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
|
412
|
412
|
$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
|
413
|
413
|
|
|
@@ -415,9 +415,9 @@ discard block |
|
|
block discarded – undo |
|
415
|
415
|
$sth_dest = $Connection->db->prepare($query_dest); |
|
416
|
416
|
try { |
|
417
|
417
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
418
|
|
- $tmp = fgetcsv($fh,9999,',','"'); |
|
|
418
|
+ $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
419
|
419
|
while (!feof($fh)) { |
|
420
|
|
- $line = fgetcsv($fh,9999,',','"'); |
|
|
420
|
+ $line = fgetcsv($fh, 9999, ',', '"'); |
|
421
|
421
|
$values = array(); |
|
422
|
422
|
//print_r($line); |
|
423
|
423
|
if ($country == 'F') { |
|
@@ -425,7 +425,7 @@ discard block |
|
|
block discarded – undo |
|
425
|
425
|
$values['base'] = $line[4]; |
|
426
|
426
|
$values['owner'] = $line[5]; |
|
427
|
427
|
if ($line[6] == '') $values['date_first_reg'] = null; |
|
428
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
|
428
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
429
|
429
|
$values['cancel'] = $line[7]; |
|
430
|
430
|
} elseif ($country == 'EI') { |
|
431
|
431
|
// TODO : add modeS & reg to aircraft_modes |
|
@@ -433,7 +433,7 @@ discard block |
|
|
block discarded – undo |
|
433
|
433
|
$values['base'] = $line[3]; |
|
434
|
434
|
$values['owner'] = $line[2]; |
|
435
|
435
|
if ($line[1] == '') $values['date_first_reg'] = null; |
|
436
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
|
436
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
437
|
437
|
$values['cancel'] = ''; |
|
438
|
438
|
} elseif ($country == 'HB') { |
|
439
|
439
|
// TODO : add modeS & reg to aircraft_modes |
|
@@ -448,7 +448,7 @@ discard block |
|
|
block discarded – undo |
|
448
|
448
|
$values['base'] = null; |
|
449
|
449
|
$values['owner'] = $line[5]; |
|
450
|
450
|
if ($line[18] == '') $values['date_first_reg'] = null; |
|
451
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
|
451
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
452
|
452
|
$values['cancel'] = ''; |
|
453
|
453
|
} elseif ($country == 'VH') { |
|
454
|
454
|
// TODO : add modeS & reg to aircraft_modes |
|
@@ -456,7 +456,7 @@ discard block |
|
|
block discarded – undo |
|
456
|
456
|
$values['base'] = null; |
|
457
|
457
|
$values['owner'] = $line[12]; |
|
458
|
458
|
if ($line[28] == '') $values['date_first_reg'] = null; |
|
459
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
|
459
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
460
|
460
|
|
|
461
|
461
|
$values['cancel'] = $line[39]; |
|
462
|
462
|
} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
|
@@ -476,28 +476,28 @@ discard block |
|
|
block discarded – undo |
|
476
|
476
|
$values['base'] = null; |
|
477
|
477
|
$values['owner'] = $line[8]; |
|
478
|
478
|
if ($line[7] == '') $values['date_first_reg'] = null; |
|
479
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
|
479
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
480
|
480
|
$values['cancel'] = ''; |
|
481
|
481
|
} elseif ($country == 'PP') { |
|
482
|
482
|
$values['registration'] = $line[0]; |
|
483
|
483
|
$values['base'] = null; |
|
484
|
484
|
$values['owner'] = $line[4]; |
|
485
|
485
|
if ($line[6] == '') $values['date_first_reg'] = null; |
|
486
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
|
486
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
487
|
487
|
$values['cancel'] = $line[7]; |
|
488
|
488
|
} elseif ($country == 'E7') { |
|
489
|
489
|
$values['registration'] = $line[0]; |
|
490
|
490
|
$values['base'] = null; |
|
491
|
491
|
$values['owner'] = $line[4]; |
|
492
|
492
|
if ($line[5] == '') $values['date_first_reg'] = null; |
|
493
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
|
493
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
494
|
494
|
$values['cancel'] = ''; |
|
495
|
495
|
} elseif ($country == '8Q') { |
|
496
|
496
|
$values['registration'] = $line[0]; |
|
497
|
497
|
$values['base'] = null; |
|
498
|
498
|
$values['owner'] = $line[3]; |
|
499
|
499
|
if ($line[7] == '') $values['date_first_reg'] = null; |
|
500
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
|
500
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
501
|
501
|
$values['cancel'] = ''; |
|
502
|
502
|
} elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
|
503
|
503
|
$values['registration'] = $line[0]; |
|
@@ -507,12 +507,12 @@ discard block |
|
|
block discarded – undo |
|
507
|
507
|
$values['cancel'] = ''; |
|
508
|
508
|
} |
|
509
|
509
|
if ($values['cancel'] == '' && $values['registration'] != null) { |
|
510
|
|
- $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
|
510
|
+ $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
511
|
511
|
$sth_dest->execute($query_dest_values); |
|
512
|
512
|
} |
|
513
|
513
|
} |
|
514
|
514
|
if ($globalTransaction) $Connection->db->commit(); |
|
515
|
|
- } catch(PDOException $e) { |
|
|
515
|
+ } catch (PDOException $e) { |
|
516
|
516
|
return "error : ".$e->getMessage(); |
|
517
|
517
|
} |
|
518
|
518
|
} |
|
@@ -627,7 +627,7 @@ discard block |
|
|
block discarded – undo |
|
627
|
627
|
$Connection = new Connection(); |
|
628
|
628
|
$sth = $Connection->db->prepare($query); |
|
629
|
629
|
$sth->execute(); |
|
630
|
|
- } catch(PDOException $e) { |
|
|
630
|
+ } catch (PDOException $e) { |
|
631
|
631
|
return "error : ".$e->getMessage(); |
|
632
|
632
|
} |
|
633
|
633
|
|
|
@@ -637,7 +637,7 @@ discard block |
|
|
block discarded – undo |
|
637
|
637
|
$Connection = new Connection(); |
|
638
|
638
|
$sth = $Connection->db->prepare($query); |
|
639
|
639
|
$sth->execute(); |
|
640
|
|
- } catch(PDOException $e) { |
|
|
640
|
+ } catch (PDOException $e) { |
|
641
|
641
|
return "error : ".$e->getMessage(); |
|
642
|
642
|
} |
|
643
|
643
|
|
|
@@ -648,7 +648,7 @@ discard block |
|
|
block discarded – undo |
|
648
|
648
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
649
|
649
|
|
|
650
|
650
|
$i = 0; |
|
651
|
|
- while($row = sparql_fetch_array($result)) |
|
|
651
|
+ while ($row = sparql_fetch_array($result)) |
|
652
|
652
|
{ |
|
653
|
653
|
if ($i >= 1) { |
|
654
|
654
|
//print_r($row); |
|
@@ -668,31 +668,31 @@ discard block |
|
|
block discarded – undo |
|
668
|
668
|
$row['image'] = ''; |
|
669
|
669
|
$row['image_thumb'] = ''; |
|
670
|
670
|
} else { |
|
671
|
|
- $image = str_replace(' ','_',$row['image']); |
|
|
671
|
+ $image = str_replace(' ', '_', $row['image']); |
|
672
|
672
|
$digest = md5($image); |
|
673
|
|
- $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
674
|
|
- $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
675
|
|
- $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
676
|
|
- $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
|
673
|
+ $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
|
674
|
+ $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
|
675
|
+ $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
|
676
|
+ $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
677
|
677
|
} |
|
678
|
678
|
|
|
679
|
|
- $country = explode('-',$row['country']); |
|
|
679
|
+ $country = explode('-', $row['country']); |
|
680
|
680
|
$row['country'] = $country[0]; |
|
681
|
681
|
|
|
682
|
682
|
$row['type'] = trim($row['type']); |
|
683
|
|
- if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
|
683
|
+ if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
684
|
684
|
$row['type'] = 'Military'; |
|
685
|
685
|
} elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
|
686
|
686
|
$row['type'] = 'small_airport'; |
|
687
|
687
|
} |
|
688
|
688
|
|
|
689
|
|
- $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
690
|
|
- $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
|
689
|
+ $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
|
690
|
+ $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $row['altitude'], ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
691
|
691
|
//print_r($query_dest_values); |
|
692
|
692
|
|
|
693
|
693
|
try { |
|
694
|
694
|
$sth_dest->execute($query_dest_values); |
|
695
|
|
- } catch(PDOException $e) { |
|
|
695
|
+ } catch (PDOException $e) { |
|
696
|
696
|
return "error : ".$e->getMessage(); |
|
697
|
697
|
} |
|
698
|
698
|
} |
|
@@ -706,7 +706,7 @@ discard block |
|
|
block discarded – undo |
|
706
|
706
|
$Connection = new Connection(); |
|
707
|
707
|
$sth = $Connection->db->prepare($query); |
|
708
|
708
|
$sth->execute(); |
|
709
|
|
- } catch(PDOException $e) { |
|
|
709
|
+ } catch (PDOException $e) { |
|
710
|
710
|
return "error : ".$e->getMessage(); |
|
711
|
711
|
} |
|
712
|
712
|
|
|
@@ -714,12 +714,12 @@ discard block |
|
|
block discarded – undo |
|
714
|
714
|
if ($globalDebug) echo "Insert Not available Airport...\n"; |
|
715
|
715
|
$query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
|
716
|
716
|
VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
|
717
|
|
- $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
|
|
717
|
+ $query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => ''); |
|
718
|
718
|
try { |
|
719
|
719
|
$Connection = new Connection(); |
|
720
|
720
|
$sth = $Connection->db->prepare($query); |
|
721
|
721
|
$sth->execute($query_values); |
|
722
|
|
- } catch(PDOException $e) { |
|
|
722
|
+ } catch (PDOException $e) { |
|
723
|
723
|
return "error : ".$e->getMessage(); |
|
724
|
724
|
} |
|
725
|
725
|
$i++; |
|
@@ -737,7 +737,7 @@ discard block |
|
|
block discarded – undo |
|
737
|
737
|
echo "Download data from ourairports.com...\n"; |
|
738
|
738
|
$delimiter = ','; |
|
739
|
739
|
$out_file = $tmp_dir.'airports.csv'; |
|
740
|
|
- update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
|
740
|
+ update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
741
|
741
|
if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
742
|
742
|
echo "Add data from ourairports.com...\n"; |
|
743
|
743
|
|
|
@@ -748,32 +748,32 @@ discard block |
|
|
block discarded – undo |
|
748
|
748
|
//$Connection->db->beginTransaction(); |
|
749
|
749
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
750
|
750
|
{ |
|
751
|
|
- if(!$header) $header = $row; |
|
|
751
|
+ if (!$header) $header = $row; |
|
752
|
752
|
else { |
|
753
|
753
|
$data = array(); |
|
754
|
754
|
$data = array_combine($header, $row); |
|
755
|
755
|
try { |
|
756
|
756
|
$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
|
757
|
757
|
$sth->execute(array(':icao' => $data['gps_code'])); |
|
758
|
|
- } catch(PDOException $e) { |
|
|
758
|
+ } catch (PDOException $e) { |
|
759
|
759
|
return "error : ".$e->getMessage(); |
|
760
|
760
|
} |
|
761
|
761
|
if ($sth->fetchColumn() > 0) { |
|
762
|
762
|
$query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
|
763
|
763
|
try { |
|
764
|
764
|
$sth = $Connection->db->prepare($query); |
|
765
|
|
- $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
766
|
|
- } catch(PDOException $e) { |
|
|
765
|
+ $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
|
766
|
+ } catch (PDOException $e) { |
|
767
|
767
|
return "error : ".$e->getMessage(); |
|
768
|
768
|
} |
|
769
|
769
|
} else { |
|
770
|
770
|
$query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
|
771
|
771
|
VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
|
772
|
|
- $query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
|
772
|
+ $query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
773
|
773
|
try { |
|
774
|
774
|
$sth = $Connection->db->prepare($query); |
|
775
|
775
|
$sth->execute($query_values); |
|
776
|
|
- } catch(PDOException $e) { |
|
|
776
|
+ } catch (PDOException $e) { |
|
777
|
777
|
return "error : ".$e->getMessage(); |
|
778
|
778
|
} |
|
779
|
779
|
$i++; |
|
@@ -786,7 +786,7 @@ discard block |
|
|
block discarded – undo |
|
786
|
786
|
|
|
787
|
787
|
echo "Download data from another free database...\n"; |
|
788
|
788
|
$out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
|
789
|
|
- update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
|
789
|
+ update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
790
|
790
|
if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
791
|
791
|
update_db::unzip($out_file); |
|
792
|
792
|
$header = NULL; |
|
@@ -798,15 +798,15 @@ discard block |
|
|
block discarded – undo |
|
798
|
798
|
//$Connection->db->beginTransaction(); |
|
799
|
799
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
800
|
800
|
{ |
|
801
|
|
- if(!$header) $header = $row; |
|
|
801
|
+ if (!$header) $header = $row; |
|
802
|
802
|
else { |
|
803
|
803
|
$data = $row; |
|
804
|
804
|
|
|
805
|
805
|
$query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
|
806
|
806
|
try { |
|
807
|
807
|
$sth = $Connection->db->prepare($query); |
|
808
|
|
- $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
809
|
|
- } catch(PDOException $e) { |
|
|
808
|
+ $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
|
809
|
+ } catch (PDOException $e) { |
|
810
|
810
|
return "error : ".$e->getMessage(); |
|
811
|
811
|
} |
|
812
|
812
|
} |
|
@@ -820,15 +820,15 @@ discard block |
|
|
block discarded – undo |
|
820
|
820
|
try { |
|
821
|
821
|
$sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
|
822
|
822
|
$sth->execute(); |
|
823
|
|
- } catch(PDOException $e) { |
|
|
823
|
+ } catch (PDOException $e) { |
|
824
|
824
|
return "error : ".$e->getMessage(); |
|
825
|
825
|
} |
|
826
|
826
|
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
827
|
827
|
$query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
|
828
|
828
|
try { |
|
829
|
829
|
$sth2 = $Connection->db->prepare($query2); |
|
830
|
|
- $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
831
|
|
- } catch(PDOException $e) { |
|
|
830
|
+ $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
|
831
|
+ } catch (PDOException $e) { |
|
832
|
832
|
return "error : ".$e->getMessage(); |
|
833
|
833
|
} |
|
834
|
834
|
} |
|
@@ -852,7 +852,7 @@ discard block |
|
|
block discarded – undo |
|
852
|
852
|
$Connection = new Connection(); |
|
853
|
853
|
$sth = $Connection->db->prepare($query); |
|
854
|
854
|
$sth->execute(array(':source' => 'translation.csv')); |
|
855
|
|
- } catch(PDOException $e) { |
|
|
855
|
+ } catch (PDOException $e) { |
|
856
|
856
|
return "error : ".$e->getMessage(); |
|
857
|
857
|
} |
|
858
|
858
|
|
|
@@ -869,7 +869,7 @@ discard block |
|
|
block discarded – undo |
|
869
|
869
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
870
|
870
|
{ |
|
871
|
871
|
$i++; |
|
872
|
|
- if($i > 12) { |
|
|
872
|
+ if ($i > 12) { |
|
873
|
873
|
$data = $row; |
|
874
|
874
|
$operator = $data[2]; |
|
875
|
875
|
if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
|
@@ -877,7 +877,7 @@ discard block |
|
|
block discarded – undo |
|
877
|
877
|
//echo substr($operator, 0, 2)."\n";; |
|
878
|
878
|
if (count($airline_array) > 0) { |
|
879
|
879
|
//print_r($airline_array); |
|
880
|
|
- $operator = $airline_array[0]['icao'].substr($operator,2); |
|
|
880
|
+ $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
881
|
881
|
} |
|
882
|
882
|
} |
|
883
|
883
|
|
|
@@ -885,14 +885,14 @@ discard block |
|
|
block discarded – undo |
|
885
|
885
|
if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
|
886
|
886
|
$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
887
|
887
|
if (count($airline_array) > 0) { |
|
888
|
|
- $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
|
888
|
+ $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
889
|
889
|
} |
|
890
|
890
|
} |
|
891
|
891
|
$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
|
892
|
892
|
try { |
|
893
|
893
|
$sth = $Connection->db->prepare($query); |
|
894
|
|
- $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
895
|
|
- } catch(PDOException $e) { |
|
|
894
|
+ $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
|
895
|
+ } catch (PDOException $e) { |
|
896
|
896
|
return "error : ".$e->getMessage(); |
|
897
|
897
|
} |
|
898
|
898
|
} |
|
@@ -912,7 +912,7 @@ discard block |
|
|
block discarded – undo |
|
912
|
912
|
$Connection = new Connection(); |
|
913
|
913
|
$sth = $Connection->db->prepare($query); |
|
914
|
914
|
$sth->execute(array(':source' => 'website_fam')); |
|
915
|
|
- } catch(PDOException $e) { |
|
|
915
|
+ } catch (PDOException $e) { |
|
916
|
916
|
return "error : ".$e->getMessage(); |
|
917
|
917
|
} |
|
918
|
918
|
|
|
@@ -932,8 +932,8 @@ discard block |
|
|
block discarded – undo |
|
932
|
932
|
$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
|
933
|
933
|
try { |
|
934
|
934
|
$sth = $Connection->db->prepare($query); |
|
935
|
|
- $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
936
|
|
- } catch(PDOException $e) { |
|
|
935
|
+ $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
|
936
|
+ } catch (PDOException $e) { |
|
937
|
937
|
return "error : ".$e->getMessage(); |
|
938
|
938
|
} |
|
939
|
939
|
} |
|
@@ -952,7 +952,7 @@ discard block |
|
|
block discarded – undo |
|
952
|
952
|
$Connection = new Connection(); |
|
953
|
953
|
$sth = $Connection->db->prepare($query); |
|
954
|
954
|
$sth->execute(array(':source' => 'website_faa')); |
|
955
|
|
- } catch(PDOException $e) { |
|
|
955
|
+ } catch (PDOException $e) { |
|
956
|
956
|
return "error : ".$e->getMessage(); |
|
957
|
957
|
} |
|
958
|
958
|
|
|
@@ -961,7 +961,7 @@ discard block |
|
|
block discarded – undo |
|
961
|
961
|
$Connection = new Connection(); |
|
962
|
962
|
$sth = $Connection->db->prepare($query); |
|
963
|
963
|
$sth->execute(array(':source' => 'website_faa')); |
|
964
|
|
- } catch(PDOException $e) { |
|
|
964
|
+ } catch (PDOException $e) { |
|
965
|
965
|
return "error : ".$e->getMessage(); |
|
966
|
966
|
} |
|
967
|
967
|
|
|
@@ -989,8 +989,8 @@ discard block |
|
|
block discarded – undo |
|
989
|
989
|
$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
|
990
|
990
|
try { |
|
991
|
991
|
$sth = $Connection->db->prepare($query); |
|
992
|
|
- $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => $data[6],':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
993
|
|
- } catch(PDOException $e) { |
|
|
992
|
+ $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => $data[6], ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
|
993
|
+ } catch (PDOException $e) { |
|
994
|
994
|
return "error : ".$e->getMessage(); |
|
995
|
995
|
} |
|
996
|
996
|
} |
|
@@ -1009,7 +1009,7 @@ discard block |
|
|
block discarded – undo |
|
1009
|
1009
|
$Connection = new Connection(); |
|
1010
|
1010
|
$sth = $Connection->db->prepare($query); |
|
1011
|
1011
|
$sth->execute(array(':source' => 'website_fam')); |
|
1012
|
|
- } catch(PDOException $e) { |
|
|
1012
|
+ } catch (PDOException $e) { |
|
1013
|
1013
|
return "error : ".$e->getMessage(); |
|
1014
|
1014
|
} |
|
1015
|
1015
|
|
|
@@ -1029,8 +1029,8 @@ discard block |
|
|
block discarded – undo |
|
1029
|
1029
|
$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
|
1030
|
1030
|
try { |
|
1031
|
1031
|
$sth = $Connection->db->prepare($query); |
|
1032
|
|
- $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
1033
|
|
- } catch(PDOException $e) { |
|
|
1032
|
+ $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
|
1033
|
+ } catch (PDOException $e) { |
|
1034
|
1034
|
return "error : ".$e->getMessage(); |
|
1035
|
1035
|
} |
|
1036
|
1036
|
} |
|
@@ -1049,7 +1049,7 @@ discard block |
|
|
block discarded – undo |
|
1049
|
1049
|
$Connection = new Connection(); |
|
1050
|
1050
|
$sth = $Connection->db->prepare($query); |
|
1051
|
1051
|
$sth->execute(array(':source' => 'website_fam')); |
|
1052
|
|
- } catch(PDOException $e) { |
|
|
1052
|
+ } catch (PDOException $e) { |
|
1053
|
1053
|
return "error : ".$e->getMessage(); |
|
1054
|
1054
|
} |
|
1055
|
1055
|
|
|
@@ -1065,8 +1065,8 @@ discard block |
|
|
block discarded – undo |
|
1065
|
1065
|
$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
|
1066
|
1066
|
try { |
|
1067
|
1067
|
$sth = $Connection->db->prepare($query); |
|
1068
|
|
- $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1069
|
|
- } catch(PDOException $e) { |
|
|
1068
|
+ $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
|
1069
|
+ } catch (PDOException $e) { |
|
1070
|
1070
|
print_r($data); |
|
1071
|
1071
|
return "error : ".$e->getMessage(); |
|
1072
|
1072
|
} |
|
@@ -1086,7 +1086,7 @@ discard block |
|
|
block discarded – undo |
|
1086
|
1086
|
$Connection = new Connection(); |
|
1087
|
1087
|
$sth = $Connection->db->prepare($query); |
|
1088
|
1088
|
$sth->execute(array(':source' => 'website_fam')); |
|
1089
|
|
- } catch(PDOException $e) { |
|
|
1089
|
+ } catch (PDOException $e) { |
|
1090
|
1090
|
return "error : ".$e->getMessage(); |
|
1091
|
1091
|
} |
|
1092
|
1092
|
|
|
@@ -1106,8 +1106,8 @@ discard block |
|
|
block discarded – undo |
|
1106
|
1106
|
$query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
|
1107
|
1107
|
try { |
|
1108
|
1108
|
$sth = $Connection->db->prepare($query); |
|
1109
|
|
- $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
1110
|
|
- } catch(PDOException $e) { |
|
|
1109
|
+ $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
|
1110
|
+ } catch (PDOException $e) { |
|
1111
|
1111
|
return "error : ".$e->getMessage(); |
|
1112
|
1112
|
} |
|
1113
|
1113
|
} |
|
@@ -1119,7 +1119,7 @@ discard block |
|
|
block discarded – undo |
|
1119
|
1119
|
return ''; |
|
1120
|
1120
|
} |
|
1121
|
1121
|
|
|
1122
|
|
- public static function tle($filename,$tletype) { |
|
|
1122
|
+ public static function tle($filename, $tletype) { |
|
1123
|
1123
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
|
1124
|
1124
|
global $tmp_dir, $globalTransaction; |
|
1125
|
1125
|
//$Spotter = new Spotter(); |
|
@@ -1129,7 +1129,7 @@ discard block |
|
|
block discarded – undo |
|
1129
|
1129
|
$Connection = new Connection(); |
|
1130
|
1130
|
$sth = $Connection->db->prepare($query); |
|
1131
|
1131
|
$sth->execute(array(':source' => $filename)); |
|
1132
|
|
- } catch(PDOException $e) { |
|
|
1132
|
+ } catch (PDOException $e) { |
|
1133
|
1133
|
return "error : ".$e->getMessage(); |
|
1134
|
1134
|
} |
|
1135
|
1135
|
|
|
@@ -1154,8 +1154,8 @@ discard block |
|
|
block discarded – undo |
|
1154
|
1154
|
$query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
|
1155
|
1155
|
try { |
|
1156
|
1156
|
$sth = $Connection->db->prepare($query); |
|
1157
|
|
- $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1158
|
|
- } catch(PDOException $e) { |
|
|
1157
|
+ $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
|
1158
|
+ } catch (PDOException $e) { |
|
1159
|
1159
|
return "error : ".$e->getMessage(); |
|
1160
|
1160
|
} |
|
1161
|
1161
|
|
|
@@ -1175,28 +1175,28 @@ discard block |
|
|
block discarded – undo |
|
1175
|
1175
|
*/ |
|
1176
|
1176
|
private static function table2array($data) { |
|
1177
|
1177
|
$html = str_get_html($data); |
|
1178
|
|
- $tabledata=array(); |
|
1179
|
|
- foreach($html->find('tr') as $element) |
|
|
1178
|
+ $tabledata = array(); |
|
|
1179
|
+ foreach ($html->find('tr') as $element) |
|
1180
|
1180
|
{ |
|
1181
|
1181
|
$td = array(); |
|
1182
|
|
- foreach( $element->find('th') as $row) |
|
|
1182
|
+ foreach ($element->find('th') as $row) |
|
1183
|
1183
|
{ |
|
1184
|
1184
|
$td [] = trim($row->plaintext); |
|
1185
|
1185
|
} |
|
1186
|
|
- $td=array_filter($td); |
|
|
1186
|
+ $td = array_filter($td); |
|
1187
|
1187
|
$tabledata[] = $td; |
|
1188
|
1188
|
|
|
1189
|
1189
|
$td = array(); |
|
1190
|
1190
|
$tdi = array(); |
|
1191
|
|
- foreach( $element->find('td') as $row) |
|
|
1191
|
+ foreach ($element->find('td') as $row) |
|
1192
|
1192
|
{ |
|
1193
|
1193
|
$td [] = trim($row->plaintext); |
|
1194
|
1194
|
$tdi [] = trim($row->innertext); |
|
1195
|
1195
|
} |
|
1196
|
|
- $td=array_filter($td); |
|
1197
|
|
- $tdi=array_filter($tdi); |
|
|
1196
|
+ $td = array_filter($td); |
|
|
1197
|
+ $tdi = array_filter($tdi); |
|
1198
|
1198
|
// $tabledata[]=array_merge($td,$tdi); |
|
1199
|
|
- $tabledata[]=$td; |
|
|
1199
|
+ $tabledata[] = $td; |
|
1200
|
1200
|
} |
|
1201
|
1201
|
return(array_filter($tabledata)); |
|
1202
|
1202
|
} |
|
@@ -1269,13 +1269,13 @@ discard block |
|
|
block discarded – undo |
|
1269
|
1269
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
1270
|
1270
|
{ |
|
1271
|
1271
|
$i++; |
|
1272
|
|
- if($i > 3 && count($row) > 2) { |
|
|
1272
|
+ if ($i > 3 && count($row) > 2) { |
|
1273
|
1273
|
$data = array_values(array_filter($row)); |
|
1274
|
1274
|
$cntdata = count($data); |
|
1275
|
1275
|
if ($cntdata > 10) { |
|
1276
|
1276
|
$value = $data[9]; |
|
1277
|
1277
|
|
|
1278
|
|
- for ($i =10;$i < $cntdata;$i++) { |
|
|
1278
|
+ for ($i = 10; $i < $cntdata; $i++) { |
|
1279
|
1279
|
$value .= ' '.$data[$i]; |
|
1280
|
1280
|
} |
|
1281
|
1281
|
$data[9] = $value; |
|
@@ -1285,8 +1285,8 @@ discard block |
|
|
block discarded – undo |
|
1285
|
1285
|
$query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
|
1286
|
1286
|
try { |
|
1287
|
1287
|
$sth = $Connection->db->prepare($query); |
|
1288
|
|
- $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1289
|
|
- } catch(PDOException $e) { |
|
|
1288
|
+ $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
|
1289
|
+ } catch (PDOException $e) { |
|
1290
|
1290
|
return "error : ".$e->getMessage(); |
|
1291
|
1291
|
} |
|
1292
|
1292
|
} |
|
@@ -1307,7 +1307,7 @@ discard block |
|
|
block discarded – undo |
|
1307
|
1307
|
$Connection = new Connection(); |
|
1308
|
1308
|
$sth = $Connection->db->prepare($query); |
|
1309
|
1309
|
$sth->execute(); |
|
1310
|
|
- } catch(PDOException $e) { |
|
|
1310
|
+ } catch (PDOException $e) { |
|
1311
|
1311
|
return "error : ".$e->getMessage(); |
|
1312
|
1312
|
} |
|
1313
|
1313
|
|
|
@@ -1319,12 +1319,12 @@ discard block |
|
|
block discarded – undo |
|
1319
|
1319
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1320
|
1320
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
1321
|
1321
|
{ |
|
1322
|
|
- if(count($row) > 1) { |
|
|
1322
|
+ if (count($row) > 1) { |
|
1323
|
1323
|
$query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
|
1324
|
1324
|
try { |
|
1325
|
1325
|
$sth = $Connection->db->prepare($query); |
|
1326
|
|
- $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1327
|
|
- } catch(PDOException $e) { |
|
|
1326
|
+ $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
|
1327
|
+ } catch (PDOException $e) { |
|
1328
|
1328
|
return "error : ".$e->getMessage(); |
|
1329
|
1329
|
} |
|
1330
|
1330
|
} |
|
@@ -1344,21 +1344,21 @@ discard block |
|
|
block discarded – undo |
|
1344
|
1344
|
try { |
|
1345
|
1345
|
$sth = $Connection->db->prepare($query); |
|
1346
|
1346
|
$sth->execute(); |
|
1347
|
|
- } catch(PDOException $e) { |
|
|
1347
|
+ } catch (PDOException $e) { |
|
1348
|
1348
|
return "error : ".$e->getMessage(); |
|
1349
|
1349
|
} |
|
1350
|
1350
|
} |
|
1351
|
1351
|
|
|
1352
|
1352
|
|
|
1353
|
|
- if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
|
1353
|
+ if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1354
|
1354
|
else { |
|
1355
|
|
- update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
|
1355
|
+ update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1356
|
1356
|
$query = "CREATE EXTENSION postgis"; |
|
1357
|
|
- $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
|
1357
|
+ $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1358
|
1358
|
try { |
|
1359
|
1359
|
$sth = $Connection->db->prepare($query); |
|
1360
|
1360
|
$sth->execute(); |
|
1361
|
|
- } catch(PDOException $e) { |
|
|
1361
|
+ } catch (PDOException $e) { |
|
1362
|
1362
|
return "error : ".$e->getMessage(); |
|
1363
|
1363
|
} |
|
1364
|
1364
|
} |
|
@@ -1371,7 +1371,7 @@ discard block |
|
|
block discarded – undo |
|
1371
|
1371
|
include_once('class.create_db.php'); |
|
1372
|
1372
|
require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
|
1373
|
1373
|
if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
1374
|
|
- update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
|
1374
|
+ update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1375
|
1375
|
$error = ''; |
|
1376
|
1376
|
if (file_exists($tmp_dir.'notam.txt.gz')) { |
|
1377
|
1377
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -1403,14 +1403,14 @@ discard block |
|
|
block discarded – undo |
|
1403
|
1403
|
try { |
|
1404
|
1404
|
$sth = $Connection->db->prepare($query); |
|
1405
|
1405
|
$sth->execute(); |
|
1406
|
|
- } catch(PDOException $e) { |
|
|
1406
|
+ } catch (PDOException $e) { |
|
1407
|
1407
|
echo "error : ".$e->getMessage(); |
|
1408
|
1408
|
} |
|
1409
|
1409
|
} |
|
1410
|
1410
|
if ($globalDBdriver == 'mysql') { |
|
1411
|
|
- update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
|
1411
|
+ update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1412
|
1412
|
} else { |
|
1413
|
|
- update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
|
1413
|
+ update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1414
|
1414
|
} |
|
1415
|
1415
|
$error = create_db::import_file($tmp_dir.'countries.sql'); |
|
1416
|
1416
|
return $error; |
|
@@ -1423,7 +1423,7 @@ discard block |
|
|
block discarded – undo |
|
1423
|
1423
|
// update_db::unzip($tmp_dir.'AptNav.zip'); |
|
1424
|
1424
|
// update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
|
1425
|
1425
|
// update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
1426
|
|
- update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
|
1426
|
+ update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
1427
|
1427
|
update_db::gunzip($tmp_dir.'awy.dat.gz'); |
|
1428
|
1428
|
$error = update_db::waypoints($tmp_dir.'awy.dat'); |
|
1429
|
1429
|
return $error; |
|
@@ -1443,7 +1443,7 @@ discard block |
|
|
block discarded – undo |
|
1443
|
1443
|
update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
|
1444
|
1444
|
if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
1445
|
1445
|
if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
|
1446
|
|
- if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
|
1446
|
+ if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1447
|
1447
|
} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
1448
|
1448
|
} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
1449
|
1449
|
if ($error != '') { |
|
@@ -1456,7 +1456,7 @@ discard block |
|
|
block discarded – undo |
|
1456
|
1456
|
global $tmp_dir, $globalDebug; |
|
1457
|
1457
|
$error = ''; |
|
1458
|
1458
|
if ($globalDebug) echo "Routes : Download..."; |
|
1459
|
|
- update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
|
1459
|
+ update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1460
|
1460
|
if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
|
1461
|
1461
|
if ($globalDebug) echo "Gunzip..."; |
|
1462
|
1462
|
update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
|
@@ -1472,7 +1472,7 @@ discard block |
|
|
block discarded – undo |
|
1472
|
1472
|
global $tmp_dir, $globalDebug; |
|
1473
|
1473
|
$error = ''; |
|
1474
|
1474
|
if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
1475
|
|
- update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
|
1475
|
+ update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1476
|
1476
|
if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
|
1477
|
1477
|
if ($globalDebug) echo "Gunzip..."; |
|
1478
|
1478
|
update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
|
@@ -1488,7 +1488,7 @@ discard block |
|
|
block discarded – undo |
|
1488
|
1488
|
global $tmp_dir, $globalDebug; |
|
1489
|
1489
|
$error = ''; |
|
1490
|
1490
|
if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
1491
|
|
- update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
|
1491
|
+ update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1492
|
1492
|
if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
|
1493
|
1493
|
if ($globalDebug) echo "Gunzip..."; |
|
1494
|
1494
|
update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
|
@@ -1516,7 +1516,7 @@ discard block |
|
|
block discarded – undo |
|
1516
|
1516
|
*/ |
|
1517
|
1517
|
if ($globalDebug) echo "Modes : Download..."; |
|
1518
|
1518
|
// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
1519
|
|
- update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
|
1519
|
+ update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
1520
|
1520
|
|
|
1521
|
1521
|
// if (file_exists($tmp_dir.'basestation_latest.zip')) { |
|
1522
|
1522
|
if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
|
@@ -1536,7 +1536,7 @@ discard block |
|
|
block discarded – undo |
|
1536
|
1536
|
public static function update_ModeS_faa() { |
|
1537
|
1537
|
global $tmp_dir, $globalDebug; |
|
1538
|
1538
|
if ($globalDebug) echo "Modes FAA: Download..."; |
|
1539
|
|
- update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
|
1539
|
+ update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
1540
|
1540
|
if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
|
1541
|
1541
|
if ($globalDebug) echo "Unzip..."; |
|
1542
|
1542
|
update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
|
@@ -1552,7 +1552,7 @@ discard block |
|
|
block discarded – undo |
|
1552
|
1552
|
public static function update_ModeS_flarm() { |
|
1553
|
1553
|
global $tmp_dir, $globalDebug; |
|
1554
|
1554
|
if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
1555
|
|
- update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
|
1555
|
+ update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
1556
|
1556
|
if (file_exists($tmp_dir.'data.fln')) { |
|
1557
|
1557
|
if ($globalDebug) echo "Add to DB..."; |
|
1558
|
1558
|
$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
|
@@ -1566,7 +1566,7 @@ discard block |
|
|
block discarded – undo |
|
1566
|
1566
|
public static function update_ModeS_ogn() { |
|
1567
|
1567
|
global $tmp_dir, $globalDebug; |
|
1568
|
1568
|
if ($globalDebug) echo "Modes OGN: Download..."; |
|
1569
|
|
- update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
|
1569
|
+ update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
1570
|
1570
|
if (file_exists($tmp_dir.'ogn.csv')) { |
|
1571
|
1571
|
if ($globalDebug) echo "Add to DB..."; |
|
1572
|
1572
|
$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
|
@@ -1581,173 +1581,173 @@ discard block |
|
|
block discarded – undo |
|
1581
|
1581
|
global $tmp_dir, $globalDebug; |
|
1582
|
1582
|
|
|
1583
|
1583
|
if ($globalDebug) echo "Owner France: Download..."; |
|
1584
|
|
- update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
|
1584
|
+ update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
1585
|
1585
|
if (file_exists($tmp_dir.'owner_f.csv')) { |
|
1586
|
1586
|
if ($globalDebug) echo "Add to DB..."; |
|
1587
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
|
1587
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
1588
|
1588
|
} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
1589
|
1589
|
if ($error != '') { |
|
1590
|
1590
|
return $error; |
|
1591
|
1591
|
} elseif ($globalDebug) echo "Done\n"; |
|
1592
|
1592
|
|
|
1593
|
1593
|
if ($globalDebug) echo "Owner Ireland: Download..."; |
|
1594
|
|
- update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
|
1594
|
+ update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
1595
|
1595
|
if (file_exists($tmp_dir.'owner_ei.csv')) { |
|
1596
|
1596
|
if ($globalDebug) echo "Add to DB..."; |
|
1597
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
|
1597
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
1598
|
1598
|
} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
1599
|
1599
|
if ($error != '') { |
|
1600
|
1600
|
return $error; |
|
1601
|
1601
|
} elseif ($globalDebug) echo "Done\n"; |
|
1602
|
1602
|
if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
1603
|
|
- update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
|
1603
|
+ update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
1604
|
1604
|
if (file_exists($tmp_dir.'owner_hb.csv')) { |
|
1605
|
1605
|
if ($globalDebug) echo "Add to DB..."; |
|
1606
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
|
1606
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
1607
|
1607
|
} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
1608
|
1608
|
if ($error != '') { |
|
1609
|
1609
|
return $error; |
|
1610
|
1610
|
} elseif ($globalDebug) echo "Done\n"; |
|
1611
|
1611
|
if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
1612
|
|
- update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
|
1612
|
+ update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
1613
|
1613
|
if (file_exists($tmp_dir.'owner_ok.csv')) { |
|
1614
|
1614
|
if ($globalDebug) echo "Add to DB..."; |
|
1615
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
|
1615
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
1616
|
1616
|
} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
1617
|
1617
|
if ($error != '') { |
|
1618
|
1618
|
return $error; |
|
1619
|
1619
|
} elseif ($globalDebug) echo "Done\n"; |
|
1620
|
1620
|
if ($globalDebug) echo "Owner Australia: Download..."; |
|
1621
|
|
- update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
|
1621
|
+ update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
1622
|
1622
|
if (file_exists($tmp_dir.'owner_vh.csv')) { |
|
1623
|
1623
|
if ($globalDebug) echo "Add to DB..."; |
|
1624
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
|
1624
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
1625
|
1625
|
} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
1626
|
1626
|
if ($error != '') { |
|
1627
|
1627
|
return $error; |
|
1628
|
1628
|
} elseif ($globalDebug) echo "Done\n"; |
|
1629
|
1629
|
if ($globalDebug) echo "Owner Austria: Download..."; |
|
1630
|
|
- update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
|
1630
|
+ update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
1631
|
1631
|
if (file_exists($tmp_dir.'owner_oe.csv')) { |
|
1632
|
1632
|
if ($globalDebug) echo "Add to DB..."; |
|
1633
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
|
1633
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
1634
|
1634
|
} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
1635
|
1635
|
if ($error != '') { |
|
1636
|
1636
|
return $error; |
|
1637
|
1637
|
} elseif ($globalDebug) echo "Done\n"; |
|
1638
|
1638
|
if ($globalDebug) echo "Owner Chile: Download..."; |
|
1639
|
|
- update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
|
1639
|
+ update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
1640
|
1640
|
if (file_exists($tmp_dir.'owner_cc.csv')) { |
|
1641
|
1641
|
if ($globalDebug) echo "Add to DB..."; |
|
1642
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
|
1642
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
1643
|
1643
|
} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
1644
|
1644
|
if ($error != '') { |
|
1645
|
1645
|
return $error; |
|
1646
|
1646
|
} elseif ($globalDebug) echo "Done\n"; |
|
1647
|
1647
|
if ($globalDebug) echo "Owner Colombia: Download..."; |
|
1648
|
|
- update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
|
1648
|
+ update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
1649
|
1649
|
if (file_exists($tmp_dir.'owner_hj.csv')) { |
|
1650
|
1650
|
if ($globalDebug) echo "Add to DB..."; |
|
1651
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
|
1651
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
1652
|
1652
|
} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
1653
|
1653
|
if ($error != '') { |
|
1654
|
1654
|
return $error; |
|
1655
|
1655
|
} elseif ($globalDebug) echo "Done\n"; |
|
1656
|
1656
|
if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
1657
|
|
- update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
|
1657
|
+ update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
1658
|
1658
|
if (file_exists($tmp_dir.'owner_e7.csv')) { |
|
1659
|
1659
|
if ($globalDebug) echo "Add to DB..."; |
|
1660
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
|
1660
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
1661
|
1661
|
} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
1662
|
1662
|
if ($error != '') { |
|
1663
|
1663
|
return $error; |
|
1664
|
1664
|
} elseif ($globalDebug) echo "Done\n"; |
|
1665
|
1665
|
if ($globalDebug) echo "Owner Brazil: Download..."; |
|
1666
|
|
- update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
|
1666
|
+ update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
1667
|
1667
|
if (file_exists($tmp_dir.'owner_pp.csv')) { |
|
1668
|
1668
|
if ($globalDebug) echo "Add to DB..."; |
|
1669
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
|
1669
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
1670
|
1670
|
} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
1671
|
1671
|
if ($error != '') { |
|
1672
|
1672
|
return $error; |
|
1673
|
1673
|
} elseif ($globalDebug) echo "Done\n"; |
|
1674
|
1674
|
if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
1675
|
|
- update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
|
1675
|
+ update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
1676
|
1676
|
if (file_exists($tmp_dir.'owner_vp.csv')) { |
|
1677
|
1677
|
if ($globalDebug) echo "Add to DB..."; |
|
1678
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
|
1678
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
1679
|
1679
|
} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
1680
|
1680
|
if ($error != '') { |
|
1681
|
1681
|
return $error; |
|
1682
|
1682
|
} elseif ($globalDebug) echo "Done\n"; |
|
1683
|
1683
|
if ($globalDebug) echo "Owner Croatia: Download..."; |
|
1684
|
|
- update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
|
1684
|
+ update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
1685
|
1685
|
if (file_exists($tmp_dir.'owner_9a.csv')) { |
|
1686
|
1686
|
if ($globalDebug) echo "Add to DB..."; |
|
1687
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
|
1687
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
1688
|
1688
|
} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
1689
|
1689
|
if ($error != '') { |
|
1690
|
1690
|
return $error; |
|
1691
|
1691
|
} elseif ($globalDebug) echo "Done\n"; |
|
1692
|
1692
|
if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
1693
|
|
- update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
|
1693
|
+ update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
1694
|
1694
|
if (file_exists($tmp_dir.'owner_lx.csv')) { |
|
1695
|
1695
|
if ($globalDebug) echo "Add to DB..."; |
|
1696
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
|
1696
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
1697
|
1697
|
} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
1698
|
1698
|
if ($error != '') { |
|
1699
|
1699
|
return $error; |
|
1700
|
1700
|
} elseif ($globalDebug) echo "Done\n"; |
|
1701
|
1701
|
if ($globalDebug) echo "Owner Maldives: Download..."; |
|
1702
|
|
- update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
|
1702
|
+ update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
1703
|
1703
|
if (file_exists($tmp_dir.'owner_8q.csv')) { |
|
1704
|
1704
|
if ($globalDebug) echo "Add to DB..."; |
|
1705
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
|
1705
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
1706
|
1706
|
} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
1707
|
1707
|
if ($error != '') { |
|
1708
|
1708
|
return $error; |
|
1709
|
1709
|
} elseif ($globalDebug) echo "Done\n"; |
|
1710
|
1710
|
if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
1711
|
|
- update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
|
1711
|
+ update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
1712
|
1712
|
if (file_exists($tmp_dir.'owner_zk.csv')) { |
|
1713
|
1713
|
if ($globalDebug) echo "Add to DB..."; |
|
1714
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
|
1714
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
1715
|
1715
|
} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
1716
|
1716
|
if ($error != '') { |
|
1717
|
1717
|
return $error; |
|
1718
|
1718
|
} elseif ($globalDebug) echo "Done\n"; |
|
1719
|
1719
|
if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
1720
|
|
- update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
|
1720
|
+ update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
1721
|
1721
|
if (file_exists($tmp_dir.'owner_p2.csv')) { |
|
1722
|
1722
|
if ($globalDebug) echo "Add to DB..."; |
|
1723
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
|
1723
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
1724
|
1724
|
} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
1725
|
1725
|
if ($error != '') { |
|
1726
|
1726
|
return $error; |
|
1727
|
1727
|
} elseif ($globalDebug) echo "Done\n"; |
|
1728
|
1728
|
if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
1729
|
|
- update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
|
1729
|
+ update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
1730
|
1730
|
if (file_exists($tmp_dir.'owner_om.csv')) { |
|
1731
|
1731
|
if ($globalDebug) echo "Add to DB..."; |
|
1732
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
|
1732
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
1733
|
1733
|
} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
1734
|
1734
|
if ($error != '') { |
|
1735
|
1735
|
return $error; |
|
1736
|
1736
|
} elseif ($globalDebug) echo "Done\n"; |
|
1737
|
1737
|
if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
1738
|
|
- update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
|
1738
|
+ update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
1739
|
1739
|
if (file_exists($tmp_dir.'owner_hc.csv')) { |
|
1740
|
1740
|
if ($globalDebug) echo "Add to DB..."; |
|
1741
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
|
1741
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
1742
|
1742
|
} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
1743
|
1743
|
if ($error != '') { |
|
1744
|
1744
|
return $error; |
|
1745
|
1745
|
} elseif ($globalDebug) echo "Done\n"; |
|
1746
|
1746
|
if ($globalDebug) echo "Owner Iceland: Download..."; |
|
1747
|
|
- update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
|
1747
|
+ update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
1748
|
1748
|
if (file_exists($tmp_dir.'owner_tf.csv')) { |
|
1749
|
1749
|
if ($globalDebug) echo "Add to DB..."; |
|
1750
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
|
1750
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
1751
|
1751
|
} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
1752
|
1752
|
if ($error != '') { |
|
1753
|
1753
|
return $error; |
|
@@ -1759,7 +1759,7 @@ discard block |
|
|
block discarded – undo |
|
1759
|
1759
|
global $tmp_dir, $globalDebug; |
|
1760
|
1760
|
$error = ''; |
|
1761
|
1761
|
if ($globalDebug) echo "Translation : Download..."; |
|
1762
|
|
- update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
|
1762
|
+ update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
1763
|
1763
|
if (file_exists($tmp_dir.'translation.zip')) { |
|
1764
|
1764
|
if ($globalDebug) echo "Unzip..."; |
|
1765
|
1765
|
update_db::unzip($tmp_dir.'translation.zip'); |
|
@@ -1775,7 +1775,7 @@ discard block |
|
|
block discarded – undo |
|
1775
|
1775
|
public static function update_translation_fam() { |
|
1776
|
1776
|
global $tmp_dir, $globalDebug; |
|
1777
|
1777
|
if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
1778
|
|
- update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
|
1778
|
+ update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
1779
|
1779
|
if (file_exists($tmp_dir.'translation.tsv.gz')) { |
|
1780
|
1780
|
if ($globalDebug) echo "Gunzip..."; |
|
1781
|
1781
|
update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
|
@@ -1790,7 +1790,7 @@ discard block |
|
|
block discarded – undo |
|
1790
|
1790
|
public static function update_ModeS_fam() { |
|
1791
|
1791
|
global $tmp_dir, $globalDebug; |
|
1792
|
1792
|
if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
1793
|
|
- update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
|
1793
|
+ update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
1794
|
1794
|
if (file_exists($tmp_dir.'modes.tsv.gz')) { |
|
1795
|
1795
|
if ($globalDebug) echo "Gunzip..."; |
|
1796
|
1796
|
update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
|
@@ -1806,9 +1806,9 @@ discard block |
|
|
block discarded – undo |
|
1806
|
1806
|
global $tmp_dir, $globalDebug, $globalOwner; |
|
1807
|
1807
|
if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
1808
|
1808
|
if ($globalOwner === TRUE) { |
|
1809
|
|
- update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
|
1809
|
+ update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1810
|
1810
|
} else { |
|
1811
|
|
- update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
|
1811
|
+ update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1812
|
1812
|
} |
|
1813
|
1813
|
if (file_exists($tmp_dir.'owners.tsv.gz')) { |
|
1814
|
1814
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -1824,7 +1824,7 @@ discard block |
|
|
block discarded – undo |
|
1824
|
1824
|
public static function update_routes_fam() { |
|
1825
|
1825
|
global $tmp_dir, $globalDebug; |
|
1826
|
1826
|
if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
1827
|
|
- update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
|
1827
|
+ update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
1828
|
1828
|
if (file_exists($tmp_dir.'routes.tsv.gz')) { |
|
1829
|
1829
|
if ($globalDebug) echo "Gunzip..."; |
|
1830
|
1830
|
update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
|
@@ -1843,18 +1843,18 @@ discard block |
|
|
block discarded – undo |
|
1843
|
1843
|
$error = ''; |
|
1844
|
1844
|
if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
1845
|
1845
|
if ($globalDBdriver == 'mysql') { |
|
1846
|
|
- update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
|
1846
|
+ update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
1847
|
1847
|
} else { |
|
1848
|
|
- update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
|
1848
|
+ update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
1849
|
1849
|
} |
|
1850
|
1850
|
if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
|
1851
|
|
- $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
|
1851
|
+ $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
1852
|
1852
|
$airspace_md5 = $airspace_md5_file[0]; |
|
1853
|
1853
|
if (!update_db::check_airspace_version($airspace_md5)) { |
|
1854
|
1854
|
if ($globalDBdriver == 'mysql') { |
|
1855
|
|
- update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
|
1855
|
+ update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
1856
|
1856
|
} else { |
|
1857
|
|
- update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
|
1857
|
+ update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
1858
|
1858
|
} |
|
1859
|
1859
|
if (file_exists($tmp_dir.'airspace.sql.gz')) { |
|
1860
|
1860
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -1866,7 +1866,7 @@ discard block |
|
|
block discarded – undo |
|
1866
|
1866
|
try { |
|
1867
|
1867
|
$sth = $Connection->db->prepare($query); |
|
1868
|
1868
|
$sth->execute(); |
|
1869
|
|
- } catch(PDOException $e) { |
|
|
1869
|
+ } catch (PDOException $e) { |
|
1870
|
1870
|
return "error : ".$e->getMessage(); |
|
1871
|
1871
|
} |
|
1872
|
1872
|
} |
|
@@ -1884,15 +1884,15 @@ discard block |
|
|
block discarded – undo |
|
1884
|
1884
|
public static function update_tle() { |
|
1885
|
1885
|
global $tmp_dir, $globalDebug; |
|
1886
|
1886
|
if ($globalDebug) echo "Download TLE : Download..."; |
|
1887
|
|
- $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
|
1888
|
|
- 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
|
1889
|
|
- 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
|
1887
|
+ $alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt', |
|
|
1888
|
+ 'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt', |
|
|
1889
|
+ 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
1890
|
1890
|
foreach ($alltle as $filename) { |
|
1891
|
1891
|
if ($globalDebug) echo "downloading ".$filename.'...'; |
|
1892
|
|
- update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
|
1892
|
+ update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
1893
|
1893
|
if (file_exists($tmp_dir.$filename)) { |
|
1894
|
1894
|
if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
1895
|
|
- $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
|
1895
|
+ $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
1896
|
1896
|
} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
1897
|
1897
|
if ($error != '') { |
|
1898
|
1898
|
echo $error."\n"; |
|
@@ -1905,32 +1905,32 @@ discard block |
|
|
block discarded – undo |
|
1905
|
1905
|
global $tmp_dir, $globalDebug; |
|
1906
|
1906
|
$error = ''; |
|
1907
|
1907
|
if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
1908
|
|
- update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
|
1908
|
+ update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
1909
|
1909
|
if (file_exists($tmp_dir.'models.md5sum')) { |
|
1910
|
1910
|
if ($globalDebug) echo "Check files...\n"; |
|
1911
|
1911
|
$newmodelsdb = array(); |
|
1912
|
|
- if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
1913
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
1912
|
+ if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
|
1913
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1914
|
1914
|
$model = trim($row[2]); |
|
1915
|
1915
|
$newmodelsdb[$model] = trim($row[0]); |
|
1916
|
1916
|
} |
|
1917
|
1917
|
} |
|
1918
|
1918
|
$modelsdb = array(); |
|
1919
|
1919
|
if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
|
1920
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
1921
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
1920
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
|
1921
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1922
|
1922
|
$model = trim($row[2]); |
|
1923
|
1923
|
$modelsdb[$model] = trim($row[0]); |
|
1924
|
1924
|
} |
|
1925
|
1925
|
} |
|
1926
|
1926
|
} |
|
1927
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
|
1927
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
|
1928
|
1928
|
foreach ($diff as $key => $value) { |
|
1929
|
1929
|
if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
1930
|
|
- update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
|
1930
|
+ update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
1931
|
1931
|
|
|
1932
|
1932
|
} |
|
1933
|
|
- update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
|
1933
|
+ update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
1934
|
1934
|
} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
1935
|
1935
|
if ($error != '') { |
|
1936
|
1936
|
return $error; |
|
@@ -1942,32 +1942,32 @@ discard block |
|
|
block discarded – undo |
|
1942
|
1942
|
global $tmp_dir, $globalDebug; |
|
1943
|
1943
|
$error = ''; |
|
1944
|
1944
|
if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
1945
|
|
- update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
|
1945
|
+ update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
1946
|
1946
|
if (file_exists($tmp_dir.'space_models.md5sum')) { |
|
1947
|
1947
|
if ($globalDebug) echo "Check files...\n"; |
|
1948
|
1948
|
$newmodelsdb = array(); |
|
1949
|
|
- if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
1950
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
1949
|
+ if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
|
1950
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1951
|
1951
|
$model = trim($row[2]); |
|
1952
|
1952
|
$newmodelsdb[$model] = trim($row[0]); |
|
1953
|
1953
|
} |
|
1954
|
1954
|
} |
|
1955
|
1955
|
$modelsdb = array(); |
|
1956
|
1956
|
if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
|
1957
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
1958
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
1957
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
|
1958
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1959
|
1959
|
$model = trim($row[2]); |
|
1960
|
1960
|
$modelsdb[$model] = trim($row[0]); |
|
1961
|
1961
|
} |
|
1962
|
1962
|
} |
|
1963
|
1963
|
} |
|
1964
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
|
1964
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
|
1965
|
1965
|
foreach ($diff as $key => $value) { |
|
1966
|
1966
|
if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
1967
|
|
- update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
|
1967
|
+ update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
1968
|
1968
|
|
|
1969
|
1969
|
} |
|
1970
|
|
- update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
|
1970
|
+ update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
1971
|
1971
|
} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
1972
|
1972
|
if ($error != '') { |
|
1973
|
1973
|
return $error; |
|
@@ -1990,8 +1990,8 @@ discard block |
|
|
block discarded – undo |
|
1990
|
1990
|
*/ |
|
1991
|
1991
|
if (file_exists($tmp_dir.'aircrafts.html')) { |
|
1992
|
1992
|
//var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
1993
|
|
- $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
1994
|
|
- $result = fread($fh,100000000); |
|
|
1993
|
+ $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
|
1994
|
+ $result = fread($fh, 100000000); |
|
1995
|
1995
|
//echo $result; |
|
1996
|
1996
|
//var_dump(str_get_html($result)); |
|
1997
|
1997
|
//print_r(self::table2array($result)); |
|
@@ -2009,23 +2009,23 @@ discard block |
|
|
block discarded – undo |
|
2009
|
2009
|
$Connection = new Connection(); |
|
2010
|
2010
|
$sth = $Connection->db->prepare($query); |
|
2011
|
2011
|
$sth->execute(); |
|
2012
|
|
- } catch(PDOException $e) { |
|
|
2012
|
+ } catch (PDOException $e) { |
|
2013
|
2013
|
return "error : ".$e->getMessage(); |
|
2014
|
2014
|
} |
|
2015
|
2015
|
|
|
2016
|
2016
|
$error = ''; |
|
2017
|
2017
|
if ($globalDebug) echo "Notam : Download..."; |
|
2018
|
|
- update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
|
2018
|
+ update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2019
|
2019
|
if (file_exists($tmp_dir.'notam.rss')) { |
|
2020
|
|
- $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
|
2020
|
+ $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2021
|
2021
|
foreach ($notams['channel']['item'] as $notam) { |
|
2022
|
|
- $title = explode(':',$notam['title']); |
|
|
2022
|
+ $title = explode(':', $notam['title']); |
|
2023
|
2023
|
$data['ref'] = trim($title[0]); |
|
2024
|
2024
|
unset($title[0]); |
|
2025
|
|
- $data['title'] = trim(implode(':',$title)); |
|
2026
|
|
- $description = strip_tags($notam['description'],'<pre>'); |
|
2027
|
|
- preg_match(':^(.*?)<pre>:',$description,$match); |
|
2028
|
|
- $q = explode('/',$match[1]); |
|
|
2025
|
+ $data['title'] = trim(implode(':', $title)); |
|
|
2026
|
+ $description = strip_tags($notam['description'], '<pre>'); |
|
|
2027
|
+ preg_match(':^(.*?)<pre>:', $description, $match); |
|
|
2028
|
+ $q = explode('/', $match[1]); |
|
2029
|
2029
|
$data['fir'] = $q[0]; |
|
2030
|
2030
|
$data['code'] = $q[1]; |
|
2031
|
2031
|
$ifrvfr = $q[2]; |
|
@@ -2041,30 +2041,30 @@ discard block |
|
|
block discarded – undo |
|
2041
|
2041
|
$data['lower_limit'] = $q[5]; |
|
2042
|
2042
|
$data['upper_limit'] = $q[6]; |
|
2043
|
2043
|
$latlonrad = $q[7]; |
|
2044
|
|
- sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2045
|
|
- $latitude = $Common->convertDec($las,'latitude'); |
|
2046
|
|
- $longitude = $Common->convertDec($lns,'longitude'); |
|
|
2044
|
+ sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
|
2045
|
+ $latitude = $Common->convertDec($las, 'latitude'); |
|
|
2046
|
+ $longitude = $Common->convertDec($lns, 'longitude'); |
|
2047
|
2047
|
if ($lac == 'S') $latitude = '-'.$latitude; |
|
2048
|
2048
|
if ($lnc == 'W') $longitude = '-'.$longitude; |
|
2049
|
2049
|
$data['center_latitude'] = $latitude; |
|
2050
|
2050
|
$data['center_longitude'] = $longitude; |
|
2051
|
2051
|
$data['radius'] = intval($radius); |
|
2052
|
2052
|
|
|
2053
|
|
- preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
|
2053
|
+ preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2054
|
2054
|
$data['text'] = $match[1]; |
|
2055
|
|
- preg_match(':</pre>(.*?)$:',$description,$match); |
|
|
2055
|
+ preg_match(':</pre>(.*?)$:', $description, $match); |
|
2056
|
2056
|
$fromto = $match[1]; |
|
2057
|
|
- preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
|
2057
|
+ preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2058
|
2058
|
$fromall = trim($match[1]); |
|
2059
|
|
- preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
|
2059
|
+ preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2060
|
2060
|
$from = trim($match[1]); |
|
2061
|
|
- $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2062
|
|
- preg_match('#TO:(.*?)$#',$fromto,$match); |
|
|
2061
|
+ $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
|
2062
|
+ preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2063
|
2063
|
$toall = trim($match[1]); |
|
2064
|
|
- if (!preg_match(':Permanent:',$toall)) { |
|
2065
|
|
- preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
|
2064
|
+ if (!preg_match(':Permanent:', $toall)) { |
|
|
2065
|
+ preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2066
|
2066
|
$to = trim($match[1]); |
|
2067
|
|
- $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
|
2067
|
+ $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2068
|
2068
|
$data['permanent'] = 0; |
|
2069
|
2069
|
} else { |
|
2070
|
2070
|
$data['date_end'] = NULL; |
|
@@ -2072,7 +2072,7 @@ discard block |
|
|
block discarded – undo |
|
2072
|
2072
|
} |
|
2073
|
2073
|
$data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
|
2074
|
2074
|
$NOTAM = new NOTAM(); |
|
2075
|
|
- $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
|
2075
|
+ $NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
2076
|
2076
|
unset($data); |
|
2077
|
2077
|
} |
|
2078
|
2078
|
} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
@@ -2095,16 +2095,16 @@ discard block |
|
|
block discarded – undo |
|
2095
|
2095
|
$Connection = new Connection(); |
|
2096
|
2096
|
$sth = $Connection->db->prepare($query); |
|
2097
|
2097
|
$sth->execute(); |
|
2098
|
|
- } catch(PDOException $e) { |
|
|
2098
|
+ } catch (PDOException $e) { |
|
2099
|
2099
|
return "error : ".$e->getMessage(); |
|
2100
|
2100
|
} |
|
2101
|
2101
|
} |
|
2102
|
2102
|
$Common = new Common(); |
|
2103
|
2103
|
$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
|
2104
|
|
- $airspace_json = json_decode($airspace_lst,true); |
|
|
2104
|
+ $airspace_json = json_decode($airspace_lst, true); |
|
2105
|
2105
|
foreach ($airspace_json['records'] as $airspace) { |
|
2106
|
2106
|
if ($globalDebug) echo $airspace['name']."...\n"; |
|
2107
|
|
- update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
|
2107
|
+ update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2108
|
2108
|
if (file_exists($tmp_dir.$airspace['name'])) { |
|
2109
|
2109
|
file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
|
2110
|
2110
|
//system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
|
@@ -2128,7 +2128,7 @@ discard block |
|
|
block discarded – undo |
|
2128
|
2128
|
$Connection = new Connection(); |
|
2129
|
2129
|
$sth = $Connection->db->prepare($query); |
|
2130
|
2130
|
$sth->execute(); |
|
2131
|
|
- } catch(PDOException $e) { |
|
|
2131
|
+ } catch (PDOException $e) { |
|
2132
|
2132
|
return "error : ".$e->getMessage(); |
|
2133
|
2133
|
} |
|
2134
|
2134
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2143,7 +2143,7 @@ discard block |
|
|
block discarded – undo |
|
2143
|
2143
|
$Connection = new Connection(); |
|
2144
|
2144
|
$sth = $Connection->db->prepare($query); |
|
2145
|
2145
|
$sth->execute(); |
|
2146
|
|
- } catch(PDOException $e) { |
|
|
2146
|
+ } catch (PDOException $e) { |
|
2147
|
2147
|
return "error : ".$e->getMessage(); |
|
2148
|
2148
|
} |
|
2149
|
2149
|
} |
|
@@ -2154,7 +2154,7 @@ discard block |
|
|
block discarded – undo |
|
2154
|
2154
|
$Connection = new Connection(); |
|
2155
|
2155
|
$sth = $Connection->db->prepare($query); |
|
2156
|
2156
|
$sth->execute(array(':version' => $version)); |
|
2157
|
|
- } catch(PDOException $e) { |
|
|
2157
|
+ } catch (PDOException $e) { |
|
2158
|
2158
|
return "error : ".$e->getMessage(); |
|
2159
|
2159
|
} |
|
2160
|
2160
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2170,7 +2170,7 @@ discard block |
|
|
block discarded – undo |
|
2170
|
2170
|
$Connection = new Connection(); |
|
2171
|
2171
|
$sth = $Connection->db->prepare($query); |
|
2172
|
2172
|
$sth->execute(array(':version' => $version)); |
|
2173
|
|
- } catch(PDOException $e) { |
|
|
2173
|
+ } catch (PDOException $e) { |
|
2174
|
2174
|
return "error : ".$e->getMessage(); |
|
2175
|
2175
|
} |
|
2176
|
2176
|
} |
|
@@ -2186,7 +2186,7 @@ discard block |
|
|
block discarded – undo |
|
2186
|
2186
|
$Connection = new Connection(); |
|
2187
|
2187
|
$sth = $Connection->db->prepare($query); |
|
2188
|
2188
|
$sth->execute(); |
|
2189
|
|
- } catch(PDOException $e) { |
|
|
2189
|
+ } catch (PDOException $e) { |
|
2190
|
2190
|
return "error : ".$e->getMessage(); |
|
2191
|
2191
|
} |
|
2192
|
2192
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2201,7 +2201,7 @@ discard block |
|
|
block discarded – undo |
|
2201
|
2201
|
$Connection = new Connection(); |
|
2202
|
2202
|
$sth = $Connection->db->prepare($query); |
|
2203
|
2203
|
$sth->execute(); |
|
2204
|
|
- } catch(PDOException $e) { |
|
|
2204
|
+ } catch (PDOException $e) { |
|
2205
|
2205
|
return "error : ".$e->getMessage(); |
|
2206
|
2206
|
} |
|
2207
|
2207
|
} |
|
@@ -2216,7 +2216,7 @@ discard block |
|
|
block discarded – undo |
|
2216
|
2216
|
$Connection = new Connection(); |
|
2217
|
2217
|
$sth = $Connection->db->prepare($query); |
|
2218
|
2218
|
$sth->execute(); |
|
2219
|
|
- } catch(PDOException $e) { |
|
|
2219
|
+ } catch (PDOException $e) { |
|
2220
|
2220
|
return "error : ".$e->getMessage(); |
|
2221
|
2221
|
} |
|
2222
|
2222
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2231,7 +2231,7 @@ discard block |
|
|
block discarded – undo |
|
2231
|
2231
|
$Connection = new Connection(); |
|
2232
|
2232
|
$sth = $Connection->db->prepare($query); |
|
2233
|
2233
|
$sth->execute(); |
|
2234
|
|
- } catch(PDOException $e) { |
|
|
2234
|
+ } catch (PDOException $e) { |
|
2235
|
2235
|
return "error : ".$e->getMessage(); |
|
2236
|
2236
|
} |
|
2237
|
2237
|
} |
|
@@ -2247,7 +2247,7 @@ discard block |
|
|
block discarded – undo |
|
2247
|
2247
|
$Connection = new Connection(); |
|
2248
|
2248
|
$sth = $Connection->db->prepare($query); |
|
2249
|
2249
|
$sth->execute(); |
|
2250
|
|
- } catch(PDOException $e) { |
|
|
2250
|
+ } catch (PDOException $e) { |
|
2251
|
2251
|
return "error : ".$e->getMessage(); |
|
2252
|
2252
|
} |
|
2253
|
2253
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2262,7 +2262,7 @@ discard block |
|
|
block discarded – undo |
|
2262
|
2262
|
$Connection = new Connection(); |
|
2263
|
2263
|
$sth = $Connection->db->prepare($query); |
|
2264
|
2264
|
$sth->execute(); |
|
2265
|
|
- } catch(PDOException $e) { |
|
|
2265
|
+ } catch (PDOException $e) { |
|
2266
|
2266
|
return "error : ".$e->getMessage(); |
|
2267
|
2267
|
} |
|
2268
|
2268
|
} |
|
@@ -2277,7 +2277,7 @@ discard block |
|
|
block discarded – undo |
|
2277
|
2277
|
$Connection = new Connection(); |
|
2278
|
2278
|
$sth = $Connection->db->prepare($query); |
|
2279
|
2279
|
$sth->execute(); |
|
2280
|
|
- } catch(PDOException $e) { |
|
|
2280
|
+ } catch (PDOException $e) { |
|
2281
|
2281
|
return "error : ".$e->getMessage(); |
|
2282
|
2282
|
} |
|
2283
|
2283
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2292,7 +2292,7 @@ discard block |
|
|
block discarded – undo |
|
2292
|
2292
|
$Connection = new Connection(); |
|
2293
|
2293
|
$sth = $Connection->db->prepare($query); |
|
2294
|
2294
|
$sth->execute(); |
|
2295
|
|
- } catch(PDOException $e) { |
|
|
2295
|
+ } catch (PDOException $e) { |
|
2296
|
2296
|
return "error : ".$e->getMessage(); |
|
2297
|
2297
|
} |
|
2298
|
2298
|
} |
|
@@ -2307,7 +2307,7 @@ discard block |
|
|
block discarded – undo |
|
2307
|
2307
|
$Connection = new Connection(); |
|
2308
|
2308
|
$sth = $Connection->db->prepare($query); |
|
2309
|
2309
|
$sth->execute(); |
|
2310
|
|
- } catch(PDOException $e) { |
|
|
2310
|
+ } catch (PDOException $e) { |
|
2311
|
2311
|
return "error : ".$e->getMessage(); |
|
2312
|
2312
|
} |
|
2313
|
2313
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2322,7 +2322,7 @@ discard block |
|
|
block discarded – undo |
|
2322
|
2322
|
$Connection = new Connection(); |
|
2323
|
2323
|
$sth = $Connection->db->prepare($query); |
|
2324
|
2324
|
$sth->execute(); |
|
2325
|
|
- } catch(PDOException $e) { |
|
|
2325
|
+ } catch (PDOException $e) { |
|
2326
|
2326
|
return "error : ".$e->getMessage(); |
|
2327
|
2327
|
} |
|
2328
|
2328
|
} |
|
@@ -2337,7 +2337,7 @@ discard block |
|
|
block discarded – undo |
|
2337
|
2337
|
$Connection = new Connection(); |
|
2338
|
2338
|
$sth = $Connection->db->prepare($query); |
|
2339
|
2339
|
$sth->execute(); |
|
2340
|
|
- } catch(PDOException $e) { |
|
|
2340
|
+ } catch (PDOException $e) { |
|
2341
|
2341
|
return "error : ".$e->getMessage(); |
|
2342
|
2342
|
} |
|
2343
|
2343
|
} |
|
@@ -2352,7 +2352,7 @@ discard block |
|
|
block discarded – undo |
|
2352
|
2352
|
$Connection = new Connection(); |
|
2353
|
2353
|
$sth = $Connection->db->prepare($query); |
|
2354
|
2354
|
$sth->execute(); |
|
2355
|
|
- } catch(PDOException $e) { |
|
|
2355
|
+ } catch (PDOException $e) { |
|
2356
|
2356
|
return "error : ".$e->getMessage(); |
|
2357
|
2357
|
} |
|
2358
|
2358
|
} |