@@ -24,20 +24,20 @@ discard block |
||
24 | 24 | fclose($fp); |
25 | 25 | } |
26 | 26 | |
27 | - public static function gunzip($in_file,$out_file_name = '') { |
|
27 | + public static function gunzip($in_file, $out_file_name = '') { |
|
28 | 28 | //echo $in_file.' -> '.$out_file_name."\n"; |
29 | 29 | $buffer_size = 4096; // read 4kb at a time |
30 | 30 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
31 | 31 | if ($in_file != '' && file_exists($in_file)) { |
32 | 32 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
33 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
34 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
33 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
34 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
35 | 35 | else { |
36 | 36 | echo 'gzopen not available'; |
37 | 37 | die; |
38 | 38 | } |
39 | 39 | $out_file = fopen($out_file_name, 'wb'); |
40 | - while(!gzeof($file)) { |
|
40 | + while (!gzeof($file)) { |
|
41 | 41 | fwrite($out_file, gzread($file, $buffer_size)); |
42 | 42 | } |
43 | 43 | fclose($out_file); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | try { |
62 | 62 | self::$db_sqlite = new PDO('sqlite:'.$database); |
63 | 63 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
64 | - } catch(PDOException $e) { |
|
64 | + } catch (PDOException $e) { |
|
65 | 65 | return "error : ".$e->getMessage(); |
66 | 66 | } |
67 | 67 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | //$Connection = new Connection(); |
77 | 77 | $sth = $Connection->db->prepare($query); |
78 | 78 | $sth->execute(array(':source' => $database_file)); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error : ".$e->getMessage(); |
81 | 81 | } |
82 | 82 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | try { |
88 | 88 | $sth = update_db::$db_sqlite->prepare($query); |
89 | 89 | $sth->execute(); |
90 | - } catch(PDOException $e) { |
|
90 | + } catch (PDOException $e) { |
|
91 | 91 | return "error : ".$e->getMessage(); |
92 | 92 | } |
93 | 93 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | if ($globalTransaction) $Connection->db->beginTransaction(); |
99 | 99 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
100 | 100 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
101 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
101 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
102 | 102 | $sth_dest->execute($query_dest_values); |
103 | 103 | } |
104 | 104 | if ($globalTransaction) $Connection->db->commit(); |
105 | - } catch(PDOException $e) { |
|
105 | + } catch (PDOException $e) { |
|
106 | 106 | if ($globalTransaction) $Connection->db->rollBack(); |
107 | 107 | return "error : ".$e->getMessage(); |
108 | 108 | } |
@@ -118,26 +118,26 @@ discard block |
||
118 | 118 | //$Connection = new Connection(); |
119 | 119 | $sth = $Connection->db->prepare($query); |
120 | 120 | $sth->execute(array(':source' => 'oneworld')); |
121 | - } catch(PDOException $e) { |
|
121 | + } catch (PDOException $e) { |
|
122 | 122 | return "error : ".$e->getMessage(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | if ($globalDebug) echo " - Add routes to DB -"; |
126 | 126 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
127 | 127 | $Spotter = new Spotter(); |
128 | - if ($fh = fopen($database_file,"r")) { |
|
128 | + if ($fh = fopen($database_file, "r")) { |
|
129 | 129 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
130 | 130 | $Connection = new Connection(); |
131 | 131 | $sth_dest = $Connection->db->prepare($query_dest); |
132 | 132 | if ($globalTransaction) $Connection->db->beginTransaction(); |
133 | 133 | while (!feof($fh)) { |
134 | - $line = fgetcsv($fh,9999,','); |
|
134 | + $line = fgetcsv($fh, 9999, ','); |
|
135 | 135 | if ($line[0] != '') { |
136 | 136 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
137 | 137 | try { |
138 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
138 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
139 | 139 | $sth_dest->execute($query_dest_values); |
140 | - } catch(PDOException $e) { |
|
140 | + } catch (PDOException $e) { |
|
141 | 141 | if ($globalTransaction) $Connection->db->rollBack(); |
142 | 142 | return "error : ".$e->getMessage(); |
143 | 143 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | //$Connection = new Connection(); |
160 | 160 | $sth = $Connection->db->prepare($query); |
161 | 161 | $sth->execute(array(':source' => 'skyteam')); |
162 | - } catch(PDOException $e) { |
|
162 | + } catch (PDOException $e) { |
|
163 | 163 | return "error : ".$e->getMessage(); |
164 | 164 | } |
165 | 165 | |
@@ -167,24 +167,24 @@ discard block |
||
167 | 167 | |
168 | 168 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
169 | 169 | $Spotter = new Spotter(); |
170 | - if ($fh = fopen($database_file,"r")) { |
|
170 | + if ($fh = fopen($database_file, "r")) { |
|
171 | 171 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
172 | 172 | $Connection = new Connection(); |
173 | 173 | $sth_dest = $Connection->db->prepare($query_dest); |
174 | 174 | try { |
175 | 175 | if ($globalTransaction) $Connection->db->beginTransaction(); |
176 | 176 | while (!feof($fh)) { |
177 | - $line = fgetcsv($fh,9999,','); |
|
177 | + $line = fgetcsv($fh, 9999, ','); |
|
178 | 178 | if ($line[0] != '') { |
179 | 179 | //$datebe = explode(' - ',$line[2]); |
180 | 180 | //if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
181 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
181 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
182 | 182 | $sth_dest->execute($query_dest_values); |
183 | 183 | //} |
184 | 184 | } |
185 | 185 | } |
186 | 186 | if ($globalTransaction) $Connection->db->commit(); |
187 | - } catch(PDOException $e) { |
|
187 | + } catch (PDOException $e) { |
|
188 | 188 | if ($globalTransaction) $Connection->db->rollBack(); |
189 | 189 | return "error : ".$e->getMessage(); |
190 | 190 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $Connection = new Connection(); |
200 | 200 | $sth = $Connection->db->prepare($query); |
201 | 201 | $sth->execute(array(':source' => $database_file)); |
202 | - } catch(PDOException $e) { |
|
202 | + } catch (PDOException $e) { |
|
203 | 203 | return "error : ".$e->getMessage(); |
204 | 204 | } |
205 | 205 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $Connection = new Connection(); |
208 | 208 | $sth = $Connection->db->prepare($query); |
209 | 209 | $sth->execute(array(':source' => $database_file)); |
210 | - } catch(PDOException $e) { |
|
210 | + } catch (PDOException $e) { |
|
211 | 211 | return "error : ".$e->getMessage(); |
212 | 212 | } |
213 | 213 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | try { |
217 | 217 | $sth = update_db::$db_sqlite->prepare($query); |
218 | 218 | $sth->execute(); |
219 | - } catch(PDOException $e) { |
|
219 | + } catch (PDOException $e) { |
|
220 | 220 | return "error : ".$e->getMessage(); |
221 | 221 | } |
222 | 222 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
234 | 234 | if ($values['UserString4'] == 'M') $type = 'military'; |
235 | 235 | else $type = null; |
236 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
236 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
237 | 237 | $sth_dest->execute($query_dest_values); |
238 | 238 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
239 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
239 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
240 | 240 | $sth_dest_owner->execute($query_dest_owner_values); |
241 | 241 | } |
242 | 242 | } |
243 | 243 | if ($globalTransaction) $Connection->db->commit(); |
244 | - } catch(PDOException $e) { |
|
244 | + } catch (PDOException $e) { |
|
245 | 245 | return "error : ".$e->getMessage(); |
246 | 246 | } |
247 | 247 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $Connection = new Connection(); |
251 | 251 | $sth = $Connection->db->prepare($query); |
252 | 252 | $sth->execute(array(':source' => $database_file)); |
253 | - } catch(PDOException $e) { |
|
253 | + } catch (PDOException $e) { |
|
254 | 254 | return "error : ".$e->getMessage(); |
255 | 255 | } |
256 | 256 | return ''; |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | $Connection = new Connection(); |
266 | 266 | $sth = $Connection->db->prepare($query); |
267 | 267 | $sth->execute(array(':source' => $database_file)); |
268 | - } catch(PDOException $e) { |
|
268 | + } catch (PDOException $e) { |
|
269 | 269 | return "error : ".$e->getMessage(); |
270 | 270 | } |
271 | 271 | |
272 | - if ($fh = fopen($database_file,"r")) { |
|
272 | + if ($fh = fopen($database_file, "r")) { |
|
273 | 273 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
274 | 274 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)'; |
275 | 275 | |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | if ($globalTransaction) $Connection->db->beginTransaction(); |
280 | 280 | while (!feof($fh)) { |
281 | 281 | $values = array(); |
282 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
282 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
283 | 283 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
284 | - $values['ModeS'] = substr($line,0,6); |
|
285 | - $values['Registration'] = trim(substr($line,69,6)); |
|
286 | - $aircraft_name = trim(substr($line,48,6)); |
|
284 | + $values['ModeS'] = substr($line, 0, 6); |
|
285 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
286 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
287 | 287 | // Check if we can find ICAO, else set it to GLID |
288 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
288 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
289 | 289 | $search_more = ''; |
290 | 290 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
291 | 291 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -297,20 +297,20 @@ discard block |
||
297 | 297 | if (isset($result['icao']) && $result['icao'] != '') { |
298 | 298 | $values['ICAOTypeCode'] = $result['icao']; |
299 | 299 | } |
300 | - } catch(PDOException $e) { |
|
300 | + } catch (PDOException $e) { |
|
301 | 301 | return "error : ".$e->getMessage(); |
302 | 302 | } |
303 | 303 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
304 | 304 | // Add data to db |
305 | 305 | if ($values['ModeS'] != '' && $values['Registration'] != '' && $values['Registration'] != '0000') { |
306 | 306 | //$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']); |
307 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file); |
|
307 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file); |
|
308 | 308 | //print_r($query_dest_values); |
309 | 309 | $sth_dest->execute($query_dest_values); |
310 | 310 | } |
311 | 311 | } |
312 | 312 | if ($globalTransaction) $Connection->db->commit(); |
313 | - } catch(PDOException $e) { |
|
313 | + } catch (PDOException $e) { |
|
314 | 314 | return "error : ".$e->getMessage(); |
315 | 315 | } |
316 | 316 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $Connection = new Connection(); |
321 | 321 | $sth = $Connection->db->prepare($query); |
322 | 322 | $sth->execute(array(':source' => $database_file)); |
323 | - } catch(PDOException $e) { |
|
323 | + } catch (PDOException $e) { |
|
324 | 324 | return "error : ".$e->getMessage(); |
325 | 325 | } |
326 | 326 | return ''; |
@@ -334,11 +334,11 @@ discard block |
||
334 | 334 | $Connection = new Connection(); |
335 | 335 | $sth = $Connection->db->prepare($query); |
336 | 336 | $sth->execute(array(':source' => $database_file)); |
337 | - } catch(PDOException $e) { |
|
337 | + } catch (PDOException $e) { |
|
338 | 338 | return "error : ".$e->getMessage(); |
339 | 339 | } |
340 | 340 | |
341 | - if ($fh = fopen($database_file,"r")) { |
|
341 | + if ($fh = fopen($database_file, "r")) { |
|
342 | 342 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
343 | 343 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)'; |
344 | 344 | |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | $sth_dest = $Connection->db->prepare($query_dest); |
347 | 347 | try { |
348 | 348 | if ($globalTransaction) $Connection->db->beginTransaction(); |
349 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
349 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
350 | 350 | while (!feof($fh)) { |
351 | - $line = fgetcsv($fh,9999,',',"'"); |
|
351 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
352 | 352 | |
353 | 353 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
354 | 354 | //print_r($line); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $values['Registration'] = $line[3]; |
357 | 357 | $aircraft_name = $line[2]; |
358 | 358 | // Check if we can find ICAO, else set it to GLID |
359 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
359 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
360 | 360 | $search_more = ''; |
361 | 361 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
362 | 362 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -365,20 +365,20 @@ discard block |
||
365 | 365 | $sth_search->execute(); |
366 | 366 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
367 | 367 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
368 | - } catch(PDOException $e) { |
|
368 | + } catch (PDOException $e) { |
|
369 | 369 | return "error : ".$e->getMessage(); |
370 | 370 | } |
371 | 371 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
372 | 372 | // Add data to db |
373 | 373 | if ($values['ModeS'] != '' && $values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
374 | 374 | //$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']); |
375 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file); |
|
375 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file); |
|
376 | 376 | //print_r($query_dest_values); |
377 | 377 | $sth_dest->execute($query_dest_values); |
378 | 378 | } |
379 | 379 | } |
380 | 380 | if ($globalTransaction) $Connection->db->commit(); |
381 | - } catch(PDOException $e) { |
|
381 | + } catch (PDOException $e) { |
|
382 | 382 | return "error : ".$e->getMessage(); |
383 | 383 | } |
384 | 384 | } |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | $Connection = new Connection(); |
389 | 389 | $sth = $Connection->db->prepare($query); |
390 | 390 | $sth->execute(array(':source' => $database_file)); |
391 | - } catch(PDOException $e) { |
|
391 | + } catch (PDOException $e) { |
|
392 | 392 | return "error : ".$e->getMessage(); |
393 | 393 | } |
394 | 394 | return ''; |
395 | 395 | } |
396 | 396 | |
397 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
397 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
398 | 398 | global $globalTransaction; |
399 | 399 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
400 | 400 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -402,11 +402,11 @@ discard block |
||
402 | 402 | $Connection = new Connection(); |
403 | 403 | $sth = $Connection->db->prepare($query); |
404 | 404 | $sth->execute(array(':source' => $database_file)); |
405 | - } catch(PDOException $e) { |
|
405 | + } catch (PDOException $e) { |
|
406 | 406 | return "error : ".$e->getMessage(); |
407 | 407 | } |
408 | 408 | |
409 | - if ($fh = fopen($database_file,"r")) { |
|
409 | + if ($fh = fopen($database_file, "r")) { |
|
410 | 410 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
411 | 411 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
412 | 412 | |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | $sth_dest = $Connection->db->prepare($query_dest); |
415 | 415 | try { |
416 | 416 | if ($globalTransaction) $Connection->db->beginTransaction(); |
417 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
417 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
418 | 418 | while (!feof($fh)) { |
419 | - $line = fgetcsv($fh,9999,',','"'); |
|
419 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
420 | 420 | $values = array(); |
421 | 421 | //print_r($line); |
422 | 422 | if ($country == 'F') { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | $values['base'] = $line[4]; |
425 | 425 | $values['owner'] = $line[5]; |
426 | 426 | if ($line[6] == '') $values['date_first_reg'] = null; |
427 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
427 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
428 | 428 | $values['cancel'] = $line[7]; |
429 | 429 | } elseif ($country == 'EI') { |
430 | 430 | // TODO : add modeS & reg to aircraft_modes |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $values['base'] = $line[3]; |
433 | 433 | $values['owner'] = $line[2]; |
434 | 434 | if ($line[1] == '') $values['date_first_reg'] = null; |
435 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
435 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
436 | 436 | $values['cancel'] = ''; |
437 | 437 | } elseif ($country == 'HB') { |
438 | 438 | // TODO : add modeS & reg to aircraft_modes |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | $values['base'] = null; |
448 | 448 | $values['owner'] = $line[5]; |
449 | 449 | if ($line[18] == '') $values['date_first_reg'] = null; |
450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
450 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
451 | 451 | $values['cancel'] = ''; |
452 | 452 | } elseif ($country == 'VH') { |
453 | 453 | // TODO : add modeS & reg to aircraft_modes |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | $values['base'] = null; |
456 | 456 | $values['owner'] = $line[12]; |
457 | 457 | if ($line[28] == '') $values['date_first_reg'] = null; |
458 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
458 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
459 | 459 | |
460 | 460 | $values['cancel'] = $line[39]; |
461 | 461 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -475,28 +475,28 @@ discard block |
||
475 | 475 | $values['base'] = null; |
476 | 476 | $values['owner'] = $line[8]; |
477 | 477 | if ($line[7] == '') $values['date_first_reg'] = null; |
478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
478 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
479 | 479 | $values['cancel'] = ''; |
480 | 480 | } elseif ($country == 'PP') { |
481 | 481 | $values['registration'] = $line[0]; |
482 | 482 | $values['base'] = null; |
483 | 483 | $values['owner'] = $line[4]; |
484 | 484 | if ($line[6] == '') $values['date_first_reg'] = null; |
485 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
485 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
486 | 486 | $values['cancel'] = $line[7]; |
487 | 487 | } elseif ($country == 'E7') { |
488 | 488 | $values['registration'] = $line[0]; |
489 | 489 | $values['base'] = null; |
490 | 490 | $values['owner'] = $line[4]; |
491 | 491 | if ($line[5] == '') $values['date_first_reg'] = null; |
492 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
492 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
493 | 493 | $values['cancel'] = ''; |
494 | 494 | } elseif ($country == '8Q') { |
495 | 495 | $values['registration'] = $line[0]; |
496 | 496 | $values['base'] = null; |
497 | 497 | $values['owner'] = $line[3]; |
498 | 498 | if ($line[7] == '') $values['date_first_reg'] = null; |
499 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
499 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
500 | 500 | $values['cancel'] = ''; |
501 | 501 | } elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
502 | 502 | $values['registration'] = $line[0]; |
@@ -506,12 +506,12 @@ discard block |
||
506 | 506 | $values['cancel'] = ''; |
507 | 507 | } |
508 | 508 | if ($values['cancel'] == '' && $values['registration'] != null) { |
509 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
509 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
510 | 510 | $sth_dest->execute($query_dest_values); |
511 | 511 | } |
512 | 512 | } |
513 | 513 | if ($globalTransaction) $Connection->db->commit(); |
514 | - } catch(PDOException $e) { |
|
514 | + } catch (PDOException $e) { |
|
515 | 515 | return "error : ".$e->getMessage(); |
516 | 516 | } |
517 | 517 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $Connection = new Connection(); |
627 | 627 | $sth = $Connection->db->prepare($query); |
628 | 628 | $sth->execute(); |
629 | - } catch(PDOException $e) { |
|
629 | + } catch (PDOException $e) { |
|
630 | 630 | return "error : ".$e->getMessage(); |
631 | 631 | } |
632 | 632 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | $Connection = new Connection(); |
637 | 637 | $sth = $Connection->db->prepare($query); |
638 | 638 | $sth->execute(); |
639 | - } catch(PDOException $e) { |
|
639 | + } catch (PDOException $e) { |
|
640 | 640 | return "error : ".$e->getMessage(); |
641 | 641 | } |
642 | 642 | |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | if ($globalTransaction) $Connection->db->beginTransaction(); |
648 | 648 | |
649 | 649 | $i = 0; |
650 | - while($row = sparql_fetch_array($result)) |
|
650 | + while ($row = sparql_fetch_array($result)) |
|
651 | 651 | { |
652 | 652 | if ($i >= 1) { |
653 | 653 | //print_r($row); |
@@ -667,31 +667,31 @@ discard block |
||
667 | 667 | $row['image'] = ''; |
668 | 668 | $row['image_thumb'] = ''; |
669 | 669 | } else { |
670 | - $image = str_replace(' ','_',$row['image']); |
|
670 | + $image = str_replace(' ', '_', $row['image']); |
|
671 | 671 | $digest = md5($image); |
672 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
673 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
674 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
675 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
672 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
673 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
674 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
675 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
676 | 676 | } |
677 | 677 | |
678 | - $country = explode('-',$row['country']); |
|
678 | + $country = explode('-', $row['country']); |
|
679 | 679 | $row['country'] = $country[0]; |
680 | 680 | |
681 | 681 | $row['type'] = trim($row['type']); |
682 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
682 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
683 | 683 | $row['type'] = 'Military'; |
684 | 684 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
685 | 685 | $row['type'] = 'small_airport'; |
686 | 686 | } |
687 | 687 | |
688 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
689 | - $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
688 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
689 | + $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $row['altitude'], ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
690 | 690 | //print_r($query_dest_values); |
691 | 691 | |
692 | 692 | try { |
693 | 693 | $sth_dest->execute($query_dest_values); |
694 | - } catch(PDOException $e) { |
|
694 | + } catch (PDOException $e) { |
|
695 | 695 | return "error : ".$e->getMessage(); |
696 | 696 | } |
697 | 697 | } |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $Connection = new Connection(); |
706 | 706 | $sth = $Connection->db->prepare($query); |
707 | 707 | $sth->execute(); |
708 | - } catch(PDOException $e) { |
|
708 | + } catch (PDOException $e) { |
|
709 | 709 | return "error : ".$e->getMessage(); |
710 | 710 | } |
711 | 711 | |
@@ -713,12 +713,12 @@ discard block |
||
713 | 713 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
714 | 714 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
715 | 715 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
716 | - $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
|
716 | + $query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => ''); |
|
717 | 717 | try { |
718 | 718 | $Connection = new Connection(); |
719 | 719 | $sth = $Connection->db->prepare($query); |
720 | 720 | $sth->execute($query_values); |
721 | - } catch(PDOException $e) { |
|
721 | + } catch (PDOException $e) { |
|
722 | 722 | return "error : ".$e->getMessage(); |
723 | 723 | } |
724 | 724 | $i++; |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | echo "Download data from ourairports.com...\n"; |
737 | 737 | $delimiter = ','; |
738 | 738 | $out_file = $tmp_dir.'airports.csv'; |
739 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
739 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
740 | 740 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
741 | 741 | echo "Add data from ourairports.com...\n"; |
742 | 742 | |
@@ -747,32 +747,32 @@ discard block |
||
747 | 747 | //$Connection->db->beginTransaction(); |
748 | 748 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
749 | 749 | { |
750 | - if(!$header) $header = $row; |
|
750 | + if (!$header) $header = $row; |
|
751 | 751 | else { |
752 | 752 | $data = array(); |
753 | 753 | $data = array_combine($header, $row); |
754 | 754 | try { |
755 | 755 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
756 | 756 | $sth->execute(array(':icao' => $data['gps_code'])); |
757 | - } catch(PDOException $e) { |
|
757 | + } catch (PDOException $e) { |
|
758 | 758 | return "error : ".$e->getMessage(); |
759 | 759 | } |
760 | 760 | if ($sth->fetchColumn() > 0) { |
761 | 761 | $query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
762 | 762 | try { |
763 | 763 | $sth = $Connection->db->prepare($query); |
764 | - $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
765 | - } catch(PDOException $e) { |
|
764 | + $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
765 | + } catch (PDOException $e) { |
|
766 | 766 | return "error : ".$e->getMessage(); |
767 | 767 | } |
768 | 768 | } else { |
769 | 769 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
770 | 770 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
771 | - $query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
771 | + $query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
772 | 772 | try { |
773 | 773 | $sth = $Connection->db->prepare($query); |
774 | 774 | $sth->execute($query_values); |
775 | - } catch(PDOException $e) { |
|
775 | + } catch (PDOException $e) { |
|
776 | 776 | return "error : ".$e->getMessage(); |
777 | 777 | } |
778 | 778 | $i++; |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | |
786 | 786 | echo "Download data from another free database...\n"; |
787 | 787 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
788 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
788 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
789 | 789 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
790 | 790 | update_db::unzip($out_file); |
791 | 791 | $header = NULL; |
@@ -797,15 +797,15 @@ discard block |
||
797 | 797 | //$Connection->db->beginTransaction(); |
798 | 798 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
799 | 799 | { |
800 | - if(!$header) $header = $row; |
|
800 | + if (!$header) $header = $row; |
|
801 | 801 | else { |
802 | 802 | $data = $row; |
803 | 803 | |
804 | 804 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
805 | 805 | try { |
806 | 806 | $sth = $Connection->db->prepare($query); |
807 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
808 | - } catch(PDOException $e) { |
|
807 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
808 | + } catch (PDOException $e) { |
|
809 | 809 | return "error : ".$e->getMessage(); |
810 | 810 | } |
811 | 811 | } |
@@ -819,15 +819,15 @@ discard block |
||
819 | 819 | try { |
820 | 820 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
821 | 821 | $sth->execute(); |
822 | - } catch(PDOException $e) { |
|
822 | + } catch (PDOException $e) { |
|
823 | 823 | return "error : ".$e->getMessage(); |
824 | 824 | } |
825 | 825 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
826 | 826 | $query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
827 | 827 | try { |
828 | 828 | $sth2 = $Connection->db->prepare($query2); |
829 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
830 | - } catch(PDOException $e) { |
|
829 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
830 | + } catch (PDOException $e) { |
|
831 | 831 | return "error : ".$e->getMessage(); |
832 | 832 | } |
833 | 833 | } |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | $Connection = new Connection(); |
852 | 852 | $sth = $Connection->db->prepare($query); |
853 | 853 | $sth->execute(array(':source' => 'translation.csv')); |
854 | - } catch(PDOException $e) { |
|
854 | + } catch (PDOException $e) { |
|
855 | 855 | return "error : ".$e->getMessage(); |
856 | 856 | } |
857 | 857 | |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
869 | 869 | { |
870 | 870 | $i++; |
871 | - if($i > 12) { |
|
871 | + if ($i > 12) { |
|
872 | 872 | $data = $row; |
873 | 873 | $operator = $data[2]; |
874 | 874 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | //echo substr($operator, 0, 2)."\n";; |
877 | 877 | if (count($airline_array) > 0) { |
878 | 878 | //print_r($airline_array); |
879 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
879 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
880 | 880 | } |
881 | 881 | } |
882 | 882 | |
@@ -884,14 +884,14 @@ discard block |
||
884 | 884 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
885 | 885 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
886 | 886 | if (count($airline_array) > 0) { |
887 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
887 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
888 | 888 | } |
889 | 889 | } |
890 | 890 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
891 | 891 | try { |
892 | 892 | $sth = $Connection->db->prepare($query); |
893 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
894 | - } catch(PDOException $e) { |
|
893 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
894 | + } catch (PDOException $e) { |
|
895 | 895 | return "error : ".$e->getMessage(); |
896 | 896 | } |
897 | 897 | } |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | $Connection = new Connection(); |
912 | 912 | $sth = $Connection->db->prepare($query); |
913 | 913 | $sth->execute(array(':source' => 'website_fam')); |
914 | - } catch(PDOException $e) { |
|
914 | + } catch (PDOException $e) { |
|
915 | 915 | return "error : ".$e->getMessage(); |
916 | 916 | } |
917 | 917 | |
@@ -931,8 +931,8 @@ discard block |
||
931 | 931 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
932 | 932 | try { |
933 | 933 | $sth = $Connection->db->prepare($query); |
934 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
935 | - } catch(PDOException $e) { |
|
934 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
935 | + } catch (PDOException $e) { |
|
936 | 936 | return "error : ".$e->getMessage(); |
937 | 937 | } |
938 | 938 | } |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | return ''; |
945 | 945 | } |
946 | 946 | |
947 | - public static function tle($filename,$tletype) { |
|
947 | + public static function tle($filename, $tletype) { |
|
948 | 948 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
949 | 949 | global $tmp_dir, $globalTransaction; |
950 | 950 | //$Spotter = new Spotter(); |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | $Connection = new Connection(); |
955 | 955 | $sth = $Connection->db->prepare($query); |
956 | 956 | $sth->execute(array(':source' => $filename)); |
957 | - } catch(PDOException $e) { |
|
957 | + } catch (PDOException $e) { |
|
958 | 958 | return "error : ".$e->getMessage(); |
959 | 959 | } |
960 | 960 | |
@@ -979,8 +979,8 @@ discard block |
||
979 | 979 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
980 | 980 | try { |
981 | 981 | $sth = $Connection->db->prepare($query); |
982 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
983 | - } catch(PDOException $e) { |
|
982 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
983 | + } catch (PDOException $e) { |
|
984 | 984 | return "error : ".$e->getMessage(); |
985 | 985 | } |
986 | 986 | |
@@ -1000,28 +1000,28 @@ discard block |
||
1000 | 1000 | */ |
1001 | 1001 | private static function table2array($data) { |
1002 | 1002 | $html = str_get_html($data); |
1003 | - $tabledata=array(); |
|
1004 | - foreach($html->find('tr') as $element) |
|
1003 | + $tabledata = array(); |
|
1004 | + foreach ($html->find('tr') as $element) |
|
1005 | 1005 | { |
1006 | 1006 | $td = array(); |
1007 | - foreach( $element->find('th') as $row) |
|
1007 | + foreach ($element->find('th') as $row) |
|
1008 | 1008 | { |
1009 | 1009 | $td [] = trim($row->plaintext); |
1010 | 1010 | } |
1011 | - $td=array_filter($td); |
|
1011 | + $td = array_filter($td); |
|
1012 | 1012 | $tabledata[] = $td; |
1013 | 1013 | |
1014 | 1014 | $td = array(); |
1015 | 1015 | $tdi = array(); |
1016 | - foreach( $element->find('td') as $row) |
|
1016 | + foreach ($element->find('td') as $row) |
|
1017 | 1017 | { |
1018 | 1018 | $td [] = trim($row->plaintext); |
1019 | 1019 | $tdi [] = trim($row->innertext); |
1020 | 1020 | } |
1021 | - $td=array_filter($td); |
|
1022 | - $tdi=array_filter($tdi); |
|
1021 | + $td = array_filter($td); |
|
1022 | + $tdi = array_filter($tdi); |
|
1023 | 1023 | // $tabledata[]=array_merge($td,$tdi); |
1024 | - $tabledata[]=$td; |
|
1024 | + $tabledata[] = $td; |
|
1025 | 1025 | } |
1026 | 1026 | return(array_filter($tabledata)); |
1027 | 1027 | } |
@@ -1094,13 +1094,13 @@ discard block |
||
1094 | 1094 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1095 | 1095 | { |
1096 | 1096 | $i++; |
1097 | - if($i > 3 && count($row) > 2) { |
|
1097 | + if ($i > 3 && count($row) > 2) { |
|
1098 | 1098 | $data = array_values(array_filter($row)); |
1099 | 1099 | $cntdata = count($data); |
1100 | 1100 | if ($cntdata > 10) { |
1101 | 1101 | $value = $data[9]; |
1102 | 1102 | |
1103 | - for ($i =10;$i < $cntdata;$i++) { |
|
1103 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1104 | 1104 | $value .= ' '.$data[$i]; |
1105 | 1105 | } |
1106 | 1106 | $data[9] = $value; |
@@ -1110,8 +1110,8 @@ discard block |
||
1110 | 1110 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
1111 | 1111 | try { |
1112 | 1112 | $sth = $Connection->db->prepare($query); |
1113 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1114 | - } catch(PDOException $e) { |
|
1113 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1114 | + } catch (PDOException $e) { |
|
1115 | 1115 | return "error : ".$e->getMessage(); |
1116 | 1116 | } |
1117 | 1117 | } |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | $Connection = new Connection(); |
1133 | 1133 | $sth = $Connection->db->prepare($query); |
1134 | 1134 | $sth->execute(); |
1135 | - } catch(PDOException $e) { |
|
1135 | + } catch (PDOException $e) { |
|
1136 | 1136 | return "error : ".$e->getMessage(); |
1137 | 1137 | } |
1138 | 1138 | |
@@ -1144,12 +1144,12 @@ discard block |
||
1144 | 1144 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1145 | 1145 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1146 | 1146 | { |
1147 | - if(count($row) > 1) { |
|
1147 | + if (count($row) > 1) { |
|
1148 | 1148 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1149 | 1149 | try { |
1150 | 1150 | $sth = $Connection->db->prepare($query); |
1151 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1152 | - } catch(PDOException $e) { |
|
1151 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1152 | + } catch (PDOException $e) { |
|
1153 | 1153 | return "error : ".$e->getMessage(); |
1154 | 1154 | } |
1155 | 1155 | } |
@@ -1169,21 +1169,21 @@ discard block |
||
1169 | 1169 | try { |
1170 | 1170 | $sth = $Connection->db->prepare($query); |
1171 | 1171 | $sth->execute(); |
1172 | - } catch(PDOException $e) { |
|
1172 | + } catch (PDOException $e) { |
|
1173 | 1173 | return "error : ".$e->getMessage(); |
1174 | 1174 | } |
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | |
1178 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1178 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1179 | 1179 | else { |
1180 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1180 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1181 | 1181 | $query = "CREATE EXTENSION postgis"; |
1182 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1182 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1183 | 1183 | try { |
1184 | 1184 | $sth = $Connection->db->prepare($query); |
1185 | 1185 | $sth->execute(); |
1186 | - } catch(PDOException $e) { |
|
1186 | + } catch (PDOException $e) { |
|
1187 | 1187 | return "error : ".$e->getMessage(); |
1188 | 1188 | } |
1189 | 1189 | } |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | include_once('class.create_db.php'); |
1197 | 1197 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1198 | 1198 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1199 | - update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1199 | + update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1200 | 1200 | $error = ''; |
1201 | 1201 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1202 | 1202 | if ($globalDebug) echo "Gunzip..."; |
@@ -1228,14 +1228,14 @@ discard block |
||
1228 | 1228 | try { |
1229 | 1229 | $sth = $Connection->db->prepare($query); |
1230 | 1230 | $sth->execute(); |
1231 | - } catch(PDOException $e) { |
|
1231 | + } catch (PDOException $e) { |
|
1232 | 1232 | echo "error : ".$e->getMessage(); |
1233 | 1233 | } |
1234 | 1234 | } |
1235 | 1235 | if ($globalDBdriver == 'mysql') { |
1236 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1236 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1237 | 1237 | } else { |
1238 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1238 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1239 | 1239 | } |
1240 | 1240 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1241 | 1241 | return $error; |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1249 | 1249 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1250 | 1250 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
1251 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
1251 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
1252 | 1252 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1253 | 1253 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1254 | 1254 | return $error; |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1269 | 1269 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
1270 | 1270 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1271 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1271 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1272 | 1272 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
1273 | 1273 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
1274 | 1274 | if ($error != '') { |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | global $tmp_dir, $globalDebug; |
1282 | 1282 | $error = ''; |
1283 | 1283 | if ($globalDebug) echo "Routes : Download..."; |
1284 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
1284 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1285 | 1285 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1286 | 1286 | if ($globalDebug) echo "Gunzip..."; |
1287 | 1287 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | global $tmp_dir, $globalDebug; |
1298 | 1298 | $error = ''; |
1299 | 1299 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
1300 | - update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
1300 | + update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1301 | 1301 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1302 | 1302 | if ($globalDebug) echo "Gunzip..."; |
1303 | 1303 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | global $tmp_dir, $globalDebug; |
1314 | 1314 | $error = ''; |
1315 | 1315 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
1316 | - update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
1316 | + update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1317 | 1317 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1318 | 1318 | if ($globalDebug) echo "Gunzip..."; |
1319 | 1319 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | } elseif ($globalDebug) echo "Done\n"; |
1341 | 1341 | */ |
1342 | 1342 | if ($globalDebug) echo "Modes : Download..."; |
1343 | - update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
1343 | + update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip', $tmp_dir.'basestation_latest.zip', 'http://planebase.biz/bstnsqb'); |
|
1344 | 1344 | if (file_exists($tmp_dir.'basestation_latest.zip')) { |
1345 | 1345 | if ($globalDebug) echo "Unzip..."; |
1346 | 1346 | update_db::unzip($tmp_dir.'basestation_latest.zip'); |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | public static function update_ModeS_flarm() { |
1357 | 1357 | global $tmp_dir, $globalDebug; |
1358 | 1358 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
1359 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
1359 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
1360 | 1360 | if (file_exists($tmp_dir.'data.fln')) { |
1361 | 1361 | if ($globalDebug) echo "Add to DB..."; |
1362 | 1362 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | public static function update_ModeS_ogn() { |
1371 | 1371 | global $tmp_dir, $globalDebug; |
1372 | 1372 | if ($globalDebug) echo "Modes OGN: Download..."; |
1373 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
1373 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
1374 | 1374 | if (file_exists($tmp_dir.'ogn.csv')) { |
1375 | 1375 | if ($globalDebug) echo "Add to DB..."; |
1376 | 1376 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -1385,173 +1385,173 @@ discard block |
||
1385 | 1385 | global $tmp_dir, $globalDebug; |
1386 | 1386 | |
1387 | 1387 | if ($globalDebug) echo "Owner France: Download..."; |
1388 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
1388 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
1389 | 1389 | if (file_exists($tmp_dir.'owner_f.csv')) { |
1390 | 1390 | if ($globalDebug) echo "Add to DB..."; |
1391 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
1391 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
1392 | 1392 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
1393 | 1393 | if ($error != '') { |
1394 | 1394 | return $error; |
1395 | 1395 | } elseif ($globalDebug) echo "Done\n"; |
1396 | 1396 | |
1397 | 1397 | if ($globalDebug) echo "Owner Ireland: Download..."; |
1398 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
1398 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
1399 | 1399 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
1400 | 1400 | if ($globalDebug) echo "Add to DB..."; |
1401 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
1401 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
1402 | 1402 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
1403 | 1403 | if ($error != '') { |
1404 | 1404 | return $error; |
1405 | 1405 | } elseif ($globalDebug) echo "Done\n"; |
1406 | 1406 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
1407 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
1407 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
1408 | 1408 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
1409 | 1409 | if ($globalDebug) echo "Add to DB..."; |
1410 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
1410 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
1411 | 1411 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
1412 | 1412 | if ($error != '') { |
1413 | 1413 | return $error; |
1414 | 1414 | } elseif ($globalDebug) echo "Done\n"; |
1415 | 1415 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
1416 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
1416 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
1417 | 1417 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
1418 | 1418 | if ($globalDebug) echo "Add to DB..."; |
1419 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
1419 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
1420 | 1420 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
1421 | 1421 | if ($error != '') { |
1422 | 1422 | return $error; |
1423 | 1423 | } elseif ($globalDebug) echo "Done\n"; |
1424 | 1424 | if ($globalDebug) echo "Owner Australia: Download..."; |
1425 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
1425 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
1426 | 1426 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
1427 | 1427 | if ($globalDebug) echo "Add to DB..."; |
1428 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
1428 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
1429 | 1429 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
1430 | 1430 | if ($error != '') { |
1431 | 1431 | return $error; |
1432 | 1432 | } elseif ($globalDebug) echo "Done\n"; |
1433 | 1433 | if ($globalDebug) echo "Owner Austria: Download..."; |
1434 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
1434 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
1435 | 1435 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
1436 | 1436 | if ($globalDebug) echo "Add to DB..."; |
1437 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
1437 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
1438 | 1438 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
1439 | 1439 | if ($error != '') { |
1440 | 1440 | return $error; |
1441 | 1441 | } elseif ($globalDebug) echo "Done\n"; |
1442 | 1442 | if ($globalDebug) echo "Owner Chile: Download..."; |
1443 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
1443 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
1444 | 1444 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
1445 | 1445 | if ($globalDebug) echo "Add to DB..."; |
1446 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
1446 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
1447 | 1447 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
1448 | 1448 | if ($error != '') { |
1449 | 1449 | return $error; |
1450 | 1450 | } elseif ($globalDebug) echo "Done\n"; |
1451 | 1451 | if ($globalDebug) echo "Owner Colombia: Download..."; |
1452 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
1452 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
1453 | 1453 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
1454 | 1454 | if ($globalDebug) echo "Add to DB..."; |
1455 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
1455 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
1456 | 1456 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
1457 | 1457 | if ($error != '') { |
1458 | 1458 | return $error; |
1459 | 1459 | } elseif ($globalDebug) echo "Done\n"; |
1460 | 1460 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
1461 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
1461 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
1462 | 1462 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
1463 | 1463 | if ($globalDebug) echo "Add to DB..."; |
1464 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
1464 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
1465 | 1465 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
1466 | 1466 | if ($error != '') { |
1467 | 1467 | return $error; |
1468 | 1468 | } elseif ($globalDebug) echo "Done\n"; |
1469 | 1469 | if ($globalDebug) echo "Owner Brazil: Download..."; |
1470 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
1470 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
1471 | 1471 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
1472 | 1472 | if ($globalDebug) echo "Add to DB..."; |
1473 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
1473 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
1474 | 1474 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
1475 | 1475 | if ($error != '') { |
1476 | 1476 | return $error; |
1477 | 1477 | } elseif ($globalDebug) echo "Done\n"; |
1478 | 1478 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
1479 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
1479 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
1480 | 1480 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
1481 | 1481 | if ($globalDebug) echo "Add to DB..."; |
1482 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
1482 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
1483 | 1483 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
1484 | 1484 | if ($error != '') { |
1485 | 1485 | return $error; |
1486 | 1486 | } elseif ($globalDebug) echo "Done\n"; |
1487 | 1487 | if ($globalDebug) echo "Owner Croatia: Download..."; |
1488 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
1488 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
1489 | 1489 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
1490 | 1490 | if ($globalDebug) echo "Add to DB..."; |
1491 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
1491 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
1492 | 1492 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
1493 | 1493 | if ($error != '') { |
1494 | 1494 | return $error; |
1495 | 1495 | } elseif ($globalDebug) echo "Done\n"; |
1496 | 1496 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
1497 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
1497 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
1498 | 1498 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
1499 | 1499 | if ($globalDebug) echo "Add to DB..."; |
1500 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
1500 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
1501 | 1501 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
1502 | 1502 | if ($error != '') { |
1503 | 1503 | return $error; |
1504 | 1504 | } elseif ($globalDebug) echo "Done\n"; |
1505 | 1505 | if ($globalDebug) echo "Owner Maldives: Download..."; |
1506 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
1506 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
1507 | 1507 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
1508 | 1508 | if ($globalDebug) echo "Add to DB..."; |
1509 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
1509 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
1510 | 1510 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
1511 | 1511 | if ($error != '') { |
1512 | 1512 | return $error; |
1513 | 1513 | } elseif ($globalDebug) echo "Done\n"; |
1514 | 1514 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
1515 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
1515 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
1516 | 1516 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
1517 | 1517 | if ($globalDebug) echo "Add to DB..."; |
1518 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
1518 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
1519 | 1519 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
1520 | 1520 | if ($error != '') { |
1521 | 1521 | return $error; |
1522 | 1522 | } elseif ($globalDebug) echo "Done\n"; |
1523 | 1523 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
1524 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
1524 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
1525 | 1525 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
1526 | 1526 | if ($globalDebug) echo "Add to DB..."; |
1527 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
1527 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
1528 | 1528 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
1529 | 1529 | if ($error != '') { |
1530 | 1530 | return $error; |
1531 | 1531 | } elseif ($globalDebug) echo "Done\n"; |
1532 | 1532 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
1533 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
1533 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
1534 | 1534 | if (file_exists($tmp_dir.'owner_om.csv')) { |
1535 | 1535 | if ($globalDebug) echo "Add to DB..."; |
1536 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
1536 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
1537 | 1537 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
1538 | 1538 | if ($error != '') { |
1539 | 1539 | return $error; |
1540 | 1540 | } elseif ($globalDebug) echo "Done\n"; |
1541 | 1541 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
1542 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
1542 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
1543 | 1543 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
1544 | 1544 | if ($globalDebug) echo "Add to DB..."; |
1545 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
1545 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
1546 | 1546 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
1547 | 1547 | if ($error != '') { |
1548 | 1548 | return $error; |
1549 | 1549 | } elseif ($globalDebug) echo "Done\n"; |
1550 | 1550 | if ($globalDebug) echo "Owner Iceland: Download..."; |
1551 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
1551 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
1552 | 1552 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
1553 | 1553 | if ($globalDebug) echo "Add to DB..."; |
1554 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
1554 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
1555 | 1555 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
1556 | 1556 | if ($error != '') { |
1557 | 1557 | return $error; |
@@ -1563,7 +1563,7 @@ discard block |
||
1563 | 1563 | global $tmp_dir, $globalDebug; |
1564 | 1564 | $error = ''; |
1565 | 1565 | if ($globalDebug) echo "Translation : Download..."; |
1566 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
1566 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
1567 | 1567 | if (file_exists($tmp_dir.'translation.zip')) { |
1568 | 1568 | if ($globalDebug) echo "Unzip..."; |
1569 | 1569 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | public static function update_translation_fam() { |
1580 | 1580 | global $tmp_dir, $globalDebug; |
1581 | 1581 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
1582 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
1582 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
1583 | 1583 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
1584 | 1584 | if ($globalDebug) echo "Gunzip..."; |
1585 | 1585 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -1597,18 +1597,18 @@ discard block |
||
1597 | 1597 | include_once('class.create_db.php'); |
1598 | 1598 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
1599 | 1599 | if ($globalDBdriver == 'mysql') { |
1600 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
1600 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
1601 | 1601 | } else { |
1602 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
1602 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
1603 | 1603 | } |
1604 | 1604 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
1605 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
1605 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
1606 | 1606 | $airspace_md5 = $airspace_md5_file[0]; |
1607 | 1607 | if (!update_db::check_airspace_version($airspace_md5)) { |
1608 | 1608 | if ($globalDBdriver == 'mysql') { |
1609 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
1609 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
1610 | 1610 | } else { |
1611 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
1611 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
1612 | 1612 | } |
1613 | 1613 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
1614 | 1614 | if ($globalDebug) echo "Gunzip..."; |
@@ -1620,7 +1620,7 @@ discard block |
||
1620 | 1620 | try { |
1621 | 1621 | $sth = $Connection->db->prepare($query); |
1622 | 1622 | $sth->execute(); |
1623 | - } catch(PDOException $e) { |
|
1623 | + } catch (PDOException $e) { |
|
1624 | 1624 | return "error : ".$e->getMessage(); |
1625 | 1625 | } |
1626 | 1626 | } |
@@ -1638,15 +1638,15 @@ discard block |
||
1638 | 1638 | public static function update_tle() { |
1639 | 1639 | global $tmp_dir, $globalDebug; |
1640 | 1640 | if ($globalDebug) echo "Download TLE : Download..."; |
1641 | - $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', |
|
1642 | - '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', |
|
1643 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
1641 | + $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', |
|
1642 | + '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', |
|
1643 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
1644 | 1644 | foreach ($alltle as $filename) { |
1645 | 1645 | if ($globalDebug) echo "downloading ".$filename.'...'; |
1646 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
1646 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
1647 | 1647 | if (file_exists($tmp_dir.$filename)) { |
1648 | 1648 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
1649 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
1649 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
1650 | 1650 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
1651 | 1651 | if ($error != '') { |
1652 | 1652 | echo $error."\n"; |
@@ -1659,32 +1659,32 @@ discard block |
||
1659 | 1659 | global $tmp_dir, $globalDebug; |
1660 | 1660 | $error = ''; |
1661 | 1661 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
1662 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
1662 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
1663 | 1663 | if (file_exists($tmp_dir.'models.md5sum')) { |
1664 | 1664 | if ($globalDebug) echo "Check files...\n"; |
1665 | 1665 | $newmodelsdb = array(); |
1666 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
1667 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
1666 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
1667 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1668 | 1668 | $model = trim($row[2]); |
1669 | 1669 | $newmodelsdb[$model] = trim($row[0]); |
1670 | 1670 | } |
1671 | 1671 | } |
1672 | 1672 | $modelsdb = array(); |
1673 | 1673 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
1674 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
1675 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
1674 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
1675 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1676 | 1676 | $model = trim($row[2]); |
1677 | 1677 | $modelsdb[$model] = trim($row[0]); |
1678 | 1678 | } |
1679 | 1679 | } |
1680 | 1680 | } |
1681 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
1681 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
1682 | 1682 | foreach ($diff as $key => $value) { |
1683 | 1683 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
1684 | - update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
1684 | + update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
1685 | 1685 | |
1686 | 1686 | } |
1687 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
1687 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
1688 | 1688 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
1689 | 1689 | if ($error != '') { |
1690 | 1690 | return $error; |
@@ -1696,32 +1696,32 @@ discard block |
||
1696 | 1696 | global $tmp_dir, $globalDebug; |
1697 | 1697 | $error = ''; |
1698 | 1698 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
1699 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
1699 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
1700 | 1700 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
1701 | 1701 | if ($globalDebug) echo "Check files...\n"; |
1702 | 1702 | $newmodelsdb = array(); |
1703 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
1704 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
1703 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
1704 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1705 | 1705 | $model = trim($row[2]); |
1706 | 1706 | $newmodelsdb[$model] = trim($row[0]); |
1707 | 1707 | } |
1708 | 1708 | } |
1709 | 1709 | $modelsdb = array(); |
1710 | 1710 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
1711 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
1712 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
1711 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
1712 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1713 | 1713 | $model = trim($row[2]); |
1714 | 1714 | $modelsdb[$model] = trim($row[0]); |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | 1717 | } |
1718 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
1718 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
1719 | 1719 | foreach ($diff as $key => $value) { |
1720 | 1720 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
1721 | - update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
1721 | + update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
1722 | 1722 | |
1723 | 1723 | } |
1724 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
1724 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
1725 | 1725 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
1726 | 1726 | if ($error != '') { |
1727 | 1727 | return $error; |
@@ -1744,8 +1744,8 @@ discard block |
||
1744 | 1744 | */ |
1745 | 1745 | if (file_exists($tmp_dir.'aircrafts.html')) { |
1746 | 1746 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
1747 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
1748 | - $result = fread($fh,100000000); |
|
1747 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
1748 | + $result = fread($fh, 100000000); |
|
1749 | 1749 | //echo $result; |
1750 | 1750 | //var_dump(str_get_html($result)); |
1751 | 1751 | //print_r(self::table2array($result)); |
@@ -1763,23 +1763,23 @@ discard block |
||
1763 | 1763 | $Connection = new Connection(); |
1764 | 1764 | $sth = $Connection->db->prepare($query); |
1765 | 1765 | $sth->execute(); |
1766 | - } catch(PDOException $e) { |
|
1766 | + } catch (PDOException $e) { |
|
1767 | 1767 | return "error : ".$e->getMessage(); |
1768 | 1768 | } |
1769 | 1769 | |
1770 | 1770 | $error = ''; |
1771 | 1771 | if ($globalDebug) echo "Notam : Download..."; |
1772 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
1772 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
1773 | 1773 | if (file_exists($tmp_dir.'notam.rss')) { |
1774 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
1774 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
1775 | 1775 | foreach ($notams['channel']['item'] as $notam) { |
1776 | - $title = explode(':',$notam['title']); |
|
1776 | + $title = explode(':', $notam['title']); |
|
1777 | 1777 | $data['ref'] = trim($title[0]); |
1778 | 1778 | unset($title[0]); |
1779 | - $data['title'] = trim(implode(':',$title)); |
|
1780 | - $description = strip_tags($notam['description'],'<pre>'); |
|
1781 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
1782 | - $q = explode('/',$match[1]); |
|
1779 | + $data['title'] = trim(implode(':', $title)); |
|
1780 | + $description = strip_tags($notam['description'], '<pre>'); |
|
1781 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
1782 | + $q = explode('/', $match[1]); |
|
1783 | 1783 | $data['fir'] = $q[0]; |
1784 | 1784 | $data['code'] = $q[1]; |
1785 | 1785 | $ifrvfr = $q[2]; |
@@ -1795,30 +1795,30 @@ discard block |
||
1795 | 1795 | $data['lower_limit'] = $q[5]; |
1796 | 1796 | $data['upper_limit'] = $q[6]; |
1797 | 1797 | $latlonrad = $q[7]; |
1798 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
1799 | - $latitude = $Common->convertDec($las,'latitude'); |
|
1800 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
1798 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
1799 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
1800 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
1801 | 1801 | if ($lac == 'S') $latitude = '-'.$latitude; |
1802 | 1802 | if ($lnc == 'W') $longitude = '-'.$longitude; |
1803 | 1803 | $data['center_latitude'] = $latitude; |
1804 | 1804 | $data['center_longitude'] = $longitude; |
1805 | 1805 | $data['radius'] = intval($radius); |
1806 | 1806 | |
1807 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
1807 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
1808 | 1808 | $data['text'] = $match[1]; |
1809 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
1809 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
1810 | 1810 | $fromto = $match[1]; |
1811 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
1811 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
1812 | 1812 | $fromall = trim($match[1]); |
1813 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
1813 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
1814 | 1814 | $from = trim($match[1]); |
1815 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
1816 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
1815 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
1816 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
1817 | 1817 | $toall = trim($match[1]); |
1818 | - if (!preg_match(':Permanent:',$toall)) { |
|
1819 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
1818 | + if (!preg_match(':Permanent:', $toall)) { |
|
1819 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
1820 | 1820 | $to = trim($match[1]); |
1821 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
1821 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
1822 | 1822 | $data['permanent'] = 0; |
1823 | 1823 | } else { |
1824 | 1824 | $data['date_end'] = NULL; |
@@ -1826,7 +1826,7 @@ discard block |
||
1826 | 1826 | } |
1827 | 1827 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
1828 | 1828 | $NOTAM = new NOTAM(); |
1829 | - $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']); |
|
1829 | + $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']); |
|
1830 | 1830 | unset($data); |
1831 | 1831 | } |
1832 | 1832 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -1849,16 +1849,16 @@ discard block |
||
1849 | 1849 | $Connection = new Connection(); |
1850 | 1850 | $sth = $Connection->db->prepare($query); |
1851 | 1851 | $sth->execute(); |
1852 | - } catch(PDOException $e) { |
|
1852 | + } catch (PDOException $e) { |
|
1853 | 1853 | return "error : ".$e->getMessage(); |
1854 | 1854 | } |
1855 | 1855 | } |
1856 | 1856 | $Common = new Common(); |
1857 | 1857 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
1858 | - $airspace_json = json_decode($airspace_lst,true); |
|
1858 | + $airspace_json = json_decode($airspace_lst, true); |
|
1859 | 1859 | foreach ($airspace_json['records'] as $airspace) { |
1860 | 1860 | if ($globalDebug) echo $airspace['name']."...\n"; |
1861 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
1861 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
1862 | 1862 | if (file_exists($tmp_dir.$airspace['name'])) { |
1863 | 1863 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
1864 | 1864 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -1882,7 +1882,7 @@ discard block |
||
1882 | 1882 | $Connection = new Connection(); |
1883 | 1883 | $sth = $Connection->db->prepare($query); |
1884 | 1884 | $sth->execute(); |
1885 | - } catch(PDOException $e) { |
|
1885 | + } catch (PDOException $e) { |
|
1886 | 1886 | return "error : ".$e->getMessage(); |
1887 | 1887 | } |
1888 | 1888 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | $Connection = new Connection(); |
1898 | 1898 | $sth = $Connection->db->prepare($query); |
1899 | 1899 | $sth->execute(); |
1900 | - } catch(PDOException $e) { |
|
1900 | + } catch (PDOException $e) { |
|
1901 | 1901 | return "error : ".$e->getMessage(); |
1902 | 1902 | } |
1903 | 1903 | } |
@@ -1908,7 +1908,7 @@ discard block |
||
1908 | 1908 | $Connection = new Connection(); |
1909 | 1909 | $sth = $Connection->db->prepare($query); |
1910 | 1910 | $sth->execute(array(':version' => $version)); |
1911 | - } catch(PDOException $e) { |
|
1911 | + } catch (PDOException $e) { |
|
1912 | 1912 | return "error : ".$e->getMessage(); |
1913 | 1913 | } |
1914 | 1914 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1924,7 +1924,7 @@ discard block |
||
1924 | 1924 | $Connection = new Connection(); |
1925 | 1925 | $sth = $Connection->db->prepare($query); |
1926 | 1926 | $sth->execute(array(':version' => $version)); |
1927 | - } catch(PDOException $e) { |
|
1927 | + } catch (PDOException $e) { |
|
1928 | 1928 | return "error : ".$e->getMessage(); |
1929 | 1929 | } |
1930 | 1930 | } |
@@ -1940,7 +1940,7 @@ discard block |
||
1940 | 1940 | $Connection = new Connection(); |
1941 | 1941 | $sth = $Connection->db->prepare($query); |
1942 | 1942 | $sth->execute(); |
1943 | - } catch(PDOException $e) { |
|
1943 | + } catch (PDOException $e) { |
|
1944 | 1944 | return "error : ".$e->getMessage(); |
1945 | 1945 | } |
1946 | 1946 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | $Connection = new Connection(); |
1956 | 1956 | $sth = $Connection->db->prepare($query); |
1957 | 1957 | $sth->execute(); |
1958 | - } catch(PDOException $e) { |
|
1958 | + } catch (PDOException $e) { |
|
1959 | 1959 | return "error : ".$e->getMessage(); |
1960 | 1960 | } |
1961 | 1961 | } |
@@ -1970,7 +1970,7 @@ discard block |
||
1970 | 1970 | $Connection = new Connection(); |
1971 | 1971 | $sth = $Connection->db->prepare($query); |
1972 | 1972 | $sth->execute(); |
1973 | - } catch(PDOException $e) { |
|
1973 | + } catch (PDOException $e) { |
|
1974 | 1974 | return "error : ".$e->getMessage(); |
1975 | 1975 | } |
1976 | 1976 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1985,7 +1985,7 @@ discard block |
||
1985 | 1985 | $Connection = new Connection(); |
1986 | 1986 | $sth = $Connection->db->prepare($query); |
1987 | 1987 | $sth->execute(); |
1988 | - } catch(PDOException $e) { |
|
1988 | + } catch (PDOException $e) { |
|
1989 | 1989 | return "error : ".$e->getMessage(); |
1990 | 1990 | } |
1991 | 1991 | } |
@@ -2001,7 +2001,7 @@ discard block |
||
2001 | 2001 | $Connection = new Connection(); |
2002 | 2002 | $sth = $Connection->db->prepare($query); |
2003 | 2003 | $sth->execute(); |
2004 | - } catch(PDOException $e) { |
|
2004 | + } catch (PDOException $e) { |
|
2005 | 2005 | return "error : ".$e->getMessage(); |
2006 | 2006 | } |
2007 | 2007 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2016,7 +2016,7 @@ discard block |
||
2016 | 2016 | $Connection = new Connection(); |
2017 | 2017 | $sth = $Connection->db->prepare($query); |
2018 | 2018 | $sth->execute(); |
2019 | - } catch(PDOException $e) { |
|
2019 | + } catch (PDOException $e) { |
|
2020 | 2020 | return "error : ".$e->getMessage(); |
2021 | 2021 | } |
2022 | 2022 | } |
@@ -2031,7 +2031,7 @@ discard block |
||
2031 | 2031 | $Connection = new Connection(); |
2032 | 2032 | $sth = $Connection->db->prepare($query); |
2033 | 2033 | $sth->execute(); |
2034 | - } catch(PDOException $e) { |
|
2034 | + } catch (PDOException $e) { |
|
2035 | 2035 | return "error : ".$e->getMessage(); |
2036 | 2036 | } |
2037 | 2037 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2046,7 +2046,7 @@ discard block |
||
2046 | 2046 | $Connection = new Connection(); |
2047 | 2047 | $sth = $Connection->db->prepare($query); |
2048 | 2048 | $sth->execute(); |
2049 | - } catch(PDOException $e) { |
|
2049 | + } catch (PDOException $e) { |
|
2050 | 2050 | return "error : ".$e->getMessage(); |
2051 | 2051 | } |
2052 | 2052 | } |
@@ -2061,7 +2061,7 @@ discard block |
||
2061 | 2061 | $Connection = new Connection(); |
2062 | 2062 | $sth = $Connection->db->prepare($query); |
2063 | 2063 | $sth->execute(); |
2064 | - } catch(PDOException $e) { |
|
2064 | + } catch (PDOException $e) { |
|
2065 | 2065 | return "error : ".$e->getMessage(); |
2066 | 2066 | } |
2067 | 2067 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2076,7 +2076,7 @@ discard block |
||
2076 | 2076 | $Connection = new Connection(); |
2077 | 2077 | $sth = $Connection->db->prepare($query); |
2078 | 2078 | $sth->execute(); |
2079 | - } catch(PDOException $e) { |
|
2079 | + } catch (PDOException $e) { |
|
2080 | 2080 | return "error : ".$e->getMessage(); |
2081 | 2081 | } |
2082 | 2082 | } |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | * @return String the icao |
23 | 23 | */ |
24 | 24 | public function ident2icao($ident) { |
25 | - if (substr($ident,0,2) == 'AF') { |
|
26 | - if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
27 | - else $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
25 | + if (substr($ident, 0, 2) == 'AF') { |
|
26 | + if (filter_var(substr($ident, 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
27 | + else $icao = 'AFR'.ltrim(substr($ident, 2), '0'); |
|
28 | 28 | } else { |
29 | 29 | $Spotter = new Spotter($this->db); |
30 | - $identicao = $Spotter->getAllAirlineInfo(substr($ident,0,2)); |
|
30 | + $identicao = $Spotter->getAllAirlineInfo(substr($ident, 0, 2)); |
|
31 | 31 | if (isset($identicao[0])) { |
32 | - $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
|
32 | + $icao = $identicao[0]['icao'].ltrim(substr($ident, 2), '0'); |
|
33 | 33 | } else $icao = $ident; |
34 | 34 | } |
35 | 35 | return $icao; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $sth = $this->db->prepare($query); |
55 | 55 | $sth->execute(); |
56 | - } catch(PDOException $e) { |
|
56 | + } catch (PDOException $e) { |
|
57 | 57 | return "error"; |
58 | 58 | } |
59 | 59 | return "success"; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $sth = $this->db->prepare($query); |
79 | 79 | $sth->execute(); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error"; |
82 | 82 | } |
83 | 83 | return "success"; |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | $ident = ''; |
103 | 103 | $message = ''; |
104 | 104 | $result = array(); |
105 | - $n = sscanf($data,'(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
106 | - if ($n == 0) $n = sscanf($data,'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
107 | - if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
108 | - if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
105 | + $n = sscanf($data, '(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
106 | + if ($n == 0) $n = sscanf($data, 'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
107 | + if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
108 | + if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
109 | 109 | if ($n != 0) { |
110 | - $registration = str_replace('.','',$registration); |
|
111 | - $result = array('registration' => $registration, 'ident' => $ident,'label' => $label, 'block_id' => $block_id,'msg_no' => $msg_no,'message' => $message); |
|
110 | + $registration = str_replace('.', '', $registration); |
|
111 | + $result = array('registration' => $registration, 'ident' => $ident, 'label' => $label, 'block_id' => $block_id, 'msg_no' => $msg_no, 'message' => $message); |
|
112 | 112 | if ($globalDebug) echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n"; |
113 | 113 | } else $message = $data; |
114 | 114 | $decode = array(); |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | $temp = ''; |
129 | 129 | $n = sscanf($message, "FST01%4c%4c%c%06d%c%07d%03d%*8[0-9a-zA-Z ]-%02dC", $dair, $darr, $lac, $la, $lnc, $ln, $alt, $temp); |
130 | 130 | if ($n > 5 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) { |
131 | - $latitude = $la / 10000.0; |
|
132 | - $longitude = $ln / 10000.0; |
|
131 | + $latitude = $la/10000.0; |
|
132 | + $longitude = $ln/10000.0; |
|
133 | 133 | if ($lac == 'S') $latitude = '-'.$latitude; |
134 | 134 | if ($lnc == 'W') $longitude = '-'.$longitude; |
135 | 135 | // Temp not always available |
136 | 136 | if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n"; |
137 | - if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt); |
|
138 | - else $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C'); |
|
137 | + if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => $alt); |
|
138 | + else $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt, 'Temperature' => $temp.'°C'); |
|
139 | 139 | |
140 | 140 | //$icao = $Translation->checkTranslation($ident); |
141 | 141 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -147,19 +147,19 @@ discard block |
||
147 | 147 | $dhour = ''; |
148 | 148 | $darr = ''; |
149 | 149 | $ahour = ''; |
150 | - $n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr,$ahour); |
|
150 | + $n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr, $ahour); |
|
151 | 151 | if ($n == 4 && strlen($darr) == 4) { |
152 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
153 | - if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
154 | - if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n"; |
|
152 | + if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2); |
|
153 | + if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2); |
|
154 | + if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '.$darr.' - departure hour : '.$dhour.' - arrival hour : '.$ahour."\n"; |
|
155 | 155 | //$icao = ACARS->ident2icao($ident); |
156 | 156 | //$icao = $Translation->checkTranslation($ident); |
157 | 157 | //$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS'); |
158 | 158 | $decode = array('Departure airport' => $dair, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour); |
159 | 159 | $found = true; |
160 | 160 | } |
161 | - elseif ($n == 2 || $n == 4) { |
|
162 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
161 | + elseif ($n == 2 || $n == 4) { |
|
162 | + if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2); |
|
163 | 163 | if ($globalDebug) echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n"; |
164 | 164 | //$icao = ACARS->ident2icao($ident); |
165 | 165 | //$icao = $Translation->checkTranslation($ident); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | $ahour = ''; |
218 | 218 | $aair = ''; |
219 | 219 | $apiste = ''; |
220 | - $n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao,$aident,$dair, $darr, $ddate, $dhour,$ahour, $aair, $apiste); |
|
220 | + $n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao, $aident, $dair, $darr, $ddate, $dhour, $ahour, $aair, $apiste); |
|
221 | 221 | if ($n > 8) { |
222 | - if ($globalDebug) echo 'airicao : '. $airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '. $darr.' - date depart : '.$ddate.' - departure hour : '. $dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n"; |
|
223 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
224 | - if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
222 | + if ($globalDebug) echo 'airicao : '.$airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '.$darr.' - date depart : '.$ddate.' - departure hour : '.$dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n"; |
|
223 | + if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2); |
|
224 | + if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2); |
|
225 | 225 | $icao = trim($aident); |
226 | 226 | |
227 | 227 | //$decode = 'Departure airport : '.$dair.' ('.$ddate.' at '.$dhour.') - Arrival Airport : '.$aair.' (at '.$ahour.') way '.$apiste; |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | if ($n == 10 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) { |
247 | 247 | $las = $las.'.'.$lass; |
248 | 248 | $lns = $lns.'.'.$lns; |
249 | - $latitude = $las / 1000.0; |
|
250 | - $longitude = $lns / 1000.0; |
|
249 | + $latitude = $las/1000.0; |
|
250 | + $longitude = $lns/1000.0; |
|
251 | 251 | if ($lac == 'S') $latitude = '-'.$latitude; |
252 | 252 | if ($lnc == 'W') $longitude = '-'.$longitude; |
253 | 253 | if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
@@ -342,17 +342,17 @@ discard block |
||
342 | 342 | $alt = ''; |
343 | 343 | $fuel = ''; |
344 | 344 | $speed = ''; |
345 | - $n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed); |
|
345 | + $n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed); |
|
346 | 346 | if ($n == 9) { |
347 | 347 | //if (self->$debug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
348 | 348 | $icao = trim($aident); |
349 | 349 | $decode['icao'] = $icao; |
350 | - $latitude = $las / 100.0; |
|
351 | - $longitude = $lns / 100.0; |
|
350 | + $latitude = $las/100.0; |
|
351 | + $longitude = $lns/100.0; |
|
352 | 352 | if ($lac == 'S') $latitude = '-'.$latitude; |
353 | 353 | if ($lnc == 'W') $longitude = '-'.$longitude; |
354 | 354 | |
355 | - $decode = array('Latitude' => $latitude,'Longitude' => $longitude,'Altitude' => 'FL'.$alt,'Fuel' => $fuel,'speed' => $speed); |
|
355 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Altitude' => 'FL'.$alt, 'Fuel' => $fuel, 'speed' => $speed); |
|
356 | 356 | $found = true; |
357 | 357 | } |
358 | 358 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if ($lac == 'S') $latitude = '-'.$latitude; |
372 | 372 | if ($lnc == 'W') $longitude = '-'.$longitude; |
373 | 373 | |
374 | - $decode = array('Latitude' => $latitude,'Longitude' => $longitude); |
|
374 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude); |
|
375 | 375 | $found = true; |
376 | 376 | } |
377 | 377 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $dair = ''; |
405 | 405 | $darr = ''; |
406 | 406 | $aident = ''; |
407 | - $n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident); |
|
407 | + $n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident); |
|
408 | 408 | if ($n == 8) { |
409 | 409 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
410 | 410 | $icao = trim($aident); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | $dair = ''; |
439 | 439 | $darr = ''; |
440 | - $n = sscanf($message,'%4[A-Z]%4[A-Z]%*4d',$dair,$darr); |
|
440 | + $n = sscanf($message, '%4[A-Z]%4[A-Z]%*4d', $dair, $darr); |
|
441 | 441 | if ($n == 3) { |
442 | 442 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
443 | 443 | //$icao = $Translation->checkTranslation($ident); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | */ |
454 | 454 | $dair = ''; |
455 | 455 | $darr = ''; |
456 | - $n = sscanf($message,'3J01 DSPTCH %*d/%*d %4s/%4s .%*6s',$dair,$darr); |
|
456 | + $n = sscanf($message, '3J01 DSPTCH %*d/%*d %4s/%4s .%*6s', $dair, $darr); |
|
457 | 457 | if ($n == 3) { |
458 | 458 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
459 | 459 | //$icao = $Translation->checkTranslation($ident); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | } |
465 | 465 | } |
466 | 466 | if (!$found) { |
467 | - $n = sscanf($message,'MET01%4c',$airport); |
|
467 | + $n = sscanf($message, 'MET01%4c', $airport); |
|
468 | 468 | if ($n == 1) { |
469 | 469 | if ($globalDebug) echo 'airport name : '.$airport; |
470 | 470 | $decode = array('Airport/Waypoint name' => $airport); |
@@ -473,241 +473,241 @@ discard block |
||
473 | 473 | } |
474 | 474 | |
475 | 475 | if ($label == 'H1') { |
476 | - if (preg_match('/^#CFBFLR/',$message) || preg_match('/^#CFBWRN/',$message)) { |
|
477 | - $decode = array_merge(array('Message nature' => 'Equipment failure'),$decode); |
|
476 | + if (preg_match('/^#CFBFLR/', $message) || preg_match('/^#CFBWRN/', $message)) { |
|
477 | + $decode = array_merge(array('Message nature' => 'Equipment failure'), $decode); |
|
478 | 478 | } |
479 | - elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) { |
|
480 | - $decode = array_merge(array('Message nature' => 'Take off performance data'),$decode); |
|
479 | + elseif (preg_match('/^#DFB\*TKO/', $message) || preg_match('/^#DFBTKO/', $message)) { |
|
480 | + $decode = array_merge(array('Message nature' => 'Take off performance data'), $decode); |
|
481 | 481 | } |
482 | - elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) { |
|
483 | - $decode = array_merge(array('Message nature' => 'Cruise performance data'),$decode); |
|
482 | + elseif (preg_match('/^#DFB\*CRZ/', $message) || preg_match('/^#DFBCRZ/', $message)) { |
|
483 | + $decode = array_merge(array('Message nature' => 'Cruise performance data'), $decode); |
|
484 | 484 | } |
485 | - elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) { |
|
486 | - $decode = array_merge(array('Message nature' => 'Weather observation'),$decode); |
|
485 | + elseif (preg_match('/^#DFB\*WOB/', $message) || preg_match('/^#DFBWOB/', $message)) { |
|
486 | + $decode = array_merge(array('Message nature' => 'Weather observation'), $decode); |
|
487 | 487 | } |
488 | - elseif (preg_match(':^#DFB/PIREP:',$message)) { |
|
489 | - $decode = array_merge(array('Message nature' => 'Pilot Report'),$decode); |
|
488 | + elseif (preg_match(':^#DFB/PIREP:', $message)) { |
|
489 | + $decode = array_merge(array('Message nature' => 'Pilot Report'), $decode); |
|
490 | 490 | } |
491 | - elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) { |
|
492 | - $decode = array_merge(array('Message nature' => 'Engine Data'),$decode); |
|
491 | + elseif (preg_match('/^#DFBEDA/', $message) || preg_match('/^#DFBENG/', $message)) { |
|
492 | + $decode = array_merge(array('Message nature' => 'Engine Data'), $decode); |
|
493 | 493 | } |
494 | - elseif (preg_match(':^#M1AAEP:',$message)) { |
|
495 | - $decode = array_merge(array('Message nature' => 'Position/Weather Report'),$decode); |
|
494 | + elseif (preg_match(':^#M1AAEP:', $message)) { |
|
495 | + $decode = array_merge(array('Message nature' => 'Position/Weather Report'), $decode); |
|
496 | 496 | } |
497 | - elseif (preg_match(':^#M2APWD:',$message)) { |
|
498 | - $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'),$decode); |
|
497 | + elseif (preg_match(':^#M2APWD:', $message)) { |
|
498 | + $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'), $decode); |
|
499 | 499 | } |
500 | - elseif (preg_match(':^#M1BREQPWI:',$message)) { |
|
501 | - $decode = array_merge(array('Message nature' => 'Predicted wind info request'),$decode); |
|
500 | + elseif (preg_match(':^#M1BREQPWI:', $message)) { |
|
501 | + $decode = array_merge(array('Message nature' => 'Predicted wind info request'), $decode); |
|
502 | 502 | } |
503 | - elseif (preg_match(':^#CF:',$message)) { |
|
504 | - $decode = array_merge(array('Message nature' => 'Central Fault Display'),$decode); |
|
503 | + elseif (preg_match(':^#CF:', $message)) { |
|
504 | + $decode = array_merge(array('Message nature' => 'Central Fault Display'), $decode); |
|
505 | 505 | } |
506 | - elseif (preg_match(':^#DF:',$message)) { |
|
507 | - $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'),$decode); |
|
506 | + elseif (preg_match(':^#DF:', $message)) { |
|
507 | + $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'), $decode); |
|
508 | 508 | } |
509 | - elseif (preg_match(':^#EC:',$message)) { |
|
510 | - $decode = array_merge(array('Message nature' => 'Engine Display System'),$decode); |
|
509 | + elseif (preg_match(':^#EC:', $message)) { |
|
510 | + $decode = array_merge(array('Message nature' => 'Engine Display System'), $decode); |
|
511 | 511 | } |
512 | - elseif (preg_match(':^#EI:',$message)) { |
|
513 | - $decode = array_merge(array('Message nature' => 'Engine Report'),$decode); |
|
512 | + elseif (preg_match(':^#EI:', $message)) { |
|
513 | + $decode = array_merge(array('Message nature' => 'Engine Report'), $decode); |
|
514 | 514 | } |
515 | - elseif (preg_match(':^#H1:',$message)) { |
|
516 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'),$decode); |
|
515 | + elseif (preg_match(':^#H1:', $message)) { |
|
516 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'), $decode); |
|
517 | 517 | } |
518 | - elseif (preg_match(':^#H2:',$message)) { |
|
519 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'),$decode); |
|
518 | + elseif (preg_match(':^#H2:', $message)) { |
|
519 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'), $decode); |
|
520 | 520 | } |
521 | - elseif (preg_match(':^#HD:',$message)) { |
|
522 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'),$decode); |
|
521 | + elseif (preg_match(':^#HD:', $message)) { |
|
522 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'), $decode); |
|
523 | 523 | } |
524 | - elseif (preg_match(':^#M1:',$message)) { |
|
525 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'),$decode); |
|
524 | + elseif (preg_match(':^#M1:', $message)) { |
|
525 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'), $decode); |
|
526 | 526 | } |
527 | - elseif (preg_match(':^#M2:',$message)) { |
|
528 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'),$decode); |
|
527 | + elseif (preg_match(':^#M2:', $message)) { |
|
528 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'), $decode); |
|
529 | 529 | } |
530 | - elseif (preg_match(':^#M3:',$message)) { |
|
531 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'),$decode); |
|
530 | + elseif (preg_match(':^#M3:', $message)) { |
|
531 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'), $decode); |
|
532 | 532 | } |
533 | - elseif (preg_match(':^#MD:',$message)) { |
|
534 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'),$decode); |
|
533 | + elseif (preg_match(':^#MD:', $message)) { |
|
534 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'), $decode); |
|
535 | 535 | } |
536 | - elseif (preg_match(':^#PS:',$message)) { |
|
537 | - $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'),$decode); |
|
536 | + elseif (preg_match(':^#PS:', $message)) { |
|
537 | + $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'), $decode); |
|
538 | 538 | } |
539 | - elseif (preg_match(':^#S1:',$message)) { |
|
540 | - $decode = array_merge(array('Message nature' => 'SDU - Left'),$decode); |
|
539 | + elseif (preg_match(':^#S1:', $message)) { |
|
540 | + $decode = array_merge(array('Message nature' => 'SDU - Left'), $decode); |
|
541 | 541 | } |
542 | - elseif (preg_match(':^#S2:',$message)) { |
|
543 | - $decode = array_merge(array('Message nature' => 'SDU - Right'),$decode); |
|
542 | + elseif (preg_match(':^#S2:', $message)) { |
|
543 | + $decode = array_merge(array('Message nature' => 'SDU - Right'), $decode); |
|
544 | 544 | } |
545 | - elseif (preg_match(':^#SD:',$message)) { |
|
546 | - $decode = array_merge(array('Message nature' => 'SDU - Selected'),$decode); |
|
545 | + elseif (preg_match(':^#SD:', $message)) { |
|
546 | + $decode = array_merge(array('Message nature' => 'SDU - Selected'), $decode); |
|
547 | 547 | } |
548 | - elseif (preg_match(':^#T[0-8]:',$message)) { |
|
549 | - $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'),$decode); |
|
548 | + elseif (preg_match(':^#T[0-8]:', $message)) { |
|
549 | + $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'), $decode); |
|
550 | 550 | } |
551 | - elseif (preg_match(':^#WO:',$message)) { |
|
552 | - $decode = array_merge(array('Message nature' => 'Weather Observation Report'),$decode); |
|
551 | + elseif (preg_match(':^#WO:', $message)) { |
|
552 | + $decode = array_merge(array('Message nature' => 'Weather Observation Report'), $decode); |
|
553 | 553 | } |
554 | - elseif (preg_match(':^#A1:',$message)) { |
|
555 | - $decode = array_merge(array('Message nature' => 'Oceanic Clearance'),$decode); |
|
554 | + elseif (preg_match(':^#A1:', $message)) { |
|
555 | + $decode = array_merge(array('Message nature' => 'Oceanic Clearance'), $decode); |
|
556 | 556 | } |
557 | - elseif (preg_match(':^#A3:',$message)) { |
|
558 | - $decode = array_merge(array('Message nature' => 'Departure Clearance Response'),$decode); |
|
557 | + elseif (preg_match(':^#A3:', $message)) { |
|
558 | + $decode = array_merge(array('Message nature' => 'Departure Clearance Response'), $decode); |
|
559 | 559 | } |
560 | - elseif (preg_match(':^#A4:',$message)) { |
|
561 | - $decode = array_merge(array('Message nature' => 'Flight Systems Message'),$decode); |
|
560 | + elseif (preg_match(':^#A4:', $message)) { |
|
561 | + $decode = array_merge(array('Message nature' => 'Flight Systems Message'), $decode); |
|
562 | 562 | } |
563 | - elseif (preg_match(':^#A6:',$message)) { |
|
564 | - $decode = array_merge(array('Message nature' => 'Request ADS Reports'),$decode); |
|
563 | + elseif (preg_match(':^#A6:', $message)) { |
|
564 | + $decode = array_merge(array('Message nature' => 'Request ADS Reports'), $decode); |
|
565 | 565 | } |
566 | - elseif (preg_match(':^#A8:',$message)) { |
|
567 | - $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'),$decode); |
|
566 | + elseif (preg_match(':^#A8:', $message)) { |
|
567 | + $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'), $decode); |
|
568 | 568 | } |
569 | - elseif (preg_match(':^#A9:',$message)) { |
|
570 | - $decode = array_merge(array('Message nature' => 'ATIS report'),$decode); |
|
569 | + elseif (preg_match(':^#A9:', $message)) { |
|
570 | + $decode = array_merge(array('Message nature' => 'ATIS report'), $decode); |
|
571 | 571 | } |
572 | - elseif (preg_match(':^#A0:',$message)) { |
|
573 | - $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'),$decode); |
|
572 | + elseif (preg_match(':^#A0:', $message)) { |
|
573 | + $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'), $decode); |
|
574 | 574 | } |
575 | - elseif (preg_match(':^#AA:',$message)) { |
|
576 | - $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
|
575 | + elseif (preg_match(':^#AA:', $message)) { |
|
576 | + $decode = array_merge(array('Message nature' => 'ATCComm'), $decode); |
|
577 | 577 | } |
578 | - elseif (preg_match(':^#AB:',$message)) { |
|
579 | - $decode = array_merge(array('Message nature' => 'TWIP Report'),$decode); |
|
578 | + elseif (preg_match(':^#AB:', $message)) { |
|
579 | + $decode = array_merge(array('Message nature' => 'TWIP Report'), $decode); |
|
580 | 580 | } |
581 | - elseif (preg_match(':^#AC:',$message)) { |
|
582 | - $decode = array_merge(array('Message nature' => 'Pushback Clearance'),$decode); |
|
581 | + elseif (preg_match(':^#AC:', $message)) { |
|
582 | + $decode = array_merge(array('Message nature' => 'Pushback Clearance'), $decode); |
|
583 | 583 | } |
584 | - elseif (preg_match(':^#AD:',$message)) { |
|
585 | - $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'),$decode); |
|
584 | + elseif (preg_match(':^#AD:', $message)) { |
|
585 | + $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'), $decode); |
|
586 | 586 | } |
587 | - elseif (preg_match(':^#AF:',$message)) { |
|
588 | - $decode = array_merge(array('Message nature' => 'CPC Command/Response'),$decode); |
|
587 | + elseif (preg_match(':^#AF:', $message)) { |
|
588 | + $decode = array_merge(array('Message nature' => 'CPC Command/Response'), $decode); |
|
589 | 589 | } |
590 | - elseif (preg_match(':^#B1:',$message)) { |
|
591 | - $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'),$decode); |
|
590 | + elseif (preg_match(':^#B1:', $message)) { |
|
591 | + $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'), $decode); |
|
592 | 592 | } |
593 | - elseif (preg_match(':^#B2:',$message)) { |
|
594 | - $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'),$decode); |
|
593 | + elseif (preg_match(':^#B2:', $message)) { |
|
594 | + $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'), $decode); |
|
595 | 595 | } |
596 | - elseif (preg_match(':^#B3:',$message)) { |
|
597 | - $decode = array_merge(array('Message nature' => 'Request Departure Clearance'),$decode); |
|
596 | + elseif (preg_match(':^#B3:', $message)) { |
|
597 | + $decode = array_merge(array('Message nature' => 'Request Departure Clearance'), $decode); |
|
598 | 598 | } |
599 | - elseif (preg_match(':^#B4:',$message)) { |
|
600 | - $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'),$decode); |
|
599 | + elseif (preg_match(':^#B4:', $message)) { |
|
600 | + $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'), $decode); |
|
601 | 601 | } |
602 | - elseif (preg_match(':^#B6:',$message)) { |
|
603 | - $decode = array_merge(array('Message nature' => 'Provide ADS Report'),$decode); |
|
602 | + elseif (preg_match(':^#B6:', $message)) { |
|
603 | + $decode = array_merge(array('Message nature' => 'Provide ADS Report'), $decode); |
|
604 | 604 | } |
605 | - elseif (preg_match(':^#B8:',$message)) { |
|
606 | - $decode = array_merge(array('Message nature' => 'Request Departure Slot'),$decode); |
|
605 | + elseif (preg_match(':^#B8:', $message)) { |
|
606 | + $decode = array_merge(array('Message nature' => 'Request Departure Slot'), $decode); |
|
607 | 607 | } |
608 | - elseif (preg_match(':^#B9:',$message)) { |
|
609 | - $decode = array_merge(array('Message nature' => 'Request ATIS Report'),$decode); |
|
608 | + elseif (preg_match(':^#B9:', $message)) { |
|
609 | + $decode = array_merge(array('Message nature' => 'Request ATIS Report'), $decode); |
|
610 | 610 | } |
611 | - elseif (preg_match(':^#B0:',$message)) { |
|
612 | - $decode = array_merge(array('Message nature' => 'ATS Facility Notification'),$decode); |
|
611 | + elseif (preg_match(':^#B0:', $message)) { |
|
612 | + $decode = array_merge(array('Message nature' => 'ATS Facility Notification'), $decode); |
|
613 | 613 | } |
614 | - elseif (preg_match(':^#BA:',$message)) { |
|
615 | - $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
|
614 | + elseif (preg_match(':^#BA:', $message)) { |
|
615 | + $decode = array_merge(array('Message nature' => 'ATCComm'), $decode); |
|
616 | 616 | } |
617 | - elseif (preg_match(':^#BB:',$message)) { |
|
618 | - $decode = array_merge(array('Message nature' => 'Request TWIP Report'),$decode); |
|
617 | + elseif (preg_match(':^#BB:', $message)) { |
|
618 | + $decode = array_merge(array('Message nature' => 'Request TWIP Report'), $decode); |
|
619 | 619 | } |
620 | - elseif (preg_match(':^#BC:',$message)) { |
|
621 | - $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'),$decode); |
|
620 | + elseif (preg_match(':^#BC:', $message)) { |
|
621 | + $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'), $decode); |
|
622 | 622 | } |
623 | - elseif (preg_match(':^#BD:',$message)) { |
|
624 | - $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'),$decode); |
|
623 | + elseif (preg_match(':^#BD:', $message)) { |
|
624 | + $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'), $decode); |
|
625 | 625 | } |
626 | - elseif (preg_match(':^#BE:',$message)) { |
|
627 | - $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'),$decode); |
|
626 | + elseif (preg_match(':^#BE:', $message)) { |
|
627 | + $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'), $decode); |
|
628 | 628 | } |
629 | - elseif (preg_match(':^#BF:',$message)) { |
|
630 | - $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'),$decode); |
|
629 | + elseif (preg_match(':^#BF:', $message)) { |
|
630 | + $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'), $decode); |
|
631 | 631 | } |
632 | - elseif (preg_match(':^#H3:',$message)) { |
|
633 | - $decode = array_merge(array('Message nature' => 'Icing Report'),$decode); |
|
632 | + elseif (preg_match(':^#H3:', $message)) { |
|
633 | + $decode = array_merge(array('Message nature' => 'Icing Report'), $decode); |
|
634 | 634 | } |
635 | 635 | } |
636 | 636 | if ($label == '10') { |
637 | - if (preg_match(':^DTO01:',$message)) { |
|
638 | - $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'),$decode); |
|
637 | + if (preg_match(':^DTO01:', $message)) { |
|
638 | + $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'), $decode); |
|
639 | 639 | } |
640 | - elseif (preg_match(':^AIS01:',$message)) { |
|
641 | - $decode = array_merge(array('Message nature' => 'AIS Request'),$decode); |
|
640 | + elseif (preg_match(':^AIS01:', $message)) { |
|
641 | + $decode = array_merge(array('Message nature' => 'AIS Request'), $decode); |
|
642 | 642 | } |
643 | - elseif (preg_match(':^FTX01:',$message)) { |
|
644 | - $decode = array_merge(array('Message nature' => 'Free Text Downlink'),$decode); |
|
643 | + elseif (preg_match(':^FTX01:', $message)) { |
|
644 | + $decode = array_merge(array('Message nature' => 'Free Text Downlink'), $decode); |
|
645 | 645 | } |
646 | - elseif (preg_match(':^FPL01:',$message)) { |
|
647 | - $decode = array_merge(array('Message nature' => 'Flight Plan Request'),$decode); |
|
646 | + elseif (preg_match(':^FPL01:', $message)) { |
|
647 | + $decode = array_merge(array('Message nature' => 'Flight Plan Request'), $decode); |
|
648 | 648 | } |
649 | - elseif (preg_match(':^WAB01:',$message)) { |
|
650 | - $decode = array_merge(array('Message nature' => 'Weight & Balance Request'),$decode); |
|
649 | + elseif (preg_match(':^WAB01:', $message)) { |
|
650 | + $decode = array_merge(array('Message nature' => 'Weight & Balance Request'), $decode); |
|
651 | 651 | } |
652 | - elseif (preg_match(':^MET01:',$message)) { |
|
653 | - $decode = array_merge(array('Message nature' => 'Weather Data Request'),$decode); |
|
652 | + elseif (preg_match(':^MET01:', $message)) { |
|
653 | + $decode = array_merge(array('Message nature' => 'Weather Data Request'), $decode); |
|
654 | 654 | } |
655 | - elseif (preg_match(':^WAB02:',$message)) { |
|
656 | - $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'),$decode); |
|
655 | + elseif (preg_match(':^WAB02:', $message)) { |
|
656 | + $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'), $decode); |
|
657 | 657 | } |
658 | 658 | } |
659 | 659 | if ($label == '15') { |
660 | - if (preg_match(':^FST01:',$message)) { |
|
661 | - $decode = array_merge(array('Message nature' => 'Flight Status Report'),$decode); |
|
660 | + if (preg_match(':^FST01:', $message)) { |
|
661 | + $decode = array_merge(array('Message nature' => 'Flight Status Report'), $decode); |
|
662 | 662 | } |
663 | 663 | } |
664 | 664 | if (!$found && $label == 'SA') { |
665 | - $n = sscanf($message, "%d%c%c%6[0-9]", $version,$state,$type,$at); |
|
665 | + $n = sscanf($message, "%d%c%c%6[0-9]", $version, $state, $type, $at); |
|
666 | 666 | if ($n == 4) { |
667 | 667 | $vsta = array('Version' => $version); |
668 | 668 | if ($state == 'E') { |
669 | - $vsta = array_merge($vsta,array('Link state' => 'Established')); |
|
669 | + $vsta = array_merge($vsta, array('Link state' => 'Established')); |
|
670 | 670 | } |
671 | 671 | elseif ($state == 'L') { |
672 | - $vsta = array_merge($vsta,array('Link state' => 'Lost')); |
|
672 | + $vsta = array_merge($vsta, array('Link state' => 'Lost')); |
|
673 | 673 | } |
674 | 674 | else { |
675 | - $vsta = array_merge($vsta,array('Link state' => 'Unknown')); |
|
675 | + $vsta = array_merge($vsta, array('Link state' => 'Unknown')); |
|
676 | 676 | } |
677 | 677 | if ($type == 'V') { |
678 | - $vsta = array_merge($vsta,array('Link type' => 'VHF ACARS')); |
|
678 | + $vsta = array_merge($vsta, array('Link type' => 'VHF ACARS')); |
|
679 | 679 | } |
680 | 680 | elseif ($type == 'S') { |
681 | - $vsta = array_merge($vsta,array('Link type' => 'Generic SATCOM')); |
|
681 | + $vsta = array_merge($vsta, array('Link type' => 'Generic SATCOM')); |
|
682 | 682 | } |
683 | 683 | elseif ($type == 'H') { |
684 | - $vsta = array_merge($vsta,array('Link type' => 'HF')); |
|
684 | + $vsta = array_merge($vsta, array('Link type' => 'HF')); |
|
685 | 685 | } |
686 | 686 | elseif ($type == 'G') { |
687 | - $vsta = array_merge($vsta,array('Link type' => 'GlobalStar SATCOM')); |
|
687 | + $vsta = array_merge($vsta, array('Link type' => 'GlobalStar SATCOM')); |
|
688 | 688 | } |
689 | 689 | elseif ($type == 'C') { |
690 | - $vsta = array_merge($vsta,array('Link type' => 'ICO SATCOM')); |
|
690 | + $vsta = array_merge($vsta, array('Link type' => 'ICO SATCOM')); |
|
691 | 691 | } |
692 | 692 | elseif ($type == '2') { |
693 | - $vsta = array_merge($vsta,array('Link type' => 'VDL Mode 2')); |
|
693 | + $vsta = array_merge($vsta, array('Link type' => 'VDL Mode 2')); |
|
694 | 694 | } |
695 | 695 | elseif ($type == 'X') { |
696 | - $vsta = array_merge($vsta,array('Link type' => 'Inmarsat Aero')); |
|
696 | + $vsta = array_merge($vsta, array('Link type' => 'Inmarsat Aero')); |
|
697 | 697 | } |
698 | 698 | elseif ($type == 'I') { |
699 | - $vsta = array_merge($vsta,array('Link type' => 'Irridium SATCOM')); |
|
699 | + $vsta = array_merge($vsta, array('Link type' => 'Irridium SATCOM')); |
|
700 | 700 | } |
701 | 701 | else { |
702 | - $vsta = array_merge($vsta,array('Link type' => 'Unknown')); |
|
702 | + $vsta = array_merge($vsta, array('Link type' => 'Unknown')); |
|
703 | 703 | } |
704 | - $vsta = array_merge($vsta,array('Event occured at' => implode(':',str_split($at,2)))); |
|
705 | - $decode = array_merge($vsta,$decode); |
|
704 | + $vsta = array_merge($vsta, array('Event occured at' => implode(':', str_split($at, 2)))); |
|
705 | + $decode = array_merge($vsta, $decode); |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 | |
709 | 709 | $title = $this->getTitlefromLabel($label); |
710 | - if ($title != '') $decode = array_merge(array('Message title' => $title),$decode); |
|
710 | + if ($title != '') $decode = array_merge(array('Message title' => $title), $decode); |
|
711 | 711 | |
712 | 712 | /* |
713 | 713 | // Business jets always use GS0001 |
@@ -740,13 +740,13 @@ discard block |
||
740 | 740 | $message = $this->parse($data); |
741 | 741 | if (isset($message['registration']) && $message['registration'] != '' && $message['ident'] != '' && $message['registration'] != '!') { |
742 | 742 | |
743 | - $ident = (string)$message['ident']; |
|
743 | + $ident = (string) $message['ident']; |
|
744 | 744 | $label = $message['label']; |
745 | 745 | $block_id = $message['block_id']; |
746 | 746 | $msg_no = $message['msg_no']; |
747 | 747 | $msg = $message['message']; |
748 | 748 | $decode = $message['decode']; |
749 | - $registration = (string)$message['registration']; |
|
749 | + $registration = (string) $message['registration']; |
|
750 | 750 | |
751 | 751 | if (isset($decode['latitude'])) $latitude = $decode['latitude']; |
752 | 752 | else $latitude = ''; |
@@ -763,23 +763,23 @@ discard block |
||
763 | 763 | } |
764 | 764 | |
765 | 765 | // Business jets always use GS0001 |
766 | - if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
|
766 | + if ($ident != 'GS0001') $info = $this->addModeSData($ident, $registration, $icao, $airicao, $latitude, $longitude); |
|
767 | 767 | if ($globalDebug && isset($info) && $info != '') echo $info; |
768 | 768 | |
769 | 769 | if (count($decode) > 0) $decode_json = json_encode($decode); |
770 | 770 | else $decode_json = ''; |
771 | 771 | if (isset($decode['Departure airport']) && isset($decode['Departure hour']) && isset($decode['Arrival airport']) && isset($decode['Arrival hour'])) { |
772 | - $Schedule->addSchedule($icao,$decode['Departure airport'],$decode['Departure hour'],$decode['Arrival airport'],$decode['Arrival hour'],'ACARS'); |
|
772 | + $Schedule->addSchedule($icao, $decode['Departure airport'], $decode['Departure hour'], $decode['Arrival airport'], $decode['Arrival hour'], 'ACARS'); |
|
773 | 773 | } elseif (isset($decode['Departure airport']) && isset($decode['Arrival airport'])) { |
774 | - $Schedule->addSchedule($icao,$decode['Departure airport'],'',$decode['Arrival airport'],'','ACARS'); |
|
774 | + $Schedule->addSchedule($icao, $decode['Departure airport'], '', $decode['Arrival airport'], '', 'ACARS'); |
|
775 | 775 | } |
776 | 776 | |
777 | - $result = $this->addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
778 | - if (!isset($globalACARSArchive)) $globalACARSArchive = array('10','80','81','82','3F'); |
|
779 | - if ($result && in_array($label,$globalACARSArchive)) $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
777 | + $result = $this->addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json); |
|
778 | + if (!isset($globalACARSArchive)) $globalACARSArchive = array('10', '80', '81', '82', '3F'); |
|
779 | + if ($result && in_array($label, $globalACARSArchive)) $this->addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json); |
|
780 | 780 | |
781 | 781 | if ($globalDebug && count($decode) > 0) { |
782 | - echo "Human readable data : ".implode(' - ',$decode)."\n"; |
|
782 | + echo "Human readable data : ".implode(' - ', $decode)."\n"; |
|
783 | 783 | } |
784 | 784 | } |
785 | 785 | } |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | * @param String $msg_no Number of the ACARS message |
795 | 795 | * @param String $message ACARS message |
796 | 796 | */ |
797 | - public function addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') { |
|
797 | + public function addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') { |
|
798 | 798 | global $globalDebug; |
799 | 799 | date_default_timezone_set('UTC'); |
800 | 800 | if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '') { |
@@ -803,22 +803,22 @@ discard block |
||
803 | 803 | |
804 | 804 | if ($globalDebug) echo "Test if not already in Live ACARS table..."; |
805 | 805 | $query_test = "SELECT COUNT(*) as nb FROM acars_live WHERE ident = :ident AND registration = :registration AND message = :message"; |
806 | - $query_test_values = array(':ident' => $ident,':registration' => $registration, ':message' => $message); |
|
806 | + $query_test_values = array(':ident' => $ident, ':registration' => $registration, ':message' => $message); |
|
807 | 807 | try { |
808 | 808 | $stht = $this->db->prepare($query_test); |
809 | 809 | $stht->execute($query_test_values); |
810 | - } catch(PDOException $e) { |
|
810 | + } catch (PDOException $e) { |
|
811 | 811 | return "error : ".$e->getMessage(); |
812 | 812 | } |
813 | 813 | if ($stht->fetchColumn() == 0) { |
814 | 814 | if ($globalDebug) echo "Add Live ACARS data..."; |
815 | 815 | $query = "INSERT INTO acars_live (ident,registration,label,block_id,msg_no,message,decode,date) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode,:date)"; |
816 | - $query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode,':date' => date("Y-m-d H:i:s")); |
|
816 | + $query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode, ':date' => date("Y-m-d H:i:s")); |
|
817 | 817 | try { |
818 | 818 | |
819 | 819 | $sth = $this->db->prepare($query); |
820 | 820 | $sth->execute($query_values); |
821 | - } catch(PDOException $e) { |
|
821 | + } catch (PDOException $e) { |
|
822 | 822 | return "error : ".$e->getMessage(); |
823 | 823 | } |
824 | 824 | } else { |
@@ -840,10 +840,10 @@ discard block |
||
840 | 840 | * @param String $msg_no Number of the ACARS message |
841 | 841 | * @param String $message ACARS message |
842 | 842 | */ |
843 | - public function addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') { |
|
843 | + public function addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') { |
|
844 | 844 | global $globalDebug; |
845 | 845 | date_default_timezone_set('UTC'); |
846 | - if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/',$message) === 0 && preg_match('/^ARR0/',$message) === 0 && preg_match('/^ETA/',$message) === 0 && preg_match('/^WXR/',$message) === 0 && preg_match('/^FTX01.FIC/',$message) === 0) { |
|
846 | + if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/', $message) === 0 && preg_match('/^ARR0/', $message) === 0 && preg_match('/^ETA/', $message) === 0 && preg_match('/^WXR/', $message) === 0 && preg_match('/^FTX01.FIC/', $message) === 0) { |
|
847 | 847 | /* |
848 | 848 | if ($globalDebug) echo "Test if not already in Archive ACARS table..."; |
849 | 849 | $query_test = "SELECT COUNT(*) as nb FROM acars_archive WHERE ident = :ident AND registration = :registration AND message = :message"; |
@@ -859,12 +859,12 @@ discard block |
||
859 | 859 | */ |
860 | 860 | if ($globalDebug) echo "Add Live ACARS data..."; |
861 | 861 | $query = "INSERT INTO acars_archive (ident,registration,label,block_id,msg_no,message,decode) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode)"; |
862 | - $query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
|
862 | + $query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
|
863 | 863 | try { |
864 | 864 | |
865 | 865 | $sth = $this->db->prepare($query); |
866 | 866 | $sth->execute($query_values); |
867 | - } catch(PDOException $e) { |
|
867 | + } catch (PDOException $e) { |
|
868 | 868 | return "error : ".$e->getMessage(); |
869 | 869 | } |
870 | 870 | // } |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | |
888 | 888 | $sth = $this->db->prepare($query); |
889 | 889 | $sth->execute($query_values); |
890 | - } catch(PDOException $e) { |
|
890 | + } catch (PDOException $e) { |
|
891 | 891 | echo "error : ".$e->getMessage(); |
892 | 892 | die; |
893 | 893 | } |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | $sth = $this->db->prepare($query); |
910 | 910 | $sth->execute($query_values); |
911 | - } catch(PDOException $e) { |
|
911 | + } catch (PDOException $e) { |
|
912 | 912 | echo "error : ".$e->getMessage(); |
913 | 913 | die; |
914 | 914 | } |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | |
931 | 931 | $sth = $this->db->prepare($query); |
932 | 932 | $sth->execute($query_values); |
933 | - } catch(PDOException $e) { |
|
933 | + } catch (PDOException $e) { |
|
934 | 934 | echo "error : ".$e->getMessage(); |
935 | 935 | die; |
936 | 936 | } |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | * |
945 | 945 | * @return Array Return ACARS data in array |
946 | 946 | */ |
947 | - public function getLatestAcarsData($limit = '',$label = '') { |
|
947 | + public function getLatestAcarsData($limit = '', $label = '') { |
|
948 | 948 | global $globalURL, $globalDBdriver; |
949 | 949 | $Image = new Image($this->db); |
950 | 950 | $Spotter = new Spotter($this->db); |
@@ -956,8 +956,8 @@ discard block |
||
956 | 956 | { |
957 | 957 | $limit_array = explode(",", $limit); |
958 | 958 | |
959 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
960 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
959 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
960 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
961 | 961 | |
962 | 962 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
963 | 963 | { |
@@ -979,48 +979,48 @@ discard block |
||
979 | 979 | |
980 | 980 | $sth = $this->db->prepare($query); |
981 | 981 | $sth->execute($query_values); |
982 | - } catch(PDOException $e) { |
|
982 | + } catch (PDOException $e) { |
|
983 | 983 | return "error : ".$e->getMessage(); |
984 | 984 | } |
985 | 985 | $i = 0; |
986 | 986 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
987 | 987 | $data = array(); |
988 | 988 | if ($row['registration'] != '') { |
989 | - $row['registration'] = str_replace('.','',$row['registration']); |
|
989 | + $row['registration'] = str_replace('.', '', $row['registration']); |
|
990 | 990 | $image_array = $Image->getSpotterImage($row['registration']); |
991 | - if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
992 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
993 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
991 | + if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website'])); |
|
992 | + else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
993 | + } else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
994 | 994 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
995 | 995 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
996 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
996 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
997 | 997 | if (isset($identicao[0])) { |
998 | - if (substr($row['ident'],0,2) == 'AF') { |
|
999 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1000 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
1001 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
998 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
999 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1000 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
1001 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
1002 | 1002 | |
1003 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
1003 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
1004 | 1004 | } else $icao = $row['ident']; |
1005 | - $icao = $Translation->checkTranslation($icao,false); |
|
1005 | + $icao = $Translation->checkTranslation($icao, false); |
|
1006 | 1006 | |
1007 | - $decode = json_decode($row['decode'],true); |
|
1007 | + $decode = json_decode($row['decode'], true); |
|
1008 | 1008 | $found = false; |
1009 | - if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
|
1009 | + if ($decode != '' && array_key_exists('Departure airport', $decode)) { |
|
1010 | 1010 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
1011 | 1011 | if (isset($airport_info[0]['icao'])) { |
1012 | 1012 | $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1013 | 1013 | $found = true; |
1014 | 1014 | } |
1015 | 1015 | } |
1016 | - if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
|
1016 | + if ($decode != '' && array_key_exists('Arrival airport', $decode)) { |
|
1017 | 1017 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
1018 | 1018 | if (isset($airport_info[0]['icao'])) { |
1019 | 1019 | $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1020 | 1020 | $found = true; |
1021 | 1021 | } |
1022 | 1022 | } |
1023 | - if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
|
1023 | + if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) { |
|
1024 | 1024 | $airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']); |
1025 | 1025 | if (isset($airport_info[0]['icao'])) { |
1026 | 1026 | $decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | } |
1029 | 1029 | } |
1030 | 1030 | if ($found) $row['decode'] = json_encode($decode); |
1031 | - $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1031 | + $data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1032 | 1032 | $result[] = $data; |
1033 | 1033 | $i++; |
1034 | 1034 | } |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | * |
1045 | 1045 | * @return Array Return ACARS data in array |
1046 | 1046 | */ |
1047 | - public function getArchiveAcarsData($limit = '',$label = '') { |
|
1047 | + public function getArchiveAcarsData($limit = '', $label = '') { |
|
1048 | 1048 | global $globalURL, $globalDBdriver; |
1049 | 1049 | $Image = new Image($this->db); |
1050 | 1050 | $Spotter = new Spotter($this->db); |
@@ -1056,8 +1056,8 @@ discard block |
||
1056 | 1056 | { |
1057 | 1057 | $limit_array = explode(",", $limit); |
1058 | 1058 | |
1059 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1060 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1059 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1060 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1061 | 1061 | |
1062 | 1062 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1063 | 1063 | { |
@@ -1087,45 +1087,45 @@ discard block |
||
1087 | 1087 | |
1088 | 1088 | $sth = $this->db->prepare($query); |
1089 | 1089 | $sth->execute($query_values); |
1090 | - } catch(PDOException $e) { |
|
1090 | + } catch (PDOException $e) { |
|
1091 | 1091 | return "error : ".$e->getMessage(); |
1092 | 1092 | } |
1093 | - $i=0; |
|
1093 | + $i = 0; |
|
1094 | 1094 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
1095 | 1095 | $data = array(); |
1096 | 1096 | if ($row['registration'] != '') { |
1097 | - $row['registration'] = str_replace('.','',$row['registration']); |
|
1097 | + $row['registration'] = str_replace('.', '', $row['registration']); |
|
1098 | 1098 | $image_array = $Image->getSpotterImage($row['registration']); |
1099 | - if (count($image_array) > 0) $data = array_merge($data,array('image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
1100 | - else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
1101 | - } else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
1099 | + if (count($image_array) > 0) $data = array_merge($data, array('image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website'])); |
|
1100 | + else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
1101 | + } else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
1102 | 1102 | $icao = ''; |
1103 | 1103 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
1104 | 1104 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
1105 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
1105 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
1106 | 1106 | if (isset($identicao[0])) { |
1107 | - if (substr($row['ident'],0,2) == 'AF') { |
|
1108 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1109 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
1110 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
1111 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
1107 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
1108 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1109 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
1110 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
1111 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
1112 | 1112 | } else $icao = $row['ident']; |
1113 | 1113 | $icao = $Translation->checkTranslation($icao); |
1114 | 1114 | |
1115 | 1115 | |
1116 | - $decode = json_decode($row['decode'],true); |
|
1116 | + $decode = json_decode($row['decode'], true); |
|
1117 | 1117 | $found = false; |
1118 | - if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
|
1118 | + if ($decode != '' && array_key_exists('Departure airport', $decode)) { |
|
1119 | 1119 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
1120 | 1120 | if (isset($airport_info[0]['icao'])) $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1121 | 1121 | $found = true; |
1122 | 1122 | } |
1123 | - if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
|
1123 | + if ($decode != '' && array_key_exists('Arrival airport', $decode)) { |
|
1124 | 1124 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
1125 | 1125 | if (isset($airport_info[0]['icao'])) $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1126 | 1126 | $found = true; |
1127 | 1127 | } |
1128 | - if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
|
1128 | + if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) { |
|
1129 | 1129 | $airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']); |
1130 | 1130 | if (isset($airport_info[0]['icao'])) { |
1131 | 1131 | $decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | } |
1135 | 1135 | if ($found) $row['decode'] = json_encode($decode); |
1136 | 1136 | |
1137 | - $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1137 | + $data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1138 | 1138 | $result[] = $data; |
1139 | 1139 | $i++; |
1140 | 1140 | } |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | * @param String $icao |
1153 | 1153 | * @param String $ICAOTypeCode |
1154 | 1154 | */ |
1155 | - public function addModeSData($ident,$registration,$icao = '',$ICAOTypeCode = '',$latitude = '', $longitude = '') { |
|
1155 | + public function addModeSData($ident, $registration, $icao = '', $ICAOTypeCode = '', $latitude = '', $longitude = '') { |
|
1156 | 1156 | global $globalDebug, $globalDBdriver; |
1157 | 1157 | $ident = trim($ident); |
1158 | 1158 | $Translation = new Translation($this->db); |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | return ''; |
1167 | 1167 | } |
1168 | 1168 | |
1169 | - $registration = str_replace('.','',$registration); |
|
1169 | + $registration = str_replace('.', '', $registration); |
|
1170 | 1170 | $ident = $Translation->ident2icao($ident); |
1171 | 1171 | // Check if a flight with same registration is flying now, if ok check if callsign = name in ACARS, else add it to translation |
1172 | 1172 | if ($globalDebug) echo "Check if needed to add translation ".$ident.'... '; |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | |
1177 | 1177 | $sthsi = $this->db->prepare($querysi); |
1178 | 1178 | $sthsi->execute($querysi_values); |
1179 | - } catch(PDOException $e) { |
|
1179 | + } catch (PDOException $e) { |
|
1180 | 1180 | if ($globalDebug) echo $e->getMessage(); |
1181 | 1181 | return "error : ".$e->getMessage(); |
1182 | 1182 | } |
@@ -1187,8 +1187,8 @@ discard block |
||
1187 | 1187 | $Translation = new Translation($this->db); |
1188 | 1188 | $trans_ident = $Translation->getOperator($resultsi['ident']); |
1189 | 1189 | if ($globalDebug) echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' '; |
1190 | - if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'],$ident,'ACARS'); |
|
1191 | - elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'],$ident,'ACARS'); |
|
1190 | + if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'], $ident, 'ACARS'); |
|
1191 | + elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'], $ident, 'ACARS'); |
|
1192 | 1192 | } else { |
1193 | 1193 | if ($registration != '' && $latitude != '' && $longitude != '') { |
1194 | 1194 | $query = "SELECT ModeS FROM aircraft_modes WHERE Registration = :registration LIMIT 1"; |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | try { |
1197 | 1197 | $sth = $this->db->prepare($query); |
1198 | 1198 | $sth->execute($query_values); |
1199 | - } catch(PDOException $e) { |
|
1199 | + } catch (PDOException $e) { |
|
1200 | 1200 | if ($globalDebug) echo $e->getMessage(); |
1201 | 1201 | return "error : ".$e->getMessage(); |
1202 | 1202 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $sth->closeCursor(); |
1205 | 1205 | if (isset($result['modes'])) $hex = $result['modes']; |
1206 | 1206 | else $hex = ''; |
1207 | - $SI_data = array('hex' => $hex,'ident' => $ident,'aircraft_icao' => $ICAOTypeCode,'registration' => $registration,'latitude' => $latitude,'$longitude' => $longitude,'format_source' => 'ACARS'); |
|
1207 | + $SI_data = array('hex' => $hex, 'ident' => $ident, 'aircraft_icao' => $ICAOTypeCode, 'registration' => $registration, 'latitude' => $latitude, '$longitude' => $longitude, 'format_source' => 'ACARS'); |
|
1208 | 1208 | $this->SI->add($SI_data); |
1209 | 1209 | } |
1210 | 1210 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | |
1217 | 1217 | $sth = $this->db->prepare($query); |
1218 | 1218 | $sth->execute($query_values); |
1219 | - } catch(PDOException $e) { |
|
1219 | + } catch (PDOException $e) { |
|
1220 | 1220 | if ($globalDebug) echo $e->getMessage(); |
1221 | 1221 | return "error : ".$e->getMessage(); |
1222 | 1222 | } |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | if (isset($result['ModeS'])) $ModeS = $result['ModeS']; |
1228 | 1228 | else $ModeS = ''; |
1229 | 1229 | if ($ModeS == '') { |
1230 | - $id = explode('-',$result['flightaware_id']); |
|
1230 | + $id = explode('-', $result['flightaware_id']); |
|
1231 | 1231 | $ModeS = $id[0]; |
1232 | 1232 | } |
1233 | 1233 | if ($ModeS != '') { |
@@ -1238,21 +1238,21 @@ discard block |
||
1238 | 1238 | |
1239 | 1239 | $sthc = $this->db->prepare($queryc); |
1240 | 1240 | $sthc->execute($queryc_values); |
1241 | - } catch(PDOException $e) { |
|
1241 | + } catch (PDOException $e) { |
|
1242 | 1242 | if ($globalDebug) echo $e->getMessage(); |
1243 | 1243 | return "error : ".$e->getMessage(); |
1244 | 1244 | } |
1245 | 1245 | $row = $sthc->fetch(PDO::FETCH_ASSOC); |
1246 | 1246 | $sthc->closeCursor(); |
1247 | - if (count($row) == 0) { |
|
1247 | + if (count($row) == 0) { |
|
1248 | 1248 | if ($globalDebug) echo " Add to ModeS table - "; |
1249 | 1249 | $queryi = "INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:ModeSCountry,:Registration, :ICAOTypeCode,'ACARS')"; |
1250 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1250 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1251 | 1251 | try { |
1252 | 1252 | |
1253 | 1253 | $sthi = $this->db->prepare($queryi); |
1254 | 1254 | $sthi->execute($queryi_values); |
1255 | - } catch(PDOException $e) { |
|
1255 | + } catch (PDOException $e) { |
|
1256 | 1256 | if ($globalDebug) echo $e->getMessage(); |
1257 | 1257 | return "error : ".$e->getMessage(); |
1258 | 1258 | } |
@@ -1260,16 +1260,16 @@ discard block |
||
1260 | 1260 | if ($globalDebug) echo " Update ModeS table - "; |
1261 | 1261 | if ($ICAOTypeCode != '') { |
1262 | 1262 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,ICAOTypeCode = :ICAOTypeCode,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
1263 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1263 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1264 | 1264 | } else { |
1265 | 1265 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
1266 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration); |
|
1266 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration); |
|
1267 | 1267 | } |
1268 | 1268 | try { |
1269 | 1269 | |
1270 | 1270 | $sthi = $this->db->prepare($queryi); |
1271 | 1271 | $sthi->execute($queryi_values); |
1272 | - } catch(PDOException $e) { |
|
1272 | + } catch (PDOException $e) { |
|
1273 | 1273 | if ($globalDebug) echo $e->getMessage(); |
1274 | 1274 | return "error : ".$e->getMessage(); |
1275 | 1275 | } |
@@ -1307,13 +1307,13 @@ discard block |
||
1307 | 1307 | elseif ($globalDBdriver == 'pgsql') { |
1308 | 1308 | $queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= NOW() AT TIME ZONE 'UTC' - INTERVAL '1 HOUR'"; |
1309 | 1309 | } |
1310 | - $queryi_values = array(':Registration' => $registration,':ident' => $icao); |
|
1310 | + $queryi_values = array(':Registration' => $registration, ':ident' => $icao); |
|
1311 | 1311 | } |
1312 | 1312 | try { |
1313 | 1313 | |
1314 | 1314 | $sthi = $this->db->prepare($queryi); |
1315 | 1315 | $sthi->execute($queryi_values); |
1316 | - } catch(PDOException $e) { |
|
1316 | + } catch (PDOException $e) { |
|
1317 | 1317 | if ($globalDebug) echo $e->getMessage(); |
1318 | 1318 | return "error : ".$e->getMessage(); |
1319 | 1319 | } |
@@ -6,17 +6,17 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Busiest Month of Last Year"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == 'all') { |
11 | 11 | unset($_COOKIE['stats_airline_icao']); |
12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
13 | 13 | $airline_icao = ''; |
14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
18 | 18 | } |
19 | -setcookie('stats_airline_icao',$airline_icao); |
|
19 | +setcookie('stats_airline_icao', $airline_icao); |
|
20 | 20 | |
21 | 21 | require_once('header.php'); |
22 | 22 | include('statistics-sub-menu.php'); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | </div> |
27 | 27 | <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>'; |
28 | 28 | |
29 | -$date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
29 | +$date_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
30 | 30 | print '<div id="chart" class="chart" width="100%"></div> |
31 | 31 | <script> |
32 | 32 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ["'._("Month").'", "'._("# of Flights").'"], '; |
37 | 37 | |
38 | 38 | $date_data = ''; |
39 | -foreach($date_array as $date_item) |
|
39 | +foreach ($date_array as $date_item) |
|
40 | 40 | { |
41 | 41 | $date_data .= '[ "'.date("F, Y", strtotime($date_item['year_name'].'-'.$date_item['month_name'].'-01')).'",'.$date_item['date_count'].'],'; |
42 | 42 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | print '</thead>'; |
74 | 74 | print '<tbody>'; |
75 | 75 | $i = 1; |
76 | - foreach($date_array as $date_item) |
|
76 | + foreach ($date_array as $date_item) |
|
77 | 77 | { |
78 | 78 | print '<tr>'; |
79 | 79 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | </div> |
15 | 15 | <p>'._("Below are the <strong>Top 10</strong> most common airlines.").'</p>'; |
16 | 16 | |
17 | -$airline_array = $Stats->countAllAirlines(true,$filter_name); |
|
17 | +$airline_array = $Stats->countAllAirlines(true, $filter_name); |
|
18 | 18 | print '<div id="chart" class="chart" width="100%"></div> |
19 | 19 | <script> |
20 | 20 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | var data = google.visualization.arrayToDataTable([ |
24 | 24 | ["'._("Airline").'", "'._("# of times").'"], '; |
25 | 25 | $airline_data = ''; |
26 | -foreach($airline_array as $airline_item) |
|
26 | +foreach ($airline_array as $airline_item) |
|
27 | 27 | { |
28 | 28 | $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
29 | 29 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | print '</thead>'; |
59 | 59 | print '<tbody>'; |
60 | 60 | $i = 1; |
61 | - foreach($airline_array as $airline_item) |
|
61 | + foreach ($airline_array as $airline_item) |
|
62 | 62 | { |
63 | 63 | print '<tr>'; |
64 | 64 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,17 +6,17 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Busiest Month of Last Year"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == 'all') { |
11 | 11 | unset($_COOKIE['stats_airline_icao']); |
12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
13 | 13 | $airline_icao = ''; |
14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
18 | 18 | } |
19 | -setcookie('stats_airline_icao',$airline_icao); |
|
19 | +setcookie('stats_airline_icao', $airline_icao); |
|
20 | 20 | |
21 | 21 | require_once('header.php'); |
22 | 22 | include('statistics-sub-menu.php'); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | </div> |
28 | 28 | <p>'._("Below is a chart that plots the busiest day during the <strong>last month</strong>.").'</p>'; |
29 | 29 | |
30 | -$date_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
30 | +$date_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
31 | 31 | print '<div id="chart" class="chart" width="100%"></div> |
32 | 32 | <script> |
33 | 33 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | ["'._("Month").'", "'._("# of Flights").'"], '; |
38 | 38 | |
39 | 39 | $date_data = ''; |
40 | -foreach($date_array as $date_item) |
|
40 | +foreach ($date_array as $date_item) |
|
41 | 41 | { |
42 | 42 | $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
43 | 43 | } |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | print '</thead>'; |
75 | 75 | print '<tbody>'; |
76 | 76 | $i = 1; |
77 | - foreach($date_array as $date_item) |
|
77 | + foreach ($date_array as $date_item) |
|
78 | 78 | { |
79 | 79 | print '<tr>'; |
80 | 80 | print '<td><strong>'.$i.'</strong></td>'; |
81 | 81 | print '<td>'; |
82 | - print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
82 | + print '<a href="'.$globalURL.'/date/'.date('Y-m-d', strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
83 | 83 | print '</td>'; |
84 | 84 | print '<td>'; |
85 | 85 | print $date_item['date_count']; |
@@ -6,17 +6,17 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Busiest Day"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == 'all') { |
11 | 11 | unset($_COOKIE['stats_airline_icao']); |
12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
13 | 13 | $airline_icao = ''; |
14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
18 | 18 | } |
19 | -setcookie('stats_airline_icao',$airline_icao); |
|
19 | +setcookie('stats_airline_icao', $airline_icao); |
|
20 | 20 | |
21 | 21 | require_once('header.php'); |
22 | 22 | include('statistics-sub-menu.php'); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | </div> |
28 | 28 | <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>'; |
29 | 29 | |
30 | -$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
30 | +$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
31 | 31 | if (count($date_array) == 0) { |
32 | 32 | print _("No data available"); |
33 | 33 | } else { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | ["'._("Date").'", "'._("# of Flights").'"], '; |
41 | 41 | |
42 | 42 | $date_data = ''; |
43 | -foreach($date_array as $date_item) |
|
43 | +foreach ($date_array as $date_item) |
|
44 | 44 | { |
45 | 45 | $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
46 | 46 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | </script>'; |
67 | 67 | } |
68 | 68 | if (isset($globalDBArchiveMonths) && $globalDBArchiveMonths > 0) { |
69 | - print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."),$globalDBArchiveMonths).'</p>'; |
|
69 | + print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."), $globalDBArchiveMonths).'</p>'; |
|
70 | 70 | } else { |
71 | 71 | print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>'; |
72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | print '</thead>'; |
83 | 83 | print '<tbody>'; |
84 | 84 | $i = 1; |
85 | - foreach($date_array as $date_item) |
|
85 | + foreach ($date_array as $date_item) |
|
86 | 86 | { |
87 | 87 | print '<tr>'; |
88 | 88 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,17 +6,17 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Arrival Airport by Country"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == 'all') { |
11 | 11 | unset($_COOKIE['stats_airline_icao']); |
12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
13 | 13 | $airline_icao = ''; |
14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
18 | 18 | } |
19 | -setcookie('stats_airline_icao',$airline_icao); |
|
19 | +setcookie('stats_airline_icao', $airline_icao); |
|
20 | 20 | |
21 | 21 | require_once('header.php'); |
22 | 22 | include('statistics-sub-menu.php'); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | </div> |
28 | 28 | <p>'._("Below are the <strong>Top 10</strong> most common countries of all the arrival airports.").'</p>'; |
29 | 29 | |
30 | -$airport_country_array = $Stats->countAllArrivalCountries(true,$airline_icao,$filter_name); |
|
30 | +$airport_country_array = $Stats->countAllArrivalCountries(true, $airline_icao, $filter_name); |
|
31 | 31 | |
32 | 32 | print '<script> |
33 | 33 | google.load("visualization", "1", {packages:["geochart"]}); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ["'._("Country").'", "'._("# of times").'"],'; |
42 | 42 | |
43 | 43 | $country_data = ''; |
44 | -foreach($airport_country_array as $airport_item) |
|
44 | +foreach ($airport_country_array as $airport_item) |
|
45 | 45 | { |
46 | 46 | $country_data .= '[ "'.$airport_item['airport_arrival_country'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
47 | 47 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | print '</thead>'; |
77 | 77 | print '<tbody>'; |
78 | 78 | $i = 1; |
79 | -foreach($airport_country_array as $airport_item) |
|
79 | +foreach ($airport_country_array as $airport_item) |
|
80 | 80 | { |
81 | 81 | print '<tr>'; |
82 | 82 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,17 +6,17 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == 'all') { |
11 | 11 | unset($_COOKIE['stats_airline_icao']); |
12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
13 | 13 | $airline_icao = ''; |
14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
18 | 18 | } |
19 | -setcookie('stats_airline_icao',$airline_icao); |
|
19 | +setcookie('stats_airline_icao', $airline_icao); |
|
20 | 20 | |
21 | 21 | require_once('header.php'); |
22 | 22 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | </div> |
28 | 28 | <p>'._("Below are the <strong>Top 10</strong> most common aircraft types.").'</p>'; |
29 | 29 | |
30 | -$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
30 | +$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name); |
|
31 | 31 | print '<div id="chart" class="chart" width="100%"></div> |
32 | 32 | <script> |
33 | 33 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | var data = google.visualization.arrayToDataTable([ |
37 | 37 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
38 | 38 | $aircraft_data = ''; |
39 | -foreach($aircraft_array as $aircraft_item) |
|
39 | +foreach ($aircraft_array as $aircraft_item) |
|
40 | 40 | { |
41 | 41 | $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
42 | 42 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | print '</thead>'; |
70 | 70 | print '<tbody>'; |
71 | 71 | $i = 1; |
72 | - foreach($aircraft_array as $aircraft_item) |
|
72 | + foreach ($aircraft_array as $aircraft_item) |
|
73 | 73 | { |
74 | 74 | print '<tr>'; |
75 | 75 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | </div> |
15 | 15 | <p>'._("Below are the <strong>Top 10</strong> countries that an airline belongs to.").'</p>'; |
16 | 16 | |
17 | -$airline_array = $Stats->countAllAirlineCountries(true,$filter_name); |
|
17 | +$airline_array = $Stats->countAllAirlineCountries(true, $filter_name); |
|
18 | 18 | if (count($airline_array) > 0) { |
19 | 19 | print '<div id="chartCountry" class="chart" width="100%"></div> |
20 | 20 | <script> |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | var data = google.visualization.arrayToDataTable([ |
25 | 25 | ["'._("Country").'", "'._("# of times").'"], '; |
26 | 26 | $country_data = ''; |
27 | -foreach($airline_array as $airline_item) |
|
27 | +foreach ($airline_array as $airline_item) |
|
28 | 28 | { |
29 | 29 | $country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],'; |
30 | 30 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | print '</thead>'; |
59 | 59 | print '<tbody>'; |
60 | 60 | $i = 1; |
61 | - foreach($airline_array as $airline_item) |
|
61 | + foreach ($airline_array as $airline_item) |
|
62 | 62 | { |
63 | 63 | print '<tr>'; |
64 | 64 | print '<td><strong>'.$i.'</strong></td>'; |