|
@@ -26,7 +26,7 @@ discard block |
|
|
block discarded – undo |
26
|
26
|
$ch = curl_init(); |
27
|
27
|
curl_setopt($ch, CURLOPT_URL, $url); |
28
|
28
|
if (isset($globalForceIPv4) && $globalForceIPv4) { |
29
|
|
- if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
29
|
+ if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
30
|
30
|
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
31
|
31
|
} |
32
|
32
|
} |
|
@@ -44,20 +44,20 @@ discard block |
|
|
block discarded – undo |
44
|
44
|
fclose($fp); |
45
|
45
|
} |
46
|
46
|
|
47
|
|
- public static function gunzip($in_file,$out_file_name = '') { |
|
47
|
+ public static function gunzip($in_file, $out_file_name = '') { |
48
|
48
|
//echo $in_file.' -> '.$out_file_name."\n"; |
49
|
49
|
$buffer_size = 4096; // read 4kb at a time |
50
|
50
|
if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
51
|
51
|
if ($in_file != '' && file_exists($in_file)) { |
52
|
52
|
// PHP version of Ubuntu use gzopen64 instead of gzopen |
53
|
|
- if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
54
|
|
- elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
53
|
+ if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
54
|
+ elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
55
|
55
|
else { |
56
|
56
|
echo 'gzopen not available'; |
57
|
57
|
die; |
58
|
58
|
} |
59
|
59
|
$out_file = fopen($out_file_name, 'wb'); |
60
|
|
- while(!gzeof($file)) { |
|
60
|
+ while (!gzeof($file)) { |
61
|
61
|
fwrite($out_file, gzread($file, $buffer_size)); |
62
|
62
|
} |
63
|
63
|
fclose($out_file); |
|
@@ -81,7 +81,7 @@ discard block |
|
|
block discarded – undo |
81
|
81
|
try { |
82
|
82
|
self::$db_sqlite = new PDO('sqlite:'.$database); |
83
|
83
|
self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
84
|
|
- } catch(PDOException $e) { |
|
84
|
+ } catch (PDOException $e) { |
85
|
85
|
return "error : ".$e->getMessage(); |
86
|
86
|
} |
87
|
87
|
} |
|
@@ -96,7 +96,7 @@ discard block |
|
|
block discarded – undo |
96
|
96
|
//$Connection = new Connection(); |
97
|
97
|
$sth = $Connection->db->prepare($query); |
98
|
98
|
$sth->execute(array(':source' => $database_file)); |
99
|
|
- } catch(PDOException $e) { |
|
99
|
+ } catch (PDOException $e) { |
100
|
100
|
return "error : ".$e->getMessage(); |
101
|
101
|
} |
102
|
102
|
|
|
@@ -107,7 +107,7 @@ discard block |
|
|
block discarded – undo |
107
|
107
|
try { |
108
|
108
|
$sth = update_db::$db_sqlite->prepare($query); |
109
|
109
|
$sth->execute(); |
110
|
|
- } catch(PDOException $e) { |
|
110
|
+ } catch (PDOException $e) { |
111
|
111
|
return "error : ".$e->getMessage(); |
112
|
112
|
} |
113
|
113
|
//$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)'; |
|
@@ -118,11 +118,11 @@ discard block |
|
|
block discarded – undo |
118
|
118
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
119
|
119
|
while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
120
|
120
|
//$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); |
121
|
|
- $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); |
|
121
|
+ $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); |
122
|
122
|
$sth_dest->execute($query_dest_values); |
123
|
123
|
} |
124
|
124
|
if ($globalTransaction) $Connection->db->commit(); |
125
|
|
- } catch(PDOException $e) { |
|
125
|
+ } catch (PDOException $e) { |
126
|
126
|
if ($globalTransaction) $Connection->db->rollBack(); |
127
|
127
|
return "error : ".$e->getMessage(); |
128
|
128
|
} |
|
@@ -138,26 +138,26 @@ discard block |
|
|
block discarded – undo |
138
|
138
|
//$Connection = new Connection(); |
139
|
139
|
$sth = $Connection->db->prepare($query); |
140
|
140
|
$sth->execute(array(':source' => 'oneworld')); |
141
|
|
- } catch(PDOException $e) { |
|
141
|
+ } catch (PDOException $e) { |
142
|
142
|
return "error : ".$e->getMessage(); |
143
|
143
|
} |
144
|
144
|
|
145
|
145
|
if ($globalDebug) echo " - Add routes to DB -"; |
146
|
146
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
147
|
147
|
$Spotter = new Spotter(); |
148
|
|
- if ($fh = fopen($database_file,"r")) { |
|
148
|
+ if ($fh = fopen($database_file, "r")) { |
149
|
149
|
$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)'; |
150
|
150
|
$Connection = new Connection(); |
151
|
151
|
$sth_dest = $Connection->db->prepare($query_dest); |
152
|
152
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
153
|
153
|
while (!feof($fh)) { |
154
|
|
- $line = fgetcsv($fh,9999,','); |
|
154
|
+ $line = fgetcsv($fh, 9999, ','); |
155
|
155
|
if ($line[0] != '') { |
156
|
156
|
if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
157
|
157
|
try { |
158
|
|
- $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'); |
|
158
|
+ $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'); |
159
|
159
|
$sth_dest->execute($query_dest_values); |
160
|
|
- } catch(PDOException $e) { |
|
160
|
+ } catch (PDOException $e) { |
161
|
161
|
if ($globalTransaction) $Connection->db->rollBack(); |
162
|
162
|
return "error : ".$e->getMessage(); |
163
|
163
|
} |
|
@@ -179,7 +179,7 @@ discard block |
|
|
block discarded – undo |
179
|
179
|
//$Connection = new Connection(); |
180
|
180
|
$sth = $Connection->db->prepare($query); |
181
|
181
|
$sth->execute(array(':source' => 'skyteam')); |
182
|
|
- } catch(PDOException $e) { |
|
182
|
+ } catch (PDOException $e) { |
183
|
183
|
return "error : ".$e->getMessage(); |
184
|
184
|
} |
185
|
185
|
|
|
@@ -187,24 +187,24 @@ discard block |
|
|
block discarded – undo |
187
|
187
|
|
188
|
188
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
189
|
189
|
$Spotter = new Spotter(); |
190
|
|
- if ($fh = fopen($database_file,"r")) { |
|
190
|
+ if ($fh = fopen($database_file, "r")) { |
191
|
191
|
$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)'; |
192
|
192
|
$Connection = new Connection(); |
193
|
193
|
$sth_dest = $Connection->db->prepare($query_dest); |
194
|
194
|
try { |
195
|
195
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
196
|
196
|
while (!feof($fh)) { |
197
|
|
- $line = fgetcsv($fh,9999,','); |
|
197
|
+ $line = fgetcsv($fh, 9999, ','); |
198
|
198
|
if ($line[0] != '') { |
199
|
|
- $datebe = explode(' - ',$line[2]); |
|
199
|
+ $datebe = explode(' - ', $line[2]); |
200
|
200
|
if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
201
|
|
- $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'); |
|
201
|
+ $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'); |
202
|
202
|
$sth_dest->execute($query_dest_values); |
203
|
203
|
} |
204
|
204
|
} |
205
|
205
|
} |
206
|
206
|
if ($globalTransaction) $Connection->db->commit(); |
207
|
|
- } catch(PDOException $e) { |
|
207
|
+ } catch (PDOException $e) { |
208
|
208
|
if ($globalTransaction) $Connection->db->rollBack(); |
209
|
209
|
return "error : ".$e->getMessage(); |
210
|
210
|
} |
|
@@ -219,7 +219,7 @@ discard block |
|
|
block discarded – undo |
219
|
219
|
$Connection = new Connection(); |
220
|
220
|
$sth = $Connection->db->prepare($query); |
221
|
221
|
$sth->execute(array(':source' => $database_file)); |
222
|
|
- } catch(PDOException $e) { |
|
222
|
+ } catch (PDOException $e) { |
223
|
223
|
return "error : ".$e->getMessage(); |
224
|
224
|
} |
225
|
225
|
$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
|
@@ -227,7 +227,7 @@ discard block |
|
|
block discarded – undo |
227
|
227
|
$Connection = new Connection(); |
228
|
228
|
$sth = $Connection->db->prepare($query); |
229
|
229
|
$sth->execute(array(':source' => $database_file)); |
230
|
|
- } catch(PDOException $e) { |
|
230
|
+ } catch (PDOException $e) { |
231
|
231
|
return "error : ".$e->getMessage(); |
232
|
232
|
} |
233
|
233
|
|
|
@@ -236,7 +236,7 @@ discard block |
|
|
block discarded – undo |
236
|
236
|
try { |
237
|
237
|
$sth = update_db::$db_sqlite->prepare($query); |
238
|
238
|
$sth->execute(); |
239
|
|
- } catch(PDOException $e) { |
|
239
|
+ } catch (PDOException $e) { |
240
|
240
|
return "error : ".$e->getMessage(); |
241
|
241
|
} |
242
|
242
|
//$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)'; |
|
@@ -253,15 +253,15 @@ discard block |
|
|
block discarded – undo |
253
|
253
|
//$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']); |
254
|
254
|
if ($values['UserString4'] == 'M') $type = 'military'; |
255
|
255
|
else $type = null; |
256
|
|
- $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
256
|
+ $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
257
|
257
|
$sth_dest->execute($query_dest_values); |
258
|
258
|
if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
259
|
|
- $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
259
|
+ $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
260
|
260
|
$sth_dest_owner->execute($query_dest_owner_values); |
261
|
261
|
} |
262
|
262
|
} |
263
|
263
|
if ($globalTransaction) $Connection->db->commit(); |
264
|
|
- } catch(PDOException $e) { |
|
264
|
+ } catch (PDOException $e) { |
265
|
265
|
return "error : ".$e->getMessage(); |
266
|
266
|
} |
267
|
267
|
|
|
@@ -271,7 +271,7 @@ discard block |
|
|
block discarded – undo |
271
|
271
|
$Connection = new Connection(); |
272
|
272
|
$sth = $Connection->db->prepare($query); |
273
|
273
|
$sth->execute(array(':source' => $database_file)); |
274
|
|
- } catch(PDOException $e) { |
|
274
|
+ } catch (PDOException $e) { |
275
|
275
|
return "error : ".$e->getMessage(); |
276
|
276
|
} |
277
|
277
|
return ''; |
|
@@ -286,11 +286,11 @@ discard block |
|
|
block discarded – undo |
286
|
286
|
$Connection = new Connection(); |
287
|
287
|
$sth = $Connection->db->prepare($query); |
288
|
288
|
$sth->execute(array(':source' => $database_file)); |
289
|
|
- } catch(PDOException $e) { |
|
289
|
+ } catch (PDOException $e) { |
290
|
290
|
return "error : ".$e->getMessage(); |
291
|
291
|
} |
292
|
292
|
|
293
|
|
- if ($fh = fopen($database_file,"r")) { |
|
293
|
+ if ($fh = fopen($database_file, "r")) { |
294
|
294
|
//$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)'; |
295
|
295
|
$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
296
|
296
|
|
|
@@ -300,13 +300,13 @@ discard block |
|
|
block discarded – undo |
300
|
300
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
301
|
301
|
while (!feof($fh)) { |
302
|
302
|
$values = array(); |
303
|
|
- $line = $Common->hex2str(fgets($fh,9999)); |
|
303
|
+ $line = $Common->hex2str(fgets($fh, 9999)); |
304
|
304
|
//FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
305
|
|
- $values['ModeS'] = substr($line,0,6); |
306
|
|
- $values['Registration'] = trim(substr($line,69,6)); |
307
|
|
- $aircraft_name = trim(substr($line,48,6)); |
|
305
|
+ $values['ModeS'] = substr($line, 0, 6); |
|
306
|
+ $values['Registration'] = trim(substr($line, 69, 6)); |
|
307
|
+ $aircraft_name = trim(substr($line, 48, 6)); |
308
|
308
|
// Check if we can find ICAO, else set it to GLID |
309
|
|
- $aircraft_name_split = explode(' ',$aircraft_name); |
|
309
|
+ $aircraft_name_split = explode(' ', $aircraft_name); |
310
|
310
|
$search_more = ''; |
311
|
311
|
if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
312
|
312
|
$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
@@ -318,20 +318,20 @@ discard block |
|
|
block discarded – undo |
318
|
318
|
if (isset($result['icao']) && $result['icao'] != '') { |
319
|
319
|
$values['ICAOTypeCode'] = $result['icao']; |
320
|
320
|
} |
321
|
|
- } catch(PDOException $e) { |
|
321
|
+ } catch (PDOException $e) { |
322
|
322
|
return "error : ".$e->getMessage(); |
323
|
323
|
} |
324
|
324
|
if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
325
|
325
|
// Add data to db |
326
|
326
|
if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
327
|
327
|
//$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']); |
328
|
|
- $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
328
|
+ $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
329
|
329
|
//print_r($query_dest_values); |
330
|
330
|
$sth_dest->execute($query_dest_values); |
331
|
331
|
} |
332
|
332
|
} |
333
|
333
|
if ($globalTransaction) $Connection->db->commit(); |
334
|
|
- } catch(PDOException $e) { |
|
334
|
+ } catch (PDOException $e) { |
335
|
335
|
return "error : ".$e->getMessage(); |
336
|
336
|
} |
337
|
337
|
} |
|
@@ -341,7 +341,7 @@ discard block |
|
|
block discarded – undo |
341
|
341
|
$Connection = new Connection(); |
342
|
342
|
$sth = $Connection->db->prepare($query); |
343
|
343
|
$sth->execute(array(':source' => $database_file)); |
344
|
|
- } catch(PDOException $e) { |
|
344
|
+ } catch (PDOException $e) { |
345
|
345
|
return "error : ".$e->getMessage(); |
346
|
346
|
} |
347
|
347
|
return ''; |
|
@@ -355,11 +355,11 @@ discard block |
|
|
block discarded – undo |
355
|
355
|
$Connection = new Connection(); |
356
|
356
|
$sth = $Connection->db->prepare($query); |
357
|
357
|
$sth->execute(array(':source' => $database_file)); |
358
|
|
- } catch(PDOException $e) { |
|
358
|
+ } catch (PDOException $e) { |
359
|
359
|
return "error : ".$e->getMessage(); |
360
|
360
|
} |
361
|
361
|
|
362
|
|
- if ($fh = fopen($database_file,"r")) { |
|
362
|
+ if ($fh = fopen($database_file, "r")) { |
363
|
363
|
//$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)'; |
364
|
364
|
$query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
365
|
365
|
|
|
@@ -367,9 +367,9 @@ discard block |
|
|
block discarded – undo |
367
|
367
|
$sth_dest = $Connection->db->prepare($query_dest); |
368
|
368
|
try { |
369
|
369
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
370
|
|
- $tmp = fgetcsv($fh,9999,',',"'"); |
|
370
|
+ $tmp = fgetcsv($fh, 9999, ',', "'"); |
371
|
371
|
while (!feof($fh)) { |
372
|
|
- $line = fgetcsv($fh,9999,',',"'"); |
|
372
|
+ $line = fgetcsv($fh, 9999, ',', "'"); |
373
|
373
|
|
374
|
374
|
//FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
375
|
375
|
//print_r($line); |
|
@@ -378,7 +378,7 @@ discard block |
|
|
block discarded – undo |
378
|
378
|
$values['ICAOTypeCode'] = ''; |
379
|
379
|
$aircraft_name = $line[2]; |
380
|
380
|
// Check if we can find ICAO, else set it to GLID |
381
|
|
- $aircraft_name_split = explode(' ',$aircraft_name); |
|
381
|
+ $aircraft_name_split = explode(' ', $aircraft_name); |
382
|
382
|
$search_more = ''; |
383
|
383
|
if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
384
|
384
|
$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
@@ -387,20 +387,20 @@ discard block |
|
|
block discarded – undo |
387
|
387
|
$sth_search->execute(); |
388
|
388
|
$result = $sth_search->fetch(PDO::FETCH_ASSOC); |
389
|
389
|
if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
390
|
|
- } catch(PDOException $e) { |
|
390
|
+ } catch (PDOException $e) { |
391
|
391
|
return "error : ".$e->getMessage(); |
392
|
392
|
} |
393
|
393
|
//if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
394
|
394
|
// Add data to db |
395
|
395
|
if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
396
|
396
|
//$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']); |
397
|
|
- $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'); |
|
397
|
+ $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'); |
398
|
398
|
//print_r($query_dest_values); |
399
|
399
|
$sth_dest->execute($query_dest_values); |
400
|
400
|
} |
401
|
401
|
} |
402
|
402
|
if ($globalTransaction) $Connection->db->commit(); |
403
|
|
- } catch(PDOException $e) { |
|
403
|
+ } catch (PDOException $e) { |
404
|
404
|
return "error : ".$e->getMessage(); |
405
|
405
|
} |
406
|
406
|
} |
|
@@ -410,13 +410,13 @@ discard block |
|
|
block discarded – undo |
410
|
410
|
$Connection = new Connection(); |
411
|
411
|
$sth = $Connection->db->prepare($query); |
412
|
412
|
$sth->execute(array(':source' => $database_file)); |
413
|
|
- } catch(PDOException $e) { |
|
413
|
+ } catch (PDOException $e) { |
414
|
414
|
return "error : ".$e->getMessage(); |
415
|
415
|
} |
416
|
416
|
return ''; |
417
|
417
|
} |
418
|
418
|
|
419
|
|
- public static function retrieve_owner($database_file,$country = 'F') { |
|
419
|
+ public static function retrieve_owner($database_file, $country = 'F') { |
420
|
420
|
global $globalTransaction, $globalMasterSource; |
421
|
421
|
//$query = 'TRUNCATE TABLE aircraft_modes'; |
422
|
422
|
$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
|
@@ -424,12 +424,12 @@ discard block |
|
|
block discarded – undo |
424
|
424
|
$Connection = new Connection(); |
425
|
425
|
$sth = $Connection->db->prepare($query); |
426
|
426
|
$sth->execute(array(':source' => $database_file)); |
427
|
|
- } catch(PDOException $e) { |
|
427
|
+ } catch (PDOException $e) { |
428
|
428
|
return "error : ".$e->getMessage(); |
429
|
429
|
} |
430
|
430
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
431
|
431
|
$Spotter = new Spotter(); |
432
|
|
- if ($fh = fopen($database_file,"r")) { |
|
432
|
+ if ($fh = fopen($database_file, "r")) { |
433
|
433
|
//$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)'; |
434
|
434
|
$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
435
|
435
|
$query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
@@ -439,9 +439,9 @@ discard block |
|
|
block discarded – undo |
439
|
439
|
$sth_modes = $Connection->db->prepare($query_modes); |
440
|
440
|
try { |
441
|
441
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
442
|
|
- $tmp = fgetcsv($fh,9999,',','"'); |
|
442
|
+ $tmp = fgetcsv($fh, 9999, ',', '"'); |
443
|
443
|
while (!feof($fh)) { |
444
|
|
- $line = fgetcsv($fh,9999,',','"'); |
|
444
|
+ $line = fgetcsv($fh, 9999, ',', '"'); |
445
|
445
|
$values = array(); |
446
|
446
|
//print_r($line); |
447
|
447
|
if ($country == 'F') { |
|
@@ -449,7 +449,7 @@ discard block |
|
|
block discarded – undo |
449
|
449
|
$values['base'] = $line[4]; |
450
|
450
|
$values['owner'] = $line[5]; |
451
|
451
|
if ($line[6] == '') $values['date_first_reg'] = null; |
452
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
452
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
453
|
453
|
$values['cancel'] = $line[7]; |
454
|
454
|
} elseif ($country == 'EI') { |
455
|
455
|
// TODO : add modeS & reg to aircraft_modes |
|
@@ -457,7 +457,7 @@ discard block |
|
|
block discarded – undo |
457
|
457
|
$values['base'] = $line[3]; |
458
|
458
|
$values['owner'] = $line[2]; |
459
|
459
|
if ($line[1] == '') $values['date_first_reg'] = null; |
460
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
460
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
461
|
461
|
$values['cancel'] = ''; |
462
|
462
|
$values['modes'] = $line[7]; |
463
|
463
|
$values['icao'] = $line[8]; |
|
@@ -477,7 +477,7 @@ discard block |
|
|
block discarded – undo |
477
|
477
|
$values['base'] = null; |
478
|
478
|
$values['owner'] = $line[5]; |
479
|
479
|
if ($line[18] == '') $values['date_first_reg'] = null; |
480
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
480
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
481
|
481
|
$values['cancel'] = ''; |
482
|
482
|
} elseif ($country == 'VH') { |
483
|
483
|
// TODO : add modeS & reg to aircraft_modes |
|
@@ -485,7 +485,7 @@ discard block |
|
|
block discarded – undo |
485
|
485
|
$values['base'] = null; |
486
|
486
|
$values['owner'] = $line[12]; |
487
|
487
|
if ($line[28] == '') $values['date_first_reg'] = null; |
488
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
488
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
489
|
489
|
|
490
|
490
|
$values['cancel'] = $line[39]; |
491
|
491
|
} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
|
@@ -505,28 +505,28 @@ discard block |
|
|
block discarded – undo |
505
|
505
|
$values['base'] = null; |
506
|
506
|
$values['owner'] = $line[8]; |
507
|
507
|
if ($line[7] == '') $values['date_first_reg'] = null; |
508
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
508
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
509
|
509
|
$values['cancel'] = ''; |
510
|
510
|
} elseif ($country == 'PP') { |
511
|
511
|
$values['registration'] = $line[0]; |
512
|
512
|
$values['base'] = null; |
513
|
513
|
$values['owner'] = $line[4]; |
514
|
514
|
if ($line[6] == '') $values['date_first_reg'] = null; |
515
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
515
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
516
|
516
|
$values['cancel'] = $line[7]; |
517
|
517
|
} elseif ($country == 'E7') { |
518
|
518
|
$values['registration'] = $line[0]; |
519
|
519
|
$values['base'] = null; |
520
|
520
|
$values['owner'] = $line[4]; |
521
|
521
|
if ($line[5] == '') $values['date_first_reg'] = null; |
522
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
522
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
523
|
523
|
$values['cancel'] = ''; |
524
|
524
|
} elseif ($country == '8Q') { |
525
|
525
|
$values['registration'] = $line[0]; |
526
|
526
|
$values['base'] = null; |
527
|
527
|
$values['owner'] = $line[3]; |
528
|
528
|
if ($line[7] == '') $values['date_first_reg'] = null; |
529
|
|
- else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
529
|
+ else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
530
|
530
|
$values['cancel'] = ''; |
531
|
531
|
} elseif ($country == 'ZK') { |
532
|
532
|
$values['registration'] = $line[0]; |
|
@@ -540,18 +540,18 @@ discard block |
|
|
block discarded – undo |
540
|
540
|
$values['registration'] = $line[0]; |
541
|
541
|
$values['base'] = null; |
542
|
542
|
$values['owner'] = $line[6]; |
543
|
|
- $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
544
|
|
- $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
543
|
+ $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
544
|
+ $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
545
|
545
|
$values['modes'] = $line[4]; |
546
|
546
|
$values['icao'] = $line[10]; |
547
|
547
|
} elseif ($country == 'OY') { |
548
|
548
|
$values['registration'] = $line[0]; |
549
|
|
- $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
549
|
+ $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
550
|
550
|
$values['modes'] = $line[5]; |
551
|
551
|
$values['icao'] = $line[6]; |
552
|
552
|
} elseif ($country == 'PH') { |
553
|
553
|
$values['registration'] = $line[0]; |
554
|
|
- $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
554
|
+ $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
555
|
555
|
$values['modes'] = $line[4]; |
556
|
556
|
$values['icao'] = $line[5]; |
557
|
557
|
} elseif ($country == 'OM' || $country == 'TF') { |
|
@@ -562,17 +562,17 @@ discard block |
|
|
block discarded – undo |
562
|
562
|
$values['cancel'] = ''; |
563
|
563
|
} |
564
|
564
|
if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
565
|
|
- $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
565
|
+ $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
566
|
566
|
$sth_dest->execute($query_dest_values); |
567
|
567
|
} |
568
|
568
|
if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
569
|
569
|
$modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
570
|
|
- $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
570
|
+ $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
571
|
571
|
$sth_modes->execute($query_modes_values); |
572
|
572
|
} |
573
|
573
|
} |
574
|
574
|
if ($globalTransaction) $Connection->db->commit(); |
575
|
|
- } catch(PDOException $e) { |
|
575
|
+ } catch (PDOException $e) { |
576
|
576
|
return "error : ".$e->getMessage(); |
577
|
577
|
} |
578
|
578
|
} |
|
@@ -710,7 +710,7 @@ discard block |
|
|
block discarded – undo |
710
|
710
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
711
|
711
|
|
712
|
712
|
$i = 0; |
713
|
|
- while($row = sparql_fetch_array($result)) |
|
713
|
+ while ($row = sparql_fetch_array($result)) |
714
|
714
|
{ |
715
|
715
|
if ($i >= 1) { |
716
|
716
|
//print_r($row); |
|
@@ -730,33 +730,33 @@ discard block |
|
|
block discarded – undo |
730
|
730
|
$row['image'] = ''; |
731
|
731
|
$row['image_thumb'] = ''; |
732
|
732
|
} else { |
733
|
|
- $image = str_replace(' ','_',$row['image']); |
|
733
|
+ $image = str_replace(' ', '_', $row['image']); |
734
|
734
|
$digest = md5($image); |
735
|
|
- $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
736
|
|
- $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
737
|
|
- $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
738
|
|
- $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
735
|
+ $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
736
|
+ $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
737
|
+ $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
738
|
+ $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
739
|
739
|
} |
740
|
740
|
|
741
|
|
- $country = explode('-',$row['country']); |
|
741
|
+ $country = explode('-', $row['country']); |
742
|
742
|
$row['country'] = $country[0]; |
743
|
743
|
|
744
|
744
|
$row['type'] = trim($row['type']); |
745
|
|
- 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'])) { |
|
745
|
+ 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'])) { |
746
|
746
|
$row['type'] = 'military'; |
747
|
747
|
} 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') { |
748
|
748
|
$row['type'] = 'small_airport'; |
749
|
749
|
} |
750
|
750
|
|
751
|
|
- $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
752
|
|
- $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']); |
|
751
|
+ $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
752
|
+ $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']); |
753
|
753
|
//print_r($query_dest_values); |
754
|
754
|
|
755
|
755
|
if ($row['icao'] != '') { |
756
|
756
|
try { |
757
|
757
|
$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
758
|
758
|
$sth->execute(array(':icao' => $row['icao'])); |
759
|
|
- } catch(PDOException $e) { |
|
759
|
+ } catch (PDOException $e) { |
760
|
760
|
return "error : ".$e->getMessage(); |
761
|
761
|
} |
762
|
762
|
if ($sth->fetchColumn() > 0) { |
|
@@ -764,15 +764,15 @@ discard block |
|
|
block discarded – undo |
764
|
764
|
$query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
765
|
765
|
try { |
766
|
766
|
$sth = $Connection->db->prepare($query); |
767
|
|
- $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
768
|
|
- } catch(PDOException $e) { |
|
767
|
+ $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
768
|
+ } catch (PDOException $e) { |
769
|
769
|
return "error : ".$e->getMessage(); |
770
|
770
|
} |
771
|
771
|
echo $row['icao'].' : '.$row['type']."\n"; |
772
|
772
|
} else { |
773
|
773
|
try { |
774
|
774
|
$sth_dest->execute($query_dest_values); |
775
|
|
- } catch(PDOException $e) { |
|
775
|
+ } catch (PDOException $e) { |
776
|
776
|
return "error : ".$e->getMessage(); |
777
|
777
|
} |
778
|
778
|
} |
|
@@ -823,7 +823,7 @@ discard block |
|
|
block discarded – undo |
823
|
823
|
echo "Download data from ourairports.com...\n"; |
824
|
824
|
$delimiter = ','; |
825
|
825
|
$out_file = $tmp_dir.'airports.csv'; |
826
|
|
- update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
826
|
+ update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
827
|
827
|
if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
828
|
828
|
echo "Add data from ourairports.com...\n"; |
829
|
829
|
|
|
@@ -834,33 +834,33 @@ discard block |
|
|
block discarded – undo |
834
|
834
|
//$Connection->db->beginTransaction(); |
835
|
835
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
836
|
836
|
{ |
837
|
|
- if(!$header) $header = $row; |
|
837
|
+ if (!$header) $header = $row; |
838
|
838
|
else { |
839
|
839
|
$data = array(); |
840
|
840
|
$data = array_combine($header, $row); |
841
|
841
|
try { |
842
|
842
|
$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
843
|
843
|
$sth->execute(array(':icao' => $data['ident'])); |
844
|
|
- } catch(PDOException $e) { |
|
844
|
+ } catch (PDOException $e) { |
845
|
845
|
return "error : ".$e->getMessage(); |
846
|
846
|
} |
847
|
847
|
if ($sth->fetchColumn() > 0) { |
848
|
848
|
$query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
849
|
849
|
try { |
850
|
850
|
$sth = $Connection->db->prepare($query); |
851
|
|
- $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
852
|
|
- } catch(PDOException $e) { |
|
851
|
+ $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
852
|
+ } catch (PDOException $e) { |
853
|
853
|
return "error : ".$e->getMessage(); |
854
|
854
|
} |
855
|
855
|
} else { |
856
|
856
|
if ($data['gps_code'] == $data['ident']) { |
857
|
857
|
$query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
858
|
858
|
VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
859
|
|
- $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']); |
|
859
|
+ $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']); |
860
|
860
|
try { |
861
|
861
|
$sth = $Connection->db->prepare($query); |
862
|
862
|
$sth->execute($query_values); |
863
|
|
- } catch(PDOException $e) { |
|
863
|
+ } catch (PDOException $e) { |
864
|
864
|
return "error : ".$e->getMessage(); |
865
|
865
|
} |
866
|
866
|
$i++; |
|
@@ -875,7 +875,7 @@ discard block |
|
|
block discarded – undo |
875
|
875
|
|
876
|
876
|
echo "Download data from another free database...\n"; |
877
|
877
|
$out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
878
|
|
- update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
878
|
+ update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
879
|
879
|
if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
880
|
880
|
update_db::unzip($out_file); |
881
|
881
|
$header = NULL; |
|
@@ -887,15 +887,15 @@ discard block |
|
|
block discarded – undo |
887
|
887
|
//$Connection->db->beginTransaction(); |
888
|
888
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
889
|
889
|
{ |
890
|
|
- if(!$header) $header = $row; |
|
890
|
+ if (!$header) $header = $row; |
891
|
891
|
else { |
892
|
892
|
$data = $row; |
893
|
893
|
|
894
|
894
|
$query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
895
|
895
|
try { |
896
|
896
|
$sth = $Connection->db->prepare($query); |
897
|
|
- $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
898
|
|
- } catch(PDOException $e) { |
|
897
|
+ $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
898
|
+ } catch (PDOException $e) { |
899
|
899
|
return "error : ".$e->getMessage(); |
900
|
900
|
} |
901
|
901
|
} |
|
@@ -909,15 +909,15 @@ discard block |
|
|
block discarded – undo |
909
|
909
|
try { |
910
|
910
|
$sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
911
|
911
|
$sth->execute(); |
912
|
|
- } catch(PDOException $e) { |
|
912
|
+ } catch (PDOException $e) { |
913
|
913
|
return "error : ".$e->getMessage(); |
914
|
914
|
} |
915
|
915
|
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
916
|
916
|
$query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
917
|
917
|
try { |
918
|
918
|
$sth2 = $Connection->db->prepare($query2); |
919
|
|
- $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
920
|
|
- } catch(PDOException $e) { |
|
919
|
+ $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
920
|
+ } catch (PDOException $e) { |
921
|
921
|
return "error : ".$e->getMessage(); |
922
|
922
|
} |
923
|
923
|
} |
|
@@ -938,7 +938,7 @@ discard block |
|
|
block discarded – undo |
938
|
938
|
$Connection = new Connection(); |
939
|
939
|
$sth = $Connection->db->prepare($query); |
940
|
940
|
$sth->execute(array(':source' => 'translation.csv')); |
941
|
|
- } catch(PDOException $e) { |
|
941
|
+ } catch (PDOException $e) { |
942
|
942
|
return "error : ".$e->getMessage(); |
943
|
943
|
} |
944
|
944
|
|
|
@@ -955,7 +955,7 @@ discard block |
|
|
block discarded – undo |
955
|
955
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
956
|
956
|
{ |
957
|
957
|
$i++; |
958
|
|
- if($i > 12) { |
|
958
|
+ if ($i > 12) { |
959
|
959
|
$data = $row; |
960
|
960
|
$operator = $data[2]; |
961
|
961
|
if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
|
@@ -963,7 +963,7 @@ discard block |
|
|
block discarded – undo |
963
|
963
|
//echo substr($operator, 0, 2)."\n";; |
964
|
964
|
if (count($airline_array) > 0) { |
965
|
965
|
//print_r($airline_array); |
966
|
|
- $operator = $airline_array[0]['icao'].substr($operator,2); |
|
966
|
+ $operator = $airline_array[0]['icao'].substr($operator, 2); |
967
|
967
|
} |
968
|
968
|
} |
969
|
969
|
|
|
@@ -971,14 +971,14 @@ discard block |
|
|
block discarded – undo |
971
|
971
|
if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
972
|
972
|
$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
973
|
973
|
if (count($airline_array) > 0) { |
974
|
|
- $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
974
|
+ $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
975
|
975
|
} |
976
|
976
|
} |
977
|
977
|
$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
978
|
978
|
try { |
979
|
979
|
$sth = $Connection->db->prepare($query); |
980
|
|
- $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
981
|
|
- } catch(PDOException $e) { |
|
980
|
+ $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
981
|
+ } catch (PDOException $e) { |
982
|
982
|
return "error : ".$e->getMessage(); |
983
|
983
|
} |
984
|
984
|
} |
|
@@ -996,7 +996,7 @@ discard block |
|
|
block discarded – undo |
996
|
996
|
$Connection = new Connection(); |
997
|
997
|
$sth = $Connection->db->prepare($query); |
998
|
998
|
$sth->execute(array(':source' => 'website_fam')); |
999
|
|
- } catch(PDOException $e) { |
|
999
|
+ } catch (PDOException $e) { |
1000
|
1000
|
return "error : ".$e->getMessage(); |
1001
|
1001
|
} |
1002
|
1002
|
//update_db::unzip($out_file); |
|
@@ -1014,8 +1014,8 @@ discard block |
|
|
block discarded – undo |
1014
|
1014
|
$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
1015
|
1015
|
try { |
1016
|
1016
|
$sth = $Connection->db->prepare($query); |
1017
|
|
- $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
1018
|
|
- } catch(PDOException $e) { |
|
1017
|
+ $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
1018
|
+ } catch (PDOException $e) { |
1019
|
1019
|
return "error : ".$e->getMessage(); |
1020
|
1020
|
} |
1021
|
1021
|
} |
|
@@ -1038,11 +1038,11 @@ discard block |
|
|
block discarded – undo |
1038
|
1038
|
while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1039
|
1039
|
{ |
1040
|
1040
|
$query = 'UPDATE airport SET diagram_pdf = :diagrampdf, diagram_png = :diagrampng WHERE icao = :icao'; |
1041
|
|
- $icao = str_replace('.pdf','',$data[2]); |
|
1041
|
+ $icao = str_replace('.pdf', '', $data[2]); |
1042
|
1042
|
try { |
1043
|
1043
|
$sth = $Connection->db->prepare($query); |
1044
|
|
- $sth->execute(array(':icao' => $icao,':diagrampdf' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.pdf',':diagrampng' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.png')); |
1045
|
|
- } catch(PDOException $e) { |
|
1044
|
+ $sth->execute(array(':icao' => $icao, ':diagrampdf' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.pdf', ':diagrampng' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.png')); |
|
1045
|
+ } catch (PDOException $e) { |
1046
|
1046
|
echo "error : ".$e->getMessage(); |
1047
|
1047
|
return "error : ".$e->getMessage(); |
1048
|
1048
|
} |
|
@@ -1064,7 +1064,7 @@ discard block |
|
|
block discarded – undo |
1064
|
1064
|
$Connection = new Connection(); |
1065
|
1065
|
$sth = $Connection->db->prepare($query); |
1066
|
1066
|
$sth->execute(array(':source' => 'website_faa')); |
1067
|
|
- } catch(PDOException $e) { |
|
1067
|
+ } catch (PDOException $e) { |
1068
|
1068
|
return "error : ".$e->getMessage(); |
1069
|
1069
|
} |
1070
|
1070
|
|
|
@@ -1073,7 +1073,7 @@ discard block |
|
|
block discarded – undo |
1073
|
1073
|
$Connection = new Connection(); |
1074
|
1074
|
$sth = $Connection->db->prepare($query); |
1075
|
1075
|
$sth->execute(array(':source' => 'website_faa')); |
1076
|
|
- } catch(PDOException $e) { |
|
1076
|
+ } catch (PDOException $e) { |
1077
|
1077
|
return "error : ".$e->getMessage(); |
1078
|
1078
|
} |
1079
|
1079
|
|
|
@@ -1090,8 +1090,8 @@ discard block |
|
|
block discarded – undo |
1090
|
1090
|
$query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1091
|
1091
|
try { |
1092
|
1092
|
$sths = $Connection->db->prepare($query_search); |
1093
|
|
- $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
1094
|
|
- } catch(PDOException $e) { |
|
1093
|
+ $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1094
|
+ } catch (PDOException $e) { |
1095
|
1095
|
return "error s : ".$e->getMessage(); |
1096
|
1096
|
} |
1097
|
1097
|
$result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1104,8 +1104,8 @@ discard block |
|
|
block discarded – undo |
1104
|
1104
|
//} |
1105
|
1105
|
try { |
1106
|
1106
|
$sthi = $Connection->db->prepare($queryi); |
1107
|
|
- $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
1108
|
|
- } catch(PDOException $e) { |
|
1107
|
+ $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1108
|
+ } catch (PDOException $e) { |
1109
|
1109
|
return "error u : ".$e->getMessage(); |
1110
|
1110
|
} |
1111
|
1111
|
} else { |
|
@@ -1113,7 +1113,7 @@ discard block |
|
|
block discarded – undo |
1113
|
1113
|
try { |
1114
|
1114
|
$sthsm = $Connection->db->prepare($query_search_mfr); |
1115
|
1115
|
$sthsm->execute(array(':mfr' => $data[2])); |
1116
|
|
- } catch(PDOException $e) { |
|
1116
|
+ } catch (PDOException $e) { |
1117
|
1117
|
return "error mfr : ".$e->getMessage(); |
1118
|
1118
|
} |
1119
|
1119
|
$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1123,8 +1123,8 @@ discard block |
|
|
block discarded – undo |
1123
|
1123
|
$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1124
|
1124
|
try { |
1125
|
1125
|
$sthf = $Connection->db->prepare($queryf); |
1126
|
|
- $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')); |
1127
|
|
- } catch(PDOException $e) { |
|
1126
|
+ $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')); |
|
1127
|
+ } catch (PDOException $e) { |
1128
|
1128
|
return "error f : ".$e->getMessage(); |
1129
|
1129
|
} |
1130
|
1130
|
} |
|
@@ -1134,13 +1134,13 @@ discard block |
|
|
block discarded – undo |
1134
|
1134
|
$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1135
|
1135
|
try { |
1136
|
1136
|
$sth = $Connection->db->prepare($query); |
1137
|
|
- $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')); |
1138
|
|
- } catch(PDOException $e) { |
|
1137
|
+ $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')); |
|
1138
|
+ } catch (PDOException $e) { |
1139
|
1139
|
return "error i : ".$e->getMessage(); |
1140
|
1140
|
} |
1141
|
1141
|
} |
1142
|
1142
|
} |
1143
|
|
- if ($i % 90 == 0) { |
|
1143
|
+ if ($i%90 == 0) { |
1144
|
1144
|
if ($globalTransaction) $Connection->db->commit(); |
1145
|
1145
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
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
|
$delimiter = "\t"; |
|
@@ -1175,8 +1175,8 @@ discard block |
|
|
block discarded – undo |
1175
|
1175
|
$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1176
|
1176
|
try { |
1177
|
1177
|
$sth = $Connection->db->prepare($query); |
1178
|
|
- $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')); |
1179
|
|
- } catch(PDOException $e) { |
|
1178
|
+ $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')); |
|
1179
|
+ } catch (PDOException $e) { |
1180
|
1180
|
return "error : ".$e->getMessage(); |
1181
|
1181
|
} |
1182
|
1182
|
} |
|
@@ -1208,7 +1208,7 @@ discard block |
|
|
block discarded – undo |
1208
|
1208
|
try { |
1209
|
1209
|
$sth = $Connection->db->prepare($query); |
1210
|
1210
|
$sth->execute(); |
1211
|
|
- } catch(PDOException $e) { |
|
1211
|
+ } catch (PDOException $e) { |
1212
|
1212
|
return "error : ".$e->getMessage(); |
1213
|
1213
|
} |
1214
|
1214
|
$delimiter = "\t"; |
|
@@ -1223,8 +1223,8 @@ discard block |
|
|
block discarded – undo |
1223
|
1223
|
$query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)'; |
1224
|
1224
|
try { |
1225
|
1225
|
$sth = $Connection->db->prepare($query); |
1226
|
|
- $sth->execute(array(':name' => $data[0],':alias' => $data[1],':iata' => $data[2],':icao' => $data[3], ':callsign' => $data[4],':country' => $data[5],':active' => $data[6],':type' => $data[7],':home' => $data[8],':wikipedia_link' => $data[9],':alliance' => $data[10],':ban_eu' => $data[11])); |
1227
|
|
- } catch(PDOException $e) { |
|
1226
|
+ $sth->execute(array(':name' => $data[0], ':alias' => $data[1], ':iata' => $data[2], ':icao' => $data[3], ':callsign' => $data[4], ':country' => $data[5], ':active' => $data[6], ':type' => $data[7], ':home' => $data[8], ':wikipedia_link' => $data[9], ':alliance' => $data[10], ':ban_eu' => $data[11])); |
|
1227
|
+ } catch (PDOException $e) { |
1228
|
1228
|
return "error : ".$e->getMessage(); |
1229
|
1229
|
} |
1230
|
1230
|
} |
|
@@ -1252,7 +1252,7 @@ discard block |
|
|
block discarded – undo |
1252
|
1252
|
$Connection = new Connection(); |
1253
|
1253
|
$sth = $Connection->db->prepare($query); |
1254
|
1254
|
$sth->execute(array(':source' => 'website_fam')); |
1255
|
|
- } catch(PDOException $e) { |
|
1255
|
+ } catch (PDOException $e) { |
1256
|
1256
|
return "error : ".$e->getMessage(); |
1257
|
1257
|
} |
1258
|
1258
|
|
|
@@ -1268,8 +1268,8 @@ discard block |
|
|
block discarded – undo |
1268
|
1268
|
$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1269
|
1269
|
try { |
1270
|
1270
|
$sth = $Connection->db->prepare($query); |
1271
|
|
- $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
1272
|
|
- } catch(PDOException $e) { |
|
1271
|
+ $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1272
|
+ } catch (PDOException $e) { |
1273
|
1273
|
//print_r($data); |
1274
|
1274
|
return "error : ".$e->getMessage(); |
1275
|
1275
|
} |
|
@@ -1289,7 +1289,7 @@ discard block |
|
|
block discarded – undo |
1289
|
1289
|
$Connection = new Connection(); |
1290
|
1290
|
$sth = $Connection->db->prepare($query); |
1291
|
1291
|
$sth->execute(array(':source' => 'website_fam')); |
1292
|
|
- } catch(PDOException $e) { |
|
1292
|
+ } catch (PDOException $e) { |
1293
|
1293
|
return "error : ".$e->getMessage(); |
1294
|
1294
|
} |
1295
|
1295
|
$delimiter = "\t"; |
|
@@ -1305,13 +1305,13 @@ discard block |
|
|
block discarded – undo |
1305
|
1305
|
$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)'; |
1306
|
1306
|
try { |
1307
|
1307
|
$sth = $Connection->db->prepare($query); |
1308
|
|
- $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')); |
1309
|
|
- } catch(PDOException $e) { |
1310
|
|
- if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1308
|
+ $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')); |
|
1309
|
+ } catch (PDOException $e) { |
|
1310
|
+ if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data); |
1311
|
1311
|
die(); |
1312
|
1312
|
} |
1313
|
1313
|
} |
1314
|
|
- if ($globalTransaction && $i % 2000 == 0) { |
|
1314
|
+ if ($globalTransaction && $i%2000 == 0) { |
1315
|
1315
|
$Connection->db->commit(); |
1316
|
1316
|
if ($globalDebug) echo '.'; |
1317
|
1317
|
$Connection->db->beginTransaction(); |
|
@@ -1331,7 +1331,7 @@ discard block |
|
|
block discarded – undo |
1331
|
1331
|
$Connection = new Connection(); |
1332
|
1332
|
$sth = $Connection->db->prepare($query); |
1333
|
1333
|
$sth->execute(array(':source' => 'website_fam')); |
1334
|
|
- } catch(PDOException $e) { |
|
1334
|
+ } catch (PDOException $e) { |
1335
|
1335
|
return "error : ".$e->getMessage(); |
1336
|
1336
|
} |
1337
|
1337
|
$Connection = new Connection(); |
|
@@ -1344,12 +1344,12 @@ discard block |
|
|
block discarded – undo |
1344
|
1344
|
$query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)'; |
1345
|
1345
|
try { |
1346
|
1346
|
$sth = $Connection->db->prepare($query); |
1347
|
|
- $sth->execute(array(':callSign' => trim($data),':source' => 'website_fam')); |
1348
|
|
- } catch(PDOException $e) { |
|
1347
|
+ $sth->execute(array(':callSign' => trim($data), ':source' => 'website_fam')); |
|
1348
|
+ } catch (PDOException $e) { |
1349
|
1349
|
if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data; |
1350
|
1350
|
die(); |
1351
|
1351
|
} |
1352
|
|
- if ($globalTransaction && $i % 2000 == 0) { |
|
1352
|
+ if ($globalTransaction && $i%2000 == 0) { |
1353
|
1353
|
$Connection->db->commit(); |
1354
|
1354
|
if ($globalDebug) echo '.'; |
1355
|
1355
|
$Connection->db->beginTransaction(); |
|
@@ -1369,7 +1369,7 @@ discard block |
|
|
block discarded – undo |
1369
|
1369
|
$Connection = new Connection(); |
1370
|
1370
|
$sth = $Connection->db->prepare($query); |
1371
|
1371
|
$sth->execute(); |
1372
|
|
- } catch(PDOException $e) { |
|
1372
|
+ } catch (PDOException $e) { |
1373
|
1373
|
return "error : ".$e->getMessage(); |
1374
|
1374
|
} |
1375
|
1375
|
|
|
@@ -1390,8 +1390,8 @@ discard block |
|
|
block discarded – undo |
1390
|
1390
|
$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)'; |
1391
|
1391
|
try { |
1392
|
1392
|
$sth = $Connection->db->prepare($query); |
1393
|
|
- $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])); |
1394
|
|
- } catch(PDOException $e) { |
|
1393
|
+ $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])); |
|
1394
|
+ } catch (PDOException $e) { |
1395
|
1395
|
return "error : ".$e->getMessage(); |
1396
|
1396
|
} |
1397
|
1397
|
} |
|
@@ -1410,7 +1410,7 @@ discard block |
|
|
block discarded – undo |
1410
|
1410
|
$Connection = new Connection(); |
1411
|
1411
|
$sth = $Connection->db->prepare($query); |
1412
|
1412
|
$sth->execute(); |
1413
|
|
- } catch(PDOException $e) { |
|
1413
|
+ } catch (PDOException $e) { |
1414
|
1414
|
return "error : ".$e->getMessage(); |
1415
|
1415
|
} |
1416
|
1416
|
$delimiter = "\t"; |
|
@@ -1427,8 +1427,8 @@ discard block |
|
|
block discarded – undo |
1427
|
1427
|
VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1428
|
1428
|
try { |
1429
|
1429
|
$sth = $Connection->db->prepare($query); |
1430
|
|
- $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
1431
|
|
- } catch(PDOException $e) { |
|
1430
|
+ $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1431
|
+ } catch (PDOException $e) { |
1432
|
1432
|
return "error : ".$e->getMessage(); |
1433
|
1433
|
} |
1434
|
1434
|
} |
|
@@ -1447,7 +1447,7 @@ discard block |
|
|
block discarded – undo |
1447
|
1447
|
$Connection = new Connection(); |
1448
|
1448
|
$sth = $Connection->db->prepare($query); |
1449
|
1449
|
$sth->execute(); |
1450
|
|
- } catch(PDOException $e) { |
|
1450
|
+ } catch (PDOException $e) { |
1451
|
1451
|
return "error : ".$e->getMessage(); |
1452
|
1452
|
} |
1453
|
1453
|
|
|
@@ -1463,7 +1463,7 @@ discard block |
|
|
block discarded – undo |
1463
|
1463
|
try { |
1464
|
1464
|
$sth = $Connection->db->prepare($query); |
1465
|
1465
|
$sth->execute(array(':icao' => $icao)); |
1466
|
|
- } catch(PDOException $e) { |
|
1466
|
+ } catch (PDOException $e) { |
1467
|
1467
|
return "error : ".$e->getMessage(); |
1468
|
1468
|
} |
1469
|
1469
|
} |
|
@@ -1474,7 +1474,7 @@ discard block |
|
|
block discarded – undo |
1474
|
1474
|
return ''; |
1475
|
1475
|
} |
1476
|
1476
|
|
1477
|
|
- public static function tle($filename,$tletype) { |
|
1477
|
+ public static function tle($filename, $tletype) { |
1478
|
1478
|
require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1479
|
1479
|
global $tmp_dir, $globalTransaction; |
1480
|
1480
|
//$Spotter = new Spotter(); |
|
@@ -1484,7 +1484,7 @@ discard block |
|
|
block discarded – undo |
1484
|
1484
|
$Connection = new Connection(); |
1485
|
1485
|
$sth = $Connection->db->prepare($query); |
1486
|
1486
|
$sth->execute(array(':source' => $filename)); |
1487
|
|
- } catch(PDOException $e) { |
|
1487
|
+ } catch (PDOException $e) { |
1488
|
1488
|
return "error : ".$e->getMessage(); |
1489
|
1489
|
} |
1490
|
1490
|
|
|
@@ -1509,8 +1509,8 @@ discard block |
|
|
block discarded – undo |
1509
|
1509
|
$query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1510
|
1510
|
try { |
1511
|
1511
|
$sth = $Connection->db->prepare($query); |
1512
|
|
- $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
1513
|
|
- } catch(PDOException $e) { |
|
1512
|
+ $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1513
|
+ } catch (PDOException $e) { |
1514
|
1514
|
return "error : ".$e->getMessage(); |
1515
|
1515
|
} |
1516
|
1516
|
|
|
@@ -1531,7 +1531,7 @@ discard block |
|
|
block discarded – undo |
1531
|
1531
|
$Connection = new Connection(); |
1532
|
1532
|
$sth = $Connection->db->prepare($query); |
1533
|
1533
|
$sth->execute(array(':source' => $filename)); |
1534
|
|
- } catch(PDOException $e) { |
|
1534
|
+ } catch (PDOException $e) { |
1535
|
1535
|
return "error : ".$e->getMessage(); |
1536
|
1536
|
} |
1537
|
1537
|
|
|
@@ -1542,13 +1542,13 @@ discard block |
|
|
block discarded – undo |
1542
|
1542
|
$i = 0; |
1543
|
1543
|
//$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1544
|
1544
|
//$Connection->db->beginTransaction(); |
1545
|
|
- while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
1545
|
+ while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
1546
|
1546
|
{ |
1547
|
1547
|
if ($i > 0 && $data[0] != '') { |
1548
|
1548
|
$sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1549
|
|
- $period = str_replace(',','',$data[14]); |
1550
|
|
- if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
1551
|
|
- if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1549
|
+ $period = str_replace(',', '', $data[14]); |
|
1550
|
+ if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
1551
|
+ if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
1552
|
1552
|
else $launch_date = NULL; |
1553
|
1553
|
$data = array_map(function($value) { |
1554
|
1554
|
return trim($value) === '' ? null : $value; |
|
@@ -1558,8 +1558,8 @@ discard block |
|
|
block discarded – undo |
1558
|
1558
|
VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1559
|
1559
|
try { |
1560
|
1560
|
$sth = $Connection->db->prepare($query); |
1561
|
|
- $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
1562
|
|
- } catch(PDOException $e) { |
|
1561
|
+ $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1562
|
+ } catch (PDOException $e) { |
1563
|
1563
|
return "error : ".$e->getMessage(); |
1564
|
1564
|
} |
1565
|
1565
|
} |
|
@@ -1599,7 +1599,7 @@ discard block |
|
|
block discarded – undo |
1599
|
1599
|
'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
1600
|
1600
|
'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
1601
|
1601
|
'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
1602
|
|
- 'EST' => array('country' => 'Estonia','owner' => ''), |
|
1602
|
+ 'EST' => array('country' => 'Estonia', 'owner' => ''), |
1603
|
1603
|
'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
1604
|
1604
|
'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
1605
|
1605
|
'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
|
@@ -1723,10 +1723,10 @@ discard block |
|
|
block discarded – undo |
1723
|
1723
|
{ |
1724
|
1724
|
if ($data != '') { |
1725
|
1725
|
$result = array(); |
1726
|
|
- $result['cospar'] = trim(substr($data,0,11)); |
1727
|
|
- $result['norad'] = trim(substr($data,13,6)); |
1728
|
|
- $result['operational'] = trim(substr($data,21,1)); |
1729
|
|
- $result['name'] = trim(substr($data,23,24)); |
|
1726
|
+ $result['cospar'] = trim(substr($data, 0, 11)); |
|
1727
|
+ $result['norad'] = trim(substr($data, 13, 6)); |
|
1728
|
+ $result['operational'] = trim(substr($data, 21, 1)); |
|
1729
|
+ $result['name'] = trim(substr($data, 23, 24)); |
1730
|
1730
|
/* |
1731
|
1731
|
* R/B(1) = Rocket body, first stage |
1732
|
1732
|
* R/B(2) = Rocket body, second stage |
|
@@ -1738,28 +1738,28 @@ discard block |
|
|
block discarded – undo |
1738
|
1738
|
* An ampersand (&) indicates two or more objects are attached |
1739
|
1739
|
*/ |
1740
|
1740
|
|
1741
|
|
- $owner_code = trim(substr($data,49,5)); |
|
1741
|
+ $owner_code = trim(substr($data, 49, 5)); |
1742
|
1742
|
|
1743
|
1743
|
if (!isset($satcat_sources[$owner_code]) && $satcat_sources[$owner_code] != 'TBD') { |
1744
|
1744
|
if ($globalDebug) echo $data.'owner_code: '.$owner_code."\n"; |
1745
|
1745
|
} |
1746
|
|
- if (!isset($satcat_launch_site[trim(substr($data,68,5))])) { |
1747
|
|
- if ($globalDebug) echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
1746
|
+ if (!isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
|
1747
|
+ if ($globalDebug) echo 'launch_site_code: '.trim(substr($data, 68, 5))."\n"; |
1748
|
1748
|
} |
1749
|
1749
|
|
1750
|
|
- if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) { |
|
1750
|
+ if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
1751
|
1751
|
$result['country_owner'] = $satcat_sources[$owner_code]['country']; |
1752
|
1752
|
$result['owner'] = $satcat_sources[$owner_code]['owner']; |
1753
|
|
- $result['launch_date'] = trim(substr($data,56,10)); |
1754
|
|
- $launch_site_code = trim(substr($data,68,5)); |
|
1753
|
+ $result['launch_date'] = trim(substr($data, 56, 10)); |
|
1754
|
+ $launch_site_code = trim(substr($data, 68, 5)); |
1755
|
1755
|
$result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
1756
|
|
- $result['lifetime'] = trim(substr($data,75,10)); |
1757
|
|
- $result['period'] = trim(substr($data,87,7)); |
1758
|
|
- $result['inclination'] = trim(substr($data,96,5)); |
1759
|
|
- $result['apogee'] = trim(substr($data,103,6)); |
1760
|
|
- $result['perigee'] = trim(substr($data,111,6)); |
|
1756
|
+ $result['lifetime'] = trim(substr($data, 75, 10)); |
|
1757
|
+ $result['period'] = trim(substr($data, 87, 7)); |
|
1758
|
+ $result['inclination'] = trim(substr($data, 96, 5)); |
|
1759
|
+ $result['apogee'] = trim(substr($data, 103, 6)); |
|
1760
|
+ $result['perigee'] = trim(substr($data, 111, 6)); |
1761
|
1761
|
//$result['radarcross'] = trim(substr($data,119,8)); |
1762
|
|
- $result['status'] = trim(substr($data,129,3)); |
|
1762
|
+ $result['status'] = trim(substr($data, 129, 3)); |
1763
|
1763
|
//print_r($result); |
1764
|
1764
|
$result = array_map(function($value) { |
1765
|
1765
|
return trim($value) === '' ? null : $value; |
|
@@ -1772,7 +1772,7 @@ discard block |
|
|
block discarded – undo |
1772
|
1772
|
$sth = $Connection->db->prepare($query); |
1773
|
1773
|
$sth->execute(array(':cospar' => $result['cospar'])); |
1774
|
1774
|
$exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
1775
|
|
- } catch(PDOException $e) { |
|
1775
|
+ } catch (PDOException $e) { |
1776
|
1776
|
return "error : ".$e->getMessage(); |
1777
|
1777
|
} |
1778
|
1778
|
if (empty($exist)) { |
|
@@ -1784,10 +1784,10 @@ discard block |
|
|
block discarded – undo |
1784
|
1784
|
':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
1785
|
1785
|
':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
1786
|
1786
|
':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
1787
|
|
- ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1787
|
+ ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
1788
|
1788
|
) |
1789
|
1789
|
); |
1790
|
|
- } catch(PDOException $e) { |
|
1790
|
+ } catch (PDOException $e) { |
1791
|
1791
|
return "error : ".$e->getMessage(); |
1792
|
1792
|
} |
1793
|
1793
|
} elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
|
@@ -1795,8 +1795,8 @@ discard block |
|
|
block discarded – undo |
1795
|
1795
|
try { |
1796
|
1796
|
$Connection = new Connection(); |
1797
|
1797
|
$sth = $Connection->db->prepare($query); |
1798
|
|
- $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
1799
|
|
- } catch(PDOException $e) { |
|
1798
|
+ $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
1799
|
+ } catch (PDOException $e) { |
1800
|
1800
|
return "error : ".$e->getMessage(); |
1801
|
1801
|
} |
1802
|
1802
|
} |
|
@@ -1915,13 +1915,13 @@ discard block |
|
|
block discarded – undo |
1915
|
1915
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1916
|
1916
|
{ |
1917
|
1917
|
$i++; |
1918
|
|
- if($i > 3 && count($row) > 2) { |
|
1918
|
+ if ($i > 3 && count($row) > 2) { |
1919
|
1919
|
$data = array_values(array_filter($row)); |
1920
|
1920
|
$cntdata = count($data); |
1921
|
1921
|
if ($cntdata > 10) { |
1922
|
1922
|
$value = $data[9]; |
1923
|
1923
|
|
1924
|
|
- for ($i =10;$i < $cntdata;$i++) { |
|
1924
|
+ for ($i = 10; $i < $cntdata; $i++) { |
1925
|
1925
|
$value .= ' '.$data[$i]; |
1926
|
1926
|
} |
1927
|
1927
|
$data[9] = $value; |
|
@@ -1931,8 +1931,8 @@ discard block |
|
|
block discarded – undo |
1931
|
1931
|
$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)'; |
1932
|
1932
|
try { |
1933
|
1933
|
$sth = $Connection->db->prepare($query); |
1934
|
|
- $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])); |
1935
|
|
- } catch(PDOException $e) { |
|
1934
|
+ $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])); |
|
1935
|
+ } catch (PDOException $e) { |
1936
|
1936
|
return "error : ".$e->getMessage(); |
1937
|
1937
|
} |
1938
|
1938
|
} |
|
@@ -1949,22 +1949,22 @@ discard block |
|
|
block discarded – undo |
1949
|
1949
|
require_once(dirname(__FILE__).'/../require/class.Source.php'); |
1950
|
1950
|
$delimiter = ','; |
1951
|
1951
|
$Common = new Common(); |
1952
|
|
- $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv',$tmp_dir.'fires.csv'); |
|
1952
|
+ $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv', $tmp_dir.'fires.csv'); |
1953
|
1953
|
$Connection = new Connection(); |
1954
|
1954
|
$Source = new Source(); |
1955
|
1955
|
$Source->deleteLocationByType('fires'); |
1956
|
1956
|
$i = 0; |
1957
|
|
- if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) { |
|
1957
|
+ if (($handle = fopen($tmp_dir.'fires.csv', 'r')) !== false) { |
1958
|
1958
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
1959
|
|
- while (($row = fgetcsv($handle,1000)) !== false) { |
|
1959
|
+ while (($row = fgetcsv($handle, 1000)) !== false) { |
1960
|
1960
|
if ($i > 0 && $row[0] != '' && $row[8] != 'low') { |
1961
|
|
- $description = array('bright_t14' => $row[2],'scan' => $row[3],'track' => $row[4],'sat' => $row[7],'confidence' => $row[8],'version' => $row[9],'bright_t15' => $row[10],'frp' => $row[11],'daynight' => $row[12]); |
|
1961
|
+ $description = array('bright_t14' => $row[2], 'scan' => $row[3], 'track' => $row[4], 'sat' => $row[7], 'confidence' => $row[8], 'version' => $row[9], 'bright_t15' => $row[10], 'frp' => $row[11], 'daynight' => $row[12]); |
1962
|
1962
|
$query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
1963
|
|
- $query_values = array(':name' => '',':latitude' => $row[0], ':longitude' => $row[1],':altitude' => null,':city' => '',':country' => '',':logo' => 'fire.png',':source' => 'NASA',':type' => 'fires',':source_id' => 0,':last_seen' => $row[5].' '.substr($row[6],0,2).':'.substr($row[6],2,2),':location_id' => 0,':description' => json_encode($description)); |
|
1963
|
+ $query_values = array(':name' => '', ':latitude' => $row[0], ':longitude' => $row[1], ':altitude' => null, ':city' => '', ':country' => '', ':logo' => 'fire.png', ':source' => 'NASA', ':type' => 'fires', ':source_id' => 0, ':last_seen' => $row[5].' '.substr($row[6], 0, 2).':'.substr($row[6], 2, 2), ':location_id' => 0, ':description' => json_encode($description)); |
1964
|
1964
|
try { |
1965
|
1965
|
$sth = $Connection->db->prepare($query); |
1966
|
1966
|
$sth->execute($query_values); |
1967
|
|
- } catch(PDOException $e) { |
|
1967
|
+ } catch (PDOException $e) { |
1968
|
1968
|
echo "error : ".$e->getMessage(); |
1969
|
1969
|
} |
1970
|
1970
|
} |
|
@@ -1983,7 +1983,7 @@ discard block |
|
|
block discarded – undo |
1983
|
1983
|
$Connection = new Connection(); |
1984
|
1984
|
$sth = $Connection->db->prepare($query); |
1985
|
1985
|
$sth->execute(); |
1986
|
|
- } catch(PDOException $e) { |
|
1986
|
+ } catch (PDOException $e) { |
1987
|
1987
|
return "error : ".$e->getMessage(); |
1988
|
1988
|
} |
1989
|
1989
|
$header = NULL; |
|
@@ -1994,12 +1994,12 @@ discard block |
|
|
block discarded – undo |
1994
|
1994
|
if ($globalTransaction) $Connection->db->beginTransaction(); |
1995
|
1995
|
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1996
|
1996
|
{ |
1997
|
|
- if(count($row) > 1) { |
|
1997
|
+ if (count($row) > 1) { |
1998
|
1998
|
$query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1999
|
1999
|
try { |
2000
|
2000
|
$sth = $Connection->db->prepare($query); |
2001
|
|
- $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
2002
|
|
- } catch(PDOException $e) { |
|
2001
|
+ $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
2002
|
+ } catch (PDOException $e) { |
2003
|
2003
|
return "error : ".$e->getMessage(); |
2004
|
2004
|
} |
2005
|
2005
|
} |
|
@@ -2019,21 +2019,21 @@ discard block |
|
|
block discarded – undo |
2019
|
2019
|
try { |
2020
|
2020
|
$sth = $Connection->db->prepare($query); |
2021
|
2021
|
$sth->execute(); |
2022
|
|
- } catch(PDOException $e) { |
|
2022
|
+ } catch (PDOException $e) { |
2023
|
2023
|
return "error : ".$e->getMessage(); |
2024
|
2024
|
} |
2025
|
2025
|
} |
2026
|
2026
|
|
2027
|
2027
|
|
2028
|
|
- if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
2028
|
+ if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
2029
|
2029
|
else { |
2030
|
|
- update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
2030
|
+ update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
2031
|
2031
|
$query = "CREATE EXTENSION postgis"; |
2032
|
|
- $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
2032
|
+ $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
2033
|
2033
|
try { |
2034
|
2034
|
$sth = $Connection->db->prepare($query); |
2035
|
2035
|
$sth->execute(); |
2036
|
|
- } catch(PDOException $e) { |
|
2036
|
+ } catch (PDOException $e) { |
2037
|
2037
|
return "error : ".$e->getMessage(); |
2038
|
2038
|
} |
2039
|
2039
|
} |
|
@@ -2046,13 +2046,13 @@ discard block |
|
|
block discarded – undo |
2046
|
2046
|
include_once('class.create_db.php'); |
2047
|
2047
|
require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
2048
|
2048
|
if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
2049
|
|
- update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
|
2049
|
+ update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5', $tmp_dir.'notam.txt.gz.md5'); |
2050
|
2050
|
$error = ''; |
2051
|
2051
|
if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
2052
|
|
- $notam_md5_file = explode(' ',file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
2052
|
+ $notam_md5_file = explode(' ', file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
2053
|
2053
|
$notam_md5 = $notam_md5_file[0]; |
2054
|
2054
|
if (!update_db::check_notam_version($notam_md5)) { |
2055
|
|
- update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
2055
|
+ update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
2056
|
2056
|
if (file_exists($tmp_dir.'notam.txt.gz')) { |
2057
|
2057
|
if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
2058
|
2058
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2088,14 +2088,14 @@ discard block |
|
|
block discarded – undo |
2088
|
2088
|
try { |
2089
|
2089
|
$sth = $Connection->db->prepare($query); |
2090
|
2090
|
$sth->execute(); |
2091
|
|
- } catch(PDOException $e) { |
|
2091
|
+ } catch (PDOException $e) { |
2092
|
2092
|
echo "error : ".$e->getMessage(); |
2093
|
2093
|
} |
2094
|
2094
|
} |
2095
|
2095
|
if ($globalDBdriver == 'mysql') { |
2096
|
|
- update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
2096
|
+ update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
2097
|
2097
|
} else { |
2098
|
|
- update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
2098
|
+ update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
2099
|
2099
|
} |
2100
|
2100
|
$error = create_db::import_file($tmp_dir.'countries.sql'); |
2101
|
2101
|
return $error; |
|
@@ -2108,7 +2108,7 @@ discard block |
|
|
block discarded – undo |
2108
|
2108
|
// update_db::unzip($tmp_dir.'AptNav.zip'); |
2109
|
2109
|
// update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
2110
|
2110
|
// 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'); |
2111
|
|
- 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'); |
|
2111
|
+ 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'); |
2112
|
2112
|
update_db::gunzip($tmp_dir.'awy.dat.gz'); |
2113
|
2113
|
$error = update_db::waypoints($tmp_dir.'awy.dat'); |
2114
|
2114
|
return $error; |
|
@@ -2129,7 +2129,7 @@ discard block |
|
|
block discarded – undo |
2129
|
2129
|
update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
2130
|
2130
|
if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
2131
|
2131
|
if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
2132
|
|
- if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2132
|
+ if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
2133
|
2133
|
} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
2134
|
2134
|
} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
2135
|
2135
|
} else $error = "ZIP module not loaded but required for IVAO."; |
|
@@ -2143,7 +2143,7 @@ discard block |
|
|
block discarded – undo |
2143
|
2143
|
global $tmp_dir, $globalDebug; |
2144
|
2144
|
$error = ''; |
2145
|
2145
|
if ($globalDebug) echo "Routes : Download..."; |
2146
|
|
- update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
2146
|
+ update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
2147
|
2147
|
if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
2148
|
2148
|
if ($globalDebug) echo "Gunzip..."; |
2149
|
2149
|
update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
|
@@ -2159,7 +2159,7 @@ discard block |
|
|
block discarded – undo |
2159
|
2159
|
global $tmp_dir, $globalDebug; |
2160
|
2160
|
$error = ''; |
2161
|
2161
|
if ($globalDebug) echo "Schedules Oneworld : Download..."; |
2162
|
|
- update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
2162
|
+ update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
2163
|
2163
|
if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
2164
|
2164
|
if ($globalDebug) echo "Gunzip..."; |
2165
|
2165
|
update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
|
@@ -2175,7 +2175,7 @@ discard block |
|
|
block discarded – undo |
2175
|
2175
|
global $tmp_dir, $globalDebug; |
2176
|
2176
|
$error = ''; |
2177
|
2177
|
if ($globalDebug) echo "Schedules Skyteam : Download..."; |
2178
|
|
- update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
2178
|
+ update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
2179
|
2179
|
if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
2180
|
2180
|
if ($globalDebug) echo "Gunzip..."; |
2181
|
2181
|
update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
|
@@ -2203,7 +2203,7 @@ discard block |
|
|
block discarded – undo |
2203
|
2203
|
*/ |
2204
|
2204
|
if ($globalDebug) echo "Modes : Download..."; |
2205
|
2205
|
// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
2206
|
|
- update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
2206
|
+ update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
2207
|
2207
|
|
2208
|
2208
|
// if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2209
|
2209
|
if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
|
@@ -2223,7 +2223,7 @@ discard block |
|
|
block discarded – undo |
2223
|
2223
|
public static function update_ModeS_faa() { |
2224
|
2224
|
global $tmp_dir, $globalDebug; |
2225
|
2225
|
if ($globalDebug) echo "Modes FAA: Download..."; |
2226
|
|
- update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
2226
|
+ update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
2227
|
2227
|
if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2228
|
2228
|
if ($globalDebug) echo "Unzip..."; |
2229
|
2229
|
update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
|
@@ -2239,7 +2239,7 @@ discard block |
|
|
block discarded – undo |
2239
|
2239
|
public static function update_ModeS_flarm() { |
2240
|
2240
|
global $tmp_dir, $globalDebug; |
2241
|
2241
|
if ($globalDebug) echo "Modes Flarmnet: Download..."; |
2242
|
|
- update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
2242
|
+ update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
2243
|
2243
|
if (file_exists($tmp_dir.'data.fln')) { |
2244
|
2244
|
if ($globalDebug) echo "Add to DB..."; |
2245
|
2245
|
$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
|
@@ -2253,7 +2253,7 @@ discard block |
|
|
block discarded – undo |
2253
|
2253
|
public static function update_ModeS_ogn() { |
2254
|
2254
|
global $tmp_dir, $globalDebug; |
2255
|
2255
|
if ($globalDebug) echo "Modes OGN: Download..."; |
2256
|
|
- update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
2256
|
+ update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
2257
|
2257
|
if (file_exists($tmp_dir.'ogn.csv')) { |
2258
|
2258
|
if ($globalDebug) echo "Add to DB..."; |
2259
|
2259
|
$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
|
@@ -2268,201 +2268,201 @@ discard block |
|
|
block discarded – undo |
2268
|
2268
|
global $tmp_dir, $globalDebug, $globalMasterSource; |
2269
|
2269
|
|
2270
|
2270
|
if ($globalDebug) echo "Owner France: Download..."; |
2271
|
|
- update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
2271
|
+ update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
2272
|
2272
|
if (file_exists($tmp_dir.'owner_f.csv')) { |
2273
|
2273
|
if ($globalDebug) echo "Add to DB..."; |
2274
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
2274
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
2275
|
2275
|
} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
2276
|
2276
|
if ($error != '') { |
2277
|
2277
|
return $error; |
2278
|
2278
|
} elseif ($globalDebug) echo "Done\n"; |
2279
|
2279
|
|
2280
|
2280
|
if ($globalDebug) echo "Owner Ireland: Download..."; |
2281
|
|
- update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
2281
|
+ update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
2282
|
2282
|
if (file_exists($tmp_dir.'owner_ei.csv')) { |
2283
|
2283
|
if ($globalDebug) echo "Add to DB..."; |
2284
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
2284
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
2285
|
2285
|
} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
2286
|
2286
|
if ($error != '') { |
2287
|
2287
|
return $error; |
2288
|
2288
|
} elseif ($globalDebug) echo "Done\n"; |
2289
|
2289
|
if ($globalDebug) echo "Owner Switzerland: Download..."; |
2290
|
|
- update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
2290
|
+ update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
2291
|
2291
|
if (file_exists($tmp_dir.'owner_hb.csv')) { |
2292
|
2292
|
if ($globalDebug) echo "Add to DB..."; |
2293
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
2293
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
2294
|
2294
|
} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
2295
|
2295
|
if ($error != '') { |
2296
|
2296
|
return $error; |
2297
|
2297
|
} elseif ($globalDebug) echo "Done\n"; |
2298
|
2298
|
if ($globalDebug) echo "Owner Czech Republic: Download..."; |
2299
|
|
- update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
2299
|
+ update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
2300
|
2300
|
if (file_exists($tmp_dir.'owner_ok.csv')) { |
2301
|
2301
|
if ($globalDebug) echo "Add to DB..."; |
2302
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
2302
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
2303
|
2303
|
} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
2304
|
2304
|
if ($error != '') { |
2305
|
2305
|
return $error; |
2306
|
2306
|
} elseif ($globalDebug) echo "Done\n"; |
2307
|
2307
|
if ($globalDebug) echo "Owner Australia: Download..."; |
2308
|
|
- update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
2308
|
+ update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
2309
|
2309
|
if (file_exists($tmp_dir.'owner_vh.csv')) { |
2310
|
2310
|
if ($globalDebug) echo "Add to DB..."; |
2311
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
2311
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
2312
|
2312
|
} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
2313
|
2313
|
if ($error != '') { |
2314
|
2314
|
return $error; |
2315
|
2315
|
} elseif ($globalDebug) echo "Done\n"; |
2316
|
2316
|
if ($globalDebug) echo "Owner Austria: Download..."; |
2317
|
|
- update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
2317
|
+ update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
2318
|
2318
|
if (file_exists($tmp_dir.'owner_oe.csv')) { |
2319
|
2319
|
if ($globalDebug) echo "Add to DB..."; |
2320
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
2320
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
2321
|
2321
|
} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
2322
|
2322
|
if ($error != '') { |
2323
|
2323
|
return $error; |
2324
|
2324
|
} elseif ($globalDebug) echo "Done\n"; |
2325
|
2325
|
if ($globalDebug) echo "Owner Chile: Download..."; |
2326
|
|
- update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
2326
|
+ update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
2327
|
2327
|
if (file_exists($tmp_dir.'owner_cc.csv')) { |
2328
|
2328
|
if ($globalDebug) echo "Add to DB..."; |
2329
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
2329
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
2330
|
2330
|
} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
2331
|
2331
|
if ($error != '') { |
2332
|
2332
|
return $error; |
2333
|
2333
|
} elseif ($globalDebug) echo "Done\n"; |
2334
|
2334
|
if ($globalDebug) echo "Owner Colombia: Download..."; |
2335
|
|
- update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
2335
|
+ update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
2336
|
2336
|
if (file_exists($tmp_dir.'owner_hj.csv')) { |
2337
|
2337
|
if ($globalDebug) echo "Add to DB..."; |
2338
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
2338
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
2339
|
2339
|
} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
2340
|
2340
|
if ($error != '') { |
2341
|
2341
|
return $error; |
2342
|
2342
|
} elseif ($globalDebug) echo "Done\n"; |
2343
|
2343
|
if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
2344
|
|
- update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
2344
|
+ update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
2345
|
2345
|
if (file_exists($tmp_dir.'owner_e7.csv')) { |
2346
|
2346
|
if ($globalDebug) echo "Add to DB..."; |
2347
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
2347
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
2348
|
2348
|
} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
2349
|
2349
|
if ($error != '') { |
2350
|
2350
|
return $error; |
2351
|
2351
|
} elseif ($globalDebug) echo "Done\n"; |
2352
|
2352
|
if ($globalDebug) echo "Owner Brazil: Download..."; |
2353
|
|
- update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
2353
|
+ update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
2354
|
2354
|
if (file_exists($tmp_dir.'owner_pp.csv')) { |
2355
|
2355
|
if ($globalDebug) echo "Add to DB..."; |
2356
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
2356
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
2357
|
2357
|
} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
2358
|
2358
|
if ($error != '') { |
2359
|
2359
|
return $error; |
2360
|
2360
|
} elseif ($globalDebug) echo "Done\n"; |
2361
|
2361
|
if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
2362
|
|
- update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
2362
|
+ update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
2363
|
2363
|
if (file_exists($tmp_dir.'owner_vp.csv')) { |
2364
|
2364
|
if ($globalDebug) echo "Add to DB..."; |
2365
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
2365
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
2366
|
2366
|
} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
2367
|
2367
|
if ($error != '') { |
2368
|
2368
|
return $error; |
2369
|
2369
|
} elseif ($globalDebug) echo "Done\n"; |
2370
|
2370
|
if ($globalDebug) echo "Owner Croatia: Download..."; |
2371
|
|
- update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
2371
|
+ update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
2372
|
2372
|
if (file_exists($tmp_dir.'owner_9a.csv')) { |
2373
|
2373
|
if ($globalDebug) echo "Add to DB..."; |
2374
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
2374
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
2375
|
2375
|
} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
2376
|
2376
|
if ($error != '') { |
2377
|
2377
|
return $error; |
2378
|
2378
|
} elseif ($globalDebug) echo "Done\n"; |
2379
|
2379
|
if ($globalDebug) echo "Owner Luxembourg: Download..."; |
2380
|
|
- update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
2380
|
+ update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
2381
|
2381
|
if (file_exists($tmp_dir.'owner_lx.csv')) { |
2382
|
2382
|
if ($globalDebug) echo "Add to DB..."; |
2383
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
2383
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
2384
|
2384
|
} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
2385
|
2385
|
if ($error != '') { |
2386
|
2386
|
return $error; |
2387
|
2387
|
} elseif ($globalDebug) echo "Done\n"; |
2388
|
2388
|
if ($globalDebug) echo "Owner Maldives: Download..."; |
2389
|
|
- update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
2389
|
+ update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
2390
|
2390
|
if (file_exists($tmp_dir.'owner_8q.csv')) { |
2391
|
2391
|
if ($globalDebug) echo "Add to DB..."; |
2392
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
2392
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
2393
|
2393
|
} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
2394
|
2394
|
if ($error != '') { |
2395
|
2395
|
return $error; |
2396
|
2396
|
} elseif ($globalDebug) echo "Done\n"; |
2397
|
2397
|
if ($globalDebug) echo "Owner New Zealand: Download..."; |
2398
|
|
- update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
2398
|
+ update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
2399
|
2399
|
if (file_exists($tmp_dir.'owner_zk.csv')) { |
2400
|
2400
|
if ($globalDebug) echo "Add to DB..."; |
2401
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
2401
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
2402
|
2402
|
} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
2403
|
2403
|
if ($error != '') { |
2404
|
2404
|
return $error; |
2405
|
2405
|
} elseif ($globalDebug) echo "Done\n"; |
2406
|
2406
|
if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
2407
|
|
- update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
2407
|
+ update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
2408
|
2408
|
if (file_exists($tmp_dir.'owner_p2.csv')) { |
2409
|
2409
|
if ($globalDebug) echo "Add to DB..."; |
2410
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
2410
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
2411
|
2411
|
} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
2412
|
2412
|
if ($error != '') { |
2413
|
2413
|
return $error; |
2414
|
2414
|
} elseif ($globalDebug) echo "Done\n"; |
2415
|
2415
|
if ($globalDebug) echo "Owner Slovakia: Download..."; |
2416
|
|
- update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
2416
|
+ update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
2417
|
2417
|
if (file_exists($tmp_dir.'owner_om.csv')) { |
2418
|
2418
|
if ($globalDebug) echo "Add to DB..."; |
2419
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
2419
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
2420
|
2420
|
} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
2421
|
2421
|
if ($error != '') { |
2422
|
2422
|
return $error; |
2423
|
2423
|
} elseif ($globalDebug) echo "Done\n"; |
2424
|
2424
|
if ($globalDebug) echo "Owner Ecuador: Download..."; |
2425
|
|
- update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
2425
|
+ update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
2426
|
2426
|
if (file_exists($tmp_dir.'owner_hc.csv')) { |
2427
|
2427
|
if ($globalDebug) echo "Add to DB..."; |
2428
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
2428
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
2429
|
2429
|
} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
2430
|
2430
|
if ($error != '') { |
2431
|
2431
|
return $error; |
2432
|
2432
|
} elseif ($globalDebug) echo "Done\n"; |
2433
|
2433
|
if ($globalDebug) echo "Owner Iceland: Download..."; |
2434
|
|
- update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
2434
|
+ update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
2435
|
2435
|
if (file_exists($tmp_dir.'owner_tf.csv')) { |
2436
|
2436
|
if ($globalDebug) echo "Add to DB..."; |
2437
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
2437
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
2438
|
2438
|
} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
2439
|
2439
|
if ($error != '') { |
2440
|
2440
|
return $error; |
2441
|
2441
|
} elseif ($globalDebug) echo "Done\n"; |
2442
|
2442
|
if ($globalDebug) echo "Owner Isle of Man: Download..."; |
2443
|
|
- update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
2443
|
+ update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
2444
|
2444
|
if (file_exists($tmp_dir.'owner_m.csv')) { |
2445
|
2445
|
if ($globalDebug) echo "Add to DB..."; |
2446
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
2446
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
2447
|
2447
|
} else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
2448
|
2448
|
if ($error != '') { |
2449
|
2449
|
return $error; |
2450
|
2450
|
} elseif ($globalDebug) echo "Done\n"; |
2451
|
2451
|
if ($globalMasterSource) { |
2452
|
2452
|
if ($globalDebug) echo "ModeS Netherlands: Download..."; |
2453
|
|
- update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
2453
|
+ update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
2454
|
2454
|
if (file_exists($tmp_dir.'owner_ph.csv')) { |
2455
|
2455
|
if ($globalDebug) echo "Add to DB..."; |
2456
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
2456
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
2457
|
2457
|
} else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
2458
|
2458
|
if ($error != '') { |
2459
|
2459
|
return $error; |
2460
|
2460
|
} elseif ($globalDebug) echo "Done\n"; |
2461
|
2461
|
if ($globalDebug) echo "ModeS Denmark: Download..."; |
2462
|
|
- update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
2462
|
+ update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
2463
|
2463
|
if (file_exists($tmp_dir.'owner_oy.csv')) { |
2464
|
2464
|
if ($globalDebug) echo "Add to DB..."; |
2465
|
|
- $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
2465
|
+ $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
2466
|
2466
|
} else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
2467
|
2467
|
if ($error != '') { |
2468
|
2468
|
return $error; |
|
@@ -2475,7 +2475,7 @@ discard block |
|
|
block discarded – undo |
2475
|
2475
|
global $tmp_dir, $globalDebug; |
2476
|
2476
|
$error = ''; |
2477
|
2477
|
if ($globalDebug) echo "Translation : Download..."; |
2478
|
|
- update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
2478
|
+ update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
2479
|
2479
|
if (file_exists($tmp_dir.'translation.zip')) { |
2480
|
2480
|
if ($globalDebug) echo "Unzip..."; |
2481
|
2481
|
update_db::unzip($tmp_dir.'translation.zip'); |
|
@@ -2492,10 +2492,10 @@ discard block |
|
|
block discarded – undo |
2492
|
2492
|
global $tmp_dir, $globalDebug; |
2493
|
2493
|
$error = ''; |
2494
|
2494
|
if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
2495
|
|
- update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
2496
|
|
- update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
|
2495
|
+ update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
2496
|
+ update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5', $tmp_dir.'translation.tsv.gz.md5'); |
2497
|
2497
|
if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
2498
|
|
- $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
2498
|
+ $translation_md5_file = explode(' ', file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
2499
|
2499
|
$translation_md5 = $translation_md5_file[0]; |
2500
|
2500
|
if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
2501
|
2501
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2513,10 +2513,10 @@ discard block |
|
|
block discarded – undo |
2513
|
2513
|
global $tmp_dir, $globalDebug; |
2514
|
2514
|
$error = ''; |
2515
|
2515
|
if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
2516
|
|
- update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
2517
|
|
- update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
|
2516
|
+ update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
2517
|
+ update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5', $tmp_dir.'modes.tsv.gz.md5'); |
2518
|
2518
|
if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
2519
|
|
- $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
2519
|
+ $modes_md5_file = explode(' ', file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
2520
|
2520
|
$modes_md5 = $modes_md5_file[0]; |
2521
|
2521
|
if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
2522
|
2522
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2535,12 +2535,12 @@ discard block |
|
|
block discarded – undo |
2535
|
2535
|
global $tmp_dir, $globalDebug; |
2536
|
2536
|
$error = ''; |
2537
|
2537
|
if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
2538
|
|
- update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
|
2538
|
+ update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5', $tmp_dir.'airlines.tsv.gz.md5'); |
2539
|
2539
|
if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
2540
|
|
- $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
2540
|
+ $airlines_md5_file = explode(' ', file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
2541
|
2541
|
$airlines_md5 = $airlines_md5_file[0]; |
2542
|
2542
|
if (!update_db::check_airlines_version($airlines_md5)) { |
2543
|
|
- update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
|
2543
|
+ update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz', $tmp_dir.'airlines.tsv.gz'); |
2544
|
2544
|
if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
2545
|
2545
|
if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
2546
|
2546
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2565,14 +2565,14 @@ discard block |
|
|
block discarded – undo |
2565
|
2565
|
if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
2566
|
2566
|
$error = ''; |
2567
|
2567
|
if ($globalOwner === TRUE) { |
2568
|
|
- update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
2569
|
|
- update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
2568
|
+ update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2569
|
+ update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
2570
|
2570
|
} else { |
2571
|
|
- update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
2572
|
|
- update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
2571
|
+ update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2572
|
+ update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
2573
|
2573
|
} |
2574
|
2574
|
if (file_exists($tmp_dir.'owners.tsv.gz') && file_exists($tmp_dir.'owners.tsv.gz.md5')) { |
2575
|
|
- $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
2575
|
+ $owners_md5_file = explode(' ', file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
2576
|
2576
|
$owners_md5 = $owners_md5_file[0]; |
2577
|
2577
|
if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
2578
|
2578
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2589,10 +2589,10 @@ discard block |
|
|
block discarded – undo |
2589
|
2589
|
public static function update_routes_fam() { |
2590
|
2590
|
global $tmp_dir, $globalDebug; |
2591
|
2591
|
if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2592
|
|
- update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
2593
|
|
- update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
|
2592
|
+ update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2593
|
+ update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5', $tmp_dir.'routes.tsv.gz.md5'); |
2594
|
2594
|
if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
2595
|
|
- $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
2595
|
+ $routes_md5_file = explode(' ', file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
2596
|
2596
|
$routes_md5 = $routes_md5_file[0]; |
2597
|
2597
|
if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
2598
|
2598
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2609,10 +2609,10 @@ discard block |
|
|
block discarded – undo |
2609
|
2609
|
public static function update_block_fam() { |
2610
|
2610
|
global $tmp_dir, $globalDebug; |
2611
|
2611
|
if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
2612
|
|
- update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
2613
|
|
- update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
|
2612
|
+ update_db::download('http://data.flightairmap.com/data/block.tsv.gz', $tmp_dir.'block.tsv.gz'); |
|
2613
|
+ update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5', $tmp_dir.'block.tsv.gz.md5'); |
2614
|
2614
|
if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
2615
|
|
- $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
|
2615
|
+ $block_md5_file = explode(' ', file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
2616
|
2616
|
$block_md5 = $block_md5_file[0]; |
2617
|
2617
|
if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
2618
|
2618
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2628,13 +2628,13 @@ discard block |
|
|
block discarded – undo |
2628
|
2628
|
} |
2629
|
2629
|
public static function update_marine_identity_fam() { |
2630
|
2630
|
global $tmp_dir, $globalDebug; |
2631
|
|
- update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2631
|
+ update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
2632
|
2632
|
if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2633
|
|
- $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2633
|
+ $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
2634
|
2634
|
$marine_identity_md5 = $marine_identity_md5_file[0]; |
2635
|
2635
|
if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2636
|
2636
|
if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2637
|
|
- update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2637
|
+ update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
2638
|
2638
|
if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2639
|
2639
|
if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
2640
|
2640
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2656,13 +2656,13 @@ discard block |
|
|
block discarded – undo |
2656
|
2656
|
|
2657
|
2657
|
public static function update_satellite_fam() { |
2658
|
2658
|
global $tmp_dir, $globalDebug; |
2659
|
|
- update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
2659
|
+ update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
2660
|
2660
|
if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
2661
|
|
- $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2661
|
+ $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
2662
|
2662
|
$satellite_md5 = $satellite_md5_file[0]; |
2663
|
2663
|
if (!update_db::check_satellite_version($satellite_md5)) { |
2664
|
2664
|
if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
2665
|
|
- update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
2665
|
+ update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
2666
|
2666
|
if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2667
|
2667
|
if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
2668
|
2668
|
if ($globalDebug) echo "Gunzip..."; |
|
@@ -2683,13 +2683,13 @@ discard block |
|
|
block discarded – undo |
2683
|
2683
|
} |
2684
|
2684
|
public static function update_diagrams_fam() { |
2685
|
2685
|
global $tmp_dir, $globalDebug; |
2686
|
|
- update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf.md5',$tmp_dir.'diagramspdf.md5'); |
|
2686
|
+ update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf.md5', $tmp_dir.'diagramspdf.md5'); |
2687
|
2687
|
if (file_exists($tmp_dir.'diagramspdf.md5')) { |
2688
|
|
- $diagrams_md5_file = explode(' ',file_get_contents($tmp_dir.'diagramspdf.md5')); |
|
2688
|
+ $diagrams_md5_file = explode(' ', file_get_contents($tmp_dir.'diagramspdf.md5')); |
2689
|
2689
|
$diagrams_md5 = $diagrams_md5_file[0]; |
2690
|
2690
|
if (!update_db::check_diagrams_version($diagrams_md5)) { |
2691
|
2691
|
if ($globalDebug) echo "Airports diagrams from FlightAirMap website : Download..."; |
2692
|
|
- update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf',$tmp_dir.'diagramspdf'); |
|
2692
|
+ update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf', $tmp_dir.'diagramspdf'); |
2693
|
2693
|
if (file_exists($tmp_dir.'diagramspdf')) { |
2694
|
2694
|
if (md5_file($tmp_dir.'diagramspdf') == $diagrams_md5) { |
2695
|
2695
|
if ($globalDebug) echo "Add to DB..."; |
|
@@ -2709,7 +2709,7 @@ discard block |
|
|
block discarded – undo |
2709
|
2709
|
public static function update_banned_fam() { |
2710
|
2710
|
global $tmp_dir, $globalDebug; |
2711
|
2711
|
if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2712
|
|
- update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2712
|
+ update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
2713
|
2713
|
if (file_exists($tmp_dir.'ban_eu.csv')) { |
2714
|
2714
|
//if ($globalDebug) echo "Gunzip..."; |
2715
|
2715
|
//update_db::gunzip($tmp_dir.'ban_ue.csv'); |
|
@@ -2728,18 +2728,18 @@ discard block |
|
|
block discarded – undo |
2728
|
2728
|
$error = ''; |
2729
|
2729
|
if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2730
|
2730
|
if ($globalDBdriver == 'mysql') { |
2731
|
|
- update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2731
|
+ update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
2732
|
2732
|
} else { |
2733
|
|
- update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2733
|
+ update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
2734
|
2734
|
} |
2735
|
2735
|
if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2736
|
|
- $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2736
|
+ $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
2737
|
2737
|
$airspace_md5 = $airspace_md5_file[0]; |
2738
|
2738
|
if (!update_db::check_airspace_version($airspace_md5)) { |
2739
|
2739
|
if ($globalDBdriver == 'mysql') { |
2740
|
|
- update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2740
|
+ update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
2741
|
2741
|
} else { |
2742
|
|
- update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2742
|
+ update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
2743
|
2743
|
} |
2744
|
2744
|
if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2745
|
2745
|
if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
|
@@ -2752,7 +2752,7 @@ discard block |
|
|
block discarded – undo |
2752
|
2752
|
try { |
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
|
} |
|
@@ -2772,16 +2772,16 @@ discard block |
|
|
block discarded – undo |
2772
|
2772
|
global $tmp_dir, $globalDebug, $globalGeoidSource; |
2773
|
2773
|
$error = ''; |
2774
|
2774
|
if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
2775
|
|
- update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2775
|
+ update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
2776
|
2776
|
if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2777
|
|
- $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2777
|
+ $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
2778
|
2778
|
$geoid_md5 = $geoid_md5_file[0]; |
2779
|
2779
|
if (!update_db::check_geoid_version($geoid_md5)) { |
2780
|
|
- update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2780
|
+ update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
2781
|
2781
|
if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2782
|
2782
|
if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
2783
|
2783
|
if ($globalDebug) echo "Gunzip..."; |
2784
|
|
- update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2784
|
+ update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
2785
|
2785
|
if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2786
|
2786
|
update_db::insert_geoid_version($geoid_md5); |
2787
|
2787
|
} else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
@@ -2798,15 +2798,15 @@ discard block |
|
|
block discarded – undo |
2798
|
2798
|
public static function update_tle() { |
2799
|
2799
|
global $tmp_dir, $globalDebug; |
2800
|
2800
|
if ($globalDebug) echo "Download TLE : Download..."; |
2801
|
|
- $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', |
2802
|
|
- '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', |
2803
|
|
- 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
|
2801
|
+ $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', |
|
2802
|
+ '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', |
|
2803
|
+ 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt', 'visual.txt', 'sarsat.txt', 'argos.txt', 'ses.txt', 'iridium-NEXT.txt', 'beidou.txt'); |
2804
|
2804
|
foreach ($alltle as $filename) { |
2805
|
2805
|
if ($globalDebug) echo "downloading ".$filename.'...'; |
2806
|
|
- update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2806
|
+ update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
2807
|
2807
|
if (file_exists($tmp_dir.$filename)) { |
2808
|
2808
|
if ($globalDebug) echo "Add to DB ".$filename."..."; |
2809
|
|
- $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2809
|
+ $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
2810
|
2810
|
} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2811
|
2811
|
if ($error != '') { |
2812
|
2812
|
echo $error."\n"; |
|
@@ -2818,7 +2818,7 @@ discard block |
|
|
block discarded – undo |
2818
|
2818
|
public static function update_ucsdb() { |
2819
|
2819
|
global $tmp_dir, $globalDebug; |
2820
|
2820
|
if ($globalDebug) echo "Download UCS DB : Download..."; |
2821
|
|
- update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt',$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
|
2821
|
+ update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt', $tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
2822
|
2822
|
if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2823
|
2823
|
if ($globalDebug) echo "Add to DB..."; |
2824
|
2824
|
$error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
|
@@ -2832,7 +2832,7 @@ discard block |
|
|
block discarded – undo |
2832
|
2832
|
public static function update_celestrak() { |
2833
|
2833
|
global $tmp_dir, $globalDebug; |
2834
|
2834
|
if ($globalDebug) echo "Download Celestrak DB : Download..."; |
2835
|
|
- update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
2835
|
+ update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
2836
|
2836
|
if (file_exists($tmp_dir.'satcat.txt')) { |
2837
|
2837
|
if ($globalDebug) echo "Add to DB..."; |
2838
|
2838
|
$error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
|
@@ -2851,62 +2851,62 @@ discard block |
|
|
block discarded – undo |
2851
|
2851
|
if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
2852
|
2852
|
return ''; |
2853
|
2853
|
} |
2854
|
|
- update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2854
|
+ update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
2855
|
2855
|
if (file_exists($tmp_dir.'models.md5sum')) { |
2856
|
2856
|
if ($globalDebug) echo "Check files...\n"; |
2857
|
2857
|
$newmodelsdb = array(); |
2858
|
|
- if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
2859
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2858
|
+ if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2859
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
2860
|
2860
|
$model = trim($row[2]); |
2861
|
2861
|
$newmodelsdb[$model] = trim($row[0]); |
2862
|
2862
|
} |
2863
|
2863
|
} |
2864
|
2864
|
$modelsdb = array(); |
2865
|
2865
|
if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2866
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
2867
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2866
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2867
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
2868
|
2868
|
$model = trim($row[2]); |
2869
|
2869
|
$modelsdb[$model] = trim($row[0]); |
2870
|
2870
|
} |
2871
|
2871
|
} |
2872
|
2872
|
} |
2873
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
2873
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
2874
|
2874
|
foreach ($diff as $key => $value) { |
2875
|
2875
|
if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2876
|
|
- update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2876
|
+ update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
2877
|
2877
|
} |
2878
|
|
- update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2878
|
+ update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
2879
|
2879
|
} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2880
|
2880
|
if ($error != '') { |
2881
|
2881
|
return $error; |
2882
|
2882
|
} elseif ($globalDebug) echo "Done\n"; |
2883
|
2883
|
if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
2884
|
|
- update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
|
2884
|
+ update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', $tmp_dir.'modelsgltf2.md5sum'); |
2885
|
2885
|
if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
2886
|
2886
|
if ($globalDebug) echo "Check files...\n"; |
2887
|
2887
|
$newmodelsdb = array(); |
2888
|
|
- if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
2889
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2888
|
+ if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum', 'r')) !== FALSE) { |
|
2889
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
2890
|
2890
|
$model = trim($row[2]); |
2891
|
2891
|
$newmodelsdb[$model] = trim($row[0]); |
2892
|
2892
|
} |
2893
|
2893
|
} |
2894
|
2894
|
$modelsdb = array(); |
2895
|
2895
|
if (file_exists(dirname(__FILE__).'/../models/gltf2/models.md5sum')) { |
2896
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum','r')) !== FALSE) { |
2897
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2896
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum', 'r')) !== FALSE) { |
|
2897
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
2898
|
2898
|
$model = trim($row[2]); |
2899
|
2899
|
$modelsdb[$model] = trim($row[0]); |
2900
|
2900
|
} |
2901
|
2901
|
} |
2902
|
2902
|
} |
2903
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
2903
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
2904
|
2904
|
foreach ($diff as $key => $value) { |
2905
|
2905
|
if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2906
|
|
- update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
|
2906
|
+ update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key, dirname(__FILE__).'/../models/gltf2/'.$key); |
2907
|
2907
|
|
2908
|
2908
|
} |
2909
|
|
- update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
|
2909
|
+ update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
2910
|
2910
|
} else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
2911
|
2911
|
if ($error != '') { |
2912
|
2912
|
return $error; |
|
@@ -2922,32 +2922,32 @@ discard block |
|
|
block discarded – undo |
2922
|
2922
|
return ''; |
2923
|
2923
|
} |
2924
|
2924
|
if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
2925
|
|
- update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
|
2925
|
+ update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', $tmp_dir.'modelsweather.md5sum'); |
2926
|
2926
|
if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
2927
|
2927
|
if ($globalDebug) echo "Check files...\n"; |
2928
|
2928
|
$newmodelsdb = array(); |
2929
|
|
- if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
2930
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2929
|
+ if (($handle = fopen($tmp_dir.'modelsweather.md5sum', 'r')) !== FALSE) { |
|
2930
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
2931
|
2931
|
$model = trim($row[2]); |
2932
|
2932
|
$newmodelsdb[$model] = trim($row[0]); |
2933
|
2933
|
} |
2934
|
2934
|
} |
2935
|
2935
|
$modelsdb = array(); |
2936
|
2936
|
if (file_exists(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum')) { |
2937
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum','r')) !== FALSE) { |
2938
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2937
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum', 'r')) !== FALSE) { |
|
2938
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
2939
|
2939
|
$model = trim($row[2]); |
2940
|
2940
|
$modelsdb[$model] = trim($row[0]); |
2941
|
2941
|
} |
2942
|
2942
|
} |
2943
|
2943
|
} |
2944
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
2944
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
2945
|
2945
|
foreach ($diff as $key => $value) { |
2946
|
2946
|
if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2947
|
|
- update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
|
2947
|
+ update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key, dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
2948
|
2948
|
|
2949
|
2949
|
} |
2950
|
|
- update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
|
2950
|
+ update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
2951
|
2951
|
} else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
2952
|
2952
|
if ($error != '') { |
2953
|
2953
|
return $error; |
|
@@ -2959,32 +2959,32 @@ discard block |
|
|
block discarded – undo |
2959
|
2959
|
global $tmp_dir, $globalDebug; |
2960
|
2960
|
$error = ''; |
2961
|
2961
|
if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
2962
|
|
- update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
|
2962
|
+ update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', $tmp_dir.'liveries.md5sum'); |
2963
|
2963
|
if (file_exists($tmp_dir.'liveries.md5sum')) { |
2964
|
2964
|
if ($globalDebug) echo "Check files...\n"; |
2965
|
2965
|
$newmodelsdb = array(); |
2966
|
|
- if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
2967
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2966
|
+ if (($handle = fopen($tmp_dir.'liveries.md5sum', 'r')) !== FALSE) { |
|
2967
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
2968
|
2968
|
$model = trim($row[2]); |
2969
|
2969
|
$newmodelsdb[$model] = trim($row[0]); |
2970
|
2970
|
} |
2971
|
2971
|
} |
2972
|
2972
|
$modelsdb = array(); |
2973
|
2973
|
if (file_exists(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum')) { |
2974
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum','r')) !== FALSE) { |
2975
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2974
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum', 'r')) !== FALSE) { |
|
2975
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
2976
|
2976
|
$model = trim($row[2]); |
2977
|
2977
|
$modelsdb[$model] = trim($row[0]); |
2978
|
2978
|
} |
2979
|
2979
|
} |
2980
|
2980
|
} |
2981
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
2981
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
2982
|
2982
|
foreach ($diff as $key => $value) { |
2983
|
2983
|
if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
2984
|
|
- update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
|
2984
|
+ update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key, dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
2985
|
2985
|
|
2986
|
2986
|
} |
2987
|
|
- update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
|
2987
|
+ update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
2988
|
2988
|
} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2989
|
2989
|
if ($error != '') { |
2990
|
2990
|
return $error; |
|
@@ -3000,32 +3000,32 @@ discard block |
|
|
block discarded – undo |
3000
|
3000
|
return ''; |
3001
|
3001
|
} |
3002
|
3002
|
if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
3003
|
|
- update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
3003
|
+ update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
3004
|
3004
|
if (file_exists($tmp_dir.'space_models.md5sum')) { |
3005
|
3005
|
if ($globalDebug) echo "Check files...\n"; |
3006
|
3006
|
$newmodelsdb = array(); |
3007
|
|
- if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
3008
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
3007
|
+ if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
3008
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
3009
|
3009
|
$model = trim($row[2]); |
3010
|
3010
|
$newmodelsdb[$model] = trim($row[0]); |
3011
|
3011
|
} |
3012
|
3012
|
} |
3013
|
3013
|
$modelsdb = array(); |
3014
|
3014
|
if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
3015
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
3016
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
3015
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
3016
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
3017
|
3017
|
$model = trim($row[2]); |
3018
|
3018
|
$modelsdb[$model] = trim($row[0]); |
3019
|
3019
|
} |
3020
|
3020
|
} |
3021
|
3021
|
} |
3022
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
3022
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
3023
|
3023
|
foreach ($diff as $key => $value) { |
3024
|
3024
|
if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
3025
|
|
- update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
3025
|
+ update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
3026
|
3026
|
|
3027
|
3027
|
} |
3028
|
|
- update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
3028
|
+ update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
3029
|
3029
|
} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
3030
|
3030
|
if ($error != '') { |
3031
|
3031
|
return $error; |
|
@@ -3041,32 +3041,32 @@ discard block |
|
|
block discarded – undo |
3041
|
3041
|
return ''; |
3042
|
3042
|
} |
3043
|
3043
|
if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
3044
|
|
- update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
3044
|
+ update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
3045
|
3045
|
if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
3046
|
3046
|
if ($globalDebug) echo "Check files...\n"; |
3047
|
3047
|
$newmodelsdb = array(); |
3048
|
|
- if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
3049
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
3048
|
+ if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
3049
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
3050
|
3050
|
$model = trim($row[2]); |
3051
|
3051
|
$newmodelsdb[$model] = trim($row[0]); |
3052
|
3052
|
} |
3053
|
3053
|
} |
3054
|
3054
|
$modelsdb = array(); |
3055
|
3055
|
if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
3056
|
|
- if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
3057
|
|
- while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
3056
|
+ if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
3057
|
+ while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
3058
|
3058
|
$model = trim($row[2]); |
3059
|
3059
|
$modelsdb[$model] = trim($row[0]); |
3060
|
3060
|
} |
3061
|
3061
|
} |
3062
|
3062
|
} |
3063
|
|
- $diff = array_diff($newmodelsdb,$modelsdb); |
|
3063
|
+ $diff = array_diff($newmodelsdb, $modelsdb); |
3064
|
3064
|
foreach ($diff as $key => $value) { |
3065
|
3065
|
if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
3066
|
|
- update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
3066
|
+ update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
3067
|
3067
|
|
3068
|
3068
|
} |
3069
|
|
- update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
3069
|
+ update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
3070
|
3070
|
} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
3071
|
3071
|
if ($error != '') { |
3072
|
3072
|
return $error; |
|
@@ -3078,8 +3078,8 @@ discard block |
|
|
block discarded – undo |
3078
|
3078
|
global $tmp_dir, $globalDebug; |
3079
|
3079
|
date_default_timezone_set('UTC'); |
3080
|
3080
|
$Common = new Common(); |
3081
|
|
- $data = $Common->getData('https://www4.icao.int/doc8643/External/AircraftTypes','post',array('X-Requested-With: XMLHttpRequest','Accept: application/json, text/javascript, */*; q=0.01','Host: www4.icao.int','Origin: https://www.icao.int','Content-Length: 0'),'','','https://www.icao.int/publications/DOC8643/Pages/Search.aspx',60); |
3082
|
|
- $all = json_decode($data,true); |
|
3081
|
+ $data = $Common->getData('https://www4.icao.int/doc8643/External/AircraftTypes', 'post', array('X-Requested-With: XMLHttpRequest', 'Accept: application/json, text/javascript, */*; q=0.01', 'Host: www4.icao.int', 'Origin: https://www.icao.int', 'Content-Length: 0'), '', '', 'https://www.icao.int/publications/DOC8643/Pages/Search.aspx', 60); |
|
3082
|
+ $all = json_decode($data, true); |
3083
|
3083
|
$Connection = new Connection(); |
3084
|
3084
|
$querychk = "SELECT COUNT(1) as nb FROM aircraft WHERE icao = :icao"; |
3085
|
3085
|
$sth = $Connection->db->prepare($querychk); |
|
@@ -3091,8 +3091,8 @@ discard block |
|
|
block discarded – undo |
3091
|
3091
|
foreach ($all as $model) { |
3092
|
3092
|
$icao = $model['Designator']; |
3093
|
3093
|
if (!isset($allicao[$icao])) { |
3094
|
|
- $aircraft_shadow = 'generic_'.substr($model['EngineType'],0,1).$model['EngineCount'].$model['WTC'].'.png'; |
3095
|
|
- $allicao[$icao] = array(':icao' => $icao,':type' => $model['ModelFullName'],':manufacturer' => $model['ManufacturerCode'],':aircraft_shadow' => $aircraft_shadow,':aircraft_description' => $model['AircraftDescription'],':engine_type' => $model['EngineType'],':engine_count' => $model['EngineCount'],':wake_category' => $model['WTC']); |
|
3094
|
+ $aircraft_shadow = 'generic_'.substr($model['EngineType'], 0, 1).$model['EngineCount'].$model['WTC'].'.png'; |
|
3095
|
+ $allicao[$icao] = array(':icao' => $icao, ':type' => $model['ModelFullName'], ':manufacturer' => $model['ManufacturerCode'], ':aircraft_shadow' => $aircraft_shadow, ':aircraft_description' => $model['AircraftDescription'], ':engine_type' => $model['EngineType'], ':engine_count' => $model['EngineCount'], ':wake_category' => $model['WTC']); |
3096
|
3096
|
} else { |
3097
|
3097
|
$allicao[$icao][':type'] = $allicao[$icao][':type'].'/'.$model['ModelFullName']; |
3098
|
3098
|
} |
|
@@ -3104,9 +3104,9 @@ discard block |
|
|
block discarded – undo |
3104
|
3104
|
if ($exist[0]['nb'] == 0) { |
3105
|
3105
|
$sthins->execute($airdata); |
3106
|
3106
|
} else { |
3107
|
|
- $sthup->execute(array(':type' => $airdata[':type'],':icao' => $icao)); |
|
3107
|
+ $sthup->execute(array(':type' => $airdata[':type'], ':icao' => $icao)); |
3108
|
3108
|
} |
3109
|
|
- } catch(PDOException $e) { |
|
3109
|
+ } catch (PDOException $e) { |
3110
|
3110
|
return "error : ".$e->getMessage(); |
3111
|
3111
|
} |
3112
|
3112
|
} |
|
@@ -3138,23 +3138,23 @@ discard block |
|
|
block discarded – undo |
3138
|
3138
|
$Connection = new Connection(); |
3139
|
3139
|
$sth = $Connection->db->prepare($query); |
3140
|
3140
|
$sth->execute(); |
3141
|
|
- } catch(PDOException $e) { |
|
3141
|
+ } catch (PDOException $e) { |
3142
|
3142
|
return "error : ".$e->getMessage(); |
3143
|
3143
|
} |
3144
|
3144
|
|
3145
|
3145
|
$error = ''; |
3146
|
3146
|
if ($globalDebug) echo "Notam : Download..."; |
3147
|
|
- update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
3147
|
+ update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
3148
|
3148
|
if (file_exists($tmp_dir.'notam.rss')) { |
3149
|
|
- $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
3149
|
+ $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
3150
|
3150
|
foreach ($notams['channel']['item'] as $notam) { |
3151
|
|
- $title = explode(':',$notam['title']); |
|
3151
|
+ $title = explode(':', $notam['title']); |
3152
|
3152
|
$data['ref'] = trim($title[0]); |
3153
|
3153
|
unset($title[0]); |
3154
|
|
- $data['title'] = trim(implode(':',$title)); |
3155
|
|
- $description = strip_tags($notam['description'],'<pre>'); |
3156
|
|
- preg_match(':^(.*?)<pre>:',$description,$match); |
3157
|
|
- $q = explode('/',$match[1]); |
|
3154
|
+ $data['title'] = trim(implode(':', $title)); |
|
3155
|
+ $description = strip_tags($notam['description'], '<pre>'); |
|
3156
|
+ preg_match(':^(.*?)<pre>:', $description, $match); |
|
3157
|
+ $q = explode('/', $match[1]); |
3158
|
3158
|
$data['fir'] = $q[0]; |
3159
|
3159
|
$data['code'] = $q[1]; |
3160
|
3160
|
$ifrvfr = $q[2]; |
|
@@ -3170,30 +3170,30 @@ discard block |
|
|
block discarded – undo |
3170
|
3170
|
$data['lower_limit'] = $q[5]; |
3171
|
3171
|
$data['upper_limit'] = $q[6]; |
3172
|
3172
|
$latlonrad = $q[7]; |
3173
|
|
- sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
3174
|
|
- $latitude = $Common->convertDec($las,'latitude'); |
3175
|
|
- $longitude = $Common->convertDec($lns,'longitude'); |
|
3173
|
+ sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
3174
|
+ $latitude = $Common->convertDec($las, 'latitude'); |
|
3175
|
+ $longitude = $Common->convertDec($lns, 'longitude'); |
3176
|
3176
|
if ($lac == 'S') $latitude = '-'.$latitude; |
3177
|
3177
|
if ($lnc == 'W') $longitude = '-'.$longitude; |
3178
|
3178
|
$data['center_latitude'] = $latitude; |
3179
|
3179
|
$data['center_longitude'] = $longitude; |
3180
|
3180
|
$data['radius'] = intval($radius); |
3181
|
3181
|
|
3182
|
|
- preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
3182
|
+ preg_match(':<pre>(.*?)</pre>:', $description, $match); |
3183
|
3183
|
$data['text'] = $match[1]; |
3184
|
|
- preg_match(':</pre>(.*?)$:',$description,$match); |
|
3184
|
+ preg_match(':</pre>(.*?)$:', $description, $match); |
3185
|
3185
|
$fromto = $match[1]; |
3186
|
|
- preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
3186
|
+ preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
3187
|
3187
|
$fromall = trim($match[1]); |
3188
|
|
- preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
3188
|
+ preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
3189
|
3189
|
$from = trim($match[1]); |
3190
|
|
- $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
3191
|
|
- preg_match('#TO:(.*?)$#',$fromto,$match); |
|
3190
|
+ $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
3191
|
+ preg_match('#TO:(.*?)$#', $fromto, $match); |
3192
|
3192
|
$toall = trim($match[1]); |
3193
|
|
- if (!preg_match(':Permanent:',$toall)) { |
3194
|
|
- preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
3193
|
+ if (!preg_match(':Permanent:', $toall)) { |
|
3194
|
+ preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
3195
|
3195
|
$to = trim($match[1]); |
3196
|
|
- $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
3196
|
+ $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
3197
|
3197
|
$data['permanent'] = 0; |
3198
|
3198
|
} else { |
3199
|
3199
|
$data['date_end'] = NULL; |
|
@@ -3201,7 +3201,7 @@ discard block |
|
|
block discarded – undo |
3201
|
3201
|
} |
3202
|
3202
|
$data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
3203
|
3203
|
$NOTAM = new NOTAM(); |
3204
|
|
- $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']); |
|
3204
|
+ $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']); |
3205
|
3205
|
unset($data); |
3206
|
3206
|
} |
3207
|
3207
|
} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
@@ -3224,16 +3224,16 @@ discard block |
|
|
block discarded – undo |
3224
|
3224
|
$Connection = new Connection(); |
3225
|
3225
|
$sth = $Connection->db->prepare($query); |
3226
|
3226
|
$sth->execute(); |
3227
|
|
- } catch(PDOException $e) { |
|
3227
|
+ } catch (PDOException $e) { |
3228
|
3228
|
return "error : ".$e->getMessage(); |
3229
|
3229
|
} |
3230
|
3230
|
} |
3231
|
3231
|
$Common = new Common(); |
3232
|
3232
|
$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
3233
|
|
- $airspace_json = json_decode($airspace_lst,true); |
|
3233
|
+ $airspace_json = json_decode($airspace_lst, true); |
3234
|
3234
|
foreach ($airspace_json['records'] as $airspace) { |
3235
|
3235
|
if ($globalDebug) echo $airspace['name']."...\n"; |
3236
|
|
- update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
3236
|
+ update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
3237
|
3237
|
if (file_exists($tmp_dir.$airspace['name'])) { |
3238
|
3238
|
file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
3239
|
3239
|
//system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
|
@@ -3255,7 +3255,7 @@ discard block |
|
|
block discarded – undo |
3255
|
3255
|
$Connection = new Connection(); |
3256
|
3256
|
$sth = $Connection->db->prepare($query); |
3257
|
3257
|
$sth->execute(array(':new' => $new, ':old' => $old)); |
3258
|
|
- } catch(PDOException $e) { |
|
3258
|
+ } catch (PDOException $e) { |
3259
|
3259
|
return "error : ".$e->getMessage(); |
3260
|
3260
|
} |
3261
|
3261
|
} |
|
@@ -3272,7 +3272,7 @@ discard block |
|
|
block discarded – undo |
3272
|
3272
|
$Connection = new Connection(); |
3273
|
3273
|
$sth = $Connection->db->prepare($query); |
3274
|
3274
|
$sth->execute(); |
3275
|
|
- } catch(PDOException $e) { |
|
3275
|
+ } catch (PDOException $e) { |
3276
|
3276
|
return "error : ".$e->getMessage(); |
3277
|
3277
|
} |
3278
|
3278
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3287,7 +3287,7 @@ discard block |
|
|
block discarded – undo |
3287
|
3287
|
$Connection = new Connection(); |
3288
|
3288
|
$sth = $Connection->db->prepare($query); |
3289
|
3289
|
$sth->execute(); |
3290
|
|
- } catch(PDOException $e) { |
|
3290
|
+ } catch (PDOException $e) { |
3291
|
3291
|
return "error : ".$e->getMessage(); |
3292
|
3292
|
} |
3293
|
3293
|
} |
|
@@ -3298,7 +3298,7 @@ discard block |
|
|
block discarded – undo |
3298
|
3298
|
$Connection = new Connection(); |
3299
|
3299
|
$sth = $Connection->db->prepare($query); |
3300
|
3300
|
$sth->execute(array(':version' => $version)); |
3301
|
|
- } catch(PDOException $e) { |
|
3301
|
+ } catch (PDOException $e) { |
3302
|
3302
|
return "error : ".$e->getMessage(); |
3303
|
3303
|
} |
3304
|
3304
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3312,7 +3312,7 @@ discard block |
|
|
block discarded – undo |
3312
|
3312
|
$Connection = new Connection(); |
3313
|
3313
|
$sth = $Connection->db->prepare($query); |
3314
|
3314
|
$sth->execute(array(':version' => $version)); |
3315
|
|
- } catch(PDOException $e) { |
|
3315
|
+ } catch (PDOException $e) { |
3316
|
3316
|
return "error : ".$e->getMessage(); |
3317
|
3317
|
} |
3318
|
3318
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3326,7 +3326,7 @@ discard block |
|
|
block discarded – undo |
3326
|
3326
|
$Connection = new Connection(); |
3327
|
3327
|
$sth = $Connection->db->prepare($query); |
3328
|
3328
|
$sth->execute(array(':version' => $version)); |
3329
|
|
- } catch(PDOException $e) { |
|
3329
|
+ } catch (PDOException $e) { |
3330
|
3330
|
return "error : ".$e->getMessage(); |
3331
|
3331
|
} |
3332
|
3332
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3340,7 +3340,7 @@ discard block |
|
|
block discarded – undo |
3340
|
3340
|
$Connection = new Connection(); |
3341
|
3341
|
$sth = $Connection->db->prepare($query); |
3342
|
3342
|
$sth->execute(array(':version' => $version)); |
3343
|
|
- } catch(PDOException $e) { |
|
3343
|
+ } catch (PDOException $e) { |
3344
|
3344
|
return "error : ".$e->getMessage(); |
3345
|
3345
|
} |
3346
|
3346
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3353,7 +3353,7 @@ discard block |
|
|
block discarded – undo |
3353
|
3353
|
$Connection = new Connection(); |
3354
|
3354
|
$sth = $Connection->db->prepare($query); |
3355
|
3355
|
$sth->execute(array(':version' => $version)); |
3356
|
|
- } catch(PDOException $e) { |
|
3356
|
+ } catch (PDOException $e) { |
3357
|
3357
|
return "error : ".$e->getMessage(); |
3358
|
3358
|
} |
3359
|
3359
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3367,7 +3367,7 @@ discard block |
|
|
block discarded – undo |
3367
|
3367
|
$Connection = new Connection(); |
3368
|
3368
|
$sth = $Connection->db->prepare($query); |
3369
|
3369
|
$sth->execute(array(':version' => $version)); |
3370
|
|
- } catch(PDOException $e) { |
|
3370
|
+ } catch (PDOException $e) { |
3371
|
3371
|
return "error : ".$e->getMessage(); |
3372
|
3372
|
} |
3373
|
3373
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3381,7 +3381,7 @@ discard block |
|
|
block discarded – undo |
3381
|
3381
|
$Connection = new Connection(); |
3382
|
3382
|
$sth = $Connection->db->prepare($query); |
3383
|
3383
|
$sth->execute(array(':version' => $version)); |
3384
|
|
- } catch(PDOException $e) { |
|
3384
|
+ } catch (PDOException $e) { |
3385
|
3385
|
return "error : ".$e->getMessage(); |
3386
|
3386
|
} |
3387
|
3387
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3396,7 +3396,7 @@ discard block |
|
|
block discarded – undo |
3396
|
3396
|
$Connection = new Connection(); |
3397
|
3397
|
$sth = $Connection->db->prepare($query); |
3398
|
3398
|
$sth->execute(array(':version' => $version)); |
3399
|
|
- } catch(PDOException $e) { |
|
3399
|
+ } catch (PDOException $e) { |
3400
|
3400
|
return "error : ".$e->getMessage(); |
3401
|
3401
|
} |
3402
|
3402
|
} |
|
@@ -3408,7 +3408,7 @@ discard block |
|
|
block discarded – undo |
3408
|
3408
|
$Connection = new Connection(); |
3409
|
3409
|
$sth = $Connection->db->prepare($query); |
3410
|
3410
|
$sth->execute(array(':version' => $version)); |
3411
|
|
- } catch(PDOException $e) { |
|
3411
|
+ } catch (PDOException $e) { |
3412
|
3412
|
return "error : ".$e->getMessage(); |
3413
|
3413
|
} |
3414
|
3414
|
} |
|
@@ -3420,7 +3420,7 @@ discard block |
|
|
block discarded – undo |
3420
|
3420
|
$Connection = new Connection(); |
3421
|
3421
|
$sth = $Connection->db->prepare($query); |
3422
|
3422
|
$sth->execute(array(':version' => $version)); |
3423
|
|
- } catch(PDOException $e) { |
|
3423
|
+ } catch (PDOException $e) { |
3424
|
3424
|
return "error : ".$e->getMessage(); |
3425
|
3425
|
} |
3426
|
3426
|
} |
|
@@ -3432,7 +3432,7 @@ discard block |
|
|
block discarded – undo |
3432
|
3432
|
$Connection = new Connection(); |
3433
|
3433
|
$sth = $Connection->db->prepare($query); |
3434
|
3434
|
$sth->execute(array(':version' => $version)); |
3435
|
|
- } catch(PDOException $e) { |
|
3435
|
+ } catch (PDOException $e) { |
3436
|
3436
|
return "error : ".$e->getMessage(); |
3437
|
3437
|
} |
3438
|
3438
|
} |
|
@@ -3444,7 +3444,7 @@ discard block |
|
|
block discarded – undo |
3444
|
3444
|
$Connection = new Connection(); |
3445
|
3445
|
$sth = $Connection->db->prepare($query); |
3446
|
3446
|
$sth->execute(array(':version' => $version)); |
3447
|
|
- } catch(PDOException $e) { |
|
3447
|
+ } catch (PDOException $e) { |
3448
|
3448
|
return "error : ".$e->getMessage(); |
3449
|
3449
|
} |
3450
|
3450
|
} |
|
@@ -3456,7 +3456,7 @@ discard block |
|
|
block discarded – undo |
3456
|
3456
|
$Connection = new Connection(); |
3457
|
3457
|
$sth = $Connection->db->prepare($query); |
3458
|
3458
|
$sth->execute(array(':version' => $version)); |
3459
|
|
- } catch(PDOException $e) { |
|
3459
|
+ } catch (PDOException $e) { |
3460
|
3460
|
return "error : ".$e->getMessage(); |
3461
|
3461
|
} |
3462
|
3462
|
} |
|
@@ -3467,7 +3467,7 @@ discard block |
|
|
block discarded – undo |
3467
|
3467
|
$Connection = new Connection(); |
3468
|
3468
|
$sth = $Connection->db->prepare($query); |
3469
|
3469
|
$sth->execute(array(':version' => $version)); |
3470
|
|
- } catch(PDOException $e) { |
|
3470
|
+ } catch (PDOException $e) { |
3471
|
3471
|
return "error : ".$e->getMessage(); |
3472
|
3472
|
} |
3473
|
3473
|
} |
|
@@ -3483,7 +3483,7 @@ discard block |
|
|
block discarded – undo |
3483
|
3483
|
$Connection = new Connection(); |
3484
|
3484
|
$sth = $Connection->db->prepare($query); |
3485
|
3485
|
$sth->execute(); |
3486
|
|
- } catch(PDOException $e) { |
|
3486
|
+ } catch (PDOException $e) { |
3487
|
3487
|
return "error : ".$e->getMessage(); |
3488
|
3488
|
} |
3489
|
3489
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3498,7 +3498,7 @@ discard block |
|
|
block discarded – undo |
3498
|
3498
|
$Connection = new Connection(); |
3499
|
3499
|
$sth = $Connection->db->prepare($query); |
3500
|
3500
|
$sth->execute(); |
3501
|
|
- } catch(PDOException $e) { |
|
3501
|
+ } catch (PDOException $e) { |
3502
|
3502
|
return "error : ".$e->getMessage(); |
3503
|
3503
|
} |
3504
|
3504
|
} |
|
@@ -3514,7 +3514,7 @@ discard block |
|
|
block discarded – undo |
3514
|
3514
|
$Connection = new Connection(); |
3515
|
3515
|
$sth = $Connection->db->prepare($query); |
3516
|
3516
|
$sth->execute(); |
3517
|
|
- } catch(PDOException $e) { |
|
3517
|
+ } catch (PDOException $e) { |
3518
|
3518
|
return "error : ".$e->getMessage(); |
3519
|
3519
|
} |
3520
|
3520
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3529,7 +3529,7 @@ discard block |
|
|
block discarded – undo |
3529
|
3529
|
$Connection = new Connection(); |
3530
|
3530
|
$sth = $Connection->db->prepare($query); |
3531
|
3531
|
$sth->execute(); |
3532
|
|
- } catch(PDOException $e) { |
|
3532
|
+ } catch (PDOException $e) { |
3533
|
3533
|
return "error : ".$e->getMessage(); |
3534
|
3534
|
} |
3535
|
3535
|
} |
|
@@ -3545,7 +3545,7 @@ discard block |
|
|
block discarded – undo |
3545
|
3545
|
$Connection = new Connection(); |
3546
|
3546
|
$sth = $Connection->db->prepare($query); |
3547
|
3547
|
$sth->execute(); |
3548
|
|
- } catch(PDOException $e) { |
|
3548
|
+ } catch (PDOException $e) { |
3549
|
3549
|
return "error : ".$e->getMessage(); |
3550
|
3550
|
} |
3551
|
3551
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3560,7 +3560,7 @@ discard block |
|
|
block discarded – undo |
3560
|
3560
|
$Connection = new Connection(); |
3561
|
3561
|
$sth = $Connection->db->prepare($query); |
3562
|
3562
|
$sth->execute(); |
3563
|
|
- } catch(PDOException $e) { |
|
3563
|
+ } catch (PDOException $e) { |
3564
|
3564
|
return "error : ".$e->getMessage(); |
3565
|
3565
|
} |
3566
|
3566
|
} |
|
@@ -3576,7 +3576,7 @@ discard block |
|
|
block discarded – undo |
3576
|
3576
|
$Connection = new Connection(); |
3577
|
3577
|
$sth = $Connection->db->prepare($query); |
3578
|
3578
|
$sth->execute(); |
3579
|
|
- } catch(PDOException $e) { |
|
3579
|
+ } catch (PDOException $e) { |
3580
|
3580
|
return "error : ".$e->getMessage(); |
3581
|
3581
|
} |
3582
|
3582
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3591,7 +3591,7 @@ discard block |
|
|
block discarded – undo |
3591
|
3591
|
$Connection = new Connection(); |
3592
|
3592
|
$sth = $Connection->db->prepare($query); |
3593
|
3593
|
$sth->execute(); |
3594
|
|
- } catch(PDOException $e) { |
|
3594
|
+ } catch (PDOException $e) { |
3595
|
3595
|
return "error : ".$e->getMessage(); |
3596
|
3596
|
} |
3597
|
3597
|
} |
|
@@ -3607,7 +3607,7 @@ discard block |
|
|
block discarded – undo |
3607
|
3607
|
$Connection = new Connection(); |
3608
|
3608
|
$sth = $Connection->db->prepare($query); |
3609
|
3609
|
$sth->execute(); |
3610
|
|
- } catch(PDOException $e) { |
|
3610
|
+ } catch (PDOException $e) { |
3611
|
3611
|
return "error : ".$e->getMessage(); |
3612
|
3612
|
} |
3613
|
3613
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3622,7 +3622,7 @@ discard block |
|
|
block discarded – undo |
3622
|
3622
|
$Connection = new Connection(); |
3623
|
3623
|
$sth = $Connection->db->prepare($query); |
3624
|
3624
|
$sth->execute(); |
3625
|
|
- } catch(PDOException $e) { |
|
3625
|
+ } catch (PDOException $e) { |
3626
|
3626
|
return "error : ".$e->getMessage(); |
3627
|
3627
|
} |
3628
|
3628
|
} |
|
@@ -3638,7 +3638,7 @@ discard block |
|
|
block discarded – undo |
3638
|
3638
|
$Connection = new Connection(); |
3639
|
3639
|
$sth = $Connection->db->prepare($query); |
3640
|
3640
|
$sth->execute(); |
3641
|
|
- } catch(PDOException $e) { |
|
3641
|
+ } catch (PDOException $e) { |
3642
|
3642
|
return "error : ".$e->getMessage(); |
3643
|
3643
|
} |
3644
|
3644
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3653,7 +3653,7 @@ discard block |
|
|
block discarded – undo |
3653
|
3653
|
$Connection = new Connection(); |
3654
|
3654
|
$sth = $Connection->db->prepare($query); |
3655
|
3655
|
$sth->execute(); |
3656
|
|
- } catch(PDOException $e) { |
|
3656
|
+ } catch (PDOException $e) { |
3657
|
3657
|
return "error : ".$e->getMessage(); |
3658
|
3658
|
} |
3659
|
3659
|
} |
|
@@ -3669,7 +3669,7 @@ discard block |
|
|
block discarded – undo |
3669
|
3669
|
$Connection = new Connection(); |
3670
|
3670
|
$sth = $Connection->db->prepare($query); |
3671
|
3671
|
$sth->execute(); |
3672
|
|
- } catch(PDOException $e) { |
|
3672
|
+ } catch (PDOException $e) { |
3673
|
3673
|
return "error : ".$e->getMessage(); |
3674
|
3674
|
} |
3675
|
3675
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3684,7 +3684,7 @@ discard block |
|
|
block discarded – undo |
3684
|
3684
|
$Connection = new Connection(); |
3685
|
3685
|
$sth = $Connection->db->prepare($query); |
3686
|
3686
|
$sth->execute(); |
3687
|
|
- } catch(PDOException $e) { |
|
3687
|
+ } catch (PDOException $e) { |
3688
|
3688
|
return "error : ".$e->getMessage(); |
3689
|
3689
|
} |
3690
|
3690
|
} |
|
@@ -3700,7 +3700,7 @@ discard block |
|
|
block discarded – undo |
3700
|
3700
|
$Connection = new Connection(); |
3701
|
3701
|
$sth = $Connection->db->prepare($query); |
3702
|
3702
|
$sth->execute(); |
3703
|
|
- } catch(PDOException $e) { |
|
3703
|
+ } catch (PDOException $e) { |
3704
|
3704
|
return "error : ".$e->getMessage(); |
3705
|
3705
|
} |
3706
|
3706
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3715,7 +3715,7 @@ discard block |
|
|
block discarded – undo |
3715
|
3715
|
$Connection = new Connection(); |
3716
|
3716
|
$sth = $Connection->db->prepare($query); |
3717
|
3717
|
$sth->execute(); |
3718
|
|
- } catch(PDOException $e) { |
|
3718
|
+ } catch (PDOException $e) { |
3719
|
3719
|
return "error : ".$e->getMessage(); |
3720
|
3720
|
} |
3721
|
3721
|
} |
|
@@ -3731,7 +3731,7 @@ discard block |
|
|
block discarded – undo |
3731
|
3731
|
$Connection = new Connection(); |
3732
|
3732
|
$sth = $Connection->db->prepare($query); |
3733
|
3733
|
$sth->execute(); |
3734
|
|
- } catch(PDOException $e) { |
|
3734
|
+ } catch (PDOException $e) { |
3735
|
3735
|
return "error : ".$e->getMessage(); |
3736
|
3736
|
} |
3737
|
3737
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3746,7 +3746,7 @@ discard block |
|
|
block discarded – undo |
3746
|
3746
|
$Connection = new Connection(); |
3747
|
3747
|
$sth = $Connection->db->prepare($query); |
3748
|
3748
|
$sth->execute(); |
3749
|
|
- } catch(PDOException $e) { |
|
3749
|
+ } catch (PDOException $e) { |
3750
|
3750
|
return "error : ".$e->getMessage(); |
3751
|
3751
|
} |
3752
|
3752
|
} |
|
@@ -3762,7 +3762,7 @@ discard block |
|
|
block discarded – undo |
3762
|
3762
|
$Connection = new Connection(); |
3763
|
3763
|
$sth = $Connection->db->prepare($query); |
3764
|
3764
|
$sth->execute(); |
3765
|
|
- } catch(PDOException $e) { |
|
3765
|
+ } catch (PDOException $e) { |
3766
|
3766
|
return "error : ".$e->getMessage(); |
3767
|
3767
|
} |
3768
|
3768
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3777,7 +3777,7 @@ discard block |
|
|
block discarded – undo |
3777
|
3777
|
$Connection = new Connection(); |
3778
|
3778
|
$sth = $Connection->db->prepare($query); |
3779
|
3779
|
$sth->execute(); |
3780
|
|
- } catch(PDOException $e) { |
|
3780
|
+ } catch (PDOException $e) { |
3781
|
3781
|
return "error : ".$e->getMessage(); |
3782
|
3782
|
} |
3783
|
3783
|
} |
|
@@ -3793,7 +3793,7 @@ discard block |
|
|
block discarded – undo |
3793
|
3793
|
$Connection = new Connection(); |
3794
|
3794
|
$sth = $Connection->db->prepare($query); |
3795
|
3795
|
$sth->execute(); |
3796
|
|
- } catch(PDOException $e) { |
|
3796
|
+ } catch (PDOException $e) { |
3797
|
3797
|
return "error : ".$e->getMessage(); |
3798
|
3798
|
} |
3799
|
3799
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3812,7 +3812,7 @@ discard block |
|
|
block discarded – undo |
3812
|
3812
|
$Connection = new Connection(); |
3813
|
3813
|
$sth = $Connection->db->prepare($query); |
3814
|
3814
|
$sth->execute(); |
3815
|
|
- } catch(PDOException $e) { |
|
3815
|
+ } catch (PDOException $e) { |
3816
|
3816
|
return "error : ".$e->getMessage(); |
3817
|
3817
|
} |
3818
|
3818
|
$row = $sth->fetch(PDO::FETCH_ASSOC); |
|
@@ -3827,7 +3827,7 @@ discard block |
|
|
block discarded – undo |
3827
|
3827
|
$Connection = new Connection(); |
3828
|
3828
|
$sth = $Connection->db->prepare($query); |
3829
|
3829
|
$sth->execute(); |
3830
|
|
- } catch(PDOException $e) { |
|
3830
|
+ } catch (PDOException $e) { |
3831
|
3831
|
return "error : ".$e->getMessage(); |
3832
|
3832
|
} |
3833
|
3833
|
} |
|
@@ -3839,7 +3839,7 @@ discard block |
|
|
block discarded – undo |
3839
|
3839
|
$Connection = new Connection(); |
3840
|
3840
|
$sth = $Connection->db->prepare($query); |
3841
|
3841
|
$sth->execute(); |
3842
|
|
- } catch(PDOException $e) { |
|
3842
|
+ } catch (PDOException $e) { |
3843
|
3843
|
return "error : ".$e->getMessage(); |
3844
|
3844
|
} |
3845
|
3845
|
} |
|
@@ -3855,7 +3855,7 @@ discard block |
|
|
block discarded – undo |
3855
|
3855
|
$Connection = new Connection(); |
3856
|
3856
|
$sth = $Connection->db->prepare($query); |
3857
|
3857
|
$sth->execute(); |
3858
|
|
- } catch(PDOException $e) { |
|
3858
|
+ } catch (PDOException $e) { |
3859
|
3859
|
return "error : ".$e->getMessage(); |
3860
|
3860
|
} |
3861
|
3861
|
} |
|
@@ -3870,7 +3870,7 @@ discard block |
|
|
block discarded – undo |
3870
|
3870
|
$Connection = new Connection(); |
3871
|
3871
|
$sth = $Connection->db->prepare($query); |
3872
|
3872
|
$sth->execute(); |
3873
|
|
- } catch(PDOException $e) { |
|
3873
|
+ } catch (PDOException $e) { |
3874
|
3874
|
return "error : ".$e->getMessage(); |
3875
|
3875
|
} |
3876
|
3876
|
} |