|
@@ -25,20 +25,20 @@ discard block |
|
|
block discarded – undo |
|
25
|
25
|
fclose($fp); |
|
26
|
26
|
} |
|
27
|
27
|
|
|
28
|
|
- public static function gunzip($in_file,$out_file_name = '') { |
|
|
28
|
+ public static function gunzip($in_file, $out_file_name = '') { |
|
29
|
29
|
//echo $in_file.' -> '.$out_file_name."\n"; |
|
30
|
30
|
$buffer_size = 4096; // read 4kb at a time |
|
31
|
31
|
if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
32
|
32
|
if ($in_file != '' && file_exists($in_file)) { |
|
33
|
33
|
// PHP version of Ubuntu use gzopen64 instead of gzopen |
|
34
|
|
- if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
35
|
|
- elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
|
34
|
+ if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
|
35
|
+ elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
36
|
36
|
else { |
|
37
|
37
|
echo 'gzopen not available'; |
|
38
|
38
|
die; |
|
39
|
39
|
} |
|
40
|
40
|
$out_file = fopen($out_file_name, 'wb'); |
|
41
|
|
- while(!gzeof($file)) { |
|
|
41
|
+ while (!gzeof($file)) { |
|
42
|
42
|
fwrite($out_file, gzread($file, $buffer_size)); |
|
43
|
43
|
} |
|
44
|
44
|
fclose($out_file); |
|
@@ -62,7 +62,7 @@ discard block |
|
|
block discarded – undo |
|
62
|
62
|
try { |
|
63
|
63
|
self::$db_sqlite = new PDO('sqlite:'.$database); |
|
64
|
64
|
self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
65
|
|
- } catch(PDOException $e) { |
|
|
65
|
+ } catch (PDOException $e) { |
|
66
|
66
|
return "error : ".$e->getMessage(); |
|
67
|
67
|
} |
|
68
|
68
|
} |
|
@@ -77,7 +77,7 @@ discard block |
|
|
block discarded – undo |
|
77
|
77
|
//$Connection = new Connection(); |
|
78
|
78
|
$sth = $Connection->db->prepare($query); |
|
79
|
79
|
$sth->execute(array(':source' => $database_file)); |
|
80
|
|
- } catch(PDOException $e) { |
|
|
80
|
+ } catch (PDOException $e) { |
|
81
|
81
|
return "error : ".$e->getMessage(); |
|
82
|
82
|
} |
|
83
|
83
|
|
|
@@ -88,7 +88,7 @@ discard block |
|
|
block discarded – undo |
|
88
|
88
|
try { |
|
89
|
89
|
$sth = update_db::$db_sqlite->prepare($query); |
|
90
|
90
|
$sth->execute(); |
|
91
|
|
- } catch(PDOException $e) { |
|
|
91
|
+ } catch (PDOException $e) { |
|
92
|
92
|
return "error : ".$e->getMessage(); |
|
93
|
93
|
} |
|
94
|
94
|
//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
|
@@ -99,11 +99,11 @@ discard block |
|
|
block discarded – undo |
|
99
|
99
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
100
|
100
|
while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
101
|
101
|
//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
102
|
|
- $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
|
102
|
+ $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
103
|
103
|
$sth_dest->execute($query_dest_values); |
|
104
|
104
|
} |
|
105
|
105
|
if ($globalTransaction) $Connection->db->commit(); |
|
106
|
|
- } catch(PDOException $e) { |
|
|
106
|
+ } catch (PDOException $e) { |
|
107
|
107
|
if ($globalTransaction) $Connection->db->rollBack(); |
|
108
|
108
|
return "error : ".$e->getMessage(); |
|
109
|
109
|
} |
|
@@ -119,26 +119,26 @@ discard block |
|
|
block discarded – undo |
|
119
|
119
|
//$Connection = new Connection(); |
|
120
|
120
|
$sth = $Connection->db->prepare($query); |
|
121
|
121
|
$sth->execute(array(':source' => 'oneworld')); |
|
122
|
|
- } catch(PDOException $e) { |
|
|
122
|
+ } catch (PDOException $e) { |
|
123
|
123
|
return "error : ".$e->getMessage(); |
|
124
|
124
|
} |
|
125
|
125
|
|
|
126
|
126
|
if ($globalDebug) echo " - Add routes to DB -"; |
|
127
|
127
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
|
128
|
128
|
$Spotter = new Spotter(); |
|
129
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
129
|
+ if ($fh = fopen($database_file, "r")) { |
|
130
|
130
|
$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
|
131
|
131
|
$Connection = new Connection(); |
|
132
|
132
|
$sth_dest = $Connection->db->prepare($query_dest); |
|
133
|
133
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
134
|
134
|
while (!feof($fh)) { |
|
135
|
|
- $line = fgetcsv($fh,9999,','); |
|
|
135
|
+ $line = fgetcsv($fh, 9999, ','); |
|
136
|
136
|
if ($line[0] != '') { |
|
137
|
137
|
if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
|
138
|
138
|
try { |
|
139
|
|
- $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
|
139
|
+ $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
140
|
140
|
$sth_dest->execute($query_dest_values); |
|
141
|
|
- } catch(PDOException $e) { |
|
|
141
|
+ } catch (PDOException $e) { |
|
142
|
142
|
if ($globalTransaction) $Connection->db->rollBack(); |
|
143
|
143
|
return "error : ".$e->getMessage(); |
|
144
|
144
|
} |
|
@@ -160,7 +160,7 @@ discard block |
|
|
block discarded – undo |
|
160
|
160
|
//$Connection = new Connection(); |
|
161
|
161
|
$sth = $Connection->db->prepare($query); |
|
162
|
162
|
$sth->execute(array(':source' => 'skyteam')); |
|
163
|
|
- } catch(PDOException $e) { |
|
|
163
|
+ } catch (PDOException $e) { |
|
164
|
164
|
return "error : ".$e->getMessage(); |
|
165
|
165
|
} |
|
166
|
166
|
|
|
@@ -168,24 +168,24 @@ discard block |
|
|
block discarded – undo |
|
168
|
168
|
|
|
169
|
169
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
|
170
|
170
|
$Spotter = new Spotter(); |
|
171
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
171
|
+ if ($fh = fopen($database_file, "r")) { |
|
172
|
172
|
$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
|
173
|
173
|
$Connection = new Connection(); |
|
174
|
174
|
$sth_dest = $Connection->db->prepare($query_dest); |
|
175
|
175
|
try { |
|
176
|
176
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
177
|
177
|
while (!feof($fh)) { |
|
178
|
|
- $line = fgetcsv($fh,9999,','); |
|
|
178
|
+ $line = fgetcsv($fh, 9999, ','); |
|
179
|
179
|
if ($line[0] != '') { |
|
180
|
|
- $datebe = explode(' - ',$line[2]); |
|
|
180
|
+ $datebe = explode(' - ', $line[2]); |
|
181
|
181
|
if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
|
182
|
|
- $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
|
182
|
+ $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
183
|
183
|
$sth_dest->execute($query_dest_values); |
|
184
|
184
|
} |
|
185
|
185
|
} |
|
186
|
186
|
} |
|
187
|
187
|
if ($globalTransaction) $Connection->db->commit(); |
|
188
|
|
- } catch(PDOException $e) { |
|
|
188
|
+ } catch (PDOException $e) { |
|
189
|
189
|
if ($globalTransaction) $Connection->db->rollBack(); |
|
190
|
190
|
return "error : ".$e->getMessage(); |
|
191
|
191
|
} |
|
@@ -200,7 +200,7 @@ discard block |
|
|
block discarded – undo |
|
200
|
200
|
$Connection = new Connection(); |
|
201
|
201
|
$sth = $Connection->db->prepare($query); |
|
202
|
202
|
$sth->execute(array(':source' => $database_file)); |
|
203
|
|
- } catch(PDOException $e) { |
|
|
203
|
+ } catch (PDOException $e) { |
|
204
|
204
|
return "error : ".$e->getMessage(); |
|
205
|
205
|
} |
|
206
|
206
|
$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
|
@@ -208,7 +208,7 @@ discard block |
|
|
block discarded – undo |
|
208
|
208
|
$Connection = new Connection(); |
|
209
|
209
|
$sth = $Connection->db->prepare($query); |
|
210
|
210
|
$sth->execute(array(':source' => $database_file)); |
|
211
|
|
- } catch(PDOException $e) { |
|
|
211
|
+ } catch (PDOException $e) { |
|
212
|
212
|
return "error : ".$e->getMessage(); |
|
213
|
213
|
} |
|
214
|
214
|
|
|
@@ -217,7 +217,7 @@ discard block |
|
|
block discarded – undo |
|
217
|
217
|
try { |
|
218
|
218
|
$sth = update_db::$db_sqlite->prepare($query); |
|
219
|
219
|
$sth->execute(); |
|
220
|
|
- } catch(PDOException $e) { |
|
|
220
|
+ } catch (PDOException $e) { |
|
221
|
221
|
return "error : ".$e->getMessage(); |
|
222
|
222
|
} |
|
223
|
223
|
//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
|
@@ -234,15 +234,15 @@ discard block |
|
|
block discarded – undo |
|
234
|
234
|
//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
|
235
|
235
|
if ($values['UserString4'] == 'M') $type = 'military'; |
|
236
|
236
|
else $type = null; |
|
237
|
|
- $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
|
237
|
+ $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
238
|
238
|
$sth_dest->execute($query_dest_values); |
|
239
|
239
|
if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
|
240
|
|
- $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
|
240
|
+ $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
241
|
241
|
$sth_dest_owner->execute($query_dest_owner_values); |
|
242
|
242
|
} |
|
243
|
243
|
} |
|
244
|
244
|
if ($globalTransaction) $Connection->db->commit(); |
|
245
|
|
- } catch(PDOException $e) { |
|
|
245
|
+ } catch (PDOException $e) { |
|
246
|
246
|
return "error : ".$e->getMessage(); |
|
247
|
247
|
} |
|
248
|
248
|
|
|
@@ -252,7 +252,7 @@ discard block |
|
|
block discarded – undo |
|
252
|
252
|
$Connection = new Connection(); |
|
253
|
253
|
$sth = $Connection->db->prepare($query); |
|
254
|
254
|
$sth->execute(array(':source' => $database_file)); |
|
255
|
|
- } catch(PDOException $e) { |
|
|
255
|
+ } catch (PDOException $e) { |
|
256
|
256
|
return "error : ".$e->getMessage(); |
|
257
|
257
|
} |
|
258
|
258
|
return ''; |
|
@@ -267,11 +267,11 @@ discard block |
|
|
block discarded – undo |
|
267
|
267
|
$Connection = new Connection(); |
|
268
|
268
|
$sth = $Connection->db->prepare($query); |
|
269
|
269
|
$sth->execute(array(':source' => $database_file)); |
|
270
|
|
- } catch(PDOException $e) { |
|
|
270
|
+ } catch (PDOException $e) { |
|
271
|
271
|
return "error : ".$e->getMessage(); |
|
272
|
272
|
} |
|
273
|
273
|
|
|
274
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
274
|
+ if ($fh = fopen($database_file, "r")) { |
|
275
|
275
|
//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
|
276
|
276
|
$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
|
277
|
277
|
|
|
@@ -281,13 +281,13 @@ discard block |
|
|
block discarded – undo |
|
281
|
281
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
282
|
282
|
while (!feof($fh)) { |
|
283
|
283
|
$values = array(); |
|
284
|
|
- $line = $Common->hex2str(fgets($fh,9999)); |
|
|
284
|
+ $line = $Common->hex2str(fgets($fh, 9999)); |
|
285
|
285
|
//FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
|
286
|
|
- $values['ModeS'] = substr($line,0,6); |
|
287
|
|
- $values['Registration'] = trim(substr($line,69,6)); |
|
288
|
|
- $aircraft_name = trim(substr($line,48,6)); |
|
|
286
|
+ $values['ModeS'] = substr($line, 0, 6); |
|
|
287
|
+ $values['Registration'] = trim(substr($line, 69, 6)); |
|
|
288
|
+ $aircraft_name = trim(substr($line, 48, 6)); |
|
289
|
289
|
// Check if we can find ICAO, else set it to GLID |
|
290
|
|
- $aircraft_name_split = explode(' ',$aircraft_name); |
|
|
290
|
+ $aircraft_name_split = explode(' ', $aircraft_name); |
|
291
|
291
|
$search_more = ''; |
|
292
|
292
|
if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
293
|
293
|
$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
@@ -299,20 +299,20 @@ discard block |
|
|
block discarded – undo |
|
299
|
299
|
if (isset($result['icao']) && $result['icao'] != '') { |
|
300
|
300
|
$values['ICAOTypeCode'] = $result['icao']; |
|
301
|
301
|
} |
|
302
|
|
- } catch(PDOException $e) { |
|
|
302
|
+ } catch (PDOException $e) { |
|
303
|
303
|
return "error : ".$e->getMessage(); |
|
304
|
304
|
} |
|
305
|
305
|
if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
306
|
306
|
// Add data to db |
|
307
|
307
|
if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
|
308
|
308
|
//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
|
309
|
|
- $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
|
309
|
+ $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
310
|
310
|
//print_r($query_dest_values); |
|
311
|
311
|
$sth_dest->execute($query_dest_values); |
|
312
|
312
|
} |
|
313
|
313
|
} |
|
314
|
314
|
if ($globalTransaction) $Connection->db->commit(); |
|
315
|
|
- } catch(PDOException $e) { |
|
|
315
|
+ } catch (PDOException $e) { |
|
316
|
316
|
return "error : ".$e->getMessage(); |
|
317
|
317
|
} |
|
318
|
318
|
} |
|
@@ -322,7 +322,7 @@ discard block |
|
|
block discarded – undo |
|
322
|
322
|
$Connection = new Connection(); |
|
323
|
323
|
$sth = $Connection->db->prepare($query); |
|
324
|
324
|
$sth->execute(array(':source' => $database_file)); |
|
325
|
|
- } catch(PDOException $e) { |
|
|
325
|
+ } catch (PDOException $e) { |
|
326
|
326
|
return "error : ".$e->getMessage(); |
|
327
|
327
|
} |
|
328
|
328
|
return ''; |
|
@@ -336,11 +336,11 @@ discard block |
|
|
block discarded – undo |
|
336
|
336
|
$Connection = new Connection(); |
|
337
|
337
|
$sth = $Connection->db->prepare($query); |
|
338
|
338
|
$sth->execute(array(':source' => $database_file)); |
|
339
|
|
- } catch(PDOException $e) { |
|
|
339
|
+ } catch (PDOException $e) { |
|
340
|
340
|
return "error : ".$e->getMessage(); |
|
341
|
341
|
} |
|
342
|
342
|
|
|
343
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
343
|
+ if ($fh = fopen($database_file, "r")) { |
|
344
|
344
|
//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
|
345
|
345
|
$query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
|
346
|
346
|
|
|
@@ -348,9 +348,9 @@ discard block |
|
|
block discarded – undo |
|
348
|
348
|
$sth_dest = $Connection->db->prepare($query_dest); |
|
349
|
349
|
try { |
|
350
|
350
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
351
|
|
- $tmp = fgetcsv($fh,9999,',',"'"); |
|
|
351
|
+ $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
352
|
352
|
while (!feof($fh)) { |
|
353
|
|
- $line = fgetcsv($fh,9999,',',"'"); |
|
|
353
|
+ $line = fgetcsv($fh, 9999, ',', "'"); |
|
354
|
354
|
|
|
355
|
355
|
//FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
|
356
|
356
|
//print_r($line); |
|
@@ -359,7 +359,7 @@ discard block |
|
|
block discarded – undo |
|
359
|
359
|
$values['ICAOTypeCode'] = ''; |
|
360
|
360
|
$aircraft_name = $line[2]; |
|
361
|
361
|
// Check if we can find ICAO, else set it to GLID |
|
362
|
|
- $aircraft_name_split = explode(' ',$aircraft_name); |
|
|
362
|
+ $aircraft_name_split = explode(' ', $aircraft_name); |
|
363
|
363
|
$search_more = ''; |
|
364
|
364
|
if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
365
|
365
|
$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
@@ -368,20 +368,20 @@ discard block |
|
|
block discarded – undo |
|
368
|
368
|
$sth_search->execute(); |
|
369
|
369
|
$result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
370
|
370
|
if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
371
|
|
- } catch(PDOException $e) { |
|
|
371
|
+ } catch (PDOException $e) { |
|
372
|
372
|
return "error : ".$e->getMessage(); |
|
373
|
373
|
} |
|
374
|
374
|
//if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
375
|
375
|
// Add data to db |
|
376
|
376
|
if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
|
377
|
377
|
//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
|
378
|
|
- $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
|
378
|
+ $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
379
|
379
|
//print_r($query_dest_values); |
|
380
|
380
|
$sth_dest->execute($query_dest_values); |
|
381
|
381
|
} |
|
382
|
382
|
} |
|
383
|
383
|
if ($globalTransaction) $Connection->db->commit(); |
|
384
|
|
- } catch(PDOException $e) { |
|
|
384
|
+ } catch (PDOException $e) { |
|
385
|
385
|
return "error : ".$e->getMessage(); |
|
386
|
386
|
} |
|
387
|
387
|
} |
|
@@ -391,13 +391,13 @@ discard block |
|
|
block discarded – undo |
|
391
|
391
|
$Connection = new Connection(); |
|
392
|
392
|
$sth = $Connection->db->prepare($query); |
|
393
|
393
|
$sth->execute(array(':source' => $database_file)); |
|
394
|
|
- } catch(PDOException $e) { |
|
|
394
|
+ } catch (PDOException $e) { |
|
395
|
395
|
return "error : ".$e->getMessage(); |
|
396
|
396
|
} |
|
397
|
397
|
return ''; |
|
398
|
398
|
} |
|
399
|
399
|
|
|
400
|
|
- public static function retrieve_owner($database_file,$country = 'F') { |
|
|
400
|
+ public static function retrieve_owner($database_file, $country = 'F') { |
|
401
|
401
|
global $globalTransaction, $globalMasterSource; |
|
402
|
402
|
//$query = 'TRUNCATE TABLE aircraft_modes'; |
|
403
|
403
|
$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
|
@@ -405,12 +405,12 @@ discard block |
|
|
block discarded – undo |
|
405
|
405
|
$Connection = new Connection(); |
|
406
|
406
|
$sth = $Connection->db->prepare($query); |
|
407
|
407
|
$sth->execute(array(':source' => $database_file)); |
|
408
|
|
- } catch(PDOException $e) { |
|
|
408
|
+ } catch (PDOException $e) { |
|
409
|
409
|
return "error : ".$e->getMessage(); |
|
410
|
410
|
} |
|
411
|
411
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
|
412
|
412
|
$Spotter = new Spotter(); |
|
413
|
|
- if ($fh = fopen($database_file,"r")) { |
|
|
413
|
+ if ($fh = fopen($database_file, "r")) { |
|
414
|
414
|
//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
|
415
|
415
|
$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
|
416
|
416
|
$query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
@@ -420,9 +420,9 @@ discard block |
|
|
block discarded – undo |
|
420
|
420
|
$sth_modes = $Connection->db->prepare($query_modes); |
|
421
|
421
|
try { |
|
422
|
422
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
423
|
|
- $tmp = fgetcsv($fh,9999,',','"'); |
|
|
423
|
+ $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
424
|
424
|
while (!feof($fh)) { |
|
425
|
|
- $line = fgetcsv($fh,9999,',','"'); |
|
|
425
|
+ $line = fgetcsv($fh, 9999, ',', '"'); |
|
426
|
426
|
$values = array(); |
|
427
|
427
|
//print_r($line); |
|
428
|
428
|
if ($country == 'F') { |
|
@@ -430,7 +430,7 @@ discard block |
|
|
block discarded – undo |
|
430
|
430
|
$values['base'] = $line[4]; |
|
431
|
431
|
$values['owner'] = $line[5]; |
|
432
|
432
|
if ($line[6] == '') $values['date_first_reg'] = null; |
|
433
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
|
433
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
434
|
434
|
$values['cancel'] = $line[7]; |
|
435
|
435
|
} elseif ($country == 'EI') { |
|
436
|
436
|
// TODO : add modeS & reg to aircraft_modes |
|
@@ -438,7 +438,7 @@ discard block |
|
|
block discarded – undo |
|
438
|
438
|
$values['base'] = $line[3]; |
|
439
|
439
|
$values['owner'] = $line[2]; |
|
440
|
440
|
if ($line[1] == '') $values['date_first_reg'] = null; |
|
441
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
|
441
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
442
|
442
|
$values['cancel'] = ''; |
|
443
|
443
|
$values['modes'] = $line[7]; |
|
444
|
444
|
$values['icao'] = $line[8]; |
|
@@ -458,7 +458,7 @@ discard block |
|
|
block discarded – undo |
|
458
|
458
|
$values['base'] = null; |
|
459
|
459
|
$values['owner'] = $line[5]; |
|
460
|
460
|
if ($line[18] == '') $values['date_first_reg'] = null; |
|
461
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
|
461
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
462
|
462
|
$values['cancel'] = ''; |
|
463
|
463
|
} elseif ($country == 'VH') { |
|
464
|
464
|
// TODO : add modeS & reg to aircraft_modes |
|
@@ -466,7 +466,7 @@ discard block |
|
|
block discarded – undo |
|
466
|
466
|
$values['base'] = null; |
|
467
|
467
|
$values['owner'] = $line[12]; |
|
468
|
468
|
if ($line[28] == '') $values['date_first_reg'] = null; |
|
469
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
|
469
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
470
|
470
|
|
|
471
|
471
|
$values['cancel'] = $line[39]; |
|
472
|
472
|
} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
|
@@ -486,28 +486,28 @@ discard block |
|
|
block discarded – undo |
|
486
|
486
|
$values['base'] = null; |
|
487
|
487
|
$values['owner'] = $line[8]; |
|
488
|
488
|
if ($line[7] == '') $values['date_first_reg'] = null; |
|
489
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
|
489
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
490
|
490
|
$values['cancel'] = ''; |
|
491
|
491
|
} elseif ($country == 'PP') { |
|
492
|
492
|
$values['registration'] = $line[0]; |
|
493
|
493
|
$values['base'] = null; |
|
494
|
494
|
$values['owner'] = $line[4]; |
|
495
|
495
|
if ($line[6] == '') $values['date_first_reg'] = null; |
|
496
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
|
496
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
497
|
497
|
$values['cancel'] = $line[7]; |
|
498
|
498
|
} elseif ($country == 'E7') { |
|
499
|
499
|
$values['registration'] = $line[0]; |
|
500
|
500
|
$values['base'] = null; |
|
501
|
501
|
$values['owner'] = $line[4]; |
|
502
|
502
|
if ($line[5] == '') $values['date_first_reg'] = null; |
|
503
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
|
503
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
504
|
504
|
$values['cancel'] = ''; |
|
505
|
505
|
} elseif ($country == '8Q') { |
|
506
|
506
|
$values['registration'] = $line[0]; |
|
507
|
507
|
$values['base'] = null; |
|
508
|
508
|
$values['owner'] = $line[3]; |
|
509
|
509
|
if ($line[7] == '') $values['date_first_reg'] = null; |
|
510
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
|
510
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
511
|
511
|
$values['cancel'] = ''; |
|
512
|
512
|
} elseif ($country == 'ZK') { |
|
513
|
513
|
$values['registration'] = $line[0]; |
|
@@ -521,18 +521,18 @@ discard block |
|
|
block discarded – undo |
|
521
|
521
|
$values['registration'] = $line[0]; |
|
522
|
522
|
$values['base'] = null; |
|
523
|
523
|
$values['owner'] = $line[6]; |
|
524
|
|
- $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
525
|
|
- $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
|
524
|
+ $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
|
525
|
+ $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
526
|
526
|
$values['modes'] = $line[4]; |
|
527
|
527
|
$values['icao'] = $line[10]; |
|
528
|
528
|
} elseif ($country == 'OY') { |
|
529
|
529
|
$values['registration'] = $line[0]; |
|
530
|
|
- $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
|
530
|
+ $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
531
|
531
|
$values['modes'] = $line[5]; |
|
532
|
532
|
$values['icao'] = $line[6]; |
|
533
|
533
|
} elseif ($country == 'PH') { |
|
534
|
534
|
$values['registration'] = $line[0]; |
|
535
|
|
- $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
|
535
|
+ $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
536
|
536
|
$values['modes'] = $line[4]; |
|
537
|
537
|
$values['icao'] = $line[5]; |
|
538
|
538
|
} elseif ($country == 'OM' || $country == 'TF') { |
|
@@ -543,17 +543,17 @@ discard block |
|
|
block discarded – undo |
|
543
|
543
|
$values['cancel'] = ''; |
|
544
|
544
|
} |
|
545
|
545
|
if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
|
546
|
|
- $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
|
546
|
+ $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
547
|
547
|
$sth_dest->execute($query_dest_values); |
|
548
|
548
|
} |
|
549
|
549
|
if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
|
550
|
550
|
$modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
|
551
|
|
- $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
|
551
|
+ $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
552
|
552
|
$sth_modes->execute($query_modes_values); |
|
553
|
553
|
} |
|
554
|
554
|
} |
|
555
|
555
|
if ($globalTransaction) $Connection->db->commit(); |
|
556
|
|
- } catch(PDOException $e) { |
|
|
556
|
+ } catch (PDOException $e) { |
|
557
|
557
|
return "error : ".$e->getMessage(); |
|
558
|
558
|
} |
|
559
|
559
|
} |
|
@@ -691,7 +691,7 @@ discard block |
|
|
block discarded – undo |
|
691
|
691
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
692
|
692
|
|
|
693
|
693
|
$i = 0; |
|
694
|
|
- while($row = sparql_fetch_array($result)) |
|
|
694
|
+ while ($row = sparql_fetch_array($result)) |
|
695
|
695
|
{ |
|
696
|
696
|
if ($i >= 1) { |
|
697
|
697
|
//print_r($row); |
|
@@ -711,33 +711,33 @@ discard block |
|
|
block discarded – undo |
|
711
|
711
|
$row['image'] = ''; |
|
712
|
712
|
$row['image_thumb'] = ''; |
|
713
|
713
|
} else { |
|
714
|
|
- $image = str_replace(' ','_',$row['image']); |
|
|
714
|
+ $image = str_replace(' ', '_', $row['image']); |
|
715
|
715
|
$digest = md5($image); |
|
716
|
|
- $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
717
|
|
- $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
718
|
|
- $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
719
|
|
- $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
|
716
|
+ $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
|
717
|
+ $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
|
718
|
+ $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
|
719
|
+ $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
720
|
720
|
} |
|
721
|
721
|
|
|
722
|
|
- $country = explode('-',$row['country']); |
|
|
722
|
+ $country = explode('-', $row['country']); |
|
723
|
723
|
$row['country'] = $country[0]; |
|
724
|
724
|
|
|
725
|
725
|
$row['type'] = trim($row['type']); |
|
726
|
|
- if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
|
726
|
+ if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
727
|
727
|
$row['type'] = 'military'; |
|
728
|
728
|
} elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
|
729
|
729
|
$row['type'] = 'small_airport'; |
|
730
|
730
|
} |
|
731
|
731
|
|
|
732
|
|
- $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
733
|
|
- $query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
|
732
|
+ $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
|
733
|
+ $query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
734
|
734
|
//print_r($query_dest_values); |
|
735
|
735
|
|
|
736
|
736
|
if ($row['icao'] != '') { |
|
737
|
737
|
try { |
|
738
|
738
|
$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
|
739
|
739
|
$sth->execute(array(':icao' => $row['icao'])); |
|
740
|
|
- } catch(PDOException $e) { |
|
|
740
|
+ } catch (PDOException $e) { |
|
741
|
741
|
return "error : ".$e->getMessage(); |
|
742
|
742
|
} |
|
743
|
743
|
if ($sth->fetchColumn() > 0) { |
|
@@ -745,15 +745,15 @@ discard block |
|
|
block discarded – undo |
|
745
|
745
|
$query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
|
746
|
746
|
try { |
|
747
|
747
|
$sth = $Connection->db->prepare($query); |
|
748
|
|
- $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
|
749
|
|
- } catch(PDOException $e) { |
|
|
748
|
+ $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
|
749
|
+ } catch (PDOException $e) { |
|
750
|
750
|
return "error : ".$e->getMessage(); |
|
751
|
751
|
} |
|
752
|
752
|
echo $row['icao'].' : '.$row['type']."\n"; |
|
753
|
753
|
} else { |
|
754
|
754
|
try { |
|
755
|
755
|
$sth_dest->execute($query_dest_values); |
|
756
|
|
- } catch(PDOException $e) { |
|
|
756
|
+ } catch (PDOException $e) { |
|
757
|
757
|
return "error : ".$e->getMessage(); |
|
758
|
758
|
} |
|
759
|
759
|
} |
|
@@ -804,7 +804,7 @@ discard block |
|
|
block discarded – undo |
|
804
|
804
|
echo "Download data from ourairports.com...\n"; |
|
805
|
805
|
$delimiter = ','; |
|
806
|
806
|
$out_file = $tmp_dir.'airports.csv'; |
|
807
|
|
- update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
|
807
|
+ update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
808
|
808
|
if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
809
|
809
|
echo "Add data from ourairports.com...\n"; |
|
810
|
810
|
|
|
@@ -815,33 +815,33 @@ discard block |
|
|
block discarded – undo |
|
815
|
815
|
//$Connection->db->beginTransaction(); |
|
816
|
816
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
817
|
817
|
{ |
|
818
|
|
- if(!$header) $header = $row; |
|
|
818
|
+ if (!$header) $header = $row; |
|
819
|
819
|
else { |
|
820
|
820
|
$data = array(); |
|
821
|
821
|
$data = array_combine($header, $row); |
|
822
|
822
|
try { |
|
823
|
823
|
$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
|
824
|
824
|
$sth->execute(array(':icao' => $data['ident'])); |
|
825
|
|
- } catch(PDOException $e) { |
|
|
825
|
+ } catch (PDOException $e) { |
|
826
|
826
|
return "error : ".$e->getMessage(); |
|
827
|
827
|
} |
|
828
|
828
|
if ($sth->fetchColumn() > 0) { |
|
829
|
829
|
$query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
|
830
|
830
|
try { |
|
831
|
831
|
$sth = $Connection->db->prepare($query); |
|
832
|
|
- $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
|
833
|
|
- } catch(PDOException $e) { |
|
|
832
|
+ $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
|
833
|
+ } catch (PDOException $e) { |
|
834
|
834
|
return "error : ".$e->getMessage(); |
|
835
|
835
|
} |
|
836
|
836
|
} else { |
|
837
|
837
|
if ($data['gps_code'] == $data['ident']) { |
|
838
|
838
|
$query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
|
839
|
839
|
VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
|
840
|
|
- $query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
|
840
|
+ $query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
841
|
841
|
try { |
|
842
|
842
|
$sth = $Connection->db->prepare($query); |
|
843
|
843
|
$sth->execute($query_values); |
|
844
|
|
- } catch(PDOException $e) { |
|
|
844
|
+ } catch (PDOException $e) { |
|
845
|
845
|
return "error : ".$e->getMessage(); |
|
846
|
846
|
} |
|
847
|
847
|
$i++; |
|
@@ -856,7 +856,7 @@ discard block |
|
|
block discarded – undo |
|
856
|
856
|
|
|
857
|
857
|
echo "Download data from another free database...\n"; |
|
858
|
858
|
$out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
|
859
|
|
- update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
|
859
|
+ update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
860
|
860
|
if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
861
|
861
|
update_db::unzip($out_file); |
|
862
|
862
|
$header = NULL; |
|
@@ -868,15 +868,15 @@ discard block |
|
|
block discarded – undo |
|
868
|
868
|
//$Connection->db->beginTransaction(); |
|
869
|
869
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
870
|
870
|
{ |
|
871
|
|
- if(!$header) $header = $row; |
|
|
871
|
+ if (!$header) $header = $row; |
|
872
|
872
|
else { |
|
873
|
873
|
$data = $row; |
|
874
|
874
|
|
|
875
|
875
|
$query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
|
876
|
876
|
try { |
|
877
|
877
|
$sth = $Connection->db->prepare($query); |
|
878
|
|
- $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
879
|
|
- } catch(PDOException $e) { |
|
|
878
|
+ $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
|
879
|
+ } catch (PDOException $e) { |
|
880
|
880
|
return "error : ".$e->getMessage(); |
|
881
|
881
|
} |
|
882
|
882
|
} |
|
@@ -890,15 +890,15 @@ discard block |
|
|
block discarded – undo |
|
890
|
890
|
try { |
|
891
|
891
|
$sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
|
892
|
892
|
$sth->execute(); |
|
893
|
|
- } catch(PDOException $e) { |
|
|
893
|
+ } catch (PDOException $e) { |
|
894
|
894
|
return "error : ".$e->getMessage(); |
|
895
|
895
|
} |
|
896
|
896
|
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
897
|
897
|
$query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
|
898
|
898
|
try { |
|
899
|
899
|
$sth2 = $Connection->db->prepare($query2); |
|
900
|
|
- $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
901
|
|
- } catch(PDOException $e) { |
|
|
900
|
+ $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
|
901
|
+ } catch (PDOException $e) { |
|
902
|
902
|
return "error : ".$e->getMessage(); |
|
903
|
903
|
} |
|
904
|
904
|
} |
|
@@ -919,7 +919,7 @@ discard block |
|
|
block discarded – undo |
|
919
|
919
|
$Connection = new Connection(); |
|
920
|
920
|
$sth = $Connection->db->prepare($query); |
|
921
|
921
|
$sth->execute(array(':source' => 'translation.csv')); |
|
922
|
|
- } catch(PDOException $e) { |
|
|
922
|
+ } catch (PDOException $e) { |
|
923
|
923
|
return "error : ".$e->getMessage(); |
|
924
|
924
|
} |
|
925
|
925
|
|
|
@@ -936,7 +936,7 @@ discard block |
|
|
block discarded – undo |
|
936
|
936
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
937
|
937
|
{ |
|
938
|
938
|
$i++; |
|
939
|
|
- if($i > 12) { |
|
|
939
|
+ if ($i > 12) { |
|
940
|
940
|
$data = $row; |
|
941
|
941
|
$operator = $data[2]; |
|
942
|
942
|
if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
|
@@ -944,7 +944,7 @@ discard block |
|
|
block discarded – undo |
|
944
|
944
|
//echo substr($operator, 0, 2)."\n";; |
|
945
|
945
|
if (count($airline_array) > 0) { |
|
946
|
946
|
//print_r($airline_array); |
|
947
|
|
- $operator = $airline_array[0]['icao'].substr($operator,2); |
|
|
947
|
+ $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
948
|
948
|
} |
|
949
|
949
|
} |
|
950
|
950
|
|
|
@@ -952,14 +952,14 @@ discard block |
|
|
block discarded – undo |
|
952
|
952
|
if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
|
953
|
953
|
$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
954
|
954
|
if (count($airline_array) > 0) { |
|
955
|
|
- $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
|
955
|
+ $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
956
|
956
|
} |
|
957
|
957
|
} |
|
958
|
958
|
$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
|
959
|
959
|
try { |
|
960
|
960
|
$sth = $Connection->db->prepare($query); |
|
961
|
|
- $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
962
|
|
- } catch(PDOException $e) { |
|
|
961
|
+ $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
|
962
|
+ } catch (PDOException $e) { |
|
963
|
963
|
return "error : ".$e->getMessage(); |
|
964
|
964
|
} |
|
965
|
965
|
} |
|
@@ -979,7 +979,7 @@ discard block |
|
|
block discarded – undo |
|
979
|
979
|
$Connection = new Connection(); |
|
980
|
980
|
$sth = $Connection->db->prepare($query); |
|
981
|
981
|
$sth->execute(array(':source' => 'website_fam')); |
|
982
|
|
- } catch(PDOException $e) { |
|
|
982
|
+ } catch (PDOException $e) { |
|
983
|
983
|
return "error : ".$e->getMessage(); |
|
984
|
984
|
} |
|
985
|
985
|
|
|
@@ -999,8 +999,8 @@ discard block |
|
|
block discarded – undo |
|
999
|
999
|
$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
|
1000
|
1000
|
try { |
|
1001
|
1001
|
$sth = $Connection->db->prepare($query); |
|
1002
|
|
- $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
1003
|
|
- } catch(PDOException $e) { |
|
|
1002
|
+ $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
|
1003
|
+ } catch (PDOException $e) { |
|
1004
|
1004
|
return "error : ".$e->getMessage(); |
|
1005
|
1005
|
} |
|
1006
|
1006
|
} |
|
@@ -1023,7 +1023,7 @@ discard block |
|
|
block discarded – undo |
|
1023
|
1023
|
$Connection = new Connection(); |
|
1024
|
1024
|
$sth = $Connection->db->prepare($query); |
|
1025
|
1025
|
$sth->execute(array(':source' => 'website_faa')); |
|
1026
|
|
- } catch(PDOException $e) { |
|
|
1026
|
+ } catch (PDOException $e) { |
|
1027
|
1027
|
return "error : ".$e->getMessage(); |
|
1028
|
1028
|
} |
|
1029
|
1029
|
|
|
@@ -1032,7 +1032,7 @@ discard block |
|
|
block discarded – undo |
|
1032
|
1032
|
$Connection = new Connection(); |
|
1033
|
1033
|
$sth = $Connection->db->prepare($query); |
|
1034
|
1034
|
$sth->execute(array(':source' => 'website_faa')); |
|
1035
|
|
- } catch(PDOException $e) { |
|
|
1035
|
+ } catch (PDOException $e) { |
|
1036
|
1036
|
return "error : ".$e->getMessage(); |
|
1037
|
1037
|
} |
|
1038
|
1038
|
|
|
@@ -1049,8 +1049,8 @@ discard block |
|
|
block discarded – undo |
|
1049
|
1049
|
$query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
|
1050
|
1050
|
try { |
|
1051
|
1051
|
$sths = $Connection->db->prepare($query_search); |
|
1052
|
|
- $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1053
|
|
- } catch(PDOException $e) { |
|
|
1052
|
+ $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
|
1053
|
+ } catch (PDOException $e) { |
|
1054
|
1054
|
return "error s : ".$e->getMessage(); |
|
1055
|
1055
|
} |
|
1056
|
1056
|
$result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1063,8 +1063,8 @@ discard block |
|
|
block discarded – undo |
|
1063
|
1063
|
//} |
|
1064
|
1064
|
try { |
|
1065
|
1065
|
$sthi = $Connection->db->prepare($queryi); |
|
1066
|
|
- $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1067
|
|
- } catch(PDOException $e) { |
|
|
1066
|
+ $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
|
1067
|
+ } catch (PDOException $e) { |
|
1068
|
1068
|
return "error u : ".$e->getMessage(); |
|
1069
|
1069
|
} |
|
1070
|
1070
|
} else { |
|
@@ -1072,7 +1072,7 @@ discard block |
|
|
block discarded – undo |
|
1072
|
1072
|
try { |
|
1073
|
1073
|
$sthsm = $Connection->db->prepare($query_search_mfr); |
|
1074
|
1074
|
$sthsm->execute(array(':mfr' => $data[2])); |
|
1075
|
|
- } catch(PDOException $e) { |
|
|
1075
|
+ } catch (PDOException $e) { |
|
1076
|
1076
|
return "error mfr : ".$e->getMessage(); |
|
1077
|
1077
|
} |
|
1078
|
1078
|
$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1082,8 +1082,8 @@ discard block |
|
|
block discarded – undo |
|
1082
|
1082
|
$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
|
1083
|
1083
|
try { |
|
1084
|
1084
|
$sthf = $Connection->db->prepare($queryf); |
|
1085
|
|
- $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
1086
|
|
- } catch(PDOException $e) { |
|
|
1085
|
+ $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
|
1086
|
+ } catch (PDOException $e) { |
|
1087
|
1087
|
return "error f : ".$e->getMessage(); |
|
1088
|
1088
|
} |
|
1089
|
1089
|
} |
|
@@ -1093,13 +1093,13 @@ discard block |
|
|
block discarded – undo |
|
1093
|
1093
|
$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
|
1094
|
1094
|
try { |
|
1095
|
1095
|
$sth = $Connection->db->prepare($query); |
|
1096
|
|
- $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
1097
|
|
- } catch(PDOException $e) { |
|
|
1096
|
+ $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
|
1097
|
+ } catch (PDOException $e) { |
|
1098
|
1098
|
return "error i : ".$e->getMessage(); |
|
1099
|
1099
|
} |
|
1100
|
1100
|
} |
|
1101
|
1101
|
} |
|
1102
|
|
- if ($i % 90 == 0) { |
|
|
1102
|
+ if ($i%90 == 0) { |
|
1103
|
1103
|
if ($globalTransaction) $Connection->db->commit(); |
|
1104
|
1104
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1105
|
1105
|
} |
|
@@ -1118,7 +1118,7 @@ discard block |
|
|
block discarded – undo |
|
1118
|
1118
|
$Connection = new Connection(); |
|
1119
|
1119
|
$sth = $Connection->db->prepare($query); |
|
1120
|
1120
|
$sth->execute(array(':source' => 'website_fam')); |
|
1121
|
|
- } catch(PDOException $e) { |
|
|
1121
|
+ } catch (PDOException $e) { |
|
1122
|
1122
|
return "error : ".$e->getMessage(); |
|
1123
|
1123
|
} |
|
1124
|
1124
|
|
|
@@ -1139,8 +1139,8 @@ discard block |
|
|
block discarded – undo |
|
1139
|
1139
|
$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
|
1140
|
1140
|
try { |
|
1141
|
1141
|
$sth = $Connection->db->prepare($query); |
|
1142
|
|
- $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')); |
|
1143
|
|
- } catch(PDOException $e) { |
|
|
1142
|
+ $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')); |
|
|
1143
|
+ } catch (PDOException $e) { |
|
1144
|
1144
|
return "error : ".$e->getMessage(); |
|
1145
|
1145
|
} |
|
1146
|
1146
|
} |
|
@@ -1159,7 +1159,7 @@ discard block |
|
|
block discarded – undo |
|
1159
|
1159
|
$Connection = new Connection(); |
|
1160
|
1160
|
$sth = $Connection->db->prepare($query); |
|
1161
|
1161
|
$sth->execute(array(':source' => 'website_fam')); |
|
1162
|
|
- } catch(PDOException $e) { |
|
|
1162
|
+ } catch (PDOException $e) { |
|
1163
|
1163
|
return "error : ".$e->getMessage(); |
|
1164
|
1164
|
} |
|
1165
|
1165
|
|
|
@@ -1175,8 +1175,8 @@ discard block |
|
|
block discarded – undo |
|
1175
|
1175
|
$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
|
1176
|
1176
|
try { |
|
1177
|
1177
|
$sth = $Connection->db->prepare($query); |
|
1178
|
|
- $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1179
|
|
- } catch(PDOException $e) { |
|
|
1178
|
+ $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
|
1179
|
+ } catch (PDOException $e) { |
|
1180
|
1180
|
print_r($data); |
|
1181
|
1181
|
return "error : ".$e->getMessage(); |
|
1182
|
1182
|
} |
|
@@ -1196,7 +1196,7 @@ discard block |
|
|
block discarded – undo |
|
1196
|
1196
|
$Connection = new Connection(); |
|
1197
|
1197
|
$sth = $Connection->db->prepare($query); |
|
1198
|
1198
|
$sth->execute(array(':source' => 'website_fam')); |
|
1199
|
|
- } catch(PDOException $e) { |
|
|
1199
|
+ } catch (PDOException $e) { |
|
1200
|
1200
|
return "error : ".$e->getMessage(); |
|
1201
|
1201
|
} |
|
1202
|
1202
|
|
|
@@ -1216,8 +1216,8 @@ discard block |
|
|
block discarded – undo |
|
1216
|
1216
|
$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)'; |
|
1217
|
1217
|
try { |
|
1218
|
1218
|
$sth = $Connection->db->prepare($query); |
|
1219
|
|
- $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')); |
|
1220
|
|
- } catch(PDOException $e) { |
|
|
1219
|
+ $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')); |
|
|
1220
|
+ } catch (PDOException $e) { |
|
1221
|
1221
|
return "error : ".$e->getMessage(); |
|
1222
|
1222
|
} |
|
1223
|
1223
|
} |
|
@@ -1236,7 +1236,7 @@ discard block |
|
|
block discarded – undo |
|
1236
|
1236
|
$Connection = new Connection(); |
|
1237
|
1237
|
$sth = $Connection->db->prepare($query); |
|
1238
|
1238
|
$sth->execute(); |
|
1239
|
|
- } catch(PDOException $e) { |
|
|
1239
|
+ } catch (PDOException $e) { |
|
1240
|
1240
|
return "error : ".$e->getMessage(); |
|
1241
|
1241
|
} |
|
1242
|
1242
|
|
|
@@ -1257,8 +1257,8 @@ discard block |
|
|
block discarded – undo |
|
1257
|
1257
|
$query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
|
1258
|
1258
|
try { |
|
1259
|
1259
|
$sth = $Connection->db->prepare($query); |
|
1260
|
|
- $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
1261
|
|
- } catch(PDOException $e) { |
|
|
1260
|
+ $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
|
1261
|
+ } catch (PDOException $e) { |
|
1262
|
1262
|
return "error : ".$e->getMessage(); |
|
1263
|
1263
|
} |
|
1264
|
1264
|
} |
|
@@ -1277,7 +1277,7 @@ discard block |
|
|
block discarded – undo |
|
1277
|
1277
|
$Connection = new Connection(); |
|
1278
|
1278
|
$sth = $Connection->db->prepare($query); |
|
1279
|
1279
|
$sth->execute(); |
|
1280
|
|
- } catch(PDOException $e) { |
|
|
1280
|
+ } catch (PDOException $e) { |
|
1281
|
1281
|
return "error : ".$e->getMessage(); |
|
1282
|
1282
|
} |
|
1283
|
1283
|
|
|
@@ -1293,7 +1293,7 @@ discard block |
|
|
block discarded – undo |
|
1293
|
1293
|
try { |
|
1294
|
1294
|
$sth = $Connection->db->prepare($query); |
|
1295
|
1295
|
$sth->execute(array(':icao' => $icao)); |
|
1296
|
|
- } catch(PDOException $e) { |
|
|
1296
|
+ } catch (PDOException $e) { |
|
1297
|
1297
|
return "error : ".$e->getMessage(); |
|
1298
|
1298
|
} |
|
1299
|
1299
|
} |
|
@@ -1304,7 +1304,7 @@ discard block |
|
|
block discarded – undo |
|
1304
|
1304
|
return ''; |
|
1305
|
1305
|
} |
|
1306
|
1306
|
|
|
1307
|
|
- public static function tle($filename,$tletype) { |
|
|
1307
|
+ public static function tle($filename, $tletype) { |
|
1308
|
1308
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
|
1309
|
1309
|
global $tmp_dir, $globalTransaction; |
|
1310
|
1310
|
//$Spotter = new Spotter(); |
|
@@ -1314,7 +1314,7 @@ discard block |
|
|
block discarded – undo |
|
1314
|
1314
|
$Connection = new Connection(); |
|
1315
|
1315
|
$sth = $Connection->db->prepare($query); |
|
1316
|
1316
|
$sth->execute(array(':source' => $filename)); |
|
1317
|
|
- } catch(PDOException $e) { |
|
|
1317
|
+ } catch (PDOException $e) { |
|
1318
|
1318
|
return "error : ".$e->getMessage(); |
|
1319
|
1319
|
} |
|
1320
|
1320
|
|
|
@@ -1339,8 +1339,8 @@ discard block |
|
|
block discarded – undo |
|
1339
|
1339
|
$query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
|
1340
|
1340
|
try { |
|
1341
|
1341
|
$sth = $Connection->db->prepare($query); |
|
1342
|
|
- $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1343
|
|
- } catch(PDOException $e) { |
|
|
1342
|
+ $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
|
1343
|
+ } catch (PDOException $e) { |
|
1344
|
1344
|
return "error : ".$e->getMessage(); |
|
1345
|
1345
|
} |
|
1346
|
1346
|
|
|
@@ -1360,28 +1360,28 @@ discard block |
|
|
block discarded – undo |
|
1360
|
1360
|
*/ |
|
1361
|
1361
|
private static function table2array($data) { |
|
1362
|
1362
|
$html = str_get_html($data); |
|
1363
|
|
- $tabledata=array(); |
|
1364
|
|
- foreach($html->find('tr') as $element) |
|
|
1363
|
+ $tabledata = array(); |
|
|
1364
|
+ foreach ($html->find('tr') as $element) |
|
1365
|
1365
|
{ |
|
1366
|
1366
|
$td = array(); |
|
1367
|
|
- foreach( $element->find('th') as $row) |
|
|
1367
|
+ foreach ($element->find('th') as $row) |
|
1368
|
1368
|
{ |
|
1369
|
1369
|
$td [] = trim($row->plaintext); |
|
1370
|
1370
|
} |
|
1371
|
|
- $td=array_filter($td); |
|
|
1371
|
+ $td = array_filter($td); |
|
1372
|
1372
|
$tabledata[] = $td; |
|
1373
|
1373
|
|
|
1374
|
1374
|
$td = array(); |
|
1375
|
1375
|
$tdi = array(); |
|
1376
|
|
- foreach( $element->find('td') as $row) |
|
|
1376
|
+ foreach ($element->find('td') as $row) |
|
1377
|
1377
|
{ |
|
1378
|
1378
|
$td [] = trim($row->plaintext); |
|
1379
|
1379
|
$tdi [] = trim($row->innertext); |
|
1380
|
1380
|
} |
|
1381
|
|
- $td=array_filter($td); |
|
1382
|
|
- $tdi=array_filter($tdi); |
|
|
1381
|
+ $td = array_filter($td); |
|
|
1382
|
+ $tdi = array_filter($tdi); |
|
1383
|
1383
|
// $tabledata[]=array_merge($td,$tdi); |
|
1384
|
|
- $tabledata[]=$td; |
|
|
1384
|
+ $tabledata[] = $td; |
|
1385
|
1385
|
} |
|
1386
|
1386
|
return(array_filter($tabledata)); |
|
1387
|
1387
|
} |
|
@@ -1454,13 +1454,13 @@ discard block |
|
|
block discarded – undo |
|
1454
|
1454
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
1455
|
1455
|
{ |
|
1456
|
1456
|
$i++; |
|
1457
|
|
- if($i > 3 && count($row) > 2) { |
|
|
1457
|
+ if ($i > 3 && count($row) > 2) { |
|
1458
|
1458
|
$data = array_values(array_filter($row)); |
|
1459
|
1459
|
$cntdata = count($data); |
|
1460
|
1460
|
if ($cntdata > 10) { |
|
1461
|
1461
|
$value = $data[9]; |
|
1462
|
1462
|
|
|
1463
|
|
- for ($i =10;$i < $cntdata;$i++) { |
|
|
1463
|
+ for ($i = 10; $i < $cntdata; $i++) { |
|
1464
|
1464
|
$value .= ' '.$data[$i]; |
|
1465
|
1465
|
} |
|
1466
|
1466
|
$data[9] = $value; |
|
@@ -1470,8 +1470,8 @@ discard block |
|
|
block discarded – undo |
|
1470
|
1470
|
$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)'; |
|
1471
|
1471
|
try { |
|
1472
|
1472
|
$sth = $Connection->db->prepare($query); |
|
1473
|
|
- $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])); |
|
1474
|
|
- } catch(PDOException $e) { |
|
|
1473
|
+ $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])); |
|
|
1474
|
+ } catch (PDOException $e) { |
|
1475
|
1475
|
return "error : ".$e->getMessage(); |
|
1476
|
1476
|
} |
|
1477
|
1477
|
} |
|
@@ -1492,7 +1492,7 @@ discard block |
|
|
block discarded – undo |
|
1492
|
1492
|
$Connection = new Connection(); |
|
1493
|
1493
|
$sth = $Connection->db->prepare($query); |
|
1494
|
1494
|
$sth->execute(); |
|
1495
|
|
- } catch(PDOException $e) { |
|
|
1495
|
+ } catch (PDOException $e) { |
|
1496
|
1496
|
return "error : ".$e->getMessage(); |
|
1497
|
1497
|
} |
|
1498
|
1498
|
|
|
@@ -1504,12 +1504,12 @@ discard block |
|
|
block discarded – undo |
|
1504
|
1504
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1505
|
1505
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
|
1506
|
1506
|
{ |
|
1507
|
|
- if(count($row) > 1) { |
|
|
1507
|
+ if (count($row) > 1) { |
|
1508
|
1508
|
$query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
|
1509
|
1509
|
try { |
|
1510
|
1510
|
$sth = $Connection->db->prepare($query); |
|
1511
|
|
- $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1512
|
|
- } catch(PDOException $e) { |
|
|
1511
|
+ $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
|
1512
|
+ } catch (PDOException $e) { |
|
1513
|
1513
|
return "error : ".$e->getMessage(); |
|
1514
|
1514
|
} |
|
1515
|
1515
|
} |
|
@@ -1529,21 +1529,21 @@ discard block |
|
|
block discarded – undo |
|
1529
|
1529
|
try { |
|
1530
|
1530
|
$sth = $Connection->db->prepare($query); |
|
1531
|
1531
|
$sth->execute(); |
|
1532
|
|
- } catch(PDOException $e) { |
|
|
1532
|
+ } catch (PDOException $e) { |
|
1533
|
1533
|
return "error : ".$e->getMessage(); |
|
1534
|
1534
|
} |
|
1535
|
1535
|
} |
|
1536
|
1536
|
|
|
1537
|
1537
|
|
|
1538
|
|
- if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
|
1538
|
+ if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1539
|
1539
|
else { |
|
1540
|
|
- update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
|
1540
|
+ update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1541
|
1541
|
$query = "CREATE EXTENSION postgis"; |
|
1542
|
|
- $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
|
1542
|
+ $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1543
|
1543
|
try { |
|
1544
|
1544
|
$sth = $Connection->db->prepare($query); |
|
1545
|
1545
|
$sth->execute(); |
|
1546
|
|
- } catch(PDOException $e) { |
|
|
1546
|
+ } catch (PDOException $e) { |
|
1547
|
1547
|
return "error : ".$e->getMessage(); |
|
1548
|
1548
|
} |
|
1549
|
1549
|
} |
|
@@ -1556,7 +1556,7 @@ discard block |
|
|
block discarded – undo |
|
1556
|
1556
|
include_once('class.create_db.php'); |
|
1557
|
1557
|
require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
|
1558
|
1558
|
if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
1559
|
|
- update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
|
1559
|
+ update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1560
|
1560
|
$error = ''; |
|
1561
|
1561
|
if (file_exists($tmp_dir.'notam.txt.gz')) { |
|
1562
|
1562
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -1588,14 +1588,14 @@ discard block |
|
|
block discarded – undo |
|
1588
|
1588
|
try { |
|
1589
|
1589
|
$sth = $Connection->db->prepare($query); |
|
1590
|
1590
|
$sth->execute(); |
|
1591
|
|
- } catch(PDOException $e) { |
|
|
1591
|
+ } catch (PDOException $e) { |
|
1592
|
1592
|
echo "error : ".$e->getMessage(); |
|
1593
|
1593
|
} |
|
1594
|
1594
|
} |
|
1595
|
1595
|
if ($globalDBdriver == 'mysql') { |
|
1596
|
|
- update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
|
1596
|
+ update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1597
|
1597
|
} else { |
|
1598
|
|
- update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
|
1598
|
+ update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1599
|
1599
|
} |
|
1600
|
1600
|
$error = create_db::import_file($tmp_dir.'countries.sql'); |
|
1601
|
1601
|
return $error; |
|
@@ -1608,7 +1608,7 @@ discard block |
|
|
block discarded – undo |
|
1608
|
1608
|
// update_db::unzip($tmp_dir.'AptNav.zip'); |
|
1609
|
1609
|
// update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
|
1610
|
1610
|
// 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'); |
|
1611
|
|
- 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'); |
|
|
1611
|
+ 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'); |
|
1612
|
1612
|
update_db::gunzip($tmp_dir.'awy.dat.gz'); |
|
1613
|
1613
|
$error = update_db::waypoints($tmp_dir.'awy.dat'); |
|
1614
|
1614
|
return $error; |
|
@@ -1628,7 +1628,7 @@ discard block |
|
|
block discarded – undo |
|
1628
|
1628
|
update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
|
1629
|
1629
|
if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
1630
|
1630
|
if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
|
1631
|
|
- if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
|
1631
|
+ if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1632
|
1632
|
} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
1633
|
1633
|
} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
1634
|
1634
|
if ($error != '') { |
|
@@ -1641,7 +1641,7 @@ discard block |
|
|
block discarded – undo |
|
1641
|
1641
|
global $tmp_dir, $globalDebug; |
|
1642
|
1642
|
$error = ''; |
|
1643
|
1643
|
if ($globalDebug) echo "Routes : Download..."; |
|
1644
|
|
- update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
|
1644
|
+ update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1645
|
1645
|
if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
|
1646
|
1646
|
if ($globalDebug) echo "Gunzip..."; |
|
1647
|
1647
|
update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
|
@@ -1657,7 +1657,7 @@ discard block |
|
|
block discarded – undo |
|
1657
|
1657
|
global $tmp_dir, $globalDebug; |
|
1658
|
1658
|
$error = ''; |
|
1659
|
1659
|
if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
1660
|
|
- update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
|
1660
|
+ update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1661
|
1661
|
if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
|
1662
|
1662
|
if ($globalDebug) echo "Gunzip..."; |
|
1663
|
1663
|
update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
|
@@ -1673,7 +1673,7 @@ discard block |
|
|
block discarded – undo |
|
1673
|
1673
|
global $tmp_dir, $globalDebug; |
|
1674
|
1674
|
$error = ''; |
|
1675
|
1675
|
if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
1676
|
|
- update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
|
1676
|
+ update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1677
|
1677
|
if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
|
1678
|
1678
|
if ($globalDebug) echo "Gunzip..."; |
|
1679
|
1679
|
update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
|
@@ -1701,7 +1701,7 @@ discard block |
|
|
block discarded – undo |
|
1701
|
1701
|
*/ |
|
1702
|
1702
|
if ($globalDebug) echo "Modes : Download..."; |
|
1703
|
1703
|
// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
1704
|
|
- update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
|
1704
|
+ update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
1705
|
1705
|
|
|
1706
|
1706
|
// if (file_exists($tmp_dir.'basestation_latest.zip')) { |
|
1707
|
1707
|
if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
|
@@ -1721,7 +1721,7 @@ discard block |
|
|
block discarded – undo |
|
1721
|
1721
|
public static function update_ModeS_faa() { |
|
1722
|
1722
|
global $tmp_dir, $globalDebug; |
|
1723
|
1723
|
if ($globalDebug) echo "Modes FAA: Download..."; |
|
1724
|
|
- update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
|
1724
|
+ update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
1725
|
1725
|
if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
|
1726
|
1726
|
if ($globalDebug) echo "Unzip..."; |
|
1727
|
1727
|
update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
|
@@ -1737,7 +1737,7 @@ discard block |
|
|
block discarded – undo |
|
1737
|
1737
|
public static function update_ModeS_flarm() { |
|
1738
|
1738
|
global $tmp_dir, $globalDebug; |
|
1739
|
1739
|
if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
1740
|
|
- update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
|
1740
|
+ update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
1741
|
1741
|
if (file_exists($tmp_dir.'data.fln')) { |
|
1742
|
1742
|
if ($globalDebug) echo "Add to DB..."; |
|
1743
|
1743
|
$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
|
@@ -1751,7 +1751,7 @@ discard block |
|
|
block discarded – undo |
|
1751
|
1751
|
public static function update_ModeS_ogn() { |
|
1752
|
1752
|
global $tmp_dir, $globalDebug; |
|
1753
|
1753
|
if ($globalDebug) echo "Modes OGN: Download..."; |
|
1754
|
|
- update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
|
1754
|
+ update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
1755
|
1755
|
if (file_exists($tmp_dir.'ogn.csv')) { |
|
1756
|
1756
|
if ($globalDebug) echo "Add to DB..."; |
|
1757
|
1757
|
$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
|
@@ -1766,201 +1766,201 @@ discard block |
|
|
block discarded – undo |
|
1766
|
1766
|
global $tmp_dir, $globalDebug, $globalMasterSource; |
|
1767
|
1767
|
|
|
1768
|
1768
|
if ($globalDebug) echo "Owner France: Download..."; |
|
1769
|
|
- update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
|
1769
|
+ update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
1770
|
1770
|
if (file_exists($tmp_dir.'owner_f.csv')) { |
|
1771
|
1771
|
if ($globalDebug) echo "Add to DB..."; |
|
1772
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
|
1772
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
1773
|
1773
|
} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
1774
|
1774
|
if ($error != '') { |
|
1775
|
1775
|
return $error; |
|
1776
|
1776
|
} elseif ($globalDebug) echo "Done\n"; |
|
1777
|
1777
|
|
|
1778
|
1778
|
if ($globalDebug) echo "Owner Ireland: Download..."; |
|
1779
|
|
- update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
|
1779
|
+ update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
1780
|
1780
|
if (file_exists($tmp_dir.'owner_ei.csv')) { |
|
1781
|
1781
|
if ($globalDebug) echo "Add to DB..."; |
|
1782
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
|
1782
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
1783
|
1783
|
} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
1784
|
1784
|
if ($error != '') { |
|
1785
|
1785
|
return $error; |
|
1786
|
1786
|
} elseif ($globalDebug) echo "Done\n"; |
|
1787
|
1787
|
if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
1788
|
|
- update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
|
1788
|
+ update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
1789
|
1789
|
if (file_exists($tmp_dir.'owner_hb.csv')) { |
|
1790
|
1790
|
if ($globalDebug) echo "Add to DB..."; |
|
1791
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
|
1791
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
1792
|
1792
|
} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
1793
|
1793
|
if ($error != '') { |
|
1794
|
1794
|
return $error; |
|
1795
|
1795
|
} elseif ($globalDebug) echo "Done\n"; |
|
1796
|
1796
|
if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
1797
|
|
- update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
|
1797
|
+ update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
1798
|
1798
|
if (file_exists($tmp_dir.'owner_ok.csv')) { |
|
1799
|
1799
|
if ($globalDebug) echo "Add to DB..."; |
|
1800
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
|
1800
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
1801
|
1801
|
} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
1802
|
1802
|
if ($error != '') { |
|
1803
|
1803
|
return $error; |
|
1804
|
1804
|
} elseif ($globalDebug) echo "Done\n"; |
|
1805
|
1805
|
if ($globalDebug) echo "Owner Australia: Download..."; |
|
1806
|
|
- update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
|
1806
|
+ update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
1807
|
1807
|
if (file_exists($tmp_dir.'owner_vh.csv')) { |
|
1808
|
1808
|
if ($globalDebug) echo "Add to DB..."; |
|
1809
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
|
1809
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
1810
|
1810
|
} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
1811
|
1811
|
if ($error != '') { |
|
1812
|
1812
|
return $error; |
|
1813
|
1813
|
} elseif ($globalDebug) echo "Done\n"; |
|
1814
|
1814
|
if ($globalDebug) echo "Owner Austria: Download..."; |
|
1815
|
|
- update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
|
1815
|
+ update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
1816
|
1816
|
if (file_exists($tmp_dir.'owner_oe.csv')) { |
|
1817
|
1817
|
if ($globalDebug) echo "Add to DB..."; |
|
1818
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
|
1818
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
1819
|
1819
|
} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
1820
|
1820
|
if ($error != '') { |
|
1821
|
1821
|
return $error; |
|
1822
|
1822
|
} elseif ($globalDebug) echo "Done\n"; |
|
1823
|
1823
|
if ($globalDebug) echo "Owner Chile: Download..."; |
|
1824
|
|
- update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
|
1824
|
+ update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
1825
|
1825
|
if (file_exists($tmp_dir.'owner_cc.csv')) { |
|
1826
|
1826
|
if ($globalDebug) echo "Add to DB..."; |
|
1827
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
|
1827
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
1828
|
1828
|
} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
1829
|
1829
|
if ($error != '') { |
|
1830
|
1830
|
return $error; |
|
1831
|
1831
|
} elseif ($globalDebug) echo "Done\n"; |
|
1832
|
1832
|
if ($globalDebug) echo "Owner Colombia: Download..."; |
|
1833
|
|
- update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
|
1833
|
+ update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
1834
|
1834
|
if (file_exists($tmp_dir.'owner_hj.csv')) { |
|
1835
|
1835
|
if ($globalDebug) echo "Add to DB..."; |
|
1836
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
|
1836
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
1837
|
1837
|
} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
1838
|
1838
|
if ($error != '') { |
|
1839
|
1839
|
return $error; |
|
1840
|
1840
|
} elseif ($globalDebug) echo "Done\n"; |
|
1841
|
1841
|
if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
1842
|
|
- update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
|
1842
|
+ update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
1843
|
1843
|
if (file_exists($tmp_dir.'owner_e7.csv')) { |
|
1844
|
1844
|
if ($globalDebug) echo "Add to DB..."; |
|
1845
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
|
1845
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
1846
|
1846
|
} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
1847
|
1847
|
if ($error != '') { |
|
1848
|
1848
|
return $error; |
|
1849
|
1849
|
} elseif ($globalDebug) echo "Done\n"; |
|
1850
|
1850
|
if ($globalDebug) echo "Owner Brazil: Download..."; |
|
1851
|
|
- update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
|
1851
|
+ update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
1852
|
1852
|
if (file_exists($tmp_dir.'owner_pp.csv')) { |
|
1853
|
1853
|
if ($globalDebug) echo "Add to DB..."; |
|
1854
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
|
1854
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
1855
|
1855
|
} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
1856
|
1856
|
if ($error != '') { |
|
1857
|
1857
|
return $error; |
|
1858
|
1858
|
} elseif ($globalDebug) echo "Done\n"; |
|
1859
|
1859
|
if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
1860
|
|
- update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
|
1860
|
+ update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
1861
|
1861
|
if (file_exists($tmp_dir.'owner_vp.csv')) { |
|
1862
|
1862
|
if ($globalDebug) echo "Add to DB..."; |
|
1863
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
|
1863
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
1864
|
1864
|
} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
1865
|
1865
|
if ($error != '') { |
|
1866
|
1866
|
return $error; |
|
1867
|
1867
|
} elseif ($globalDebug) echo "Done\n"; |
|
1868
|
1868
|
if ($globalDebug) echo "Owner Croatia: Download..."; |
|
1869
|
|
- update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
|
1869
|
+ update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
1870
|
1870
|
if (file_exists($tmp_dir.'owner_9a.csv')) { |
|
1871
|
1871
|
if ($globalDebug) echo "Add to DB..."; |
|
1872
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
|
1872
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
1873
|
1873
|
} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
1874
|
1874
|
if ($error != '') { |
|
1875
|
1875
|
return $error; |
|
1876
|
1876
|
} elseif ($globalDebug) echo "Done\n"; |
|
1877
|
1877
|
if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
1878
|
|
- update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
|
1878
|
+ update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
1879
|
1879
|
if (file_exists($tmp_dir.'owner_lx.csv')) { |
|
1880
|
1880
|
if ($globalDebug) echo "Add to DB..."; |
|
1881
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
|
1881
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
1882
|
1882
|
} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
1883
|
1883
|
if ($error != '') { |
|
1884
|
1884
|
return $error; |
|
1885
|
1885
|
} elseif ($globalDebug) echo "Done\n"; |
|
1886
|
1886
|
if ($globalDebug) echo "Owner Maldives: Download..."; |
|
1887
|
|
- update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
|
1887
|
+ update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
1888
|
1888
|
if (file_exists($tmp_dir.'owner_8q.csv')) { |
|
1889
|
1889
|
if ($globalDebug) echo "Add to DB..."; |
|
1890
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
|
1890
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
1891
|
1891
|
} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
1892
|
1892
|
if ($error != '') { |
|
1893
|
1893
|
return $error; |
|
1894
|
1894
|
} elseif ($globalDebug) echo "Done\n"; |
|
1895
|
1895
|
if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
1896
|
|
- update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
|
1896
|
+ update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
1897
|
1897
|
if (file_exists($tmp_dir.'owner_zk.csv')) { |
|
1898
|
1898
|
if ($globalDebug) echo "Add to DB..."; |
|
1899
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
|
1899
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
1900
|
1900
|
} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
1901
|
1901
|
if ($error != '') { |
|
1902
|
1902
|
return $error; |
|
1903
|
1903
|
} elseif ($globalDebug) echo "Done\n"; |
|
1904
|
1904
|
if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
1905
|
|
- update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
|
1905
|
+ update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
1906
|
1906
|
if (file_exists($tmp_dir.'owner_p2.csv')) { |
|
1907
|
1907
|
if ($globalDebug) echo "Add to DB..."; |
|
1908
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
|
1908
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
1909
|
1909
|
} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
1910
|
1910
|
if ($error != '') { |
|
1911
|
1911
|
return $error; |
|
1912
|
1912
|
} elseif ($globalDebug) echo "Done\n"; |
|
1913
|
1913
|
if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
1914
|
|
- update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
|
1914
|
+ update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
1915
|
1915
|
if (file_exists($tmp_dir.'owner_om.csv')) { |
|
1916
|
1916
|
if ($globalDebug) echo "Add to DB..."; |
|
1917
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
|
1917
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
1918
|
1918
|
} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
1919
|
1919
|
if ($error != '') { |
|
1920
|
1920
|
return $error; |
|
1921
|
1921
|
} elseif ($globalDebug) echo "Done\n"; |
|
1922
|
1922
|
if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
1923
|
|
- update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
|
1923
|
+ update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
1924
|
1924
|
if (file_exists($tmp_dir.'owner_hc.csv')) { |
|
1925
|
1925
|
if ($globalDebug) echo "Add to DB..."; |
|
1926
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
|
1926
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
1927
|
1927
|
} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
1928
|
1928
|
if ($error != '') { |
|
1929
|
1929
|
return $error; |
|
1930
|
1930
|
} elseif ($globalDebug) echo "Done\n"; |
|
1931
|
1931
|
if ($globalDebug) echo "Owner Iceland: Download..."; |
|
1932
|
|
- update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
|
1932
|
+ update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
1933
|
1933
|
if (file_exists($tmp_dir.'owner_tf.csv')) { |
|
1934
|
1934
|
if ($globalDebug) echo "Add to DB..."; |
|
1935
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
|
1935
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
1936
|
1936
|
} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
1937
|
1937
|
if ($error != '') { |
|
1938
|
1938
|
return $error; |
|
1939
|
1939
|
} elseif ($globalDebug) echo "Done\n"; |
|
1940
|
1940
|
if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
1941
|
|
- update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
|
1941
|
+ update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
1942
|
1942
|
if (file_exists($tmp_dir.'owner_m.csv')) { |
|
1943
|
1943
|
if ($globalDebug) echo "Add to DB..."; |
|
1944
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
|
1944
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
1945
|
1945
|
} else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
1946
|
1946
|
if ($error != '') { |
|
1947
|
1947
|
return $error; |
|
1948
|
1948
|
} elseif ($globalDebug) echo "Done\n"; |
|
1949
|
1949
|
if ($globalMasterSource) { |
|
1950
|
1950
|
if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
1951
|
|
- update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
|
1951
|
+ update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
1952
|
1952
|
if (file_exists($tmp_dir.'owner_ph.csv')) { |
|
1953
|
1953
|
if ($globalDebug) echo "Add to DB..."; |
|
1954
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
|
1954
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
1955
|
1955
|
} else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
1956
|
1956
|
if ($error != '') { |
|
1957
|
1957
|
return $error; |
|
1958
|
1958
|
} elseif ($globalDebug) echo "Done\n"; |
|
1959
|
1959
|
if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
1960
|
|
- update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
|
1960
|
+ update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
1961
|
1961
|
if (file_exists($tmp_dir.'owner_oy.csv')) { |
|
1962
|
1962
|
if ($globalDebug) echo "Add to DB..."; |
|
1963
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
|
1963
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
1964
|
1964
|
} else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
1965
|
1965
|
if ($error != '') { |
|
1966
|
1966
|
return $error; |
|
@@ -1973,7 +1973,7 @@ discard block |
|
|
block discarded – undo |
|
1973
|
1973
|
global $tmp_dir, $globalDebug; |
|
1974
|
1974
|
$error = ''; |
|
1975
|
1975
|
if ($globalDebug) echo "Translation : Download..."; |
|
1976
|
|
- update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
|
1976
|
+ update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
1977
|
1977
|
if (file_exists($tmp_dir.'translation.zip')) { |
|
1978
|
1978
|
if ($globalDebug) echo "Unzip..."; |
|
1979
|
1979
|
update_db::unzip($tmp_dir.'translation.zip'); |
|
@@ -1989,7 +1989,7 @@ discard block |
|
|
block discarded – undo |
|
1989
|
1989
|
public static function update_translation_fam() { |
|
1990
|
1990
|
global $tmp_dir, $globalDebug; |
|
1991
|
1991
|
if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
1992
|
|
- update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
|
1992
|
+ update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
1993
|
1993
|
if (file_exists($tmp_dir.'translation.tsv.gz')) { |
|
1994
|
1994
|
if ($globalDebug) echo "Gunzip..."; |
|
1995
|
1995
|
update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
|
@@ -2004,7 +2004,7 @@ discard block |
|
|
block discarded – undo |
|
2004
|
2004
|
public static function update_ModeS_fam() { |
|
2005
|
2005
|
global $tmp_dir, $globalDebug; |
|
2006
|
2006
|
if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
2007
|
|
- update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
|
2007
|
+ update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
2008
|
2008
|
if (file_exists($tmp_dir.'modes.tsv.gz')) { |
|
2009
|
2009
|
if ($globalDebug) echo "Gunzip..."; |
|
2010
|
2010
|
update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
|
@@ -2020,9 +2020,9 @@ discard block |
|
|
block discarded – undo |
|
2020
|
2020
|
global $tmp_dir, $globalDebug, $globalOwner; |
|
2021
|
2021
|
if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
2022
|
2022
|
if ($globalOwner === TRUE) { |
|
2023
|
|
- update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
|
2023
|
+ update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2024
|
2024
|
} else { |
|
2025
|
|
- update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
|
2025
|
+ update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2026
|
2026
|
} |
|
2027
|
2027
|
if (file_exists($tmp_dir.'owners.tsv.gz')) { |
|
2028
|
2028
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2038,7 +2038,7 @@ discard block |
|
|
block discarded – undo |
|
2038
|
2038
|
public static function update_routes_fam() { |
|
2039
|
2039
|
global $tmp_dir, $globalDebug; |
|
2040
|
2040
|
if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
2041
|
|
- update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
|
2041
|
+ update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2042
|
2042
|
if (file_exists($tmp_dir.'routes.tsv.gz')) { |
|
2043
|
2043
|
if ($globalDebug) echo "Gunzip..."; |
|
2044
|
2044
|
update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
|
@@ -2052,13 +2052,13 @@ discard block |
|
|
block discarded – undo |
|
2052
|
2052
|
} |
|
2053
|
2053
|
public static function update_marine_identity_fam() { |
|
2054
|
2054
|
global $tmp_dir, $globalDebug; |
|
2055
|
|
- update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
|
2055
|
+ update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2056
|
2056
|
if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
|
2057
|
|
- $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
|
2057
|
+ $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2058
|
2058
|
$marine_identity_md5 = $marine_identity_md5_file[0]; |
|
2059
|
2059
|
if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
|
2060
|
2060
|
if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
2061
|
|
- update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
|
2061
|
+ update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2062
|
2062
|
if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
|
2063
|
2063
|
if ($globalDebug) echo "Gunzip..."; |
|
2064
|
2064
|
update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
|
@@ -2078,7 +2078,7 @@ discard block |
|
|
block discarded – undo |
|
2078
|
2078
|
public static function update_banned_fam() { |
|
2079
|
2079
|
global $tmp_dir, $globalDebug; |
|
2080
|
2080
|
if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2081
|
|
- update_db::download('http://data.flightairmap.fr/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
|
2081
|
+ update_db::download('http://data.flightairmap.fr/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2082
|
2082
|
if (file_exists($tmp_dir.'ban_eu.csv')) { |
|
2083
|
2083
|
//if ($globalDebug) echo "Gunzip..."; |
|
2084
|
2084
|
//update_db::gunzip($tmp_dir.'ban_ue.csv'); |
|
@@ -2097,18 +2097,18 @@ discard block |
|
|
block discarded – undo |
|
2097
|
2097
|
$error = ''; |
|
2098
|
2098
|
if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
2099
|
2099
|
if ($globalDBdriver == 'mysql') { |
|
2100
|
|
- update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
|
2100
|
+ update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2101
|
2101
|
} else { |
|
2102
|
|
- update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
|
2102
|
+ update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2103
|
2103
|
} |
|
2104
|
2104
|
if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
|
2105
|
|
- $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
|
2105
|
+ $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2106
|
2106
|
$airspace_md5 = $airspace_md5_file[0]; |
|
2107
|
2107
|
if (!update_db::check_airspace_version($airspace_md5)) { |
|
2108
|
2108
|
if ($globalDBdriver == 'mysql') { |
|
2109
|
|
- update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
|
2109
|
+ update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2110
|
2110
|
} else { |
|
2111
|
|
- update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
|
2111
|
+ update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2112
|
2112
|
} |
|
2113
|
2113
|
if (file_exists($tmp_dir.'airspace.sql.gz')) { |
|
2114
|
2114
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2120,7 +2120,7 @@ discard block |
|
|
block discarded – undo |
|
2120
|
2120
|
try { |
|
2121
|
2121
|
$sth = $Connection->db->prepare($query); |
|
2122
|
2122
|
$sth->execute(); |
|
2123
|
|
- } catch(PDOException $e) { |
|
|
2123
|
+ } catch (PDOException $e) { |
|
2124
|
2124
|
return "error : ".$e->getMessage(); |
|
2125
|
2125
|
} |
|
2126
|
2126
|
} |
|
@@ -2139,15 +2139,15 @@ discard block |
|
|
block discarded – undo |
|
2139
|
2139
|
global $tmp_dir, $globalDebug, $globalGeoidSource; |
|
2140
|
2140
|
$error = ''; |
|
2141
|
2141
|
if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
2142
|
|
- update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
|
2142
|
+ update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2143
|
2143
|
if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
|
2144
|
|
- $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
|
2144
|
+ $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2145
|
2145
|
$geoid_md5 = $geoid_md5_file[0]; |
|
2146
|
2146
|
if (!update_db::check_geoid_version($geoid_md5)) { |
|
2147
|
|
- update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
|
2147
|
+ update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2148
|
2148
|
if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
|
2149
|
2149
|
if ($globalDebug) echo "Gunzip..."; |
|
2150
|
|
- update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
|
2150
|
+ update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2151
|
2151
|
if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
|
2152
|
2152
|
update_db::insert_geoid_version($geoid_md5); |
|
2153
|
2153
|
} |
|
@@ -2163,15 +2163,15 @@ discard block |
|
|
block discarded – undo |
|
2163
|
2163
|
public static function update_tle() { |
|
2164
|
2164
|
global $tmp_dir, $globalDebug; |
|
2165
|
2165
|
if ($globalDebug) echo "Download TLE : Download..."; |
|
2166
|
|
- $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', |
|
2167
|
|
- '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', |
|
2168
|
|
- 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
|
2166
|
+ $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', |
|
|
2167
|
+ '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', |
|
|
2168
|
+ 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
2169
|
2169
|
foreach ($alltle as $filename) { |
|
2170
|
2170
|
if ($globalDebug) echo "downloading ".$filename.'...'; |
|
2171
|
|
- update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
|
2171
|
+ update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2172
|
2172
|
if (file_exists($tmp_dir.$filename)) { |
|
2173
|
2173
|
if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
2174
|
|
- $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
|
2174
|
+ $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2175
|
2175
|
} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
2176
|
2176
|
if ($error != '') { |
|
2177
|
2177
|
echo $error."\n"; |
|
@@ -2184,32 +2184,32 @@ discard block |
|
|
block discarded – undo |
|
2184
|
2184
|
global $tmp_dir, $globalDebug; |
|
2185
|
2185
|
$error = ''; |
|
2186
|
2186
|
if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
2187
|
|
- update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
|
2187
|
+ update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2188
|
2188
|
if (file_exists($tmp_dir.'models.md5sum')) { |
|
2189
|
2189
|
if ($globalDebug) echo "Check files...\n"; |
|
2190
|
2190
|
$newmodelsdb = array(); |
|
2191
|
|
- if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2192
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
2191
|
+ if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
|
2192
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2193
|
2193
|
$model = trim($row[2]); |
|
2194
|
2194
|
$newmodelsdb[$model] = trim($row[0]); |
|
2195
|
2195
|
} |
|
2196
|
2196
|
} |
|
2197
|
2197
|
$modelsdb = array(); |
|
2198
|
2198
|
if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
|
2199
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2200
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
2199
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
|
2200
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2201
|
2201
|
$model = trim($row[2]); |
|
2202
|
2202
|
$modelsdb[$model] = trim($row[0]); |
|
2203
|
2203
|
} |
|
2204
|
2204
|
} |
|
2205
|
2205
|
} |
|
2206
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
|
2206
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
|
2207
|
2207
|
foreach ($diff as $key => $value) { |
|
2208
|
2208
|
if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
2209
|
|
- update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
|
2209
|
+ update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2210
|
2210
|
|
|
2211
|
2211
|
} |
|
2212
|
|
- update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
|
2212
|
+ update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2213
|
2213
|
} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2214
|
2214
|
if ($error != '') { |
|
2215
|
2215
|
return $error; |
|
@@ -2221,32 +2221,32 @@ discard block |
|
|
block discarded – undo |
|
2221
|
2221
|
global $tmp_dir, $globalDebug; |
|
2222
|
2222
|
$error = ''; |
|
2223
|
2223
|
if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
2224
|
|
- update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
|
2224
|
+ update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2225
|
2225
|
if (file_exists($tmp_dir.'space_models.md5sum')) { |
|
2226
|
2226
|
if ($globalDebug) echo "Check files...\n"; |
|
2227
|
2227
|
$newmodelsdb = array(); |
|
2228
|
|
- if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2229
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
2228
|
+ if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
|
2229
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2230
|
2230
|
$model = trim($row[2]); |
|
2231
|
2231
|
$newmodelsdb[$model] = trim($row[0]); |
|
2232
|
2232
|
} |
|
2233
|
2233
|
} |
|
2234
|
2234
|
$modelsdb = array(); |
|
2235
|
2235
|
if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
|
2236
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2237
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
2236
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
|
2237
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2238
|
2238
|
$model = trim($row[2]); |
|
2239
|
2239
|
$modelsdb[$model] = trim($row[0]); |
|
2240
|
2240
|
} |
|
2241
|
2241
|
} |
|
2242
|
2242
|
} |
|
2243
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
|
2243
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
|
2244
|
2244
|
foreach ($diff as $key => $value) { |
|
2245
|
2245
|
if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
2246
|
|
- update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
|
2246
|
+ update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2247
|
2247
|
|
|
2248
|
2248
|
} |
|
2249
|
|
- update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
|
2249
|
+ update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2250
|
2250
|
} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2251
|
2251
|
if ($error != '') { |
|
2252
|
2252
|
return $error; |
|
@@ -2258,32 +2258,32 @@ discard block |
|
|
block discarded – undo |
|
2258
|
2258
|
global $tmp_dir, $globalDebug; |
|
2259
|
2259
|
$error = ''; |
|
2260
|
2260
|
if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
2261
|
|
- update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
|
2261
|
+ update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2262
|
2262
|
if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
|
2263
|
2263
|
if ($globalDebug) echo "Check files...\n"; |
|
2264
|
2264
|
$newmodelsdb = array(); |
|
2265
|
|
- if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2266
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
2265
|
+ if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
|
2266
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2267
|
2267
|
$model = trim($row[2]); |
|
2268
|
2268
|
$newmodelsdb[$model] = trim($row[0]); |
|
2269
|
2269
|
} |
|
2270
|
2270
|
} |
|
2271
|
2271
|
$modelsdb = array(); |
|
2272
|
2272
|
if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
|
2273
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2274
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
|
2273
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
|
2274
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2275
|
2275
|
$model = trim($row[2]); |
|
2276
|
2276
|
$modelsdb[$model] = trim($row[0]); |
|
2277
|
2277
|
} |
|
2278
|
2278
|
} |
|
2279
|
2279
|
} |
|
2280
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
|
2280
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
|
2281
|
2281
|
foreach ($diff as $key => $value) { |
|
2282
|
2282
|
if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
2283
|
|
- update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
|
2283
|
+ update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2284
|
2284
|
|
|
2285
|
2285
|
} |
|
2286
|
|
- update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
|
2286
|
+ update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2287
|
2287
|
} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2288
|
2288
|
if ($error != '') { |
|
2289
|
2289
|
return $error; |
|
@@ -2306,8 +2306,8 @@ discard block |
|
|
block discarded – undo |
|
2306
|
2306
|
*/ |
|
2307
|
2307
|
if (file_exists($tmp_dir.'aircrafts.html')) { |
|
2308
|
2308
|
//var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
2309
|
|
- $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2310
|
|
- $result = fread($fh,100000000); |
|
|
2309
|
+ $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
|
2310
|
+ $result = fread($fh, 100000000); |
|
2311
|
2311
|
//echo $result; |
|
2312
|
2312
|
//var_dump(str_get_html($result)); |
|
2313
|
2313
|
//print_r(self::table2array($result)); |
|
@@ -2325,23 +2325,23 @@ discard block |
|
|
block discarded – undo |
|
2325
|
2325
|
$Connection = new Connection(); |
|
2326
|
2326
|
$sth = $Connection->db->prepare($query); |
|
2327
|
2327
|
$sth->execute(); |
|
2328
|
|
- } catch(PDOException $e) { |
|
|
2328
|
+ } catch (PDOException $e) { |
|
2329
|
2329
|
return "error : ".$e->getMessage(); |
|
2330
|
2330
|
} |
|
2331
|
2331
|
|
|
2332
|
2332
|
$error = ''; |
|
2333
|
2333
|
if ($globalDebug) echo "Notam : Download..."; |
|
2334
|
|
- update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
|
2334
|
+ update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2335
|
2335
|
if (file_exists($tmp_dir.'notam.rss')) { |
|
2336
|
|
- $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
|
2336
|
+ $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2337
|
2337
|
foreach ($notams['channel']['item'] as $notam) { |
|
2338
|
|
- $title = explode(':',$notam['title']); |
|
|
2338
|
+ $title = explode(':', $notam['title']); |
|
2339
|
2339
|
$data['ref'] = trim($title[0]); |
|
2340
|
2340
|
unset($title[0]); |
|
2341
|
|
- $data['title'] = trim(implode(':',$title)); |
|
2342
|
|
- $description = strip_tags($notam['description'],'<pre>'); |
|
2343
|
|
- preg_match(':^(.*?)<pre>:',$description,$match); |
|
2344
|
|
- $q = explode('/',$match[1]); |
|
|
2341
|
+ $data['title'] = trim(implode(':', $title)); |
|
|
2342
|
+ $description = strip_tags($notam['description'], '<pre>'); |
|
|
2343
|
+ preg_match(':^(.*?)<pre>:', $description, $match); |
|
|
2344
|
+ $q = explode('/', $match[1]); |
|
2345
|
2345
|
$data['fir'] = $q[0]; |
|
2346
|
2346
|
$data['code'] = $q[1]; |
|
2347
|
2347
|
$ifrvfr = $q[2]; |
|
@@ -2357,30 +2357,30 @@ discard block |
|
|
block discarded – undo |
|
2357
|
2357
|
$data['lower_limit'] = $q[5]; |
|
2358
|
2358
|
$data['upper_limit'] = $q[6]; |
|
2359
|
2359
|
$latlonrad = $q[7]; |
|
2360
|
|
- sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2361
|
|
- $latitude = $Common->convertDec($las,'latitude'); |
|
2362
|
|
- $longitude = $Common->convertDec($lns,'longitude'); |
|
|
2360
|
+ sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
|
2361
|
+ $latitude = $Common->convertDec($las, 'latitude'); |
|
|
2362
|
+ $longitude = $Common->convertDec($lns, 'longitude'); |
|
2363
|
2363
|
if ($lac == 'S') $latitude = '-'.$latitude; |
|
2364
|
2364
|
if ($lnc == 'W') $longitude = '-'.$longitude; |
|
2365
|
2365
|
$data['center_latitude'] = $latitude; |
|
2366
|
2366
|
$data['center_longitude'] = $longitude; |
|
2367
|
2367
|
$data['radius'] = intval($radius); |
|
2368
|
2368
|
|
|
2369
|
|
- preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
|
2369
|
+ preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2370
|
2370
|
$data['text'] = $match[1]; |
|
2371
|
|
- preg_match(':</pre>(.*?)$:',$description,$match); |
|
|
2371
|
+ preg_match(':</pre>(.*?)$:', $description, $match); |
|
2372
|
2372
|
$fromto = $match[1]; |
|
2373
|
|
- preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
|
2373
|
+ preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2374
|
2374
|
$fromall = trim($match[1]); |
|
2375
|
|
- preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
|
2375
|
+ preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2376
|
2376
|
$from = trim($match[1]); |
|
2377
|
|
- $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2378
|
|
- preg_match('#TO:(.*?)$#',$fromto,$match); |
|
|
2377
|
+ $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
|
2378
|
+ preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2379
|
2379
|
$toall = trim($match[1]); |
|
2380
|
|
- if (!preg_match(':Permanent:',$toall)) { |
|
2381
|
|
- preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
|
2380
|
+ if (!preg_match(':Permanent:', $toall)) { |
|
|
2381
|
+ preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2382
|
2382
|
$to = trim($match[1]); |
|
2383
|
|
- $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
|
2383
|
+ $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2384
|
2384
|
$data['permanent'] = 0; |
|
2385
|
2385
|
} else { |
|
2386
|
2386
|
$data['date_end'] = NULL; |
|
@@ -2388,7 +2388,7 @@ discard block |
|
|
block discarded – undo |
|
2388
|
2388
|
} |
|
2389
|
2389
|
$data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
|
2390
|
2390
|
$NOTAM = new NOTAM(); |
|
2391
|
|
- $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']); |
|
|
2391
|
+ $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']); |
|
2392
|
2392
|
unset($data); |
|
2393
|
2393
|
} |
|
2394
|
2394
|
} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
@@ -2411,16 +2411,16 @@ discard block |
|
|
block discarded – undo |
|
2411
|
2411
|
$Connection = new Connection(); |
|
2412
|
2412
|
$sth = $Connection->db->prepare($query); |
|
2413
|
2413
|
$sth->execute(); |
|
2414
|
|
- } catch(PDOException $e) { |
|
|
2414
|
+ } catch (PDOException $e) { |
|
2415
|
2415
|
return "error : ".$e->getMessage(); |
|
2416
|
2416
|
} |
|
2417
|
2417
|
} |
|
2418
|
2418
|
$Common = new Common(); |
|
2419
|
2419
|
$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
|
2420
|
|
- $airspace_json = json_decode($airspace_lst,true); |
|
|
2420
|
+ $airspace_json = json_decode($airspace_lst, true); |
|
2421
|
2421
|
foreach ($airspace_json['records'] as $airspace) { |
|
2422
|
2422
|
if ($globalDebug) echo $airspace['name']."...\n"; |
|
2423
|
|
- update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
|
2423
|
+ update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2424
|
2424
|
if (file_exists($tmp_dir.$airspace['name'])) { |
|
2425
|
2425
|
file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
|
2426
|
2426
|
//system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
|
@@ -2442,7 +2442,7 @@ discard block |
|
|
block discarded – undo |
|
2442
|
2442
|
$Connection = new Connection(); |
|
2443
|
2443
|
$sth = $Connection->db->prepare($query); |
|
2444
|
2444
|
$sth->execute(array(':new' => $new, ':old' => $old)); |
|
2445
|
|
- } catch(PDOException $e) { |
|
|
2445
|
+ } catch (PDOException $e) { |
|
2446
|
2446
|
return "error : ".$e->getMessage(); |
|
2447
|
2447
|
} |
|
2448
|
2448
|
} |
|
@@ -2459,7 +2459,7 @@ discard block |
|
|
block discarded – undo |
|
2459
|
2459
|
$Connection = new Connection(); |
|
2460
|
2460
|
$sth = $Connection->db->prepare($query); |
|
2461
|
2461
|
$sth->execute(); |
|
2462
|
|
- } catch(PDOException $e) { |
|
|
2462
|
+ } catch (PDOException $e) { |
|
2463
|
2463
|
return "error : ".$e->getMessage(); |
|
2464
|
2464
|
} |
|
2465
|
2465
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2474,7 +2474,7 @@ discard block |
|
|
block discarded – undo |
|
2474
|
2474
|
$Connection = new Connection(); |
|
2475
|
2475
|
$sth = $Connection->db->prepare($query); |
|
2476
|
2476
|
$sth->execute(); |
|
2477
|
|
- } catch(PDOException $e) { |
|
|
2477
|
+ } catch (PDOException $e) { |
|
2478
|
2478
|
return "error : ".$e->getMessage(); |
|
2479
|
2479
|
} |
|
2480
|
2480
|
} |
|
@@ -2485,7 +2485,7 @@ discard block |
|
|
block discarded – undo |
|
2485
|
2485
|
$Connection = new Connection(); |
|
2486
|
2486
|
$sth = $Connection->db->prepare($query); |
|
2487
|
2487
|
$sth->execute(array(':version' => $version)); |
|
2488
|
|
- } catch(PDOException $e) { |
|
|
2488
|
+ } catch (PDOException $e) { |
|
2489
|
2489
|
return "error : ".$e->getMessage(); |
|
2490
|
2490
|
} |
|
2491
|
2491
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2499,7 +2499,7 @@ discard block |
|
|
block discarded – undo |
|
2499
|
2499
|
$Connection = new Connection(); |
|
2500
|
2500
|
$sth = $Connection->db->prepare($query); |
|
2501
|
2501
|
$sth->execute(array(':version' => $version)); |
|
2502
|
|
- } catch(PDOException $e) { |
|
|
2502
|
+ } catch (PDOException $e) { |
|
2503
|
2503
|
return "error : ".$e->getMessage(); |
|
2504
|
2504
|
} |
|
2505
|
2505
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2513,7 +2513,7 @@ discard block |
|
|
block discarded – undo |
|
2513
|
2513
|
$Connection = new Connection(); |
|
2514
|
2514
|
$sth = $Connection->db->prepare($query); |
|
2515
|
2515
|
$sth->execute(array(':version' => $version)); |
|
2516
|
|
- } catch(PDOException $e) { |
|
|
2516
|
+ } catch (PDOException $e) { |
|
2517
|
2517
|
return "error : ".$e->getMessage(); |
|
2518
|
2518
|
} |
|
2519
|
2519
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2529,7 +2529,7 @@ discard block |
|
|
block discarded – undo |
|
2529
|
2529
|
$Connection = new Connection(); |
|
2530
|
2530
|
$sth = $Connection->db->prepare($query); |
|
2531
|
2531
|
$sth->execute(array(':version' => $version)); |
|
2532
|
|
- } catch(PDOException $e) { |
|
|
2532
|
+ } catch (PDOException $e) { |
|
2533
|
2533
|
return "error : ".$e->getMessage(); |
|
2534
|
2534
|
} |
|
2535
|
2535
|
} |
|
@@ -2541,7 +2541,7 @@ discard block |
|
|
block discarded – undo |
|
2541
|
2541
|
$Connection = new Connection(); |
|
2542
|
2542
|
$sth = $Connection->db->prepare($query); |
|
2543
|
2543
|
$sth->execute(array(':version' => $version)); |
|
2544
|
|
- } catch(PDOException $e) { |
|
|
2544
|
+ } catch (PDOException $e) { |
|
2545
|
2545
|
return "error : ".$e->getMessage(); |
|
2546
|
2546
|
} |
|
2547
|
2547
|
} |
|
@@ -2553,7 +2553,7 @@ discard block |
|
|
block discarded – undo |
|
2553
|
2553
|
$Connection = new Connection(); |
|
2554
|
2554
|
$sth = $Connection->db->prepare($query); |
|
2555
|
2555
|
$sth->execute(array(':version' => $version)); |
|
2556
|
|
- } catch(PDOException $e) { |
|
|
2556
|
+ } catch (PDOException $e) { |
|
2557
|
2557
|
return "error : ".$e->getMessage(); |
|
2558
|
2558
|
} |
|
2559
|
2559
|
} |
|
@@ -2569,7 +2569,7 @@ discard block |
|
|
block discarded – undo |
|
2569
|
2569
|
$Connection = new Connection(); |
|
2570
|
2570
|
$sth = $Connection->db->prepare($query); |
|
2571
|
2571
|
$sth->execute(); |
|
2572
|
|
- } catch(PDOException $e) { |
|
|
2572
|
+ } catch (PDOException $e) { |
|
2573
|
2573
|
return "error : ".$e->getMessage(); |
|
2574
|
2574
|
} |
|
2575
|
2575
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2584,7 +2584,7 @@ discard block |
|
|
block discarded – undo |
|
2584
|
2584
|
$Connection = new Connection(); |
|
2585
|
2585
|
$sth = $Connection->db->prepare($query); |
|
2586
|
2586
|
$sth->execute(); |
|
2587
|
|
- } catch(PDOException $e) { |
|
|
2587
|
+ } catch (PDOException $e) { |
|
2588
|
2588
|
return "error : ".$e->getMessage(); |
|
2589
|
2589
|
} |
|
2590
|
2590
|
} |
|
@@ -2600,7 +2600,7 @@ discard block |
|
|
block discarded – undo |
|
2600
|
2600
|
$Connection = new Connection(); |
|
2601
|
2601
|
$sth = $Connection->db->prepare($query); |
|
2602
|
2602
|
$sth->execute(); |
|
2603
|
|
- } catch(PDOException $e) { |
|
|
2603
|
+ } catch (PDOException $e) { |
|
2604
|
2604
|
return "error : ".$e->getMessage(); |
|
2605
|
2605
|
} |
|
2606
|
2606
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2615,7 +2615,7 @@ discard block |
|
|
block discarded – undo |
|
2615
|
2615
|
$Connection = new Connection(); |
|
2616
|
2616
|
$sth = $Connection->db->prepare($query); |
|
2617
|
2617
|
$sth->execute(); |
|
2618
|
|
- } catch(PDOException $e) { |
|
|
2618
|
+ } catch (PDOException $e) { |
|
2619
|
2619
|
return "error : ".$e->getMessage(); |
|
2620
|
2620
|
} |
|
2621
|
2621
|
} |
|
@@ -2631,7 +2631,7 @@ discard block |
|
|
block discarded – undo |
|
2631
|
2631
|
$Connection = new Connection(); |
|
2632
|
2632
|
$sth = $Connection->db->prepare($query); |
|
2633
|
2633
|
$sth->execute(); |
|
2634
|
|
- } catch(PDOException $e) { |
|
|
2634
|
+ } catch (PDOException $e) { |
|
2635
|
2635
|
return "error : ".$e->getMessage(); |
|
2636
|
2636
|
} |
|
2637
|
2637
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2646,7 +2646,7 @@ discard block |
|
|
block discarded – undo |
|
2646
|
2646
|
$Connection = new Connection(); |
|
2647
|
2647
|
$sth = $Connection->db->prepare($query); |
|
2648
|
2648
|
$sth->execute(); |
|
2649
|
|
- } catch(PDOException $e) { |
|
|
2649
|
+ } catch (PDOException $e) { |
|
2650
|
2650
|
return "error : ".$e->getMessage(); |
|
2651
|
2651
|
} |
|
2652
|
2652
|
} |
|
@@ -2662,7 +2662,7 @@ discard block |
|
|
block discarded – undo |
|
2662
|
2662
|
$Connection = new Connection(); |
|
2663
|
2663
|
$sth = $Connection->db->prepare($query); |
|
2664
|
2664
|
$sth->execute(); |
|
2665
|
|
- } catch(PDOException $e) { |
|
|
2665
|
+ } catch (PDOException $e) { |
|
2666
|
2666
|
return "error : ".$e->getMessage(); |
|
2667
|
2667
|
} |
|
2668
|
2668
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2677,7 +2677,7 @@ discard block |
|
|
block discarded – undo |
|
2677
|
2677
|
$Connection = new Connection(); |
|
2678
|
2678
|
$sth = $Connection->db->prepare($query); |
|
2679
|
2679
|
$sth->execute(); |
|
2680
|
|
- } catch(PDOException $e) { |
|
|
2680
|
+ } catch (PDOException $e) { |
|
2681
|
2681
|
return "error : ".$e->getMessage(); |
|
2682
|
2682
|
} |
|
2683
|
2683
|
} |
|
@@ -2692,7 +2692,7 @@ discard block |
|
|
block discarded – undo |
|
2692
|
2692
|
$Connection = new Connection(); |
|
2693
|
2693
|
$sth = $Connection->db->prepare($query); |
|
2694
|
2694
|
$sth->execute(); |
|
2695
|
|
- } catch(PDOException $e) { |
|
|
2695
|
+ } catch (PDOException $e) { |
|
2696
|
2696
|
return "error : ".$e->getMessage(); |
|
2697
|
2697
|
} |
|
2698
|
2698
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2707,7 +2707,7 @@ discard block |
|
|
block discarded – undo |
|
2707
|
2707
|
$Connection = new Connection(); |
|
2708
|
2708
|
$sth = $Connection->db->prepare($query); |
|
2709
|
2709
|
$sth->execute(); |
|
2710
|
|
- } catch(PDOException $e) { |
|
|
2710
|
+ } catch (PDOException $e) { |
|
2711
|
2711
|
return "error : ".$e->getMessage(); |
|
2712
|
2712
|
} |
|
2713
|
2713
|
} |
|
@@ -2722,7 +2722,7 @@ discard block |
|
|
block discarded – undo |
|
2722
|
2722
|
$Connection = new Connection(); |
|
2723
|
2723
|
$sth = $Connection->db->prepare($query); |
|
2724
|
2724
|
$sth->execute(); |
|
2725
|
|
- } catch(PDOException $e) { |
|
|
2725
|
+ } catch (PDOException $e) { |
|
2726
|
2726
|
return "error : ".$e->getMessage(); |
|
2727
|
2727
|
} |
|
2728
|
2728
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2737,7 +2737,7 @@ discard block |
|
|
block discarded – undo |
|
2737
|
2737
|
$Connection = new Connection(); |
|
2738
|
2738
|
$sth = $Connection->db->prepare($query); |
|
2739
|
2739
|
$sth->execute(); |
|
2740
|
|
- } catch(PDOException $e) { |
|
|
2740
|
+ } catch (PDOException $e) { |
|
2741
|
2741
|
return "error : ".$e->getMessage(); |
|
2742
|
2742
|
} |
|
2743
|
2743
|
} |
|
@@ -2752,7 +2752,7 @@ discard block |
|
|
block discarded – undo |
|
2752
|
2752
|
$Connection = new Connection(); |
|
2753
|
2753
|
$sth = $Connection->db->prepare($query); |
|
2754
|
2754
|
$sth->execute(); |
|
2755
|
|
- } catch(PDOException $e) { |
|
|
2755
|
+ } catch (PDOException $e) { |
|
2756
|
2756
|
return "error : ".$e->getMessage(); |
|
2757
|
2757
|
} |
|
2758
|
2758
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -2767,7 +2767,7 @@ discard block |
|
|
block discarded – undo |
|
2767
|
2767
|
$Connection = new Connection(); |
|
2768
|
2768
|
$sth = $Connection->db->prepare($query); |
|
2769
|
2769
|
$sth->execute(); |
|
2770
|
|
- } catch(PDOException $e) { |
|
|
2770
|
+ } catch (PDOException $e) { |
|
2771
|
2771
|
return "error : ".$e->getMessage(); |
|
2772
|
2772
|
} |
|
2773
|
2773
|
} |
|
@@ -2782,7 +2782,7 @@ discard block |
|
|
block discarded – undo |
|
2782
|
2782
|
$Connection = new Connection(); |
|
2783
|
2783
|
$sth = $Connection->db->prepare($query); |
|
2784
|
2784
|
$sth->execute(); |
|
2785
|
|
- } catch(PDOException $e) { |
|
|
2785
|
+ } catch (PDOException $e) { |
|
2786
|
2786
|
return "error : ".$e->getMessage(); |
|
2787
|
2787
|
} |
|
2788
|
2788
|
} |
|
@@ -2797,7 +2797,7 @@ discard block |
|
|
block discarded – undo |
|
2797
|
2797
|
$Connection = new Connection(); |
|
2798
|
2798
|
$sth = $Connection->db->prepare($query); |
|
2799
|
2799
|
$sth->execute(); |
|
2800
|
|
- } catch(PDOException $e) { |
|
|
2800
|
+ } catch (PDOException $e) { |
|
2801
|
2801
|
return "error : ".$e->getMessage(); |
|
2802
|
2802
|
} |
|
2803
|
2803
|
} |