@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | curl_setopt($ch, CURLOPT_URL, $url); |
18 | 18 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
19 | 19 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
20 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
20 | + if ($referer != '') { |
|
21 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
22 | + } |
|
21 | 23 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
22 | 24 | curl_setopt($ch, CURLOPT_FILE, $fp); |
23 | 25 | curl_exec($ch); |
@@ -28,12 +30,16 @@ discard block |
||
28 | 30 | public static function gunzip($in_file,$out_file_name = '') { |
29 | 31 | //echo $in_file.' -> '.$out_file_name."\n"; |
30 | 32 | $buffer_size = 4096; // read 4kb at a time |
31 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
33 | + if ($out_file_name == '') { |
|
34 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
35 | + } |
|
32 | 36 | if ($in_file != '' && file_exists($in_file)) { |
33 | 37 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
34 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
35 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
36 | - else { |
|
38 | + if (function_exists('gzopen')) { |
|
39 | + $file = gzopen($in_file,'rb'); |
|
40 | + } elseif (function_exists('gzopen64')) { |
|
41 | + $file = gzopen64($in_file,'rb'); |
|
42 | + } else { |
|
37 | 43 | echo 'gzopen not available'; |
38 | 44 | die; |
39 | 45 | } |
@@ -54,8 +60,12 @@ discard block |
||
54 | 60 | if ($res === TRUE) { |
55 | 61 | $zip->extractTo($path); |
56 | 62 | $zip->close(); |
57 | - } else return false; |
|
58 | - } else return false; |
|
63 | + } else { |
|
64 | + return false; |
|
65 | + } |
|
66 | + } else { |
|
67 | + return false; |
|
68 | + } |
|
59 | 69 | } |
60 | 70 | |
61 | 71 | public static function connect_sqlite($database) { |
@@ -70,7 +80,9 @@ discard block |
||
70 | 80 | public static function retrieve_route_sqlite_to_dest($database_file) { |
71 | 81 | global $globalDebug, $globalTransaction; |
72 | 82 | //$query = 'TRUNCATE TABLE routes'; |
73 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
83 | + if ($globalDebug) { |
|
84 | + echo " - Delete previous routes from DB -"; |
|
85 | + } |
|
74 | 86 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
75 | 87 | $Connection = new Connection(); |
76 | 88 | try { |
@@ -81,7 +93,9 @@ discard block |
||
81 | 93 | return "error : ".$e->getMessage(); |
82 | 94 | } |
83 | 95 | |
84 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
96 | + if ($globalDebug) { |
|
97 | + echo " - Add routes to DB -"; |
|
98 | + } |
|
85 | 99 | update_db::connect_sqlite($database_file); |
86 | 100 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
87 | 101 | $query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID"; |
@@ -96,15 +110,21 @@ discard block |
||
96 | 110 | $Connection = new Connection(); |
97 | 111 | $sth_dest = $Connection->db->prepare($query_dest); |
98 | 112 | try { |
99 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
113 | + if ($globalTransaction) { |
|
114 | + $Connection->db->beginTransaction(); |
|
115 | + } |
|
100 | 116 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
101 | 117 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
102 | 118 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
103 | 119 | $sth_dest->execute($query_dest_values); |
104 | 120 | } |
105 | - if ($globalTransaction) $Connection->db->commit(); |
|
121 | + if ($globalTransaction) { |
|
122 | + $Connection->db->commit(); |
|
123 | + } |
|
106 | 124 | } catch(PDOException $e) { |
107 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
125 | + if ($globalTransaction) { |
|
126 | + $Connection->db->rollBack(); |
|
127 | + } |
|
108 | 128 | return "error : ".$e->getMessage(); |
109 | 129 | } |
110 | 130 | return ''; |
@@ -112,7 +132,9 @@ discard block |
||
112 | 132 | public static function retrieve_route_oneworld($database_file) { |
113 | 133 | global $globalDebug, $globalTransaction; |
114 | 134 | //$query = 'TRUNCATE TABLE routes'; |
115 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
135 | + if ($globalDebug) { |
|
136 | + echo " - Delete previous routes from DB -"; |
|
137 | + } |
|
116 | 138 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
117 | 139 | $Connection = new Connection(); |
118 | 140 | try { |
@@ -123,14 +145,18 @@ discard block |
||
123 | 145 | return "error : ".$e->getMessage(); |
124 | 146 | } |
125 | 147 | |
126 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
148 | + if ($globalDebug) { |
|
149 | + echo " - Add routes to DB -"; |
|
150 | + } |
|
127 | 151 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
128 | 152 | $Spotter = new Spotter(); |
129 | 153 | if ($fh = fopen($database_file,"r")) { |
130 | 154 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
131 | 155 | $Connection = new Connection(); |
132 | 156 | $sth_dest = $Connection->db->prepare($query_dest); |
133 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
157 | + if ($globalTransaction) { |
|
158 | + $Connection->db->beginTransaction(); |
|
159 | + } |
|
134 | 160 | while (!feof($fh)) { |
135 | 161 | $line = fgetcsv($fh,9999,','); |
136 | 162 | if ($line[0] != '') { |
@@ -139,13 +165,17 @@ discard block |
||
139 | 165 | $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
140 | 166 | $sth_dest->execute($query_dest_values); |
141 | 167 | } catch(PDOException $e) { |
142 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
168 | + if ($globalTransaction) { |
|
169 | + $Connection->db->rollBack(); |
|
170 | + } |
|
143 | 171 | return "error : ".$e->getMessage(); |
144 | 172 | } |
145 | 173 | } |
146 | 174 | } |
147 | 175 | } |
148 | - if ($globalTransaction) $Connection->db->commit(); |
|
176 | + if ($globalTransaction) { |
|
177 | + $Connection->db->commit(); |
|
178 | + } |
|
149 | 179 | } |
150 | 180 | return ''; |
151 | 181 | } |
@@ -153,7 +183,9 @@ discard block |
||
153 | 183 | public static function retrieve_route_skyteam($database_file) { |
154 | 184 | global $globalDebug, $globalTransaction; |
155 | 185 | //$query = 'TRUNCATE TABLE routes'; |
156 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
186 | + if ($globalDebug) { |
|
187 | + echo " - Delete previous routes from DB -"; |
|
188 | + } |
|
157 | 189 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
158 | 190 | $Connection = new Connection(); |
159 | 191 | try { |
@@ -164,7 +196,9 @@ discard block |
||
164 | 196 | return "error : ".$e->getMessage(); |
165 | 197 | } |
166 | 198 | |
167 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
199 | + if ($globalDebug) { |
|
200 | + echo " - Add routes to DB -"; |
|
201 | + } |
|
168 | 202 | |
169 | 203 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
170 | 204 | $Spotter = new Spotter(); |
@@ -173,7 +207,9 @@ discard block |
||
173 | 207 | $Connection = new Connection(); |
174 | 208 | $sth_dest = $Connection->db->prepare($query_dest); |
175 | 209 | try { |
176 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
210 | + if ($globalTransaction) { |
|
211 | + $Connection->db->beginTransaction(); |
|
212 | + } |
|
177 | 213 | while (!feof($fh)) { |
178 | 214 | $line = fgetcsv($fh,9999,','); |
179 | 215 | if ($line[0] != '') { |
@@ -184,9 +220,13 @@ discard block |
||
184 | 220 | } |
185 | 221 | } |
186 | 222 | } |
187 | - if ($globalTransaction) $Connection->db->commit(); |
|
223 | + if ($globalTransaction) { |
|
224 | + $Connection->db->commit(); |
|
225 | + } |
|
188 | 226 | } catch(PDOException $e) { |
189 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
227 | + if ($globalTransaction) { |
|
228 | + $Connection->db->rollBack(); |
|
229 | + } |
|
190 | 230 | return "error : ".$e->getMessage(); |
191 | 231 | } |
192 | 232 | } |
@@ -229,11 +269,16 @@ discard block |
||
229 | 269 | $sth_dest = $Connection->db->prepare($query_dest); |
230 | 270 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
231 | 271 | try { |
232 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
272 | + if ($globalTransaction) { |
|
273 | + $Connection->db->beginTransaction(); |
|
274 | + } |
|
233 | 275 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
234 | 276 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
235 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
236 | - else $type = null; |
|
277 | + if ($values['UserString4'] == 'M') { |
|
278 | + $type = 'military'; |
|
279 | + } else { |
|
280 | + $type = null; |
|
281 | + } |
|
237 | 282 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
238 | 283 | $sth_dest->execute($query_dest_values); |
239 | 284 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -241,7 +286,9 @@ discard block |
||
241 | 286 | $sth_dest_owner->execute($query_dest_owner_values); |
242 | 287 | } |
243 | 288 | } |
244 | - if ($globalTransaction) $Connection->db->commit(); |
|
289 | + if ($globalTransaction) { |
|
290 | + $Connection->db->commit(); |
|
291 | + } |
|
245 | 292 | } catch(PDOException $e) { |
246 | 293 | return "error : ".$e->getMessage(); |
247 | 294 | } |
@@ -278,7 +325,9 @@ discard block |
||
278 | 325 | $Connection = new Connection(); |
279 | 326 | $sth_dest = $Connection->db->prepare($query_dest); |
280 | 327 | try { |
281 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
328 | + if ($globalTransaction) { |
|
329 | + $Connection->db->beginTransaction(); |
|
330 | + } |
|
282 | 331 | while (!feof($fh)) { |
283 | 332 | $values = array(); |
284 | 333 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -289,7 +338,9 @@ discard block |
||
289 | 338 | // Check if we can find ICAO, else set it to GLID |
290 | 339 | $aircraft_name_split = explode(' ',$aircraft_name); |
291 | 340 | $search_more = ''; |
292 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
341 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
342 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
343 | + } |
|
293 | 344 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
294 | 345 | $sth_search = $Connection->db->prepare($query_search); |
295 | 346 | try { |
@@ -302,7 +353,9 @@ discard block |
||
302 | 353 | } catch(PDOException $e) { |
303 | 354 | return "error : ".$e->getMessage(); |
304 | 355 | } |
305 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
356 | + if (!isset($values['ICAOTypeCode'])) { |
|
357 | + $values['ICAOTypeCode'] = 'GLID'; |
|
358 | + } |
|
306 | 359 | // Add data to db |
307 | 360 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
308 | 361 | //$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']); |
@@ -311,7 +364,9 @@ discard block |
||
311 | 364 | $sth_dest->execute($query_dest_values); |
312 | 365 | } |
313 | 366 | } |
314 | - if ($globalTransaction) $Connection->db->commit(); |
|
367 | + if ($globalTransaction) { |
|
368 | + $Connection->db->commit(); |
|
369 | + } |
|
315 | 370 | } catch(PDOException $e) { |
316 | 371 | return "error : ".$e->getMessage(); |
317 | 372 | } |
@@ -347,7 +402,9 @@ discard block |
||
347 | 402 | $Connection = new Connection(); |
348 | 403 | $sth_dest = $Connection->db->prepare($query_dest); |
349 | 404 | try { |
350 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
405 | + if ($globalTransaction) { |
|
406 | + $Connection->db->beginTransaction(); |
|
407 | + } |
|
351 | 408 | $tmp = fgetcsv($fh,9999,',',"'"); |
352 | 409 | while (!feof($fh)) { |
353 | 410 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -361,13 +418,17 @@ discard block |
||
361 | 418 | // Check if we can find ICAO, else set it to GLID |
362 | 419 | $aircraft_name_split = explode(' ',$aircraft_name); |
363 | 420 | $search_more = ''; |
364 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
421 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
422 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
423 | + } |
|
365 | 424 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
366 | 425 | $sth_search = $Connection->db->prepare($query_search); |
367 | 426 | try { |
368 | 427 | $sth_search->execute(); |
369 | 428 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
370 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
429 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
430 | + $values['ICAOTypeCode'] = $result['icao']; |
|
431 | + } |
|
371 | 432 | } catch(PDOException $e) { |
372 | 433 | return "error : ".$e->getMessage(); |
373 | 434 | } |
@@ -380,7 +441,9 @@ discard block |
||
380 | 441 | $sth_dest->execute($query_dest_values); |
381 | 442 | } |
382 | 443 | } |
383 | - if ($globalTransaction) $Connection->db->commit(); |
|
444 | + if ($globalTransaction) { |
|
445 | + $Connection->db->commit(); |
|
446 | + } |
|
384 | 447 | } catch(PDOException $e) { |
385 | 448 | return "error : ".$e->getMessage(); |
386 | 449 | } |
@@ -419,7 +482,9 @@ discard block |
||
419 | 482 | $sth_dest = $Connection->db->prepare($query_dest); |
420 | 483 | $sth_modes = $Connection->db->prepare($query_modes); |
421 | 484 | try { |
422 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
485 | + if ($globalTransaction) { |
|
486 | + $Connection->db->beginTransaction(); |
|
487 | + } |
|
423 | 488 | $tmp = fgetcsv($fh,9999,',','"'); |
424 | 489 | while (!feof($fh)) { |
425 | 490 | $line = fgetcsv($fh,9999,',','"'); |
@@ -429,16 +494,22 @@ discard block |
||
429 | 494 | $values['registration'] = $line[0]; |
430 | 495 | $values['base'] = $line[4]; |
431 | 496 | $values['owner'] = $line[5]; |
432 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
433 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
497 | + if ($line[6] == '') { |
|
498 | + $values['date_first_reg'] = null; |
|
499 | + } else { |
|
500 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
501 | + } |
|
434 | 502 | $values['cancel'] = $line[7]; |
435 | 503 | } elseif ($country == 'EI') { |
436 | 504 | // TODO : add modeS & reg to aircraft_modes |
437 | 505 | $values['registration'] = $line[0]; |
438 | 506 | $values['base'] = $line[3]; |
439 | 507 | $values['owner'] = $line[2]; |
440 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
441 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
508 | + if ($line[1] == '') { |
|
509 | + $values['date_first_reg'] = null; |
|
510 | + } else { |
|
511 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
512 | + } |
|
442 | 513 | $values['cancel'] = ''; |
443 | 514 | $values['modes'] = $line[7]; |
444 | 515 | $values['icao'] = $line[8]; |
@@ -457,16 +528,22 @@ discard block |
||
457 | 528 | $values['registration'] = $line[3]; |
458 | 529 | $values['base'] = null; |
459 | 530 | $values['owner'] = $line[5]; |
460 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
461 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
531 | + if ($line[18] == '') { |
|
532 | + $values['date_first_reg'] = null; |
|
533 | + } else { |
|
534 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
535 | + } |
|
462 | 536 | $values['cancel'] = ''; |
463 | 537 | } elseif ($country == 'VH') { |
464 | 538 | // TODO : add modeS & reg to aircraft_modes |
465 | 539 | $values['registration'] = $line[0]; |
466 | 540 | $values['base'] = null; |
467 | 541 | $values['owner'] = $line[12]; |
468 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
469 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
542 | + if ($line[28] == '') { |
|
543 | + $values['date_first_reg'] = null; |
|
544 | + } else { |
|
545 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
546 | + } |
|
470 | 547 | |
471 | 548 | $values['cancel'] = $line[39]; |
472 | 549 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -485,29 +562,41 @@ discard block |
||
485 | 562 | $values['registration'] = $line[0]; |
486 | 563 | $values['base'] = null; |
487 | 564 | $values['owner'] = $line[8]; |
488 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
489 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
565 | + if ($line[7] == '') { |
|
566 | + $values['date_first_reg'] = null; |
|
567 | + } else { |
|
568 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
569 | + } |
|
490 | 570 | $values['cancel'] = ''; |
491 | 571 | } elseif ($country == 'PP') { |
492 | 572 | $values['registration'] = $line[0]; |
493 | 573 | $values['base'] = null; |
494 | 574 | $values['owner'] = $line[4]; |
495 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
496 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
575 | + if ($line[6] == '') { |
|
576 | + $values['date_first_reg'] = null; |
|
577 | + } else { |
|
578 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
579 | + } |
|
497 | 580 | $values['cancel'] = $line[7]; |
498 | 581 | } elseif ($country == 'E7') { |
499 | 582 | $values['registration'] = $line[0]; |
500 | 583 | $values['base'] = null; |
501 | 584 | $values['owner'] = $line[4]; |
502 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
503 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
585 | + if ($line[5] == '') { |
|
586 | + $values['date_first_reg'] = null; |
|
587 | + } else { |
|
588 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
589 | + } |
|
504 | 590 | $values['cancel'] = ''; |
505 | 591 | } elseif ($country == '8Q') { |
506 | 592 | $values['registration'] = $line[0]; |
507 | 593 | $values['base'] = null; |
508 | 594 | $values['owner'] = $line[3]; |
509 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
510 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
595 | + if ($line[7] == '') { |
|
596 | + $values['date_first_reg'] = null; |
|
597 | + } else { |
|
598 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
599 | + } |
|
511 | 600 | $values['cancel'] = ''; |
512 | 601 | } elseif ($country == 'ZK') { |
513 | 602 | $values['registration'] = $line[0]; |
@@ -552,7 +641,9 @@ discard block |
||
552 | 641 | $sth_modes->execute($query_modes_values); |
553 | 642 | } |
554 | 643 | } |
555 | - if ($globalTransaction) $Connection->db->commit(); |
|
644 | + if ($globalTransaction) { |
|
645 | + $Connection->db->commit(); |
|
646 | + } |
|
556 | 647 | } catch(PDOException $e) { |
557 | 648 | return "error : ".$e->getMessage(); |
558 | 649 | } |
@@ -688,25 +779,45 @@ discard block |
||
688 | 779 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
689 | 780 | $Connection = new Connection(); |
690 | 781 | $sth_dest = $Connection->db->prepare($query_dest); |
691 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
782 | + if ($globalTransaction) { |
|
783 | + $Connection->db->beginTransaction(); |
|
784 | + } |
|
692 | 785 | |
693 | 786 | $i = 0; |
694 | 787 | while($row = sparql_fetch_array($result)) |
695 | 788 | { |
696 | 789 | if ($i >= 1) { |
697 | 790 | //print_r($row); |
698 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
699 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
700 | - if (!isset($row['type'])) $row['type'] = ''; |
|
701 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
791 | + if (!isset($row['iata'])) { |
|
792 | + $row['iata'] = ''; |
|
793 | + } |
|
794 | + if (!isset($row['icao'])) { |
|
795 | + $row['icao'] = ''; |
|
796 | + } |
|
797 | + if (!isset($row['type'])) { |
|
798 | + $row['type'] = ''; |
|
799 | + } |
|
800 | + if (!isset($row['altitude'])) { |
|
801 | + $row['altitude'] = ''; |
|
802 | + } |
|
702 | 803 | if (isset($row['city_bis'])) { |
703 | 804 | $row['city'] = $row['city_bis']; |
704 | 805 | } |
705 | - if (!isset($row['city'])) $row['city'] = ''; |
|
706 | - if (!isset($row['country'])) $row['country'] = ''; |
|
707 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
708 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
709 | - if (!isset($row['name'])) continue; |
|
806 | + if (!isset($row['city'])) { |
|
807 | + $row['city'] = ''; |
|
808 | + } |
|
809 | + if (!isset($row['country'])) { |
|
810 | + $row['country'] = ''; |
|
811 | + } |
|
812 | + if (!isset($row['homepage'])) { |
|
813 | + $row['homepage'] = ''; |
|
814 | + } |
|
815 | + if (!isset($row['wikipedia_page'])) { |
|
816 | + $row['wikipedia_page'] = ''; |
|
817 | + } |
|
818 | + if (!isset($row['name'])) { |
|
819 | + continue; |
|
820 | + } |
|
710 | 821 | if (!isset($row['image'])) { |
711 | 822 | $row['image'] = ''; |
712 | 823 | $row['image_thumb'] = ''; |
@@ -762,7 +873,9 @@ discard block |
||
762 | 873 | |
763 | 874 | $i++; |
764 | 875 | } |
765 | - if ($globalTransaction) $Connection->db->commit(); |
|
876 | + if ($globalTransaction) { |
|
877 | + $Connection->db->commit(); |
|
878 | + } |
|
766 | 879 | /* |
767 | 880 | echo "Delete duplicate rows...\n"; |
768 | 881 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
@@ -805,7 +918,9 @@ discard block |
||
805 | 918 | $delimiter = ','; |
806 | 919 | $out_file = $tmp_dir.'airports.csv'; |
807 | 920 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
808 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
921 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
922 | + return FALSE; |
|
923 | + } |
|
809 | 924 | echo "Add data from ourairports.com...\n"; |
810 | 925 | |
811 | 926 | $header = NULL; |
@@ -815,8 +930,9 @@ discard block |
||
815 | 930 | //$Connection->db->beginTransaction(); |
816 | 931 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
817 | 932 | { |
818 | - if(!$header) $header = $row; |
|
819 | - else { |
|
933 | + if(!$header) { |
|
934 | + $header = $row; |
|
935 | + } else { |
|
820 | 936 | $data = array(); |
821 | 937 | $data = array_combine($header, $row); |
822 | 938 | try { |
@@ -857,7 +973,9 @@ discard block |
||
857 | 973 | echo "Download data from another free database...\n"; |
858 | 974 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
859 | 975 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
860 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
976 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
977 | + return FALSE; |
|
978 | + } |
|
861 | 979 | update_db::unzip($out_file); |
862 | 980 | $header = NULL; |
863 | 981 | echo "Add data from another free database...\n"; |
@@ -868,8 +986,9 @@ discard block |
||
868 | 986 | //$Connection->db->beginTransaction(); |
869 | 987 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
870 | 988 | { |
871 | - if(!$header) $header = $row; |
|
872 | - else { |
|
989 | + if(!$header) { |
|
990 | + $header = $row; |
|
991 | + } else { |
|
873 | 992 | $data = $row; |
874 | 993 | |
875 | 994 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
@@ -1038,7 +1157,9 @@ discard block |
||
1038 | 1157 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
1039 | 1158 | { |
1040 | 1159 | $i = 0; |
1041 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1160 | + if ($globalTransaction) { |
|
1161 | + $Connection->db->beginTransaction(); |
|
1162 | + } |
|
1042 | 1163 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1043 | 1164 | { |
1044 | 1165 | if ($i > 0) { |
@@ -1051,7 +1172,9 @@ discard block |
||
1051 | 1172 | } |
1052 | 1173 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
1053 | 1174 | if (!empty($result_search)) { |
1054 | - if ($globalDebug) echo '.'; |
|
1175 | + if ($globalDebug) { |
|
1176 | + echo '.'; |
|
1177 | + } |
|
1055 | 1178 | //if ($globalDBdriver == 'mysql') { |
1056 | 1179 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
1057 | 1180 | //} else { |
@@ -1073,8 +1196,12 @@ discard block |
||
1073 | 1196 | } |
1074 | 1197 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
1075 | 1198 | if (!empty($result_search_mfr)) { |
1076 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
1077 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
1199 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
1200 | + $data[16] = $data[23]; |
|
1201 | + } |
|
1202 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
1203 | + $data[16] = $data[15]; |
|
1204 | + } |
|
1078 | 1205 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1079 | 1206 | try { |
1080 | 1207 | $sthf = $Connection->db->prepare($queryf); |
@@ -1085,7 +1212,9 @@ discard block |
||
1085 | 1212 | } |
1086 | 1213 | } |
1087 | 1214 | if (strtotime($data[29]) > time()) { |
1088 | - if ($globalDebug) echo 'i'; |
|
1215 | + if ($globalDebug) { |
|
1216 | + echo 'i'; |
|
1217 | + } |
|
1089 | 1218 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1090 | 1219 | try { |
1091 | 1220 | $sth = $Connection->db->prepare($query); |
@@ -1096,13 +1225,19 @@ discard block |
||
1096 | 1225 | } |
1097 | 1226 | } |
1098 | 1227 | if ($i % 90 == 0) { |
1099 | - if ($globalTransaction) $Connection->db->commit(); |
|
1100 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1228 | + if ($globalTransaction) { |
|
1229 | + $Connection->db->commit(); |
|
1230 | + } |
|
1231 | + if ($globalTransaction) { |
|
1232 | + $Connection->db->beginTransaction(); |
|
1233 | + } |
|
1101 | 1234 | } |
1102 | 1235 | $i++; |
1103 | 1236 | } |
1104 | 1237 | fclose($handle); |
1105 | - if ($globalTransaction) $Connection->db->commit(); |
|
1238 | + if ($globalTransaction) { |
|
1239 | + $Connection->db->commit(); |
|
1240 | + } |
|
1106 | 1241 | } |
1107 | 1242 | //print_r($mfr); |
1108 | 1243 | return ''; |
@@ -1127,11 +1262,15 @@ discard block |
||
1127 | 1262 | $i = 0; |
1128 | 1263 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1129 | 1264 | //$Connection->db->beginTransaction(); |
1130 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1265 | + if ($globalTransaction) { |
|
1266 | + $Connection->db->beginTransaction(); |
|
1267 | + } |
|
1131 | 1268 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1132 | 1269 | { |
1133 | 1270 | if ($i > 0) { |
1134 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
1271 | + if ($data[1] == 'NULL') { |
|
1272 | + $data[1] = $data[0]; |
|
1273 | + } |
|
1135 | 1274 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1136 | 1275 | try { |
1137 | 1276 | $sth = $Connection->db->prepare($query); |
@@ -1143,7 +1282,9 @@ discard block |
||
1143 | 1282 | $i++; |
1144 | 1283 | } |
1145 | 1284 | fclose($handle); |
1146 | - if ($globalTransaction) $Connection->db->commit(); |
|
1285 | + if ($globalTransaction) { |
|
1286 | + $Connection->db->commit(); |
|
1287 | + } |
|
1147 | 1288 | } |
1148 | 1289 | return ''; |
1149 | 1290 | } |
@@ -1164,7 +1305,9 @@ discard block |
||
1164 | 1305 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
1165 | 1306 | { |
1166 | 1307 | $i = 0; |
1167 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1308 | + if ($globalTransaction) { |
|
1309 | + $Connection->db->beginTransaction(); |
|
1310 | + } |
|
1168 | 1311 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1169 | 1312 | { |
1170 | 1313 | if ($i > 0) { |
@@ -1180,7 +1323,9 @@ discard block |
||
1180 | 1323 | $i++; |
1181 | 1324 | } |
1182 | 1325 | fclose($handle); |
1183 | - if ($globalTransaction) $Connection->db->commit(); |
|
1326 | + if ($globalTransaction) { |
|
1327 | + $Connection->db->commit(); |
|
1328 | + } |
|
1184 | 1329 | } |
1185 | 1330 | return ''; |
1186 | 1331 | } |
@@ -1200,7 +1345,9 @@ discard block |
||
1200 | 1345 | if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE) |
1201 | 1346 | { |
1202 | 1347 | $i = 0; |
1203 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1348 | + if ($globalTransaction) { |
|
1349 | + $Connection->db->beginTransaction(); |
|
1350 | + } |
|
1204 | 1351 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1205 | 1352 | { |
1206 | 1353 | if ($i > 0) { |
@@ -1209,13 +1356,17 @@ discard block |
||
1209 | 1356 | $sth = $Connection->db->prepare($query); |
1210 | 1357 | $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')); |
1211 | 1358 | } catch(PDOException $e) { |
1212 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1359 | + if ($globalDebug) { |
|
1360 | + echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1361 | + } |
|
1213 | 1362 | } |
1214 | 1363 | } |
1215 | 1364 | $i++; |
1216 | 1365 | } |
1217 | 1366 | fclose($handle); |
1218 | - if ($globalTransaction) $Connection->db->commit(); |
|
1367 | + if ($globalTransaction) { |
|
1368 | + $Connection->db->commit(); |
|
1369 | + } |
|
1219 | 1370 | } |
1220 | 1371 | return ''; |
1221 | 1372 | } |
@@ -1240,7 +1391,9 @@ discard block |
||
1240 | 1391 | $i = 0; |
1241 | 1392 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1242 | 1393 | //$Connection->db->beginTransaction(); |
1243 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1394 | + if ($globalTransaction) { |
|
1395 | + $Connection->db->beginTransaction(); |
|
1396 | + } |
|
1244 | 1397 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1245 | 1398 | { |
1246 | 1399 | if ($i > 0) { |
@@ -1256,7 +1409,9 @@ discard block |
||
1256 | 1409 | $i++; |
1257 | 1410 | } |
1258 | 1411 | fclose($handle); |
1259 | - if ($globalTransaction) $Connection->db->commit(); |
|
1412 | + if ($globalTransaction) { |
|
1413 | + $Connection->db->commit(); |
|
1414 | + } |
|
1260 | 1415 | } |
1261 | 1416 | return ''; |
1262 | 1417 | } |
@@ -1276,7 +1431,9 @@ discard block |
||
1276 | 1431 | if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE) |
1277 | 1432 | { |
1278 | 1433 | $i = 0; |
1279 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1434 | + if ($globalTransaction) { |
|
1435 | + $Connection->db->beginTransaction(); |
|
1436 | + } |
|
1280 | 1437 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1281 | 1438 | { |
1282 | 1439 | if ($i > 0) { |
@@ -1293,7 +1450,9 @@ discard block |
||
1293 | 1450 | $i++; |
1294 | 1451 | } |
1295 | 1452 | fclose($handle); |
1296 | - if ($globalTransaction) $Connection->db->commit(); |
|
1453 | + if ($globalTransaction) { |
|
1454 | + $Connection->db->commit(); |
|
1455 | + } |
|
1297 | 1456 | } |
1298 | 1457 | return ''; |
1299 | 1458 | } |
@@ -1312,7 +1471,9 @@ discard block |
||
1312 | 1471 | $Connection = new Connection(); |
1313 | 1472 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
1314 | 1473 | { |
1315 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1474 | + if ($globalTransaction) { |
|
1475 | + $Connection->db->beginTransaction(); |
|
1476 | + } |
|
1316 | 1477 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
1317 | 1478 | { |
1318 | 1479 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1327,7 +1488,9 @@ discard block |
||
1327 | 1488 | } |
1328 | 1489 | } |
1329 | 1490 | fclose($handle); |
1330 | - if ($globalTransaction) $Connection->db->commit(); |
|
1491 | + if ($globalTransaction) { |
|
1492 | + $Connection->db->commit(); |
|
1493 | + } |
|
1331 | 1494 | } |
1332 | 1495 | return ''; |
1333 | 1496 | } |
@@ -1403,9 +1566,14 @@ discard block |
||
1403 | 1566 | if ($i > 0 && $data[0] != '') { |
1404 | 1567 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1405 | 1568 | $period = str_replace(',','',$data[14]); |
1406 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1407 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1408 | - else $launch_date = NULL; |
|
1569 | + if (!empty($period) && strpos($period,'days')) { |
|
1570 | + $period = str_replace(' days','',$period)*24*60; |
|
1571 | + } |
|
1572 | + if ($data[18] != '') { |
|
1573 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1574 | + } else { |
|
1575 | + $launch_date = NULL; |
|
1576 | + } |
|
1409 | 1577 | $data = array_map(function($value) { |
1410 | 1578 | return trim($value) === '' ? null : $value; |
1411 | 1579 | }, $data); |
@@ -1755,7 +1923,9 @@ discard block |
||
1755 | 1923 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1756 | 1924 | { |
1757 | 1925 | $i = 0; |
1758 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1926 | + if ($globalTransaction) { |
|
1927 | + $Connection->db->beginTransaction(); |
|
1928 | + } |
|
1759 | 1929 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1760 | 1930 | { |
1761 | 1931 | $i++; |
@@ -1783,7 +1953,9 @@ discard block |
||
1783 | 1953 | } |
1784 | 1954 | } |
1785 | 1955 | fclose($handle); |
1786 | - if ($globalTransaction) $Connection->db->commit(); |
|
1956 | + if ($globalTransaction) { |
|
1957 | + $Connection->db->commit(); |
|
1958 | + } |
|
1787 | 1959 | } |
1788 | 1960 | return ''; |
1789 | 1961 | } |
@@ -1806,7 +1978,9 @@ discard block |
||
1806 | 1978 | $Connection = new Connection(); |
1807 | 1979 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1808 | 1980 | { |
1809 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1981 | + if ($globalTransaction) { |
|
1982 | + $Connection->db->beginTransaction(); |
|
1983 | + } |
|
1810 | 1984 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1811 | 1985 | { |
1812 | 1986 | if(count($row) > 1) { |
@@ -1820,7 +1994,9 @@ discard block |
||
1820 | 1994 | } |
1821 | 1995 | } |
1822 | 1996 | fclose($handle); |
1823 | - if ($globalTransaction) $Connection->db->commit(); |
|
1997 | + if ($globalTransaction) { |
|
1998 | + $Connection->db->commit(); |
|
1999 | + } |
|
1824 | 2000 | } |
1825 | 2001 | return ''; |
1826 | 2002 | } |
@@ -1840,8 +2016,9 @@ discard block |
||
1840 | 2016 | } |
1841 | 2017 | |
1842 | 2018 | |
1843 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1844 | - else { |
|
2019 | + if ($globalDBdriver == 'mysql') { |
|
2020 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
2021 | + } else { |
|
1845 | 2022 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
1846 | 2023 | $query = "CREATE EXTENSION postgis"; |
1847 | 2024 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -1860,20 +2037,30 @@ discard block |
||
1860 | 2037 | global $tmp_dir, $globalDebug; |
1861 | 2038 | include_once('class.create_db.php'); |
1862 | 2039 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1863 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
2040 | + if ($globalDebug) { |
|
2041 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
2042 | + } |
|
1864 | 2043 | update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
1865 | 2044 | $error = ''; |
1866 | 2045 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1867 | - if ($globalDebug) echo "Gunzip..."; |
|
2046 | + if ($globalDebug) { |
|
2047 | + echo "Gunzip..."; |
|
2048 | + } |
|
1868 | 2049 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
1869 | - if ($globalDebug) echo "Add to DB..."; |
|
2050 | + if ($globalDebug) { |
|
2051 | + echo "Add to DB..."; |
|
2052 | + } |
|
1870 | 2053 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
1871 | 2054 | $NOTAM = new NOTAM(); |
1872 | 2055 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
1873 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2056 | + } else { |
|
2057 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2058 | + } |
|
1874 | 2059 | if ($error != '') { |
1875 | 2060 | return $error; |
1876 | - } elseif ($globalDebug) echo "Done\n"; |
|
2061 | + } elseif ($globalDebug) { |
|
2062 | + echo "Done\n"; |
|
2063 | + } |
|
1877 | 2064 | return ''; |
1878 | 2065 | } |
1879 | 2066 | |
@@ -1927,67 +2114,111 @@ discard block |
||
1927 | 2114 | //if ($globalDebug) echo "IVAO : Download..."; |
1928 | 2115 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
1929 | 2116 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
1930 | - if ($globalDebug) echo "Unzip..."; |
|
2117 | + if ($globalDebug) { |
|
2118 | + echo "Unzip..."; |
|
2119 | + } |
|
1931 | 2120 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
1932 | - if ($globalDebug) echo "Add to DB..."; |
|
2121 | + if ($globalDebug) { |
|
2122 | + echo "Add to DB..."; |
|
2123 | + } |
|
1933 | 2124 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1934 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
2125 | + if ($globalDebug) { |
|
2126 | + echo "Copy airlines logos to airlines images directory..."; |
|
2127 | + } |
|
1935 | 2128 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1936 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1937 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
1938 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2129 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
2130 | + $error = "Failed to copy airlines logo."; |
|
2131 | + } |
|
2132 | + } else { |
|
2133 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
2134 | + } |
|
2135 | + } else { |
|
2136 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2137 | + } |
|
1939 | 2138 | if ($error != '') { |
1940 | 2139 | return $error; |
1941 | - } elseif ($globalDebug) echo "Done\n"; |
|
2140 | + } elseif ($globalDebug) { |
|
2141 | + echo "Done\n"; |
|
2142 | + } |
|
1942 | 2143 | return ''; |
1943 | 2144 | } |
1944 | 2145 | |
1945 | 2146 | public static function update_routes() { |
1946 | 2147 | global $tmp_dir, $globalDebug; |
1947 | 2148 | $error = ''; |
1948 | - if ($globalDebug) echo "Routes : Download..."; |
|
2149 | + if ($globalDebug) { |
|
2150 | + echo "Routes : Download..."; |
|
2151 | + } |
|
1949 | 2152 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
1950 | 2153 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1951 | - if ($globalDebug) echo "Gunzip..."; |
|
2154 | + if ($globalDebug) { |
|
2155 | + echo "Gunzip..."; |
|
2156 | + } |
|
1952 | 2157 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
1953 | - if ($globalDebug) echo "Add to DB..."; |
|
2158 | + if ($globalDebug) { |
|
2159 | + echo "Add to DB..."; |
|
2160 | + } |
|
1954 | 2161 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
1955 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2162 | + } else { |
|
2163 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2164 | + } |
|
1956 | 2165 | if ($error != '') { |
1957 | 2166 | return $error; |
1958 | - } elseif ($globalDebug) echo "Done\n"; |
|
2167 | + } elseif ($globalDebug) { |
|
2168 | + echo "Done\n"; |
|
2169 | + } |
|
1959 | 2170 | return ''; |
1960 | 2171 | } |
1961 | 2172 | public static function update_oneworld() { |
1962 | 2173 | global $tmp_dir, $globalDebug; |
1963 | 2174 | $error = ''; |
1964 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
2175 | + if ($globalDebug) { |
|
2176 | + echo "Schedules Oneworld : Download..."; |
|
2177 | + } |
|
1965 | 2178 | update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
1966 | 2179 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1967 | - if ($globalDebug) echo "Gunzip..."; |
|
2180 | + if ($globalDebug) { |
|
2181 | + echo "Gunzip..."; |
|
2182 | + } |
|
1968 | 2183 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
1969 | - if ($globalDebug) echo "Add to DB..."; |
|
2184 | + if ($globalDebug) { |
|
2185 | + echo "Add to DB..."; |
|
2186 | + } |
|
1970 | 2187 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
1971 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2188 | + } else { |
|
2189 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2190 | + } |
|
1972 | 2191 | if ($error != '') { |
1973 | 2192 | return $error; |
1974 | - } elseif ($globalDebug) echo "Done\n"; |
|
2193 | + } elseif ($globalDebug) { |
|
2194 | + echo "Done\n"; |
|
2195 | + } |
|
1975 | 2196 | return ''; |
1976 | 2197 | } |
1977 | 2198 | public static function update_skyteam() { |
1978 | 2199 | global $tmp_dir, $globalDebug; |
1979 | 2200 | $error = ''; |
1980 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
2201 | + if ($globalDebug) { |
|
2202 | + echo "Schedules Skyteam : Download..."; |
|
2203 | + } |
|
1981 | 2204 | update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
1982 | 2205 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1983 | - if ($globalDebug) echo "Gunzip..."; |
|
2206 | + if ($globalDebug) { |
|
2207 | + echo "Gunzip..."; |
|
2208 | + } |
|
1984 | 2209 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
1985 | - if ($globalDebug) echo "Add to DB..."; |
|
2210 | + if ($globalDebug) { |
|
2211 | + echo "Add to DB..."; |
|
2212 | + } |
|
1986 | 2213 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
1987 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2214 | + } else { |
|
2215 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2216 | + } |
|
1988 | 2217 | if ($error != '') { |
1989 | 2218 | return $error; |
1990 | - } elseif ($globalDebug) echo "Done\n"; |
|
2219 | + } elseif ($globalDebug) { |
|
2220 | + echo "Done\n"; |
|
2221 | + } |
|
1991 | 2222 | return ''; |
1992 | 2223 | } |
1993 | 2224 | public static function update_ModeS() { |
@@ -2004,355 +2235,619 @@ discard block |
||
2004 | 2235 | exit; |
2005 | 2236 | } elseif ($globalDebug) echo "Done\n"; |
2006 | 2237 | */ |
2007 | - if ($globalDebug) echo "Modes : Download..."; |
|
2008 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2238 | + if ($globalDebug) { |
|
2239 | + echo "Modes : Download..."; |
|
2240 | + } |
|
2241 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2009 | 2242 | update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
2010 | 2243 | |
2011 | 2244 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2012 | 2245 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
2013 | - if ($globalDebug) echo "Unzip..."; |
|
2014 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2246 | + if ($globalDebug) { |
|
2247 | + echo "Unzip..."; |
|
2248 | + } |
|
2249 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2015 | 2250 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
2016 | - if ($globalDebug) echo "Add to DB..."; |
|
2251 | + if ($globalDebug) { |
|
2252 | + echo "Add to DB..."; |
|
2253 | + } |
|
2017 | 2254 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
2018 | 2255 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
2019 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2256 | + } else { |
|
2257 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2258 | + } |
|
2020 | 2259 | if ($error != '') { |
2021 | 2260 | return $error; |
2022 | - } elseif ($globalDebug) echo "Done\n"; |
|
2261 | + } elseif ($globalDebug) { |
|
2262 | + echo "Done\n"; |
|
2263 | + } |
|
2023 | 2264 | return ''; |
2024 | 2265 | } |
2025 | 2266 | |
2026 | 2267 | public static function update_ModeS_faa() { |
2027 | 2268 | global $tmp_dir, $globalDebug; |
2028 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
2269 | + if ($globalDebug) { |
|
2270 | + echo "Modes FAA: Download..."; |
|
2271 | + } |
|
2029 | 2272 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
2030 | 2273 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2031 | - if ($globalDebug) echo "Unzip..."; |
|
2274 | + if ($globalDebug) { |
|
2275 | + echo "Unzip..."; |
|
2276 | + } |
|
2032 | 2277 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
2033 | - if ($globalDebug) echo "Add to DB..."; |
|
2278 | + if ($globalDebug) { |
|
2279 | + echo "Add to DB..."; |
|
2280 | + } |
|
2034 | 2281 | $error = update_db::modes_faa(); |
2035 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2282 | + } else { |
|
2283 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2284 | + } |
|
2036 | 2285 | if ($error != '') { |
2037 | 2286 | return $error; |
2038 | - } elseif ($globalDebug) echo "Done\n"; |
|
2287 | + } elseif ($globalDebug) { |
|
2288 | + echo "Done\n"; |
|
2289 | + } |
|
2039 | 2290 | return ''; |
2040 | 2291 | } |
2041 | 2292 | |
2042 | 2293 | public static function update_ModeS_flarm() { |
2043 | 2294 | global $tmp_dir, $globalDebug; |
2044 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
2295 | + if ($globalDebug) { |
|
2296 | + echo "Modes Flarmnet: Download..."; |
|
2297 | + } |
|
2045 | 2298 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
2046 | 2299 | if (file_exists($tmp_dir.'data.fln')) { |
2047 | - if ($globalDebug) echo "Add to DB..."; |
|
2300 | + if ($globalDebug) { |
|
2301 | + echo "Add to DB..."; |
|
2302 | + } |
|
2048 | 2303 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
2049 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2304 | + } else { |
|
2305 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2306 | + } |
|
2050 | 2307 | if ($error != '') { |
2051 | 2308 | return $error; |
2052 | - } elseif ($globalDebug) echo "Done\n"; |
|
2309 | + } elseif ($globalDebug) { |
|
2310 | + echo "Done\n"; |
|
2311 | + } |
|
2053 | 2312 | return ''; |
2054 | 2313 | } |
2055 | 2314 | |
2056 | 2315 | public static function update_ModeS_ogn() { |
2057 | 2316 | global $tmp_dir, $globalDebug; |
2058 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
2317 | + if ($globalDebug) { |
|
2318 | + echo "Modes OGN: Download..."; |
|
2319 | + } |
|
2059 | 2320 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
2060 | 2321 | if (file_exists($tmp_dir.'ogn.csv')) { |
2061 | - if ($globalDebug) echo "Add to DB..."; |
|
2322 | + if ($globalDebug) { |
|
2323 | + echo "Add to DB..."; |
|
2324 | + } |
|
2062 | 2325 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
2063 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2326 | + } else { |
|
2327 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2328 | + } |
|
2064 | 2329 | if ($error != '') { |
2065 | 2330 | return $error; |
2066 | - } elseif ($globalDebug) echo "Done\n"; |
|
2331 | + } elseif ($globalDebug) { |
|
2332 | + echo "Done\n"; |
|
2333 | + } |
|
2067 | 2334 | return ''; |
2068 | 2335 | } |
2069 | 2336 | |
2070 | 2337 | public static function update_owner() { |
2071 | 2338 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2072 | 2339 | |
2073 | - if ($globalDebug) echo "Owner France: Download..."; |
|
2340 | + if ($globalDebug) { |
|
2341 | + echo "Owner France: Download..."; |
|
2342 | + } |
|
2074 | 2343 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
2075 | 2344 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2076 | - if ($globalDebug) echo "Add to DB..."; |
|
2345 | + if ($globalDebug) { |
|
2346 | + echo "Add to DB..."; |
|
2347 | + } |
|
2077 | 2348 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
2078 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2349 | + } else { |
|
2350 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2351 | + } |
|
2079 | 2352 | if ($error != '') { |
2080 | 2353 | return $error; |
2081 | - } elseif ($globalDebug) echo "Done\n"; |
|
2354 | + } elseif ($globalDebug) { |
|
2355 | + echo "Done\n"; |
|
2356 | + } |
|
2082 | 2357 | |
2083 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
2358 | + if ($globalDebug) { |
|
2359 | + echo "Owner Ireland: Download..."; |
|
2360 | + } |
|
2084 | 2361 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
2085 | 2362 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2086 | - if ($globalDebug) echo "Add to DB..."; |
|
2363 | + if ($globalDebug) { |
|
2364 | + echo "Add to DB..."; |
|
2365 | + } |
|
2087 | 2366 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
2088 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2367 | + } else { |
|
2368 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2369 | + } |
|
2089 | 2370 | if ($error != '') { |
2090 | 2371 | return $error; |
2091 | - } elseif ($globalDebug) echo "Done\n"; |
|
2092 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
2372 | + } elseif ($globalDebug) { |
|
2373 | + echo "Done\n"; |
|
2374 | + } |
|
2375 | + if ($globalDebug) { |
|
2376 | + echo "Owner Switzerland: Download..."; |
|
2377 | + } |
|
2093 | 2378 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
2094 | 2379 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2095 | - if ($globalDebug) echo "Add to DB..."; |
|
2380 | + if ($globalDebug) { |
|
2381 | + echo "Add to DB..."; |
|
2382 | + } |
|
2096 | 2383 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
2097 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2384 | + } else { |
|
2385 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2386 | + } |
|
2098 | 2387 | if ($error != '') { |
2099 | 2388 | return $error; |
2100 | - } elseif ($globalDebug) echo "Done\n"; |
|
2101 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
2389 | + } elseif ($globalDebug) { |
|
2390 | + echo "Done\n"; |
|
2391 | + } |
|
2392 | + if ($globalDebug) { |
|
2393 | + echo "Owner Czech Republic: Download..."; |
|
2394 | + } |
|
2102 | 2395 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
2103 | 2396 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2104 | - if ($globalDebug) echo "Add to DB..."; |
|
2397 | + if ($globalDebug) { |
|
2398 | + echo "Add to DB..."; |
|
2399 | + } |
|
2105 | 2400 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
2106 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2401 | + } else { |
|
2402 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2403 | + } |
|
2107 | 2404 | if ($error != '') { |
2108 | 2405 | return $error; |
2109 | - } elseif ($globalDebug) echo "Done\n"; |
|
2110 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
2406 | + } elseif ($globalDebug) { |
|
2407 | + echo "Done\n"; |
|
2408 | + } |
|
2409 | + if ($globalDebug) { |
|
2410 | + echo "Owner Australia: Download..."; |
|
2411 | + } |
|
2111 | 2412 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
2112 | 2413 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2113 | - if ($globalDebug) echo "Add to DB..."; |
|
2414 | + if ($globalDebug) { |
|
2415 | + echo "Add to DB..."; |
|
2416 | + } |
|
2114 | 2417 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
2115 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2418 | + } else { |
|
2419 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2420 | + } |
|
2116 | 2421 | if ($error != '') { |
2117 | 2422 | return $error; |
2118 | - } elseif ($globalDebug) echo "Done\n"; |
|
2119 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
2423 | + } elseif ($globalDebug) { |
|
2424 | + echo "Done\n"; |
|
2425 | + } |
|
2426 | + if ($globalDebug) { |
|
2427 | + echo "Owner Austria: Download..."; |
|
2428 | + } |
|
2120 | 2429 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
2121 | 2430 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2122 | - if ($globalDebug) echo "Add to DB..."; |
|
2431 | + if ($globalDebug) { |
|
2432 | + echo "Add to DB..."; |
|
2433 | + } |
|
2123 | 2434 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
2124 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2435 | + } else { |
|
2436 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2437 | + } |
|
2125 | 2438 | if ($error != '') { |
2126 | 2439 | return $error; |
2127 | - } elseif ($globalDebug) echo "Done\n"; |
|
2128 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
2440 | + } elseif ($globalDebug) { |
|
2441 | + echo "Done\n"; |
|
2442 | + } |
|
2443 | + if ($globalDebug) { |
|
2444 | + echo "Owner Chile: Download..."; |
|
2445 | + } |
|
2129 | 2446 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
2130 | 2447 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2131 | - if ($globalDebug) echo "Add to DB..."; |
|
2448 | + if ($globalDebug) { |
|
2449 | + echo "Add to DB..."; |
|
2450 | + } |
|
2132 | 2451 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
2133 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2452 | + } else { |
|
2453 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2454 | + } |
|
2134 | 2455 | if ($error != '') { |
2135 | 2456 | return $error; |
2136 | - } elseif ($globalDebug) echo "Done\n"; |
|
2137 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
2457 | + } elseif ($globalDebug) { |
|
2458 | + echo "Done\n"; |
|
2459 | + } |
|
2460 | + if ($globalDebug) { |
|
2461 | + echo "Owner Colombia: Download..."; |
|
2462 | + } |
|
2138 | 2463 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
2139 | 2464 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2140 | - if ($globalDebug) echo "Add to DB..."; |
|
2465 | + if ($globalDebug) { |
|
2466 | + echo "Add to DB..."; |
|
2467 | + } |
|
2141 | 2468 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
2142 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2469 | + } else { |
|
2470 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2471 | + } |
|
2143 | 2472 | if ($error != '') { |
2144 | 2473 | return $error; |
2145 | - } elseif ($globalDebug) echo "Done\n"; |
|
2146 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
2474 | + } elseif ($globalDebug) { |
|
2475 | + echo "Done\n"; |
|
2476 | + } |
|
2477 | + if ($globalDebug) { |
|
2478 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
2479 | + } |
|
2147 | 2480 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
2148 | 2481 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2149 | - if ($globalDebug) echo "Add to DB..."; |
|
2482 | + if ($globalDebug) { |
|
2483 | + echo "Add to DB..."; |
|
2484 | + } |
|
2150 | 2485 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
2151 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2486 | + } else { |
|
2487 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2488 | + } |
|
2152 | 2489 | if ($error != '') { |
2153 | 2490 | return $error; |
2154 | - } elseif ($globalDebug) echo "Done\n"; |
|
2155 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
2491 | + } elseif ($globalDebug) { |
|
2492 | + echo "Done\n"; |
|
2493 | + } |
|
2494 | + if ($globalDebug) { |
|
2495 | + echo "Owner Brazil: Download..."; |
|
2496 | + } |
|
2156 | 2497 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
2157 | 2498 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2158 | - if ($globalDebug) echo "Add to DB..."; |
|
2499 | + if ($globalDebug) { |
|
2500 | + echo "Add to DB..."; |
|
2501 | + } |
|
2159 | 2502 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
2160 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2503 | + } else { |
|
2504 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2505 | + } |
|
2161 | 2506 | if ($error != '') { |
2162 | 2507 | return $error; |
2163 | - } elseif ($globalDebug) echo "Done\n"; |
|
2164 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
2508 | + } elseif ($globalDebug) { |
|
2509 | + echo "Done\n"; |
|
2510 | + } |
|
2511 | + if ($globalDebug) { |
|
2512 | + echo "Owner Cayman Islands: Download..."; |
|
2513 | + } |
|
2165 | 2514 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
2166 | 2515 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2167 | - if ($globalDebug) echo "Add to DB..."; |
|
2516 | + if ($globalDebug) { |
|
2517 | + echo "Add to DB..."; |
|
2518 | + } |
|
2168 | 2519 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
2169 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2520 | + } else { |
|
2521 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2522 | + } |
|
2170 | 2523 | if ($error != '') { |
2171 | 2524 | return $error; |
2172 | - } elseif ($globalDebug) echo "Done\n"; |
|
2173 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
2525 | + } elseif ($globalDebug) { |
|
2526 | + echo "Done\n"; |
|
2527 | + } |
|
2528 | + if ($globalDebug) { |
|
2529 | + echo "Owner Croatia: Download..."; |
|
2530 | + } |
|
2174 | 2531 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
2175 | 2532 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2176 | - if ($globalDebug) echo "Add to DB..."; |
|
2533 | + if ($globalDebug) { |
|
2534 | + echo "Add to DB..."; |
|
2535 | + } |
|
2177 | 2536 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
2178 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2537 | + } else { |
|
2538 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2539 | + } |
|
2179 | 2540 | if ($error != '') { |
2180 | 2541 | return $error; |
2181 | - } elseif ($globalDebug) echo "Done\n"; |
|
2182 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
2542 | + } elseif ($globalDebug) { |
|
2543 | + echo "Done\n"; |
|
2544 | + } |
|
2545 | + if ($globalDebug) { |
|
2546 | + echo "Owner Luxembourg: Download..."; |
|
2547 | + } |
|
2183 | 2548 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
2184 | 2549 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2185 | - if ($globalDebug) echo "Add to DB..."; |
|
2550 | + if ($globalDebug) { |
|
2551 | + echo "Add to DB..."; |
|
2552 | + } |
|
2186 | 2553 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
2187 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2554 | + } else { |
|
2555 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2556 | + } |
|
2188 | 2557 | if ($error != '') { |
2189 | 2558 | return $error; |
2190 | - } elseif ($globalDebug) echo "Done\n"; |
|
2191 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
2559 | + } elseif ($globalDebug) { |
|
2560 | + echo "Done\n"; |
|
2561 | + } |
|
2562 | + if ($globalDebug) { |
|
2563 | + echo "Owner Maldives: Download..."; |
|
2564 | + } |
|
2192 | 2565 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
2193 | 2566 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2194 | - if ($globalDebug) echo "Add to DB..."; |
|
2567 | + if ($globalDebug) { |
|
2568 | + echo "Add to DB..."; |
|
2569 | + } |
|
2195 | 2570 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
2196 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2571 | + } else { |
|
2572 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2573 | + } |
|
2197 | 2574 | if ($error != '') { |
2198 | 2575 | return $error; |
2199 | - } elseif ($globalDebug) echo "Done\n"; |
|
2200 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
2576 | + } elseif ($globalDebug) { |
|
2577 | + echo "Done\n"; |
|
2578 | + } |
|
2579 | + if ($globalDebug) { |
|
2580 | + echo "Owner New Zealand: Download..."; |
|
2581 | + } |
|
2201 | 2582 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
2202 | 2583 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2203 | - if ($globalDebug) echo "Add to DB..."; |
|
2584 | + if ($globalDebug) { |
|
2585 | + echo "Add to DB..."; |
|
2586 | + } |
|
2204 | 2587 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
2205 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2588 | + } else { |
|
2589 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2590 | + } |
|
2206 | 2591 | if ($error != '') { |
2207 | 2592 | return $error; |
2208 | - } elseif ($globalDebug) echo "Done\n"; |
|
2209 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
2593 | + } elseif ($globalDebug) { |
|
2594 | + echo "Done\n"; |
|
2595 | + } |
|
2596 | + if ($globalDebug) { |
|
2597 | + echo "Owner Papua New Guinea: Download..."; |
|
2598 | + } |
|
2210 | 2599 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
2211 | 2600 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2212 | - if ($globalDebug) echo "Add to DB..."; |
|
2601 | + if ($globalDebug) { |
|
2602 | + echo "Add to DB..."; |
|
2603 | + } |
|
2213 | 2604 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
2214 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2605 | + } else { |
|
2606 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2607 | + } |
|
2215 | 2608 | if ($error != '') { |
2216 | 2609 | return $error; |
2217 | - } elseif ($globalDebug) echo "Done\n"; |
|
2218 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
2610 | + } elseif ($globalDebug) { |
|
2611 | + echo "Done\n"; |
|
2612 | + } |
|
2613 | + if ($globalDebug) { |
|
2614 | + echo "Owner Slovakia: Download..."; |
|
2615 | + } |
|
2219 | 2616 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
2220 | 2617 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2221 | - if ($globalDebug) echo "Add to DB..."; |
|
2618 | + if ($globalDebug) { |
|
2619 | + echo "Add to DB..."; |
|
2620 | + } |
|
2222 | 2621 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
2223 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2622 | + } else { |
|
2623 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2624 | + } |
|
2224 | 2625 | if ($error != '') { |
2225 | 2626 | return $error; |
2226 | - } elseif ($globalDebug) echo "Done\n"; |
|
2227 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
2627 | + } elseif ($globalDebug) { |
|
2628 | + echo "Done\n"; |
|
2629 | + } |
|
2630 | + if ($globalDebug) { |
|
2631 | + echo "Owner Ecuador: Download..."; |
|
2632 | + } |
|
2228 | 2633 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
2229 | 2634 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2230 | - if ($globalDebug) echo "Add to DB..."; |
|
2635 | + if ($globalDebug) { |
|
2636 | + echo "Add to DB..."; |
|
2637 | + } |
|
2231 | 2638 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
2232 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2639 | + } else { |
|
2640 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2641 | + } |
|
2233 | 2642 | if ($error != '') { |
2234 | 2643 | return $error; |
2235 | - } elseif ($globalDebug) echo "Done\n"; |
|
2236 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
2644 | + } elseif ($globalDebug) { |
|
2645 | + echo "Done\n"; |
|
2646 | + } |
|
2647 | + if ($globalDebug) { |
|
2648 | + echo "Owner Iceland: Download..."; |
|
2649 | + } |
|
2237 | 2650 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
2238 | 2651 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2239 | - if ($globalDebug) echo "Add to DB..."; |
|
2652 | + if ($globalDebug) { |
|
2653 | + echo "Add to DB..."; |
|
2654 | + } |
|
2240 | 2655 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
2241 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2656 | + } else { |
|
2657 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2658 | + } |
|
2242 | 2659 | if ($error != '') { |
2243 | 2660 | return $error; |
2244 | - } elseif ($globalDebug) echo "Done\n"; |
|
2245 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
2661 | + } elseif ($globalDebug) { |
|
2662 | + echo "Done\n"; |
|
2663 | + } |
|
2664 | + if ($globalDebug) { |
|
2665 | + echo "Owner Isle of Man: Download..."; |
|
2666 | + } |
|
2246 | 2667 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
2247 | 2668 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2248 | - if ($globalDebug) echo "Add to DB..."; |
|
2669 | + if ($globalDebug) { |
|
2670 | + echo "Add to DB..."; |
|
2671 | + } |
|
2249 | 2672 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
2250 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2673 | + } else { |
|
2674 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2675 | + } |
|
2251 | 2676 | if ($error != '') { |
2252 | 2677 | return $error; |
2253 | - } elseif ($globalDebug) echo "Done\n"; |
|
2678 | + } elseif ($globalDebug) { |
|
2679 | + echo "Done\n"; |
|
2680 | + } |
|
2254 | 2681 | if ($globalMasterSource) { |
2255 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
2682 | + if ($globalDebug) { |
|
2683 | + echo "ModeS Netherlands: Download..."; |
|
2684 | + } |
|
2256 | 2685 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
2257 | 2686 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2258 | - if ($globalDebug) echo "Add to DB..."; |
|
2687 | + if ($globalDebug) { |
|
2688 | + echo "Add to DB..."; |
|
2689 | + } |
|
2259 | 2690 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
2260 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2691 | + } else { |
|
2692 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2693 | + } |
|
2261 | 2694 | if ($error != '') { |
2262 | 2695 | return $error; |
2263 | - } elseif ($globalDebug) echo "Done\n"; |
|
2264 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
2696 | + } elseif ($globalDebug) { |
|
2697 | + echo "Done\n"; |
|
2698 | + } |
|
2699 | + if ($globalDebug) { |
|
2700 | + echo "ModeS Denmark: Download..."; |
|
2701 | + } |
|
2265 | 2702 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
2266 | 2703 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2267 | - if ($globalDebug) echo "Add to DB..."; |
|
2704 | + if ($globalDebug) { |
|
2705 | + echo "Add to DB..."; |
|
2706 | + } |
|
2268 | 2707 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
2269 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2708 | + } else { |
|
2709 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2710 | + } |
|
2270 | 2711 | if ($error != '') { |
2271 | 2712 | return $error; |
2272 | - } elseif ($globalDebug) echo "Done\n"; |
|
2273 | - } elseif ($globalDebug) echo "Done\n"; |
|
2713 | + } elseif ($globalDebug) { |
|
2714 | + echo "Done\n"; |
|
2715 | + } |
|
2716 | + } elseif ($globalDebug) { |
|
2717 | + echo "Done\n"; |
|
2718 | + } |
|
2274 | 2719 | return ''; |
2275 | 2720 | } |
2276 | 2721 | |
2277 | 2722 | public static function update_translation() { |
2278 | 2723 | global $tmp_dir, $globalDebug; |
2279 | 2724 | $error = ''; |
2280 | - if ($globalDebug) echo "Translation : Download..."; |
|
2725 | + if ($globalDebug) { |
|
2726 | + echo "Translation : Download..."; |
|
2727 | + } |
|
2281 | 2728 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
2282 | 2729 | if (file_exists($tmp_dir.'translation.zip')) { |
2283 | - if ($globalDebug) echo "Unzip..."; |
|
2730 | + if ($globalDebug) { |
|
2731 | + echo "Unzip..."; |
|
2732 | + } |
|
2284 | 2733 | update_db::unzip($tmp_dir.'translation.zip'); |
2285 | - if ($globalDebug) echo "Add to DB..."; |
|
2734 | + if ($globalDebug) { |
|
2735 | + echo "Add to DB..."; |
|
2736 | + } |
|
2286 | 2737 | $error = update_db::translation(); |
2287 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2738 | + } else { |
|
2739 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2740 | + } |
|
2288 | 2741 | if ($error != '') { |
2289 | 2742 | return $error; |
2290 | - } elseif ($globalDebug) echo "Done\n"; |
|
2743 | + } elseif ($globalDebug) { |
|
2744 | + echo "Done\n"; |
|
2745 | + } |
|
2291 | 2746 | return ''; |
2292 | 2747 | } |
2293 | 2748 | |
2294 | 2749 | public static function update_translation_fam() { |
2295 | 2750 | global $tmp_dir, $globalDebug; |
2296 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
2751 | + if ($globalDebug) { |
|
2752 | + echo "Translation from FlightAirMap website : Download..."; |
|
2753 | + } |
|
2297 | 2754 | update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
2298 | 2755 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
2299 | - if ($globalDebug) echo "Gunzip..."; |
|
2756 | + if ($globalDebug) { |
|
2757 | + echo "Gunzip..."; |
|
2758 | + } |
|
2300 | 2759 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
2301 | - if ($globalDebug) echo "Add to DB..."; |
|
2760 | + if ($globalDebug) { |
|
2761 | + echo "Add to DB..."; |
|
2762 | + } |
|
2302 | 2763 | $error = update_db::translation_fam(); |
2303 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2764 | + } else { |
|
2765 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2766 | + } |
|
2304 | 2767 | if ($error != '') { |
2305 | 2768 | return $error; |
2306 | - } elseif ($globalDebug) echo "Done\n"; |
|
2769 | + } elseif ($globalDebug) { |
|
2770 | + echo "Done\n"; |
|
2771 | + } |
|
2307 | 2772 | return ''; |
2308 | 2773 | } |
2309 | 2774 | public static function update_ModeS_fam() { |
2310 | 2775 | global $tmp_dir, $globalDebug; |
2311 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
2776 | + if ($globalDebug) { |
|
2777 | + echo "ModeS from FlightAirMap website : Download..."; |
|
2778 | + } |
|
2312 | 2779 | update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
2313 | 2780 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
2314 | - if ($globalDebug) echo "Gunzip..."; |
|
2781 | + if ($globalDebug) { |
|
2782 | + echo "Gunzip..."; |
|
2783 | + } |
|
2315 | 2784 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
2316 | - if ($globalDebug) echo "Add to DB..."; |
|
2785 | + if ($globalDebug) { |
|
2786 | + echo "Add to DB..."; |
|
2787 | + } |
|
2317 | 2788 | $error = update_db::modes_fam(); |
2318 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2789 | + } else { |
|
2790 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2791 | + } |
|
2319 | 2792 | if ($error != '') { |
2320 | 2793 | return $error; |
2321 | - } elseif ($globalDebug) echo "Done\n"; |
|
2794 | + } elseif ($globalDebug) { |
|
2795 | + echo "Done\n"; |
|
2796 | + } |
|
2322 | 2797 | return ''; |
2323 | 2798 | } |
2324 | 2799 | public static function update_owner_fam() { |
2325 | 2800 | global $tmp_dir, $globalDebug, $globalOwner; |
2326 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
2801 | + if ($globalDebug) { |
|
2802 | + echo "owner from FlightAirMap website : Download..."; |
|
2803 | + } |
|
2327 | 2804 | if ($globalOwner === TRUE) { |
2328 | 2805 | update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
2329 | 2806 | } else { |
2330 | 2807 | update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
2331 | 2808 | } |
2332 | 2809 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
2333 | - if ($globalDebug) echo "Gunzip..."; |
|
2810 | + if ($globalDebug) { |
|
2811 | + echo "Gunzip..."; |
|
2812 | + } |
|
2334 | 2813 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
2335 | - if ($globalDebug) echo "Add to DB..."; |
|
2814 | + if ($globalDebug) { |
|
2815 | + echo "Add to DB..."; |
|
2816 | + } |
|
2336 | 2817 | $error = update_db::owner_fam(); |
2337 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2818 | + } else { |
|
2819 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2820 | + } |
|
2338 | 2821 | if ($error != '') { |
2339 | 2822 | return $error; |
2340 | - } elseif ($globalDebug) echo "Done\n"; |
|
2823 | + } elseif ($globalDebug) { |
|
2824 | + echo "Done\n"; |
|
2825 | + } |
|
2341 | 2826 | return ''; |
2342 | 2827 | } |
2343 | 2828 | public static function update_routes_fam() { |
2344 | 2829 | global $tmp_dir, $globalDebug; |
2345 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
2830 | + if ($globalDebug) { |
|
2831 | + echo "Routes from FlightAirMap website : Download..."; |
|
2832 | + } |
|
2346 | 2833 | update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
2347 | 2834 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2348 | - if ($globalDebug) echo "Gunzip..."; |
|
2835 | + if ($globalDebug) { |
|
2836 | + echo "Gunzip..."; |
|
2837 | + } |
|
2349 | 2838 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
2350 | - if ($globalDebug) echo "Add to DB..."; |
|
2839 | + if ($globalDebug) { |
|
2840 | + echo "Add to DB..."; |
|
2841 | + } |
|
2351 | 2842 | $error = update_db::routes_fam(); |
2352 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2843 | + } else { |
|
2844 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2845 | + } |
|
2353 | 2846 | if ($error != '') { |
2354 | 2847 | return $error; |
2355 | - } elseif ($globalDebug) echo "Done\n"; |
|
2848 | + } elseif ($globalDebug) { |
|
2849 | + echo "Done\n"; |
|
2850 | + } |
|
2356 | 2851 | return ''; |
2357 | 2852 | } |
2358 | 2853 | public static function update_marine_identity_fam() { |
@@ -2362,14 +2857,22 @@ discard block |
||
2362 | 2857 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
2363 | 2858 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2364 | 2859 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2365 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
2860 | + if ($globalDebug) { |
|
2861 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
2862 | + } |
|
2366 | 2863 | update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
2367 | 2864 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2368 | - if ($globalDebug) echo "Gunzip..."; |
|
2865 | + if ($globalDebug) { |
|
2866 | + echo "Gunzip..."; |
|
2867 | + } |
|
2369 | 2868 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
2370 | - if ($globalDebug) echo "Add to DB..."; |
|
2869 | + if ($globalDebug) { |
|
2870 | + echo "Add to DB..."; |
|
2871 | + } |
|
2371 | 2872 | $error = update_db::marine_identity_fam(); |
2372 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2873 | + } else { |
|
2874 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2875 | + } |
|
2373 | 2876 | if ($error != '') { |
2374 | 2877 | return $error; |
2375 | 2878 | } elseif ($globalDebug) { |
@@ -2388,14 +2891,22 @@ discard block |
||
2388 | 2891 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
2389 | 2892 | $satellite_md5 = $satellite_md5_file[0]; |
2390 | 2893 | if (!update_db::check_satellite_version($satellite_md5)) { |
2391 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
2894 | + if ($globalDebug) { |
|
2895 | + echo "Satellite from FlightAirMap website : Download..."; |
|
2896 | + } |
|
2392 | 2897 | update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
2393 | 2898 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2394 | - if ($globalDebug) echo "Gunzip..."; |
|
2899 | + if ($globalDebug) { |
|
2900 | + echo "Gunzip..."; |
|
2901 | + } |
|
2395 | 2902 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
2396 | - if ($globalDebug) echo "Add to DB..."; |
|
2903 | + if ($globalDebug) { |
|
2904 | + echo "Add to DB..."; |
|
2905 | + } |
|
2397 | 2906 | $error = update_db::satellite_fam(); |
2398 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
2907 | + } else { |
|
2908 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
2909 | + } |
|
2399 | 2910 | if ($error != '') { |
2400 | 2911 | return $error; |
2401 | 2912 | } elseif ($globalDebug) { |
@@ -2408,17 +2919,25 @@ discard block |
||
2408 | 2919 | } |
2409 | 2920 | public static function update_banned_fam() { |
2410 | 2921 | global $tmp_dir, $globalDebug; |
2411 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2922 | + if ($globalDebug) { |
|
2923 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2924 | + } |
|
2412 | 2925 | update_db::download('http://data.flightairmap.fr/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
2413 | 2926 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2414 | 2927 | //if ($globalDebug) echo "Gunzip..."; |
2415 | 2928 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
2416 | - if ($globalDebug) echo "Add to DB..."; |
|
2929 | + if ($globalDebug) { |
|
2930 | + echo "Add to DB..."; |
|
2931 | + } |
|
2417 | 2932 | $error = update_db::banned_fam(); |
2418 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2933 | + } else { |
|
2934 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2935 | + } |
|
2419 | 2936 | if ($error != '') { |
2420 | 2937 | return $error; |
2421 | - } elseif ($globalDebug) echo "Done\n"; |
|
2938 | + } elseif ($globalDebug) { |
|
2939 | + echo "Done\n"; |
|
2940 | + } |
|
2422 | 2941 | return ''; |
2423 | 2942 | } |
2424 | 2943 | |
@@ -2426,7 +2945,9 @@ discard block |
||
2426 | 2945 | global $tmp_dir, $globalDebug, $globalDBdriver; |
2427 | 2946 | include_once('class.create_db.php'); |
2428 | 2947 | $error = ''; |
2429 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
2948 | + if ($globalDebug) { |
|
2949 | + echo "Airspace from FlightAirMap website : Download..."; |
|
2950 | + } |
|
2430 | 2951 | if ($globalDBdriver == 'mysql') { |
2431 | 2952 | update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
2432 | 2953 | } else { |
@@ -2442,9 +2963,13 @@ discard block |
||
2442 | 2963 | update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
2443 | 2964 | } |
2444 | 2965 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2445 | - if ($globalDebug) echo "Gunzip..."; |
|
2966 | + if ($globalDebug) { |
|
2967 | + echo "Gunzip..."; |
|
2968 | + } |
|
2446 | 2969 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
2447 | - if ($globalDebug) echo "Add to DB..."; |
|
2970 | + if ($globalDebug) { |
|
2971 | + echo "Add to DB..."; |
|
2972 | + } |
|
2448 | 2973 | $Connection = new Connection(); |
2449 | 2974 | if ($Connection->tableExists('airspace')) { |
2450 | 2975 | $query = 'DROP TABLE airspace'; |
@@ -2457,19 +2982,27 @@ discard block |
||
2457 | 2982 | } |
2458 | 2983 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2459 | 2984 | update_db::insert_airspace_version($airspace_md5); |
2460 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2985 | + } else { |
|
2986 | + $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2987 | + } |
|
2461 | 2988 | } |
2462 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2989 | + } else { |
|
2990 | + $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2991 | + } |
|
2463 | 2992 | if ($error != '') { |
2464 | 2993 | return $error; |
2465 | - } elseif ($globalDebug) echo "Done\n"; |
|
2994 | + } elseif ($globalDebug) { |
|
2995 | + echo "Done\n"; |
|
2996 | + } |
|
2466 | 2997 | return ''; |
2467 | 2998 | } |
2468 | 2999 | |
2469 | 3000 | public static function update_geoid_fam() { |
2470 | 3001 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2471 | 3002 | $error = ''; |
2472 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
3003 | + if ($globalDebug) { |
|
3004 | + echo "Geoid from FlightAirMap website : Download..."; |
|
3005 | + } |
|
2473 | 3006 | update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
2474 | 3007 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2475 | 3008 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2477,75 +3010,113 @@ discard block |
||
2477 | 3010 | if (!update_db::check_geoid_version($geoid_md5)) { |
2478 | 3011 | update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
2479 | 3012 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2480 | - if ($globalDebug) echo "Gunzip..."; |
|
3013 | + if ($globalDebug) { |
|
3014 | + echo "Gunzip..."; |
|
3015 | + } |
|
2481 | 3016 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
2482 | 3017 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2483 | 3018 | update_db::insert_geoid_version($geoid_md5); |
2484 | 3019 | } |
2485 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
3020 | + } else { |
|
3021 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
3022 | + } |
|
2486 | 3023 | } |
2487 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3024 | + } else { |
|
3025 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3026 | + } |
|
2488 | 3027 | if ($error != '') { |
2489 | 3028 | return $error; |
2490 | - } elseif ($globalDebug) echo "Done\n"; |
|
3029 | + } elseif ($globalDebug) { |
|
3030 | + echo "Done\n"; |
|
3031 | + } |
|
2491 | 3032 | return ''; |
2492 | 3033 | } |
2493 | 3034 | |
2494 | 3035 | public static function update_tle() { |
2495 | 3036 | global $tmp_dir, $globalDebug; |
2496 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
3037 | + if ($globalDebug) { |
|
3038 | + echo "Download TLE : Download..."; |
|
3039 | + } |
|
2497 | 3040 | $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', |
2498 | 3041 | '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', |
2499 | 3042 | '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'); |
2500 | 3043 | foreach ($alltle as $filename) { |
2501 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
3044 | + if ($globalDebug) { |
|
3045 | + echo "downloading ".$filename.'...'; |
|
3046 | + } |
|
2502 | 3047 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
2503 | 3048 | if (file_exists($tmp_dir.$filename)) { |
2504 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
3049 | + if ($globalDebug) { |
|
3050 | + echo "Add to DB ".$filename."..."; |
|
3051 | + } |
|
2505 | 3052 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
2506 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3053 | + } else { |
|
3054 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3055 | + } |
|
2507 | 3056 | if ($error != '') { |
2508 | 3057 | echo $error."\n"; |
2509 | - } elseif ($globalDebug) echo "Done\n"; |
|
3058 | + } elseif ($globalDebug) { |
|
3059 | + echo "Done\n"; |
|
3060 | + } |
|
2510 | 3061 | } |
2511 | 3062 | return ''; |
2512 | 3063 | } |
2513 | 3064 | |
2514 | 3065 | public static function update_ucsdb() { |
2515 | 3066 | global $tmp_dir, $globalDebug; |
2516 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
3067 | + if ($globalDebug) { |
|
3068 | + echo "Download UCS DB : Download..."; |
|
3069 | + } |
|
2517 | 3070 | update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2518 | 3071 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2519 | - if ($globalDebug) echo "Add to DB..."; |
|
3072 | + if ($globalDebug) { |
|
3073 | + echo "Add to DB..."; |
|
3074 | + } |
|
2520 | 3075 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2521 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3076 | + } else { |
|
3077 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3078 | + } |
|
2522 | 3079 | if ($error != '') { |
2523 | 3080 | echo $error."\n"; |
2524 | - } elseif ($globalDebug) echo "Done\n"; |
|
3081 | + } elseif ($globalDebug) { |
|
3082 | + echo "Done\n"; |
|
3083 | + } |
|
2525 | 3084 | return ''; |
2526 | 3085 | } |
2527 | 3086 | |
2528 | 3087 | public static function update_celestrak() { |
2529 | 3088 | global $tmp_dir, $globalDebug; |
2530 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
3089 | + if ($globalDebug) { |
|
3090 | + echo "Download Celestrak DB : Download..."; |
|
3091 | + } |
|
2531 | 3092 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
2532 | 3093 | if (file_exists($tmp_dir.'satcat.txt')) { |
2533 | - if ($globalDebug) echo "Add to DB..."; |
|
3094 | + if ($globalDebug) { |
|
3095 | + echo "Add to DB..."; |
|
3096 | + } |
|
2534 | 3097 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
2535 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3098 | + } else { |
|
3099 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3100 | + } |
|
2536 | 3101 | if ($error != '') { |
2537 | 3102 | echo $error."\n"; |
2538 | - } elseif ($globalDebug) echo "Done\n"; |
|
3103 | + } elseif ($globalDebug) { |
|
3104 | + echo "Done\n"; |
|
3105 | + } |
|
2539 | 3106 | return ''; |
2540 | 3107 | } |
2541 | 3108 | |
2542 | 3109 | public static function update_models() { |
2543 | 3110 | global $tmp_dir, $globalDebug; |
2544 | 3111 | $error = ''; |
2545 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
3112 | + if ($globalDebug) { |
|
3113 | + echo "Models from FlightAirMap website : Download..."; |
|
3114 | + } |
|
2546 | 3115 | update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
2547 | 3116 | if (file_exists($tmp_dir.'models.md5sum')) { |
2548 | - if ($globalDebug) echo "Check files...\n"; |
|
3117 | + if ($globalDebug) { |
|
3118 | + echo "Check files...\n"; |
|
3119 | + } |
|
2549 | 3120 | $newmodelsdb = array(); |
2550 | 3121 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
2551 | 3122 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2564,25 +3135,35 @@ discard block |
||
2564 | 3135 | } |
2565 | 3136 | $diff = array_diff($newmodelsdb,$modelsdb); |
2566 | 3137 | foreach ($diff as $key => $value) { |
2567 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3138 | + if ($globalDebug) { |
|
3139 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3140 | + } |
|
2568 | 3141 | update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
2569 | 3142 | |
2570 | 3143 | } |
2571 | 3144 | update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
2572 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3145 | + } else { |
|
3146 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3147 | + } |
|
2573 | 3148 | if ($error != '') { |
2574 | 3149 | return $error; |
2575 | - } elseif ($globalDebug) echo "Done\n"; |
|
3150 | + } elseif ($globalDebug) { |
|
3151 | + echo "Done\n"; |
|
3152 | + } |
|
2576 | 3153 | return ''; |
2577 | 3154 | } |
2578 | 3155 | |
2579 | 3156 | public static function update_space_models() { |
2580 | 3157 | global $tmp_dir, $globalDebug; |
2581 | 3158 | $error = ''; |
2582 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
3159 | + if ($globalDebug) { |
|
3160 | + echo "Space models from FlightAirMap website : Download..."; |
|
3161 | + } |
|
2583 | 3162 | update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
2584 | 3163 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2585 | - if ($globalDebug) echo "Check files...\n"; |
|
3164 | + if ($globalDebug) { |
|
3165 | + echo "Check files...\n"; |
|
3166 | + } |
|
2586 | 3167 | $newmodelsdb = array(); |
2587 | 3168 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
2588 | 3169 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2601,25 +3182,35 @@ discard block |
||
2601 | 3182 | } |
2602 | 3183 | $diff = array_diff($newmodelsdb,$modelsdb); |
2603 | 3184 | foreach ($diff as $key => $value) { |
2604 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
3185 | + if ($globalDebug) { |
|
3186 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
3187 | + } |
|
2605 | 3188 | update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
2606 | 3189 | |
2607 | 3190 | } |
2608 | 3191 | update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
2609 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3192 | + } else { |
|
3193 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3194 | + } |
|
2610 | 3195 | if ($error != '') { |
2611 | 3196 | return $error; |
2612 | - } elseif ($globalDebug) echo "Done\n"; |
|
3197 | + } elseif ($globalDebug) { |
|
3198 | + echo "Done\n"; |
|
3199 | + } |
|
2613 | 3200 | return ''; |
2614 | 3201 | } |
2615 | 3202 | |
2616 | 3203 | public static function update_vehicules_models() { |
2617 | 3204 | global $tmp_dir, $globalDebug; |
2618 | 3205 | $error = ''; |
2619 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
3206 | + if ($globalDebug) { |
|
3207 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
3208 | + } |
|
2620 | 3209 | update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
2621 | 3210 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2622 | - if ($globalDebug) echo "Check files...\n"; |
|
3211 | + if ($globalDebug) { |
|
3212 | + echo "Check files...\n"; |
|
3213 | + } |
|
2623 | 3214 | $newmodelsdb = array(); |
2624 | 3215 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
2625 | 3216 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2638,15 +3229,21 @@ discard block |
||
2638 | 3229 | } |
2639 | 3230 | $diff = array_diff($newmodelsdb,$modelsdb); |
2640 | 3231 | foreach ($diff as $key => $value) { |
2641 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3232 | + if ($globalDebug) { |
|
3233 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3234 | + } |
|
2642 | 3235 | update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
2643 | 3236 | |
2644 | 3237 | } |
2645 | 3238 | update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
2646 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3239 | + } else { |
|
3240 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3241 | + } |
|
2647 | 3242 | if ($error != '') { |
2648 | 3243 | return $error; |
2649 | - } elseif ($globalDebug) echo "Done\n"; |
|
3244 | + } elseif ($globalDebug) { |
|
3245 | + echo "Done\n"; |
|
3246 | + } |
|
2650 | 3247 | return ''; |
2651 | 3248 | } |
2652 | 3249 | |
@@ -2689,7 +3286,9 @@ discard block |
||
2689 | 3286 | } |
2690 | 3287 | |
2691 | 3288 | $error = ''; |
2692 | - if ($globalDebug) echo "Notam : Download..."; |
|
3289 | + if ($globalDebug) { |
|
3290 | + echo "Notam : Download..."; |
|
3291 | + } |
|
2693 | 3292 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
2694 | 3293 | if (file_exists($tmp_dir.'notam.rss')) { |
2695 | 3294 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -2704,14 +3303,30 @@ discard block |
||
2704 | 3303 | $data['fir'] = $q[0]; |
2705 | 3304 | $data['code'] = $q[1]; |
2706 | 3305 | $ifrvfr = $q[2]; |
2707 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
2708 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
2709 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
2710 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
2711 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
2712 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
2713 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
2714 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
3306 | + if ($ifrvfr == 'IV') { |
|
3307 | + $data['rules'] = 'IFR/VFR'; |
|
3308 | + } |
|
3309 | + if ($ifrvfr == 'I') { |
|
3310 | + $data['rules'] = 'IFR'; |
|
3311 | + } |
|
3312 | + if ($ifrvfr == 'V') { |
|
3313 | + $data['rules'] = 'VFR'; |
|
3314 | + } |
|
3315 | + if ($q[4] == 'A') { |
|
3316 | + $data['scope'] = 'Airport warning'; |
|
3317 | + } |
|
3318 | + if ($q[4] == 'E') { |
|
3319 | + $data['scope'] = 'Enroute warning'; |
|
3320 | + } |
|
3321 | + if ($q[4] == 'W') { |
|
3322 | + $data['scope'] = 'Navigation warning'; |
|
3323 | + } |
|
3324 | + if ($q[4] == 'AE') { |
|
3325 | + $data['scope'] = 'Airport/Enroute warning'; |
|
3326 | + } |
|
3327 | + if ($q[4] == 'AW') { |
|
3328 | + $data['scope'] = 'Airport/Navigation warning'; |
|
3329 | + } |
|
2715 | 3330 | //$data['scope'] = $q[4]; |
2716 | 3331 | $data['lower_limit'] = $q[5]; |
2717 | 3332 | $data['upper_limit'] = $q[6]; |
@@ -2719,8 +3334,12 @@ discard block |
||
2719 | 3334 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
2720 | 3335 | $latitude = $Common->convertDec($las,'latitude'); |
2721 | 3336 | $longitude = $Common->convertDec($lns,'longitude'); |
2722 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
2723 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
3337 | + if ($lac == 'S') { |
|
3338 | + $latitude = '-'.$latitude; |
|
3339 | + } |
|
3340 | + if ($lnc == 'W') { |
|
3341 | + $longitude = '-'.$longitude; |
|
3342 | + } |
|
2724 | 3343 | $data['center_latitude'] = $latitude; |
2725 | 3344 | $data['center_longitude'] = $longitude; |
2726 | 3345 | $data['radius'] = intval($radius); |
@@ -2750,10 +3369,14 @@ discard block |
||
2750 | 3369 | $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']); |
2751 | 3370 | unset($data); |
2752 | 3371 | } |
2753 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3372 | + } else { |
|
3373 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3374 | + } |
|
2754 | 3375 | if ($error != '') { |
2755 | 3376 | return $error; |
2756 | - } elseif ($globalDebug) echo "Done\n"; |
|
3377 | + } elseif ($globalDebug) { |
|
3378 | + echo "Done\n"; |
|
3379 | + } |
|
2757 | 3380 | return ''; |
2758 | 3381 | } |
2759 | 3382 | |
@@ -2778,7 +3401,9 @@ discard block |
||
2778 | 3401 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2779 | 3402 | $airspace_json = json_decode($airspace_lst,true); |
2780 | 3403 | foreach ($airspace_json['records'] as $airspace) { |
2781 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
3404 | + if ($globalDebug) { |
|
3405 | + echo $airspace['name']."...\n"; |
|
3406 | + } |
|
2782 | 3407 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
2783 | 3408 | if (file_exists($tmp_dir.$airspace['name'])) { |
2784 | 3409 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -2822,8 +3447,11 @@ discard block |
||
2822 | 3447 | return "error : ".$e->getMessage(); |
2823 | 3448 | } |
2824 | 3449 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2825 | - if ($row['nb'] > 0) return false; |
|
2826 | - else return true; |
|
3450 | + if ($row['nb'] > 0) { |
|
3451 | + return false; |
|
3452 | + } else { |
|
3453 | + return true; |
|
3454 | + } |
|
2827 | 3455 | } |
2828 | 3456 | |
2829 | 3457 | public static function insert_last_update() { |
@@ -2848,8 +3476,11 @@ discard block |
||
2848 | 3476 | return "error : ".$e->getMessage(); |
2849 | 3477 | } |
2850 | 3478 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2851 | - if ($row['nb'] > 0) return true; |
|
2852 | - else return false; |
|
3479 | + if ($row['nb'] > 0) { |
|
3480 | + return true; |
|
3481 | + } else { |
|
3482 | + return false; |
|
3483 | + } |
|
2853 | 3484 | } |
2854 | 3485 | |
2855 | 3486 | public static function check_geoid_version($version) { |
@@ -2862,8 +3493,11 @@ discard block |
||
2862 | 3493 | return "error : ".$e->getMessage(); |
2863 | 3494 | } |
2864 | 3495 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2865 | - if ($row['nb'] > 0) return true; |
|
2866 | - else return false; |
|
3496 | + if ($row['nb'] > 0) { |
|
3497 | + return true; |
|
3498 | + } else { |
|
3499 | + return false; |
|
3500 | + } |
|
2867 | 3501 | } |
2868 | 3502 | |
2869 | 3503 | public static function check_marine_identity_version($version) { |
@@ -2876,8 +3510,11 @@ discard block |
||
2876 | 3510 | return "error : ".$e->getMessage(); |
2877 | 3511 | } |
2878 | 3512 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2879 | - if ($row['nb'] > 0) return true; |
|
2880 | - else return false; |
|
3513 | + if ($row['nb'] > 0) { |
|
3514 | + return true; |
|
3515 | + } else { |
|
3516 | + return false; |
|
3517 | + } |
|
2881 | 3518 | } |
2882 | 3519 | |
2883 | 3520 | public static function check_satellite_version($version) { |
@@ -2890,8 +3527,11 @@ discard block |
||
2890 | 3527 | return "error : ".$e->getMessage(); |
2891 | 3528 | } |
2892 | 3529 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2893 | - if ($row['nb'] > 0) return true; |
|
2894 | - else return false; |
|
3530 | + if ($row['nb'] > 0) { |
|
3531 | + return true; |
|
3532 | + } else { |
|
3533 | + return false; |
|
3534 | + } |
|
2895 | 3535 | } |
2896 | 3536 | |
2897 | 3537 | |
@@ -2958,8 +3598,11 @@ discard block |
||
2958 | 3598 | return "error : ".$e->getMessage(); |
2959 | 3599 | } |
2960 | 3600 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2961 | - if ($row['nb'] > 0) return false; |
|
2962 | - else return true; |
|
3601 | + if ($row['nb'] > 0) { |
|
3602 | + return false; |
|
3603 | + } else { |
|
3604 | + return true; |
|
3605 | + } |
|
2963 | 3606 | } |
2964 | 3607 | |
2965 | 3608 | public static function insert_last_notam_update() { |
@@ -2989,8 +3632,11 @@ discard block |
||
2989 | 3632 | return "error : ".$e->getMessage(); |
2990 | 3633 | } |
2991 | 3634 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2992 | - if ($row['nb'] > 0) return false; |
|
2993 | - else return true; |
|
3635 | + if ($row['nb'] > 0) { |
|
3636 | + return false; |
|
3637 | + } else { |
|
3638 | + return true; |
|
3639 | + } |
|
2994 | 3640 | } |
2995 | 3641 | |
2996 | 3642 | public static function insert_last_airspace_update() { |
@@ -3020,8 +3666,11 @@ discard block |
||
3020 | 3666 | return "error : ".$e->getMessage(); |
3021 | 3667 | } |
3022 | 3668 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3023 | - if ($row['nb'] > 0) return false; |
|
3024 | - else return true; |
|
3669 | + if ($row['nb'] > 0) { |
|
3670 | + return false; |
|
3671 | + } else { |
|
3672 | + return true; |
|
3673 | + } |
|
3025 | 3674 | } |
3026 | 3675 | |
3027 | 3676 | public static function insert_last_geoid_update() { |
@@ -3051,8 +3700,11 @@ discard block |
||
3051 | 3700 | return "error : ".$e->getMessage(); |
3052 | 3701 | } |
3053 | 3702 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3054 | - if ($row['nb'] > 0) return false; |
|
3055 | - else return true; |
|
3703 | + if ($row['nb'] > 0) { |
|
3704 | + return false; |
|
3705 | + } else { |
|
3706 | + return true; |
|
3707 | + } |
|
3056 | 3708 | } |
3057 | 3709 | |
3058 | 3710 | public static function insert_last_owner_update() { |
@@ -3081,8 +3733,11 @@ discard block |
||
3081 | 3733 | return "error : ".$e->getMessage(); |
3082 | 3734 | } |
3083 | 3735 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3084 | - if ($row['nb'] > 0) return false; |
|
3085 | - else return true; |
|
3736 | + if ($row['nb'] > 0) { |
|
3737 | + return false; |
|
3738 | + } else { |
|
3739 | + return true; |
|
3740 | + } |
|
3086 | 3741 | } |
3087 | 3742 | |
3088 | 3743 | public static function insert_last_schedules_update() { |
@@ -3112,8 +3767,11 @@ discard block |
||
3112 | 3767 | return "error : ".$e->getMessage(); |
3113 | 3768 | } |
3114 | 3769 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3115 | - if ($row['nb'] > 0) return false; |
|
3116 | - else return true; |
|
3770 | + if ($row['nb'] > 0) { |
|
3771 | + return false; |
|
3772 | + } else { |
|
3773 | + return true; |
|
3774 | + } |
|
3117 | 3775 | } |
3118 | 3776 | |
3119 | 3777 | public static function insert_last_tle_update() { |
@@ -3143,8 +3801,11 @@ discard block |
||
3143 | 3801 | return "error : ".$e->getMessage(); |
3144 | 3802 | } |
3145 | 3803 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3146 | - if ($row['nb'] > 0) return false; |
|
3147 | - else return true; |
|
3804 | + if ($row['nb'] > 0) { |
|
3805 | + return false; |
|
3806 | + } else { |
|
3807 | + return true; |
|
3808 | + } |
|
3148 | 3809 | } |
3149 | 3810 | |
3150 | 3811 | public static function insert_last_ucsdb_update() { |
@@ -3174,8 +3835,11 @@ discard block |
||
3174 | 3835 | return "error : ".$e->getMessage(); |
3175 | 3836 | } |
3176 | 3837 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3177 | - if ($row['nb'] > 0) return false; |
|
3178 | - else return true; |
|
3838 | + if ($row['nb'] > 0) { |
|
3839 | + return false; |
|
3840 | + } else { |
|
3841 | + return true; |
|
3842 | + } |
|
3179 | 3843 | } |
3180 | 3844 | |
3181 | 3845 | public static function insert_last_celestrak_update() { |
@@ -3205,8 +3869,11 @@ discard block |
||
3205 | 3869 | return "error : ".$e->getMessage(); |
3206 | 3870 | } |
3207 | 3871 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3208 | - if ($row['nb'] > 0) return false; |
|
3209 | - else return true; |
|
3872 | + if ($row['nb'] > 0) { |
|
3873 | + return false; |
|
3874 | + } else { |
|
3875 | + return true; |
|
3876 | + } |
|
3210 | 3877 | } |
3211 | 3878 | |
3212 | 3879 | public static function check_last_satellite_update() { |
@@ -3224,8 +3891,11 @@ discard block |
||
3224 | 3891 | return "error : ".$e->getMessage(); |
3225 | 3892 | } |
3226 | 3893 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3227 | - if ($row['nb'] > 0) return false; |
|
3228 | - else return true; |
|
3894 | + if ($row['nb'] > 0) { |
|
3895 | + return false; |
|
3896 | + } else { |
|
3897 | + return true; |
|
3898 | + } |
|
3229 | 3899 | } |
3230 | 3900 | |
3231 | 3901 | public static function insert_last_marine_identity_update() { |
@@ -22,11 +22,15 @@ discard block |
||
22 | 22 | require_once('require/class.Spotter.php'); |
23 | 23 | } |
24 | 24 | |
25 | -if (!isset($filter_name)) $filter_name = ''; |
|
25 | +if (!isset($filter_name)) { |
|
26 | + $filter_name = ''; |
|
27 | +} |
|
26 | 28 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
27 | 29 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
28 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
29 | -} |
|
30 | + if (isset($globalFilter['airline'])) { |
|
31 | + $airline_icao = $globalFilter['airline'][0]; |
|
32 | + } |
|
33 | + } |
|
30 | 34 | if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') { |
31 | 35 | $Spotter = new Spotter(); |
32 | 36 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -61,7 +65,12 @@ discard block |
||
61 | 65 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
62 | 66 | <div class="column"> |
63 | 67 | <div class="info"> |
64 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
68 | + <h1><?php if (isset($airline_name)) { |
|
69 | + echo _("Statistics for ").$airline_name; |
|
70 | +} else { |
|
71 | + echo _("Statistics"); |
|
72 | +} |
|
73 | +?></h1> |
|
65 | 74 | <?php |
66 | 75 | if ($type == 'aircraft') { |
67 | 76 | $last_update = $Stats->getLastStatsUpdate(); |
@@ -69,7 +78,9 @@ discard block |
||
69 | 78 | if (isset($last_update[0]['value'])) { |
70 | 79 | date_default_timezone_set('UTC'); |
71 | 80 | $lastupdate = strtotime($last_update[0]['value']); |
72 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
81 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
82 | + date_default_timezone_set($globalTimezone); |
|
83 | + } |
|
73 | 84 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
74 | 85 | } |
75 | 86 | } |
@@ -154,8 +165,11 @@ discard block |
||
154 | 165 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
155 | 166 | $aircraft_data = ''; |
156 | 167 | foreach($aircraft_array as $aircraft_item) { |
157 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
158 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
168 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') { |
|
169 | + $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
170 | + } else { |
|
171 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
172 | + } |
|
159 | 173 | } |
160 | 174 | $aircraft_data = substr($aircraft_data, 0, -1); |
161 | 175 | print 'var series = ['.$aircraft_data.'];'; |
@@ -172,11 +186,17 @@ discard block |
||
172 | 186 | <?php |
173 | 187 | if ($year != '' && $month != '') { |
174 | 188 | ?> |
175 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
189 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
190 | + echo '/'.$airline_icao; |
|
191 | +} |
|
192 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
176 | 193 | <?php |
177 | 194 | } else { |
178 | 195 | ?> |
179 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
196 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
197 | + echo '/'.$airline_icao; |
|
198 | +} |
|
199 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
180 | 200 | <?php |
181 | 201 | } |
182 | 202 | ?> |
@@ -205,11 +225,15 @@ discard block |
||
205 | 225 | print '</script>'; |
206 | 226 | if ($year != '' && $month != '') { |
207 | 227 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
208 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
228 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
229 | + echo '/'.$airline_icao; |
|
230 | + } |
|
209 | 231 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
210 | 232 | } else { |
211 | 233 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
212 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
234 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
235 | + echo '/'.$airline_icao; |
|
236 | + } |
|
213 | 237 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
214 | 238 | } |
215 | 239 | print '</div>'; |
@@ -229,8 +253,9 @@ discard block |
||
229 | 253 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
230 | 254 | <?php |
231 | 255 | $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
232 | - if (count($marine_array) == 0) print _("No data available"); |
|
233 | - else { |
|
256 | + if (count($marine_array) == 0) { |
|
257 | + print _("No data available"); |
|
258 | + } else { |
|
234 | 259 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
235 | 260 | $marine_data = ''; |
236 | 261 | foreach($marine_array as $marine_item) { |
@@ -274,8 +299,9 @@ discard block |
||
274 | 299 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
275 | 300 | <?php |
276 | 301 | $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
277 | - if (count($tracker_array) == 0) print _("No data available"); |
|
278 | - else { |
|
302 | + if (count($tracker_array) == 0) { |
|
303 | + print _("No data available"); |
|
304 | + } else { |
|
279 | 305 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
280 | 306 | $tracker_data = ''; |
281 | 307 | foreach($tracker_array as $tracker_item) { |
@@ -319,8 +345,9 @@ discard block |
||
319 | 345 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
320 | 346 | <?php |
321 | 347 | $owner_array = $Satellite->countAllOwners(true); |
322 | - if (count($owner_array) == 0) print _("No data available"); |
|
323 | - else { |
|
348 | + if (count($owner_array) == 0) { |
|
349 | + print _("No data available"); |
|
350 | + } else { |
|
324 | 351 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
325 | 352 | $owner_data = ''; |
326 | 353 | foreach($owner_array as $owner_item) { |
@@ -339,7 +366,10 @@ discard block |
||
339 | 366 | ?> |
340 | 367 | <!-- |
341 | 368 | <div class="more"> |
342 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
369 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
370 | + echo '/'.$airline_icao; |
|
371 | +} |
|
372 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
343 | 373 | </div> |
344 | 374 | --> |
345 | 375 | </div> |
@@ -348,8 +378,9 @@ discard block |
||
348 | 378 | <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2> |
349 | 379 | <?php |
350 | 380 | $countries_array = $Satellite->countAllCountriesOwners(true); |
351 | - if (count($countries_array) == 0) print _("No data available"); |
|
352 | - else { |
|
381 | + if (count($countries_array) == 0) { |
|
382 | + print _("No data available"); |
|
383 | + } else { |
|
353 | 384 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
354 | 385 | $owner_data = ''; |
355 | 386 | foreach($countries_array as $owner_item) { |
@@ -368,7 +399,10 @@ discard block |
||
368 | 399 | ?> |
369 | 400 | <!-- |
370 | 401 | <div class="more"> |
371 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
402 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
403 | + echo '/'.$airline_icao; |
|
404 | +} |
|
405 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
372 | 406 | </div> |
373 | 407 | --> |
374 | 408 | </div> |
@@ -380,8 +414,9 @@ discard block |
||
380 | 414 | <h2><?php echo _("Top 10 Most Common Launch Sites"); ?></h2> |
381 | 415 | <?php |
382 | 416 | $launch_site_array = $Satellite->countAllLaunchSite(true); |
383 | - if (count($launch_site_array) == 0) print _("No data available"); |
|
384 | - else { |
|
417 | + if (count($launch_site_array) == 0) { |
|
418 | + print _("No data available"); |
|
419 | + } else { |
|
385 | 420 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
386 | 421 | $launch_site_data = ''; |
387 | 422 | foreach($launch_site_array as $launch_site_item) { |
@@ -400,7 +435,10 @@ discard block |
||
400 | 435 | ?> |
401 | 436 | <!-- |
402 | 437 | <div class="more"> |
403 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
438 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
439 | + echo '/'.$airline_icao; |
|
440 | +} |
|
441 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
404 | 442 | </div> |
405 | 443 | --> |
406 | 444 | </div> |
@@ -423,8 +461,9 @@ discard block |
||
423 | 461 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
424 | 462 | <?php |
425 | 463 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
426 | - if (count($pilot_array) == 0) print _("No data available"); |
|
427 | - else { |
|
464 | + if (count($pilot_array) == 0) { |
|
465 | + print _("No data available"); |
|
466 | + } else { |
|
428 | 467 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
429 | 468 | $pilot_data = ''; |
430 | 469 | foreach($pilot_array as $pilot_item) { |
@@ -442,7 +481,9 @@ discard block |
||
442 | 481 | } |
443 | 482 | print '<div class="more">'; |
444 | 483 | print '<a href="'.$globalURL.'/statistics/pilot'; |
445 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
484 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
485 | + echo '/'.$airline_icao; |
|
486 | + } |
|
446 | 487 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
447 | 488 | print '</div>'; |
448 | 489 | ?> |
@@ -458,8 +499,9 @@ discard block |
||
458 | 499 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
459 | 500 | <?php |
460 | 501 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
461 | - if (count($owner_array) == 0) print _("No data available"); |
|
462 | - else { |
|
502 | + if (count($owner_array) == 0) { |
|
503 | + print _("No data available"); |
|
504 | + } else { |
|
463 | 505 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
464 | 506 | $owner_data = ''; |
465 | 507 | foreach($owner_array as $owner_item) { |
@@ -477,7 +519,10 @@ discard block |
||
477 | 519 | } |
478 | 520 | ?> |
479 | 521 | <div class="more"> |
480 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
522 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
523 | + echo '/'.$airline_icao; |
|
524 | +} |
|
525 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
481 | 526 | </div> |
482 | 527 | </div> |
483 | 528 | |
@@ -490,8 +535,9 @@ discard block |
||
490 | 535 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
491 | 536 | <?php |
492 | 537 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
493 | - if (count($flightover_array) == 0) print _("No data available"); |
|
494 | - else { |
|
538 | + if (count($flightover_array) == 0) { |
|
539 | + print _("No data available"); |
|
540 | + } else { |
|
495 | 541 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
496 | 542 | print 'var series = ['; |
497 | 543 | $flightover_data = ''; |
@@ -533,7 +579,10 @@ discard block |
||
533 | 579 | } |
534 | 580 | ?> |
535 | 581 | <div class="more"> |
536 | - <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
582 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
583 | + echo '/'.$airline_icao; |
|
584 | +} |
|
585 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
537 | 586 | </div> |
538 | 587 | </div> |
539 | 588 | <?php |
@@ -551,8 +600,9 @@ discard block |
||
551 | 600 | <div class="col-md-6"> |
552 | 601 | <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2> |
553 | 602 | <?php |
554 | - if (count($flightover_array) == 0) print _("No data available"); |
|
555 | - else { |
|
603 | + if (count($flightover_array) == 0) { |
|
604 | + print _("No data available"); |
|
605 | + } else { |
|
556 | 606 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
557 | 607 | print 'var series = ['; |
558 | 608 | $flightover_data = ''; |
@@ -608,8 +658,9 @@ discard block |
||
608 | 658 | <div class="col-md-6"> |
609 | 659 | <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2> |
610 | 660 | <?php |
611 | - if (count($flightover_array) == 0) print _("No data available"); |
|
612 | - else { |
|
661 | + if (count($flightover_array) == 0) { |
|
662 | + print _("No data available"); |
|
663 | + } else { |
|
613 | 664 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
614 | 665 | print 'var series = ['; |
615 | 666 | $flightover_data = ''; |
@@ -715,7 +766,9 @@ discard block |
||
715 | 766 | });"; |
716 | 767 | print '</script>'; |
717 | 768 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
718 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
769 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
770 | + echo '/'.$airline_icao; |
|
771 | + } |
|
719 | 772 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
720 | 773 | } |
721 | 774 | ?> |
@@ -777,7 +830,9 @@ discard block |
||
777 | 830 | });"; |
778 | 831 | print '</script>'; |
779 | 832 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
780 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
833 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
834 | + echo '/'.$airline_icao; |
|
835 | + } |
|
781 | 836 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
782 | 837 | } |
783 | 838 | ?> |
@@ -796,8 +851,9 @@ discard block |
||
796 | 851 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
797 | 852 | <?php |
798 | 853 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
799 | - if (count($year_array) == 0) print _("No data available"); |
|
800 | - else { |
|
854 | + if (count($year_array) == 0) { |
|
855 | + print _("No data available"); |
|
856 | + } else { |
|
801 | 857 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
802 | 858 | $year_data = ''; |
803 | 859 | $year_cnt = ''; |
@@ -816,7 +872,10 @@ discard block |
||
816 | 872 | } |
817 | 873 | ?> |
818 | 874 | <div class="more"> |
819 | - <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
875 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
876 | + echo '/'.$airline_icao; |
|
877 | +} |
|
878 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
820 | 879 | </div> |
821 | 880 | </div> |
822 | 881 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -824,8 +883,9 @@ discard block |
||
824 | 883 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
825 | 884 | <?php |
826 | 885 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
827 | - if (count($month_array) == 0) print _("No data available"); |
|
828 | - else { |
|
886 | + if (count($month_array) == 0) { |
|
887 | + print _("No data available"); |
|
888 | + } else { |
|
829 | 889 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
830 | 890 | $month_data = ''; |
831 | 891 | $month_cnt = ''; |
@@ -844,7 +904,10 @@ discard block |
||
844 | 904 | } |
845 | 905 | ?> |
846 | 906 | <div class="more"> |
847 | - <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
907 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
908 | + echo '/'.$airline_icao; |
|
909 | +} |
|
910 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
848 | 911 | </div> |
849 | 912 | </div> |
850 | 913 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -853,8 +916,9 @@ discard block |
||
853 | 916 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
854 | 917 | <?php |
855 | 918 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
856 | - if (empty($date_array)) print _("No data available"); |
|
857 | - else { |
|
919 | + if (empty($date_array)) { |
|
920 | + print _("No data available"); |
|
921 | + } else { |
|
858 | 922 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
859 | 923 | $date_data = ''; |
860 | 924 | $date_cnt = ''; |
@@ -873,7 +937,10 @@ discard block |
||
873 | 937 | } |
874 | 938 | ?> |
875 | 939 | <div class="more"> |
876 | - <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
940 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
941 | + echo '/'.$airline_icao; |
|
942 | +} |
|
943 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
877 | 944 | </div> |
878 | 945 | </div> |
879 | 946 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -881,8 +948,9 @@ discard block |
||
881 | 948 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
882 | 949 | <?php |
883 | 950 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
884 | - if (empty($hour_array)) print _("No data available"); |
|
885 | - else { |
|
951 | + if (empty($hour_array)) { |
|
952 | + print _("No data available"); |
|
953 | + } else { |
|
886 | 954 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
887 | 955 | $hour_data = ''; |
888 | 956 | $hour_cnt = ''; |
@@ -901,7 +969,10 @@ discard block |
||
901 | 969 | } |
902 | 970 | ?> |
903 | 971 | <div class="more"> |
904 | - <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
972 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
973 | + echo '/'.$airline_icao; |
|
974 | +} |
|
975 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
905 | 976 | </div> |
906 | 977 | </div> |
907 | 978 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -921,8 +992,9 @@ discard block |
||
921 | 992 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
922 | 993 | <?php |
923 | 994 | $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
924 | - if (count($year_array) == 0) print _("No data available"); |
|
925 | - else { |
|
995 | + if (count($year_array) == 0) { |
|
996 | + print _("No data available"); |
|
997 | + } else { |
|
926 | 998 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
927 | 999 | $year_data = ''; |
928 | 1000 | $year_cnt = ''; |
@@ -950,8 +1022,9 @@ discard block |
||
950 | 1022 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
951 | 1023 | <?php |
952 | 1024 | $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
953 | - if (count($month_array) == 0) print _("No data available"); |
|
954 | - else { |
|
1025 | + if (count($month_array) == 0) { |
|
1026 | + print _("No data available"); |
|
1027 | + } else { |
|
955 | 1028 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
956 | 1029 | $month_data = ''; |
957 | 1030 | $month_cnt = ''; |
@@ -979,8 +1052,9 @@ discard block |
||
979 | 1052 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
980 | 1053 | <?php |
981 | 1054 | $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
982 | - if (empty($date_array)) print _("No data available"); |
|
983 | - else { |
|
1055 | + if (empty($date_array)) { |
|
1056 | + print _("No data available"); |
|
1057 | + } else { |
|
984 | 1058 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
985 | 1059 | $date_data = ''; |
986 | 1060 | $date_cnt = ''; |
@@ -1007,8 +1081,9 @@ discard block |
||
1007 | 1081 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1008 | 1082 | <?php |
1009 | 1083 | $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
1010 | - if (empty($hour_array)) print _("No data available"); |
|
1011 | - else { |
|
1084 | + if (empty($hour_array)) { |
|
1085 | + print _("No data available"); |
|
1086 | + } else { |
|
1012 | 1087 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1013 | 1088 | $hour_data = ''; |
1014 | 1089 | $hour_cnt = ''; |
@@ -1047,8 +1122,9 @@ discard block |
||
1047 | 1122 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
1048 | 1123 | <?php |
1049 | 1124 | $year_array = $Tracker->countAllMonthsLastYear(true); |
1050 | - if (count($year_array) == 0) print _("No data available"); |
|
1051 | - else { |
|
1125 | + if (count($year_array) == 0) { |
|
1126 | + print _("No data available"); |
|
1127 | + } else { |
|
1052 | 1128 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
1053 | 1129 | $year_data = ''; |
1054 | 1130 | $year_cnt = ''; |
@@ -1076,8 +1152,9 @@ discard block |
||
1076 | 1152 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1077 | 1153 | <?php |
1078 | 1154 | $month_array = $Tracker->countAllDatesLastMonth(); |
1079 | - if (count($month_array) == 0) print _("No data available"); |
|
1080 | - else { |
|
1155 | + if (count($month_array) == 0) { |
|
1156 | + print _("No data available"); |
|
1157 | + } else { |
|
1081 | 1158 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1082 | 1159 | $month_data = ''; |
1083 | 1160 | $month_cnt = ''; |
@@ -1105,8 +1182,9 @@ discard block |
||
1105 | 1182 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
1106 | 1183 | <?php |
1107 | 1184 | $date_array = $Tracker->countAllDatesLast7Days(); |
1108 | - if (empty($date_array)) print _("No data available"); |
|
1109 | - else { |
|
1185 | + if (empty($date_array)) { |
|
1186 | + print _("No data available"); |
|
1187 | + } else { |
|
1110 | 1188 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1111 | 1189 | $date_data = ''; |
1112 | 1190 | $date_cnt = ''; |
@@ -1133,8 +1211,9 @@ discard block |
||
1133 | 1211 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1134 | 1212 | <?php |
1135 | 1213 | $hour_array = $Tracker->countAllHours('hour',true); |
1136 | - if (empty($hour_array)) print _("No data available"); |
|
1137 | - else { |
|
1214 | + if (empty($hour_array)) { |
|
1215 | + print _("No data available"); |
|
1216 | + } else { |
|
1138 | 1217 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1139 | 1218 | $hour_data = ''; |
1140 | 1219 | $hour_cnt = ''; |
@@ -1173,8 +1252,9 @@ discard block |
||
1173 | 1252 | <h2><?php echo _("Busiest Launch Months of the last 12 Months"); ?></h2> |
1174 | 1253 | <?php |
1175 | 1254 | $year_array = $Satellite->countAllMonthsLastYear(); |
1176 | - if (count($year_array) == 0) print _("No data available"); |
|
1177 | - else { |
|
1255 | + if (count($year_array) == 0) { |
|
1256 | + print _("No data available"); |
|
1257 | + } else { |
|
1178 | 1258 | print '<div id="chart21" class="chart" width="100%"></div><script>'; |
1179 | 1259 | $year_data = ''; |
1180 | 1260 | $year_cnt = ''; |
@@ -1204,8 +1284,9 @@ discard block |
||
1204 | 1284 | <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2> |
1205 | 1285 | <?php |
1206 | 1286 | $year_array = $Satellite->countAllYears(); |
1207 | - if (count($year_array) == 0) print _("No data available"); |
|
1208 | - else { |
|
1287 | + if (count($year_array) == 0) { |
|
1288 | + print _("No data available"); |
|
1289 | + } else { |
|
1209 | 1290 | print '<div id="chart22" class="chart" width="100%"></div><script>'; |
1210 | 1291 | $year_data = ''; |
1211 | 1292 | $year_cnt = ''; |
@@ -1247,8 +1328,9 @@ discard block |
||
1247 | 1328 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
1248 | 1329 | <?php |
1249 | 1330 | $year_array = $Stats->countFatalitiesByYear(); |
1250 | - if (count($year_array) == 0) print _("No data available"); |
|
1251 | - else { |
|
1331 | + if (count($year_array) == 0) { |
|
1332 | + print _("No data available"); |
|
1333 | + } else { |
|
1252 | 1334 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1253 | 1335 | $year_data = ''; |
1254 | 1336 | $year_cnt = ''; |
@@ -1277,8 +1359,9 @@ discard block |
||
1277 | 1359 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
1278 | 1360 | <?php |
1279 | 1361 | $year_array = $Stats->countFatalitiesLast12Months(); |
1280 | - if (count($year_array) == 0) print _("No data available"); |
|
1281 | - else { |
|
1362 | + if (count($year_array) == 0) { |
|
1363 | + print _("No data available"); |
|
1364 | + } else { |
|
1282 | 1365 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1283 | 1366 | $year_data = ''; |
1284 | 1367 | $year_cnt = ''; |
@@ -1349,8 +1432,11 @@ discard block |
||
1349 | 1432 | $distance = $distance; |
1350 | 1433 | $unit = 'km'; |
1351 | 1434 | } |
1352 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1353 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1435 | + if (!isset($polar_data)) { |
|
1436 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1437 | + } else { |
|
1438 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1439 | + } |
|
1354 | 1440 | } |
1355 | 1441 | ?> |
1356 | 1442 | <div class="col-md-6"> |
@@ -1414,9 +1500,12 @@ discard block |
||
1414 | 1500 | foreach ($msg as $eachmsg) { |
1415 | 1501 | //$eachmsg = $msg[0]; |
1416 | 1502 | $data = $eachmsg['source_data']; |
1417 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1418 | - else $max = 500; |
|
1419 | -?> |
|
1503 | + if ($data > 500) { |
|
1504 | + $max = (round(($data+100)/100))*100; |
|
1505 | + } else { |
|
1506 | + $max = 500; |
|
1507 | + } |
|
1508 | + ?> |
|
1420 | 1509 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
1421 | 1510 | <script> |
1422 | 1511 | var g = new JustGage({ |