@@ -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 | - $datebe = explode(' - ',$line[2]); |
|
179 | + $datebe = explode(' - ', $line[2]); |
|
180 | 180 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
181 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
181 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
182 | 182 | $sth_dest->execute($query_dest_values); |
183 | 183 | } |
184 | 184 | } |
185 | 185 | } |
186 | 186 | if ($globalTransaction) $Connection->db->commit(); |
187 | - } catch(PDOException $e) { |
|
187 | + } catch (PDOException $e) { |
|
188 | 188 | if ($globalTransaction) $Connection->db->rollBack(); |
189 | 189 | return "error : ".$e->getMessage(); |
190 | 190 | } |
@@ -199,7 +199,7 @@ discard block |
||
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 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $Connection = new Connection(); |
252 | 252 | $sth = $Connection->db->prepare($query); |
253 | 253 | $sth->execute(array(':source' => $database_file)); |
254 | - } catch(PDOException $e) { |
|
254 | + } catch (PDOException $e) { |
|
255 | 255 | return "error : ".$e->getMessage(); |
256 | 256 | } |
257 | 257 | return ''; |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | $Connection = new Connection(); |
267 | 267 | $sth = $Connection->db->prepare($query); |
268 | 268 | $sth->execute(array(':source' => $database_file)); |
269 | - } catch(PDOException $e) { |
|
269 | + } catch (PDOException $e) { |
|
270 | 270 | return "error : ".$e->getMessage(); |
271 | 271 | } |
272 | 272 | |
273 | - if ($fh = fopen($database_file,"r")) { |
|
273 | + if ($fh = fopen($database_file, "r")) { |
|
274 | 274 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
275 | 275 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
276 | 276 | |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | if ($globalTransaction) $Connection->db->beginTransaction(); |
281 | 281 | while (!feof($fh)) { |
282 | 282 | $values = array(); |
283 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
283 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
284 | 284 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
285 | - $values['ModeS'] = substr($line,0,6); |
|
286 | - $values['Registration'] = trim(substr($line,69,6)); |
|
287 | - $aircraft_name = trim(substr($line,48,6)); |
|
285 | + $values['ModeS'] = substr($line, 0, 6); |
|
286 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
287 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
288 | 288 | // Check if we can find ICAO, else set it to GLID |
289 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
289 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
290 | 290 | $search_more = ''; |
291 | 291 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
292 | 292 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -298,20 +298,20 @@ discard block |
||
298 | 298 | if (isset($result['icao']) && $result['icao'] != '') { |
299 | 299 | $values['ICAOTypeCode'] = $result['icao']; |
300 | 300 | } |
301 | - } catch(PDOException $e) { |
|
301 | + } catch (PDOException $e) { |
|
302 | 302 | return "error : ".$e->getMessage(); |
303 | 303 | } |
304 | 304 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
305 | 305 | // Add data to db |
306 | 306 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
307 | 307 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
308 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
308 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
309 | 309 | //print_r($query_dest_values); |
310 | 310 | $sth_dest->execute($query_dest_values); |
311 | 311 | } |
312 | 312 | } |
313 | 313 | if ($globalTransaction) $Connection->db->commit(); |
314 | - } catch(PDOException $e) { |
|
314 | + } catch (PDOException $e) { |
|
315 | 315 | return "error : ".$e->getMessage(); |
316 | 316 | } |
317 | 317 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $Connection = new Connection(); |
322 | 322 | $sth = $Connection->db->prepare($query); |
323 | 323 | $sth->execute(array(':source' => $database_file)); |
324 | - } catch(PDOException $e) { |
|
324 | + } catch (PDOException $e) { |
|
325 | 325 | return "error : ".$e->getMessage(); |
326 | 326 | } |
327 | 327 | return ''; |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | $Connection = new Connection(); |
336 | 336 | $sth = $Connection->db->prepare($query); |
337 | 337 | $sth->execute(array(':source' => $database_file)); |
338 | - } catch(PDOException $e) { |
|
338 | + } catch (PDOException $e) { |
|
339 | 339 | return "error : ".$e->getMessage(); |
340 | 340 | } |
341 | 341 | |
342 | - if ($fh = fopen($database_file,"r")) { |
|
342 | + if ($fh = fopen($database_file, "r")) { |
|
343 | 343 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
344 | 344 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
345 | 345 | |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | $sth_dest = $Connection->db->prepare($query_dest); |
348 | 348 | try { |
349 | 349 | if ($globalTransaction) $Connection->db->beginTransaction(); |
350 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
350 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
351 | 351 | while (!feof($fh)) { |
352 | - $line = fgetcsv($fh,9999,',',"'"); |
|
352 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
353 | 353 | |
354 | 354 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
355 | 355 | //print_r($line); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $values['Registration'] = $line[3]; |
358 | 358 | $aircraft_name = $line[2]; |
359 | 359 | // Check if we can find ICAO, else set it to GLID |
360 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
360 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
361 | 361 | $search_more = ''; |
362 | 362 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
363 | 363 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -366,20 +366,20 @@ discard block |
||
366 | 366 | $sth_search->execute(); |
367 | 367 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
368 | 368 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
369 | - } catch(PDOException $e) { |
|
369 | + } catch (PDOException $e) { |
|
370 | 370 | return "error : ".$e->getMessage(); |
371 | 371 | } |
372 | 372 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
373 | 373 | // Add data to db |
374 | 374 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
375 | 375 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
376 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
376 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
377 | 377 | //print_r($query_dest_values); |
378 | 378 | $sth_dest->execute($query_dest_values); |
379 | 379 | } |
380 | 380 | } |
381 | 381 | if ($globalTransaction) $Connection->db->commit(); |
382 | - } catch(PDOException $e) { |
|
382 | + } catch (PDOException $e) { |
|
383 | 383 | return "error : ".$e->getMessage(); |
384 | 384 | } |
385 | 385 | } |
@@ -389,13 +389,13 @@ discard block |
||
389 | 389 | $Connection = new Connection(); |
390 | 390 | $sth = $Connection->db->prepare($query); |
391 | 391 | $sth->execute(array(':source' => $database_file)); |
392 | - } catch(PDOException $e) { |
|
392 | + } catch (PDOException $e) { |
|
393 | 393 | return "error : ".$e->getMessage(); |
394 | 394 | } |
395 | 395 | return ''; |
396 | 396 | } |
397 | 397 | |
398 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
398 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
399 | 399 | global $globalTransaction, $globalMasterSource; |
400 | 400 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
401 | 401 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -403,12 +403,12 @@ discard block |
||
403 | 403 | $Connection = new Connection(); |
404 | 404 | $sth = $Connection->db->prepare($query); |
405 | 405 | $sth->execute(array(':source' => $database_file)); |
406 | - } catch(PDOException $e) { |
|
406 | + } catch (PDOException $e) { |
|
407 | 407 | return "error : ".$e->getMessage(); |
408 | 408 | } |
409 | 409 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
410 | 410 | $Spotter = new Spotter(); |
411 | - if ($fh = fopen($database_file,"r")) { |
|
411 | + if ($fh = fopen($database_file, "r")) { |
|
412 | 412 | //$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)'; |
413 | 413 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
414 | 414 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -418,9 +418,9 @@ discard block |
||
418 | 418 | $sth_modes = $Connection->db->prepare($query_modes); |
419 | 419 | try { |
420 | 420 | if ($globalTransaction) $Connection->db->beginTransaction(); |
421 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
421 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
422 | 422 | while (!feof($fh)) { |
423 | - $line = fgetcsv($fh,9999,',','"'); |
|
423 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
424 | 424 | $values = array(); |
425 | 425 | //print_r($line); |
426 | 426 | if ($country == 'F') { |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $values['base'] = $line[4]; |
429 | 429 | $values['owner'] = $line[5]; |
430 | 430 | if ($line[6] == '') $values['date_first_reg'] = null; |
431 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
431 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
432 | 432 | $values['cancel'] = $line[7]; |
433 | 433 | } elseif ($country == 'EI') { |
434 | 434 | // TODO : add modeS & reg to aircraft_modes |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | $values['base'] = $line[3]; |
437 | 437 | $values['owner'] = $line[2]; |
438 | 438 | if ($line[1] == '') $values['date_first_reg'] = null; |
439 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
439 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
440 | 440 | $values['cancel'] = ''; |
441 | 441 | $values['modes'] = $line[7]; |
442 | 442 | $values['icao'] = $line[8]; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $values['base'] = null; |
457 | 457 | $values['owner'] = $line[5]; |
458 | 458 | if ($line[18] == '') $values['date_first_reg'] = null; |
459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
459 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
460 | 460 | $values['cancel'] = ''; |
461 | 461 | } elseif ($country == 'VH') { |
462 | 462 | // TODO : add modeS & reg to aircraft_modes |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $values['base'] = null; |
465 | 465 | $values['owner'] = $line[12]; |
466 | 466 | if ($line[28] == '') $values['date_first_reg'] = null; |
467 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
467 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
468 | 468 | |
469 | 469 | $values['cancel'] = $line[39]; |
470 | 470 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -484,28 +484,28 @@ discard block |
||
484 | 484 | $values['base'] = null; |
485 | 485 | $values['owner'] = $line[8]; |
486 | 486 | if ($line[7] == '') $values['date_first_reg'] = null; |
487 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
487 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
488 | 488 | $values['cancel'] = ''; |
489 | 489 | } elseif ($country == 'PP') { |
490 | 490 | $values['registration'] = $line[0]; |
491 | 491 | $values['base'] = null; |
492 | 492 | $values['owner'] = $line[4]; |
493 | 493 | if ($line[6] == '') $values['date_first_reg'] = null; |
494 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
494 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
495 | 495 | $values['cancel'] = $line[7]; |
496 | 496 | } elseif ($country == 'E7') { |
497 | 497 | $values['registration'] = $line[0]; |
498 | 498 | $values['base'] = null; |
499 | 499 | $values['owner'] = $line[4]; |
500 | 500 | if ($line[5] == '') $values['date_first_reg'] = null; |
501 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
501 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
502 | 502 | $values['cancel'] = ''; |
503 | 503 | } elseif ($country == '8Q') { |
504 | 504 | $values['registration'] = $line[0]; |
505 | 505 | $values['base'] = null; |
506 | 506 | $values['owner'] = $line[3]; |
507 | 507 | if ($line[7] == '') $values['date_first_reg'] = null; |
508 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
508 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
509 | 509 | $values['cancel'] = ''; |
510 | 510 | } elseif ($country == 'ZK') { |
511 | 511 | $values['registration'] = $line[0]; |
@@ -519,18 +519,18 @@ discard block |
||
519 | 519 | $values['registration'] = $line[0]; |
520 | 520 | $values['base'] = null; |
521 | 521 | $values['owner'] = $line[6]; |
522 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
523 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
522 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
523 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
524 | 524 | $values['modes'] = $line[4]; |
525 | 525 | $values['icao'] = $line[10]; |
526 | 526 | } elseif ($country == 'OY') { |
527 | 527 | $values['registration'] = $line[0]; |
528 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
528 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
529 | 529 | $values['modes'] = $line[5]; |
530 | 530 | $values['icao'] = $line[6]; |
531 | 531 | } elseif ($country == 'PH') { |
532 | 532 | $values['registration'] = $line[0]; |
533 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
533 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
534 | 534 | $values['modes'] = $line[4]; |
535 | 535 | $values['icao'] = $line[5]; |
536 | 536 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -541,17 +541,17 @@ discard block |
||
541 | 541 | $values['cancel'] = ''; |
542 | 542 | } |
543 | 543 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
544 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
544 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
545 | 545 | $sth_dest->execute($query_dest_values); |
546 | 546 | } |
547 | 547 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
548 | 548 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
549 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
549 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
550 | 550 | $sth_modes->execute($query_modes_values); |
551 | 551 | } |
552 | 552 | } |
553 | 553 | if ($globalTransaction) $Connection->db->commit(); |
554 | - } catch(PDOException $e) { |
|
554 | + } catch (PDOException $e) { |
|
555 | 555 | return "error : ".$e->getMessage(); |
556 | 556 | } |
557 | 557 | } |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | $Connection = new Connection(); |
667 | 667 | $sth = $Connection->db->prepare($query); |
668 | 668 | $sth->execute(); |
669 | - } catch(PDOException $e) { |
|
669 | + } catch (PDOException $e) { |
|
670 | 670 | return "error : ".$e->getMessage(); |
671 | 671 | } |
672 | 672 | |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | $Connection = new Connection(); |
677 | 677 | $sth = $Connection->db->prepare($query); |
678 | 678 | $sth->execute(); |
679 | - } catch(PDOException $e) { |
|
679 | + } catch (PDOException $e) { |
|
680 | 680 | return "error : ".$e->getMessage(); |
681 | 681 | } |
682 | 682 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | if ($globalTransaction) $Connection->db->beginTransaction(); |
688 | 688 | |
689 | 689 | $i = 0; |
690 | - while($row = sparql_fetch_array($result)) |
|
690 | + while ($row = sparql_fetch_array($result)) |
|
691 | 691 | { |
692 | 692 | if ($i >= 1) { |
693 | 693 | //print_r($row); |
@@ -707,31 +707,31 @@ discard block |
||
707 | 707 | $row['image'] = ''; |
708 | 708 | $row['image_thumb'] = ''; |
709 | 709 | } else { |
710 | - $image = str_replace(' ','_',$row['image']); |
|
710 | + $image = str_replace(' ', '_', $row['image']); |
|
711 | 711 | $digest = md5($image); |
712 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
713 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
714 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
715 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
712 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
713 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
714 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
715 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
716 | 716 | } |
717 | 717 | |
718 | - $country = explode('-',$row['country']); |
|
718 | + $country = explode('-', $row['country']); |
|
719 | 719 | $row['country'] = $country[0]; |
720 | 720 | |
721 | 721 | $row['type'] = trim($row['type']); |
722 | - 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'])) { |
|
722 | + 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'])) { |
|
723 | 723 | $row['type'] = 'Military'; |
724 | 724 | } 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') { |
725 | 725 | $row['type'] = 'small_airport'; |
726 | 726 | } |
727 | 727 | |
728 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
729 | - $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']); |
|
728 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
729 | + $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']); |
|
730 | 730 | //print_r($query_dest_values); |
731 | 731 | |
732 | 732 | try { |
733 | 733 | $sth_dest->execute($query_dest_values); |
734 | - } catch(PDOException $e) { |
|
734 | + } catch (PDOException $e) { |
|
735 | 735 | return "error : ".$e->getMessage(); |
736 | 736 | } |
737 | 737 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $Connection = new Connection(); |
746 | 746 | $sth = $Connection->db->prepare($query); |
747 | 747 | $sth->execute(); |
748 | - } catch(PDOException $e) { |
|
748 | + } catch (PDOException $e) { |
|
749 | 749 | return "error : ".$e->getMessage(); |
750 | 750 | } |
751 | 751 | |
@@ -753,12 +753,12 @@ discard block |
||
753 | 753 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
754 | 754 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
755 | 755 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
756 | - $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' => ''); |
|
756 | + $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' => ''); |
|
757 | 757 | try { |
758 | 758 | $Connection = new Connection(); |
759 | 759 | $sth = $Connection->db->prepare($query); |
760 | 760 | $sth->execute($query_values); |
761 | - } catch(PDOException $e) { |
|
761 | + } catch (PDOException $e) { |
|
762 | 762 | return "error : ".$e->getMessage(); |
763 | 763 | } |
764 | 764 | $i++; |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | echo "Download data from ourairports.com...\n"; |
777 | 777 | $delimiter = ','; |
778 | 778 | $out_file = $tmp_dir.'airports.csv'; |
779 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
779 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
780 | 780 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
781 | 781 | echo "Add data from ourairports.com...\n"; |
782 | 782 | |
@@ -787,32 +787,32 @@ discard block |
||
787 | 787 | //$Connection->db->beginTransaction(); |
788 | 788 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
789 | 789 | { |
790 | - if(!$header) $header = $row; |
|
790 | + if (!$header) $header = $row; |
|
791 | 791 | else { |
792 | 792 | $data = array(); |
793 | 793 | $data = array_combine($header, $row); |
794 | 794 | try { |
795 | 795 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
796 | 796 | $sth->execute(array(':icao' => $data['gps_code'])); |
797 | - } catch(PDOException $e) { |
|
797 | + } catch (PDOException $e) { |
|
798 | 798 | return "error : ".$e->getMessage(); |
799 | 799 | } |
800 | 800 | if ($sth->fetchColumn() > 0) { |
801 | 801 | $query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
802 | 802 | try { |
803 | 803 | $sth = $Connection->db->prepare($query); |
804 | - $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
805 | - } catch(PDOException $e) { |
|
804 | + $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
805 | + } catch (PDOException $e) { |
|
806 | 806 | return "error : ".$e->getMessage(); |
807 | 807 | } |
808 | 808 | } else { |
809 | 809 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
810 | 810 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
811 | - $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']); |
|
811 | + $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']); |
|
812 | 812 | try { |
813 | 813 | $sth = $Connection->db->prepare($query); |
814 | 814 | $sth->execute($query_values); |
815 | - } catch(PDOException $e) { |
|
815 | + } catch (PDOException $e) { |
|
816 | 816 | return "error : ".$e->getMessage(); |
817 | 817 | } |
818 | 818 | $i++; |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | |
826 | 826 | echo "Download data from another free database...\n"; |
827 | 827 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
828 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
828 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
829 | 829 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
830 | 830 | update_db::unzip($out_file); |
831 | 831 | $header = NULL; |
@@ -837,15 +837,15 @@ discard block |
||
837 | 837 | //$Connection->db->beginTransaction(); |
838 | 838 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
839 | 839 | { |
840 | - if(!$header) $header = $row; |
|
840 | + if (!$header) $header = $row; |
|
841 | 841 | else { |
842 | 842 | $data = $row; |
843 | 843 | |
844 | 844 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
845 | 845 | try { |
846 | 846 | $sth = $Connection->db->prepare($query); |
847 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
848 | - } catch(PDOException $e) { |
|
847 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
848 | + } catch (PDOException $e) { |
|
849 | 849 | return "error : ".$e->getMessage(); |
850 | 850 | } |
851 | 851 | } |
@@ -859,15 +859,15 @@ discard block |
||
859 | 859 | try { |
860 | 860 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
861 | 861 | $sth->execute(); |
862 | - } catch(PDOException $e) { |
|
862 | + } catch (PDOException $e) { |
|
863 | 863 | return "error : ".$e->getMessage(); |
864 | 864 | } |
865 | 865 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
866 | 866 | $query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
867 | 867 | try { |
868 | 868 | $sth2 = $Connection->db->prepare($query2); |
869 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
870 | - } catch(PDOException $e) { |
|
869 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
870 | + } catch (PDOException $e) { |
|
871 | 871 | return "error : ".$e->getMessage(); |
872 | 872 | } |
873 | 873 | } |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | $Connection = new Connection(); |
892 | 892 | $sth = $Connection->db->prepare($query); |
893 | 893 | $sth->execute(array(':source' => 'translation.csv')); |
894 | - } catch(PDOException $e) { |
|
894 | + } catch (PDOException $e) { |
|
895 | 895 | return "error : ".$e->getMessage(); |
896 | 896 | } |
897 | 897 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
909 | 909 | { |
910 | 910 | $i++; |
911 | - if($i > 12) { |
|
911 | + if ($i > 12) { |
|
912 | 912 | $data = $row; |
913 | 913 | $operator = $data[2]; |
914 | 914 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | //echo substr($operator, 0, 2)."\n";; |
917 | 917 | if (count($airline_array) > 0) { |
918 | 918 | //print_r($airline_array); |
919 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
919 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
920 | 920 | } |
921 | 921 | } |
922 | 922 | |
@@ -924,14 +924,14 @@ discard block |
||
924 | 924 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
925 | 925 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
926 | 926 | if (count($airline_array) > 0) { |
927 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
927 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
931 | 931 | try { |
932 | 932 | $sth = $Connection->db->prepare($query); |
933 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
934 | - } catch(PDOException $e) { |
|
933 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
934 | + } catch (PDOException $e) { |
|
935 | 935 | return "error : ".$e->getMessage(); |
936 | 936 | } |
937 | 937 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | $Connection = new Connection(); |
952 | 952 | $sth = $Connection->db->prepare($query); |
953 | 953 | $sth->execute(array(':source' => 'website_fam')); |
954 | - } catch(PDOException $e) { |
|
954 | + } catch (PDOException $e) { |
|
955 | 955 | return "error : ".$e->getMessage(); |
956 | 956 | } |
957 | 957 | |
@@ -971,8 +971,8 @@ discard block |
||
971 | 971 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
972 | 972 | try { |
973 | 973 | $sth = $Connection->db->prepare($query); |
974 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
975 | - } catch(PDOException $e) { |
|
974 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
975 | + } catch (PDOException $e) { |
|
976 | 976 | return "error : ".$e->getMessage(); |
977 | 977 | } |
978 | 978 | } |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | $Connection = new Connection(); |
996 | 996 | $sth = $Connection->db->prepare($query); |
997 | 997 | $sth->execute(array(':source' => 'website_faa')); |
998 | - } catch(PDOException $e) { |
|
998 | + } catch (PDOException $e) { |
|
999 | 999 | return "error : ".$e->getMessage(); |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | $Connection = new Connection(); |
1005 | 1005 | $sth = $Connection->db->prepare($query); |
1006 | 1006 | $sth->execute(array(':source' => 'website_faa')); |
1007 | - } catch(PDOException $e) { |
|
1007 | + } catch (PDOException $e) { |
|
1008 | 1008 | return "error : ".$e->getMessage(); |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1021,8 +1021,8 @@ discard block |
||
1021 | 1021 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1022 | 1022 | try { |
1023 | 1023 | $sths = $Connection->db->prepare($query_search); |
1024 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1025 | - } catch(PDOException $e) { |
|
1024 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1025 | + } catch (PDOException $e) { |
|
1026 | 1026 | return "error s : ".$e->getMessage(); |
1027 | 1027 | } |
1028 | 1028 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | //} |
1036 | 1036 | try { |
1037 | 1037 | $sthi = $Connection->db->prepare($queryi); |
1038 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1039 | - } catch(PDOException $e) { |
|
1038 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1039 | + } catch (PDOException $e) { |
|
1040 | 1040 | return "error u : ".$e->getMessage(); |
1041 | 1041 | } |
1042 | 1042 | } else { |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | try { |
1045 | 1045 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1046 | 1046 | $sthsm->execute(array(':mfr' => $data[2])); |
1047 | - } catch(PDOException $e) { |
|
1047 | + } catch (PDOException $e) { |
|
1048 | 1048 | return "error mfr : ".$e->getMessage(); |
1049 | 1049 | } |
1050 | 1050 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1054,8 +1054,8 @@ discard block |
||
1054 | 1054 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1055 | 1055 | try { |
1056 | 1056 | $sthf = $Connection->db->prepare($queryf); |
1057 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
1058 | - } catch(PDOException $e) { |
|
1057 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
1058 | + } catch (PDOException $e) { |
|
1059 | 1059 | return "error f : ".$e->getMessage(); |
1060 | 1060 | } |
1061 | 1061 | } |
@@ -1065,13 +1065,13 @@ discard block |
||
1065 | 1065 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1066 | 1066 | try { |
1067 | 1067 | $sth = $Connection->db->prepare($query); |
1068 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
1069 | - } catch(PDOException $e) { |
|
1068 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
1069 | + } catch (PDOException $e) { |
|
1070 | 1070 | return "error i : ".$e->getMessage(); |
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | } |
1074 | - if ($i % 90 == 0) { |
|
1074 | + if ($i%90 == 0) { |
|
1075 | 1075 | if ($globalTransaction) $Connection->db->commit(); |
1076 | 1076 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1077 | 1077 | } |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | $Connection = new Connection(); |
1091 | 1091 | $sth = $Connection->db->prepare($query); |
1092 | 1092 | $sth->execute(array(':source' => 'website_fam')); |
1093 | - } catch(PDOException $e) { |
|
1093 | + } catch (PDOException $e) { |
|
1094 | 1094 | return "error : ".$e->getMessage(); |
1095 | 1095 | } |
1096 | 1096 | |
@@ -1111,8 +1111,8 @@ discard block |
||
1111 | 1111 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1112 | 1112 | try { |
1113 | 1113 | $sth = $Connection->db->prepare($query); |
1114 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
1115 | - } catch(PDOException $e) { |
|
1114 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
1115 | + } catch (PDOException $e) { |
|
1116 | 1116 | return "error : ".$e->getMessage(); |
1117 | 1117 | } |
1118 | 1118 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | $Connection = new Connection(); |
1132 | 1132 | $sth = $Connection->db->prepare($query); |
1133 | 1133 | $sth->execute(array(':source' => 'website_fam')); |
1134 | - } catch(PDOException $e) { |
|
1134 | + } catch (PDOException $e) { |
|
1135 | 1135 | return "error : ".$e->getMessage(); |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1147,8 +1147,8 @@ discard block |
||
1147 | 1147 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1148 | 1148 | try { |
1149 | 1149 | $sth = $Connection->db->prepare($query); |
1150 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1151 | - } catch(PDOException $e) { |
|
1150 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1151 | + } catch (PDOException $e) { |
|
1152 | 1152 | print_r($data); |
1153 | 1153 | return "error : ".$e->getMessage(); |
1154 | 1154 | } |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | $Connection = new Connection(); |
1169 | 1169 | $sth = $Connection->db->prepare($query); |
1170 | 1170 | $sth->execute(array(':source' => 'website_fam')); |
1171 | - } catch(PDOException $e) { |
|
1171 | + } catch (PDOException $e) { |
|
1172 | 1172 | return "error : ".$e->getMessage(); |
1173 | 1173 | } |
1174 | 1174 | |
@@ -1188,8 +1188,8 @@ discard block |
||
1188 | 1188 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
1189 | 1189 | try { |
1190 | 1190 | $sth = $Connection->db->prepare($query); |
1191 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
1192 | - } catch(PDOException $e) { |
|
1191 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
1192 | + } catch (PDOException $e) { |
|
1193 | 1193 | return "error : ".$e->getMessage(); |
1194 | 1194 | } |
1195 | 1195 | } |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | $Connection = new Connection(); |
1209 | 1209 | $sth = $Connection->db->prepare($query); |
1210 | 1210 | $sth->execute(); |
1211 | - } catch(PDOException $e) { |
|
1211 | + } catch (PDOException $e) { |
|
1212 | 1212 | return "error : ".$e->getMessage(); |
1213 | 1213 | } |
1214 | 1214 | |
@@ -1228,8 +1228,8 @@ discard block |
||
1228 | 1228 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
1229 | 1229 | try { |
1230 | 1230 | $sth = $Connection->db->prepare($query); |
1231 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
1232 | - } catch(PDOException $e) { |
|
1231 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
1232 | + } catch (PDOException $e) { |
|
1233 | 1233 | return "error : ".$e->getMessage(); |
1234 | 1234 | } |
1235 | 1235 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | $Connection = new Connection(); |
1249 | 1249 | $sth = $Connection->db->prepare($query); |
1250 | 1250 | $sth->execute(); |
1251 | - } catch(PDOException $e) { |
|
1251 | + } catch (PDOException $e) { |
|
1252 | 1252 | return "error : ".$e->getMessage(); |
1253 | 1253 | } |
1254 | 1254 | |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | try { |
1265 | 1265 | $sth = $Connection->db->prepare($query); |
1266 | 1266 | $sth->execute(array(':icao' => $icao)); |
1267 | - } catch(PDOException $e) { |
|
1267 | + } catch (PDOException $e) { |
|
1268 | 1268 | return "error : ".$e->getMessage(); |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | return ''; |
1276 | 1276 | } |
1277 | 1277 | |
1278 | - public static function tle($filename,$tletype) { |
|
1278 | + public static function tle($filename, $tletype) { |
|
1279 | 1279 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1280 | 1280 | global $tmp_dir, $globalTransaction; |
1281 | 1281 | //$Spotter = new Spotter(); |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | $Connection = new Connection(); |
1286 | 1286 | $sth = $Connection->db->prepare($query); |
1287 | 1287 | $sth->execute(array(':source' => $filename)); |
1288 | - } catch(PDOException $e) { |
|
1288 | + } catch (PDOException $e) { |
|
1289 | 1289 | return "error : ".$e->getMessage(); |
1290 | 1290 | } |
1291 | 1291 | |
@@ -1310,8 +1310,8 @@ discard block |
||
1310 | 1310 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1311 | 1311 | try { |
1312 | 1312 | $sth = $Connection->db->prepare($query); |
1313 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1314 | - } catch(PDOException $e) { |
|
1313 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1314 | + } catch (PDOException $e) { |
|
1315 | 1315 | return "error : ".$e->getMessage(); |
1316 | 1316 | } |
1317 | 1317 | |
@@ -1331,28 +1331,28 @@ discard block |
||
1331 | 1331 | */ |
1332 | 1332 | private static function table2array($data) { |
1333 | 1333 | $html = str_get_html($data); |
1334 | - $tabledata=array(); |
|
1335 | - foreach($html->find('tr') as $element) |
|
1334 | + $tabledata = array(); |
|
1335 | + foreach ($html->find('tr') as $element) |
|
1336 | 1336 | { |
1337 | 1337 | $td = array(); |
1338 | - foreach( $element->find('th') as $row) |
|
1338 | + foreach ($element->find('th') as $row) |
|
1339 | 1339 | { |
1340 | 1340 | $td [] = trim($row->plaintext); |
1341 | 1341 | } |
1342 | - $td=array_filter($td); |
|
1342 | + $td = array_filter($td); |
|
1343 | 1343 | $tabledata[] = $td; |
1344 | 1344 | |
1345 | 1345 | $td = array(); |
1346 | 1346 | $tdi = array(); |
1347 | - foreach( $element->find('td') as $row) |
|
1347 | + foreach ($element->find('td') as $row) |
|
1348 | 1348 | { |
1349 | 1349 | $td [] = trim($row->plaintext); |
1350 | 1350 | $tdi [] = trim($row->innertext); |
1351 | 1351 | } |
1352 | - $td=array_filter($td); |
|
1353 | - $tdi=array_filter($tdi); |
|
1352 | + $td = array_filter($td); |
|
1353 | + $tdi = array_filter($tdi); |
|
1354 | 1354 | // $tabledata[]=array_merge($td,$tdi); |
1355 | - $tabledata[]=$td; |
|
1355 | + $tabledata[] = $td; |
|
1356 | 1356 | } |
1357 | 1357 | return(array_filter($tabledata)); |
1358 | 1358 | } |
@@ -1425,13 +1425,13 @@ discard block |
||
1425 | 1425 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1426 | 1426 | { |
1427 | 1427 | $i++; |
1428 | - if($i > 3 && count($row) > 2) { |
|
1428 | + if ($i > 3 && count($row) > 2) { |
|
1429 | 1429 | $data = array_values(array_filter($row)); |
1430 | 1430 | $cntdata = count($data); |
1431 | 1431 | if ($cntdata > 10) { |
1432 | 1432 | $value = $data[9]; |
1433 | 1433 | |
1434 | - for ($i =10;$i < $cntdata;$i++) { |
|
1434 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1435 | 1435 | $value .= ' '.$data[$i]; |
1436 | 1436 | } |
1437 | 1437 | $data[9] = $value; |
@@ -1441,8 +1441,8 @@ discard block |
||
1441 | 1441 | $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)'; |
1442 | 1442 | try { |
1443 | 1443 | $sth = $Connection->db->prepare($query); |
1444 | - $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])); |
|
1445 | - } catch(PDOException $e) { |
|
1444 | + $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])); |
|
1445 | + } catch (PDOException $e) { |
|
1446 | 1446 | return "error : ".$e->getMessage(); |
1447 | 1447 | } |
1448 | 1448 | } |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | $Connection = new Connection(); |
1464 | 1464 | $sth = $Connection->db->prepare($query); |
1465 | 1465 | $sth->execute(); |
1466 | - } catch(PDOException $e) { |
|
1466 | + } catch (PDOException $e) { |
|
1467 | 1467 | return "error : ".$e->getMessage(); |
1468 | 1468 | } |
1469 | 1469 | |
@@ -1475,12 +1475,12 @@ discard block |
||
1475 | 1475 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1476 | 1476 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1477 | 1477 | { |
1478 | - if(count($row) > 1) { |
|
1478 | + if (count($row) > 1) { |
|
1479 | 1479 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1480 | 1480 | try { |
1481 | 1481 | $sth = $Connection->db->prepare($query); |
1482 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1483 | - } catch(PDOException $e) { |
|
1482 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1483 | + } catch (PDOException $e) { |
|
1484 | 1484 | return "error : ".$e->getMessage(); |
1485 | 1485 | } |
1486 | 1486 | } |
@@ -1500,21 +1500,21 @@ discard block |
||
1500 | 1500 | try { |
1501 | 1501 | $sth = $Connection->db->prepare($query); |
1502 | 1502 | $sth->execute(); |
1503 | - } catch(PDOException $e) { |
|
1503 | + } catch (PDOException $e) { |
|
1504 | 1504 | return "error : ".$e->getMessage(); |
1505 | 1505 | } |
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | |
1509 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1509 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1510 | 1510 | else { |
1511 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1511 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1512 | 1512 | $query = "CREATE EXTENSION postgis"; |
1513 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1513 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1514 | 1514 | try { |
1515 | 1515 | $sth = $Connection->db->prepare($query); |
1516 | 1516 | $sth->execute(); |
1517 | - } catch(PDOException $e) { |
|
1517 | + } catch (PDOException $e) { |
|
1518 | 1518 | return "error : ".$e->getMessage(); |
1519 | 1519 | } |
1520 | 1520 | } |
@@ -1527,7 +1527,7 @@ discard block |
||
1527 | 1527 | include_once('class.create_db.php'); |
1528 | 1528 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1529 | 1529 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1530 | - update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1530 | + update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1531 | 1531 | $error = ''; |
1532 | 1532 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1533 | 1533 | if ($globalDebug) echo "Gunzip..."; |
@@ -1559,14 +1559,14 @@ discard block |
||
1559 | 1559 | try { |
1560 | 1560 | $sth = $Connection->db->prepare($query); |
1561 | 1561 | $sth->execute(); |
1562 | - } catch(PDOException $e) { |
|
1562 | + } catch (PDOException $e) { |
|
1563 | 1563 | echo "error : ".$e->getMessage(); |
1564 | 1564 | } |
1565 | 1565 | } |
1566 | 1566 | if ($globalDBdriver == 'mysql') { |
1567 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1567 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1568 | 1568 | } else { |
1569 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1569 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1570 | 1570 | } |
1571 | 1571 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1572 | 1572 | return $error; |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1580 | 1580 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1581 | 1581 | // 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'); |
1582 | - 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'); |
|
1582 | + 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'); |
|
1583 | 1583 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1584 | 1584 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1585 | 1585 | return $error; |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1600 | 1600 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
1601 | 1601 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1602 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1602 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1603 | 1603 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
1604 | 1604 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
1605 | 1605 | if ($error != '') { |
@@ -1612,7 +1612,7 @@ discard block |
||
1612 | 1612 | global $tmp_dir, $globalDebug; |
1613 | 1613 | $error = ''; |
1614 | 1614 | if ($globalDebug) echo "Routes : Download..."; |
1615 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
1615 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1616 | 1616 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1617 | 1617 | if ($globalDebug) echo "Gunzip..."; |
1618 | 1618 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | global $tmp_dir, $globalDebug; |
1629 | 1629 | $error = ''; |
1630 | 1630 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
1631 | - update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
1631 | + update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1632 | 1632 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1633 | 1633 | if ($globalDebug) echo "Gunzip..."; |
1634 | 1634 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | global $tmp_dir, $globalDebug; |
1645 | 1645 | $error = ''; |
1646 | 1646 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
1647 | - update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
1647 | + update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1648 | 1648 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1649 | 1649 | if ($globalDebug) echo "Gunzip..."; |
1650 | 1650 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -1672,7 +1672,7 @@ discard block |
||
1672 | 1672 | */ |
1673 | 1673 | if ($globalDebug) echo "Modes : Download..."; |
1674 | 1674 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
1675 | - update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
1675 | + update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
1676 | 1676 | |
1677 | 1677 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
1678 | 1678 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -1692,7 +1692,7 @@ discard block |
||
1692 | 1692 | public static function update_ModeS_faa() { |
1693 | 1693 | global $tmp_dir, $globalDebug; |
1694 | 1694 | if ($globalDebug) echo "Modes FAA: Download..."; |
1695 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
1695 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
1696 | 1696 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
1697 | 1697 | if ($globalDebug) echo "Unzip..."; |
1698 | 1698 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | public static function update_ModeS_flarm() { |
1709 | 1709 | global $tmp_dir, $globalDebug; |
1710 | 1710 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
1711 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
1711 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
1712 | 1712 | if (file_exists($tmp_dir.'data.fln')) { |
1713 | 1713 | if ($globalDebug) echo "Add to DB..."; |
1714 | 1714 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -1722,7 +1722,7 @@ discard block |
||
1722 | 1722 | public static function update_ModeS_ogn() { |
1723 | 1723 | global $tmp_dir, $globalDebug; |
1724 | 1724 | if ($globalDebug) echo "Modes OGN: Download..."; |
1725 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
1725 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
1726 | 1726 | if (file_exists($tmp_dir.'ogn.csv')) { |
1727 | 1727 | if ($globalDebug) echo "Add to DB..."; |
1728 | 1728 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -1737,201 +1737,201 @@ discard block |
||
1737 | 1737 | global $tmp_dir, $globalDebug, $globalMasterSource; |
1738 | 1738 | |
1739 | 1739 | if ($globalDebug) echo "Owner France: Download..."; |
1740 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
1740 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
1741 | 1741 | if (file_exists($tmp_dir.'owner_f.csv')) { |
1742 | 1742 | if ($globalDebug) echo "Add to DB..."; |
1743 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
1743 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
1744 | 1744 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
1745 | 1745 | if ($error != '') { |
1746 | 1746 | return $error; |
1747 | 1747 | } elseif ($globalDebug) echo "Done\n"; |
1748 | 1748 | |
1749 | 1749 | if ($globalDebug) echo "Owner Ireland: Download..."; |
1750 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
1750 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
1751 | 1751 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
1752 | 1752 | if ($globalDebug) echo "Add to DB..."; |
1753 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
1753 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
1754 | 1754 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
1755 | 1755 | if ($error != '') { |
1756 | 1756 | return $error; |
1757 | 1757 | } elseif ($globalDebug) echo "Done\n"; |
1758 | 1758 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
1759 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
1759 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
1760 | 1760 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
1761 | 1761 | if ($globalDebug) echo "Add to DB..."; |
1762 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
1762 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
1763 | 1763 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
1764 | 1764 | if ($error != '') { |
1765 | 1765 | return $error; |
1766 | 1766 | } elseif ($globalDebug) echo "Done\n"; |
1767 | 1767 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
1768 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
1768 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
1769 | 1769 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
1770 | 1770 | if ($globalDebug) echo "Add to DB..."; |
1771 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
1771 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
1772 | 1772 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
1773 | 1773 | if ($error != '') { |
1774 | 1774 | return $error; |
1775 | 1775 | } elseif ($globalDebug) echo "Done\n"; |
1776 | 1776 | if ($globalDebug) echo "Owner Australia: Download..."; |
1777 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
1777 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
1778 | 1778 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
1779 | 1779 | if ($globalDebug) echo "Add to DB..."; |
1780 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
1780 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
1781 | 1781 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
1782 | 1782 | if ($error != '') { |
1783 | 1783 | return $error; |
1784 | 1784 | } elseif ($globalDebug) echo "Done\n"; |
1785 | 1785 | if ($globalDebug) echo "Owner Austria: Download..."; |
1786 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
1786 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
1787 | 1787 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
1788 | 1788 | if ($globalDebug) echo "Add to DB..."; |
1789 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
1789 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
1790 | 1790 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
1791 | 1791 | if ($error != '') { |
1792 | 1792 | return $error; |
1793 | 1793 | } elseif ($globalDebug) echo "Done\n"; |
1794 | 1794 | if ($globalDebug) echo "Owner Chile: Download..."; |
1795 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
1795 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
1796 | 1796 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
1797 | 1797 | if ($globalDebug) echo "Add to DB..."; |
1798 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
1798 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
1799 | 1799 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
1800 | 1800 | if ($error != '') { |
1801 | 1801 | return $error; |
1802 | 1802 | } elseif ($globalDebug) echo "Done\n"; |
1803 | 1803 | if ($globalDebug) echo "Owner Colombia: Download..."; |
1804 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
1804 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
1805 | 1805 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
1806 | 1806 | if ($globalDebug) echo "Add to DB..."; |
1807 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
1807 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
1808 | 1808 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
1809 | 1809 | if ($error != '') { |
1810 | 1810 | return $error; |
1811 | 1811 | } elseif ($globalDebug) echo "Done\n"; |
1812 | 1812 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
1813 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
1813 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
1814 | 1814 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
1815 | 1815 | if ($globalDebug) echo "Add to DB..."; |
1816 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
1816 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
1817 | 1817 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
1818 | 1818 | if ($error != '') { |
1819 | 1819 | return $error; |
1820 | 1820 | } elseif ($globalDebug) echo "Done\n"; |
1821 | 1821 | if ($globalDebug) echo "Owner Brazil: Download..."; |
1822 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
1822 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
1823 | 1823 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
1824 | 1824 | if ($globalDebug) echo "Add to DB..."; |
1825 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
1825 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
1826 | 1826 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
1827 | 1827 | if ($error != '') { |
1828 | 1828 | return $error; |
1829 | 1829 | } elseif ($globalDebug) echo "Done\n"; |
1830 | 1830 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
1831 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
1831 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
1832 | 1832 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
1833 | 1833 | if ($globalDebug) echo "Add to DB..."; |
1834 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
1834 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
1835 | 1835 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
1836 | 1836 | if ($error != '') { |
1837 | 1837 | return $error; |
1838 | 1838 | } elseif ($globalDebug) echo "Done\n"; |
1839 | 1839 | if ($globalDebug) echo "Owner Croatia: Download..."; |
1840 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
1840 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
1841 | 1841 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
1842 | 1842 | if ($globalDebug) echo "Add to DB..."; |
1843 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
1843 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
1844 | 1844 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
1845 | 1845 | if ($error != '') { |
1846 | 1846 | return $error; |
1847 | 1847 | } elseif ($globalDebug) echo "Done\n"; |
1848 | 1848 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
1849 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
1849 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
1850 | 1850 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
1851 | 1851 | if ($globalDebug) echo "Add to DB..."; |
1852 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
1852 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
1853 | 1853 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
1854 | 1854 | if ($error != '') { |
1855 | 1855 | return $error; |
1856 | 1856 | } elseif ($globalDebug) echo "Done\n"; |
1857 | 1857 | if ($globalDebug) echo "Owner Maldives: Download..."; |
1858 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
1858 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
1859 | 1859 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
1860 | 1860 | if ($globalDebug) echo "Add to DB..."; |
1861 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
1861 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
1862 | 1862 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
1863 | 1863 | if ($error != '') { |
1864 | 1864 | return $error; |
1865 | 1865 | } elseif ($globalDebug) echo "Done\n"; |
1866 | 1866 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
1867 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
1867 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
1868 | 1868 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
1869 | 1869 | if ($globalDebug) echo "Add to DB..."; |
1870 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
1870 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
1871 | 1871 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
1872 | 1872 | if ($error != '') { |
1873 | 1873 | return $error; |
1874 | 1874 | } elseif ($globalDebug) echo "Done\n"; |
1875 | 1875 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
1876 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
1876 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
1877 | 1877 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
1878 | 1878 | if ($globalDebug) echo "Add to DB..."; |
1879 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
1879 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
1880 | 1880 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
1881 | 1881 | if ($error != '') { |
1882 | 1882 | return $error; |
1883 | 1883 | } elseif ($globalDebug) echo "Done\n"; |
1884 | 1884 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
1885 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
1885 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
1886 | 1886 | if (file_exists($tmp_dir.'owner_om.csv')) { |
1887 | 1887 | if ($globalDebug) echo "Add to DB..."; |
1888 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
1888 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
1889 | 1889 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
1890 | 1890 | if ($error != '') { |
1891 | 1891 | return $error; |
1892 | 1892 | } elseif ($globalDebug) echo "Done\n"; |
1893 | 1893 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
1894 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
1894 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
1895 | 1895 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
1896 | 1896 | if ($globalDebug) echo "Add to DB..."; |
1897 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
1897 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
1898 | 1898 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
1899 | 1899 | if ($error != '') { |
1900 | 1900 | return $error; |
1901 | 1901 | } elseif ($globalDebug) echo "Done\n"; |
1902 | 1902 | if ($globalDebug) echo "Owner Iceland: Download..."; |
1903 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
1903 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
1904 | 1904 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
1905 | 1905 | if ($globalDebug) echo "Add to DB..."; |
1906 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
1906 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
1907 | 1907 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
1908 | 1908 | if ($error != '') { |
1909 | 1909 | return $error; |
1910 | 1910 | } elseif ($globalDebug) echo "Done\n"; |
1911 | 1911 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
1912 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
1912 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
1913 | 1913 | if (file_exists($tmp_dir.'owner_m.csv')) { |
1914 | 1914 | if ($globalDebug) echo "Add to DB..."; |
1915 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
1915 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
1916 | 1916 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
1917 | 1917 | if ($error != '') { |
1918 | 1918 | return $error; |
1919 | 1919 | } elseif ($globalDebug) echo "Done\n"; |
1920 | 1920 | if ($globalMasterSource) { |
1921 | 1921 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
1922 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
1922 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
1923 | 1923 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
1924 | 1924 | if ($globalDebug) echo "Add to DB..."; |
1925 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
1925 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
1926 | 1926 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
1927 | 1927 | if ($error != '') { |
1928 | 1928 | return $error; |
1929 | 1929 | } elseif ($globalDebug) echo "Done\n"; |
1930 | 1930 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
1931 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
1931 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
1932 | 1932 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
1933 | 1933 | if ($globalDebug) echo "Add to DB..."; |
1934 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
1934 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
1935 | 1935 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
1936 | 1936 | if ($error != '') { |
1937 | 1937 | return $error; |
@@ -1944,7 +1944,7 @@ discard block |
||
1944 | 1944 | global $tmp_dir, $globalDebug; |
1945 | 1945 | $error = ''; |
1946 | 1946 | if ($globalDebug) echo "Translation : Download..."; |
1947 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
1947 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
1948 | 1948 | if (file_exists($tmp_dir.'translation.zip')) { |
1949 | 1949 | if ($globalDebug) echo "Unzip..."; |
1950 | 1950 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -1960,7 +1960,7 @@ discard block |
||
1960 | 1960 | public static function update_translation_fam() { |
1961 | 1961 | global $tmp_dir, $globalDebug; |
1962 | 1962 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
1963 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
1963 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
1964 | 1964 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
1965 | 1965 | if ($globalDebug) echo "Gunzip..."; |
1966 | 1966 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -1975,7 +1975,7 @@ discard block |
||
1975 | 1975 | public static function update_ModeS_fam() { |
1976 | 1976 | global $tmp_dir, $globalDebug; |
1977 | 1977 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
1978 | - update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
1978 | + update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
1979 | 1979 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
1980 | 1980 | if ($globalDebug) echo "Gunzip..."; |
1981 | 1981 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -1991,9 +1991,9 @@ discard block |
||
1991 | 1991 | global $tmp_dir, $globalDebug, $globalOwner; |
1992 | 1992 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
1993 | 1993 | if ($globalOwner === TRUE) { |
1994 | - update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1994 | + update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1995 | 1995 | } else { |
1996 | - update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1996 | + update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1997 | 1997 | } |
1998 | 1998 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
1999 | 1999 | if ($globalDebug) echo "Gunzip..."; |
@@ -2009,7 +2009,7 @@ discard block |
||
2009 | 2009 | public static function update_routes_fam() { |
2010 | 2010 | global $tmp_dir, $globalDebug; |
2011 | 2011 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2012 | - update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2012 | + update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2013 | 2013 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2014 | 2014 | if ($globalDebug) echo "Gunzip..."; |
2015 | 2015 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -2023,13 +2023,13 @@ discard block |
||
2023 | 2023 | } |
2024 | 2024 | public static function update_marine_identity_fam() { |
2025 | 2025 | global $tmp_dir, $globalDebug; |
2026 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2026 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2027 | 2027 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2028 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2028 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2029 | 2029 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2030 | 2030 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2031 | 2031 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2032 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2032 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2033 | 2033 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2034 | 2034 | if ($globalDebug) echo "Gunzip..."; |
2035 | 2035 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
@@ -2049,7 +2049,7 @@ discard block |
||
2049 | 2049 | public static function update_banned_fam() { |
2050 | 2050 | global $tmp_dir, $globalDebug; |
2051 | 2051 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2052 | - update_db::download('http://data.flightairmap.fr/data/ban_eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2052 | + update_db::download('http://data.flightairmap.fr/data/ban_eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2053 | 2053 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2054 | 2054 | //if ($globalDebug) echo "Gunzip..."; |
2055 | 2055 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2068,18 +2068,18 @@ discard block |
||
2068 | 2068 | $error = ''; |
2069 | 2069 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2070 | 2070 | if ($globalDBdriver == 'mysql') { |
2071 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2071 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2072 | 2072 | } else { |
2073 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2073 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2074 | 2074 | } |
2075 | 2075 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2076 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2076 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2077 | 2077 | $airspace_md5 = $airspace_md5_file[0]; |
2078 | 2078 | if (!update_db::check_airspace_version($airspace_md5)) { |
2079 | 2079 | if ($globalDBdriver == 'mysql') { |
2080 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2080 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2081 | 2081 | } else { |
2082 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2082 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2083 | 2083 | } |
2084 | 2084 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2085 | 2085 | if ($globalDebug) echo "Gunzip..."; |
@@ -2091,7 +2091,7 @@ discard block |
||
2091 | 2091 | try { |
2092 | 2092 | $sth = $Connection->db->prepare($query); |
2093 | 2093 | $sth->execute(); |
2094 | - } catch(PDOException $e) { |
|
2094 | + } catch (PDOException $e) { |
|
2095 | 2095 | return "error : ".$e->getMessage(); |
2096 | 2096 | } |
2097 | 2097 | } |
@@ -2109,15 +2109,15 @@ discard block |
||
2109 | 2109 | public static function update_tle() { |
2110 | 2110 | global $tmp_dir, $globalDebug; |
2111 | 2111 | if ($globalDebug) echo "Download TLE : Download..."; |
2112 | - $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', |
|
2113 | - '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', |
|
2114 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
2112 | + $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', |
|
2113 | + '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', |
|
2114 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
2115 | 2115 | foreach ($alltle as $filename) { |
2116 | 2116 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2117 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2117 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2118 | 2118 | if (file_exists($tmp_dir.$filename)) { |
2119 | 2119 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2120 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2120 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2121 | 2121 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2122 | 2122 | if ($error != '') { |
2123 | 2123 | echo $error."\n"; |
@@ -2130,32 +2130,32 @@ discard block |
||
2130 | 2130 | global $tmp_dir, $globalDebug; |
2131 | 2131 | $error = ''; |
2132 | 2132 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
2133 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2133 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2134 | 2134 | if (file_exists($tmp_dir.'models.md5sum')) { |
2135 | 2135 | if ($globalDebug) echo "Check files...\n"; |
2136 | 2136 | $newmodelsdb = array(); |
2137 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2138 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2137 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2138 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2139 | 2139 | $model = trim($row[2]); |
2140 | 2140 | $newmodelsdb[$model] = trim($row[0]); |
2141 | 2141 | } |
2142 | 2142 | } |
2143 | 2143 | $modelsdb = array(); |
2144 | 2144 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2145 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2146 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2145 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2146 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2147 | 2147 | $model = trim($row[2]); |
2148 | 2148 | $modelsdb[$model] = trim($row[0]); |
2149 | 2149 | } |
2150 | 2150 | } |
2151 | 2151 | } |
2152 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2152 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2153 | 2153 | foreach ($diff as $key => $value) { |
2154 | 2154 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2155 | - update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2155 | + update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2156 | 2156 | |
2157 | 2157 | } |
2158 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2158 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2159 | 2159 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2160 | 2160 | if ($error != '') { |
2161 | 2161 | return $error; |
@@ -2167,32 +2167,32 @@ discard block |
||
2167 | 2167 | global $tmp_dir, $globalDebug; |
2168 | 2168 | $error = ''; |
2169 | 2169 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2170 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2170 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2171 | 2171 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2172 | 2172 | if ($globalDebug) echo "Check files...\n"; |
2173 | 2173 | $newmodelsdb = array(); |
2174 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2175 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2174 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2175 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2176 | 2176 | $model = trim($row[2]); |
2177 | 2177 | $newmodelsdb[$model] = trim($row[0]); |
2178 | 2178 | } |
2179 | 2179 | } |
2180 | 2180 | $modelsdb = array(); |
2181 | 2181 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2182 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2183 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2182 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2183 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2184 | 2184 | $model = trim($row[2]); |
2185 | 2185 | $modelsdb[$model] = trim($row[0]); |
2186 | 2186 | } |
2187 | 2187 | } |
2188 | 2188 | } |
2189 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2189 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2190 | 2190 | foreach ($diff as $key => $value) { |
2191 | 2191 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2192 | - update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2192 | + update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2193 | 2193 | |
2194 | 2194 | } |
2195 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2195 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2196 | 2196 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2197 | 2197 | if ($error != '') { |
2198 | 2198 | return $error; |
@@ -2204,32 +2204,32 @@ discard block |
||
2204 | 2204 | global $tmp_dir, $globalDebug; |
2205 | 2205 | $error = ''; |
2206 | 2206 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2207 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2207 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2208 | 2208 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2209 | 2209 | if ($globalDebug) echo "Check files...\n"; |
2210 | 2210 | $newmodelsdb = array(); |
2211 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2212 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2211 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2212 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2213 | 2213 | $model = trim($row[2]); |
2214 | 2214 | $newmodelsdb[$model] = trim($row[0]); |
2215 | 2215 | } |
2216 | 2216 | } |
2217 | 2217 | $modelsdb = array(); |
2218 | 2218 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2219 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2220 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2219 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2220 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2221 | 2221 | $model = trim($row[2]); |
2222 | 2222 | $modelsdb[$model] = trim($row[0]); |
2223 | 2223 | } |
2224 | 2224 | } |
2225 | 2225 | } |
2226 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2226 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2227 | 2227 | foreach ($diff as $key => $value) { |
2228 | 2228 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
2229 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2229 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2230 | 2230 | |
2231 | 2231 | } |
2232 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2232 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2233 | 2233 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2234 | 2234 | if ($error != '') { |
2235 | 2235 | return $error; |
@@ -2252,8 +2252,8 @@ discard block |
||
2252 | 2252 | */ |
2253 | 2253 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2254 | 2254 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
2255 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2256 | - $result = fread($fh,100000000); |
|
2255 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
2256 | + $result = fread($fh, 100000000); |
|
2257 | 2257 | //echo $result; |
2258 | 2258 | //var_dump(str_get_html($result)); |
2259 | 2259 | //print_r(self::table2array($result)); |
@@ -2271,23 +2271,23 @@ discard block |
||
2271 | 2271 | $Connection = new Connection(); |
2272 | 2272 | $sth = $Connection->db->prepare($query); |
2273 | 2273 | $sth->execute(); |
2274 | - } catch(PDOException $e) { |
|
2274 | + } catch (PDOException $e) { |
|
2275 | 2275 | return "error : ".$e->getMessage(); |
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | $error = ''; |
2279 | 2279 | if ($globalDebug) echo "Notam : Download..."; |
2280 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
2280 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2281 | 2281 | if (file_exists($tmp_dir.'notam.rss')) { |
2282 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
2282 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2283 | 2283 | foreach ($notams['channel']['item'] as $notam) { |
2284 | - $title = explode(':',$notam['title']); |
|
2284 | + $title = explode(':', $notam['title']); |
|
2285 | 2285 | $data['ref'] = trim($title[0]); |
2286 | 2286 | unset($title[0]); |
2287 | - $data['title'] = trim(implode(':',$title)); |
|
2288 | - $description = strip_tags($notam['description'],'<pre>'); |
|
2289 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
2290 | - $q = explode('/',$match[1]); |
|
2287 | + $data['title'] = trim(implode(':', $title)); |
|
2288 | + $description = strip_tags($notam['description'], '<pre>'); |
|
2289 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
2290 | + $q = explode('/', $match[1]); |
|
2291 | 2291 | $data['fir'] = $q[0]; |
2292 | 2292 | $data['code'] = $q[1]; |
2293 | 2293 | $ifrvfr = $q[2]; |
@@ -2303,30 +2303,30 @@ discard block |
||
2303 | 2303 | $data['lower_limit'] = $q[5]; |
2304 | 2304 | $data['upper_limit'] = $q[6]; |
2305 | 2305 | $latlonrad = $q[7]; |
2306 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2307 | - $latitude = $Common->convertDec($las,'latitude'); |
|
2308 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
2306 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
2307 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
2308 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
2309 | 2309 | if ($lac == 'S') $latitude = '-'.$latitude; |
2310 | 2310 | if ($lnc == 'W') $longitude = '-'.$longitude; |
2311 | 2311 | $data['center_latitude'] = $latitude; |
2312 | 2312 | $data['center_longitude'] = $longitude; |
2313 | 2313 | $data['radius'] = intval($radius); |
2314 | 2314 | |
2315 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
2315 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2316 | 2316 | $data['text'] = $match[1]; |
2317 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
2317 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
2318 | 2318 | $fromto = $match[1]; |
2319 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
2319 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2320 | 2320 | $fromall = trim($match[1]); |
2321 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
2321 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2322 | 2322 | $from = trim($match[1]); |
2323 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2324 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
2323 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
2324 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2325 | 2325 | $toall = trim($match[1]); |
2326 | - if (!preg_match(':Permanent:',$toall)) { |
|
2327 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
2326 | + if (!preg_match(':Permanent:', $toall)) { |
|
2327 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2328 | 2328 | $to = trim($match[1]); |
2329 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
2329 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2330 | 2330 | $data['permanent'] = 0; |
2331 | 2331 | } else { |
2332 | 2332 | $data['date_end'] = NULL; |
@@ -2334,7 +2334,7 @@ discard block |
||
2334 | 2334 | } |
2335 | 2335 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2336 | 2336 | $NOTAM = new NOTAM(); |
2337 | - $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']); |
|
2337 | + $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']); |
|
2338 | 2338 | unset($data); |
2339 | 2339 | } |
2340 | 2340 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2357,16 +2357,16 @@ discard block |
||
2357 | 2357 | $Connection = new Connection(); |
2358 | 2358 | $sth = $Connection->db->prepare($query); |
2359 | 2359 | $sth->execute(); |
2360 | - } catch(PDOException $e) { |
|
2360 | + } catch (PDOException $e) { |
|
2361 | 2361 | return "error : ".$e->getMessage(); |
2362 | 2362 | } |
2363 | 2363 | } |
2364 | 2364 | $Common = new Common(); |
2365 | 2365 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2366 | - $airspace_json = json_decode($airspace_lst,true); |
|
2366 | + $airspace_json = json_decode($airspace_lst, true); |
|
2367 | 2367 | foreach ($airspace_json['records'] as $airspace) { |
2368 | 2368 | if ($globalDebug) echo $airspace['name']."...\n"; |
2369 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
2369 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2370 | 2370 | if (file_exists($tmp_dir.$airspace['name'])) { |
2371 | 2371 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
2372 | 2372 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2388,7 +2388,7 @@ discard block |
||
2388 | 2388 | $Connection = new Connection(); |
2389 | 2389 | $sth = $Connection->db->prepare($query); |
2390 | 2390 | $sth->execute(array(':new' => $new, ':old' => $old)); |
2391 | - } catch(PDOException $e) { |
|
2391 | + } catch (PDOException $e) { |
|
2392 | 2392 | return "error : ".$e->getMessage(); |
2393 | 2393 | } |
2394 | 2394 | } |
@@ -2405,7 +2405,7 @@ discard block |
||
2405 | 2405 | $Connection = new Connection(); |
2406 | 2406 | $sth = $Connection->db->prepare($query); |
2407 | 2407 | $sth->execute(); |
2408 | - } catch(PDOException $e) { |
|
2408 | + } catch (PDOException $e) { |
|
2409 | 2409 | return "error : ".$e->getMessage(); |
2410 | 2410 | } |
2411 | 2411 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2420,7 +2420,7 @@ discard block |
||
2420 | 2420 | $Connection = new Connection(); |
2421 | 2421 | $sth = $Connection->db->prepare($query); |
2422 | 2422 | $sth->execute(); |
2423 | - } catch(PDOException $e) { |
|
2423 | + } catch (PDOException $e) { |
|
2424 | 2424 | return "error : ".$e->getMessage(); |
2425 | 2425 | } |
2426 | 2426 | } |
@@ -2431,7 +2431,7 @@ discard block |
||
2431 | 2431 | $Connection = new Connection(); |
2432 | 2432 | $sth = $Connection->db->prepare($query); |
2433 | 2433 | $sth->execute(array(':version' => $version)); |
2434 | - } catch(PDOException $e) { |
|
2434 | + } catch (PDOException $e) { |
|
2435 | 2435 | return "error : ".$e->getMessage(); |
2436 | 2436 | } |
2437 | 2437 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2445,7 +2445,7 @@ discard block |
||
2445 | 2445 | $Connection = new Connection(); |
2446 | 2446 | $sth = $Connection->db->prepare($query); |
2447 | 2447 | $sth->execute(array(':version' => $version)); |
2448 | - } catch(PDOException $e) { |
|
2448 | + } catch (PDOException $e) { |
|
2449 | 2449 | return "error : ".$e->getMessage(); |
2450 | 2450 | } |
2451 | 2451 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2461,7 +2461,7 @@ discard block |
||
2461 | 2461 | $Connection = new Connection(); |
2462 | 2462 | $sth = $Connection->db->prepare($query); |
2463 | 2463 | $sth->execute(array(':version' => $version)); |
2464 | - } catch(PDOException $e) { |
|
2464 | + } catch (PDOException $e) { |
|
2465 | 2465 | return "error : ".$e->getMessage(); |
2466 | 2466 | } |
2467 | 2467 | } |
@@ -2473,7 +2473,7 @@ discard block |
||
2473 | 2473 | $Connection = new Connection(); |
2474 | 2474 | $sth = $Connection->db->prepare($query); |
2475 | 2475 | $sth->execute(array(':version' => $version)); |
2476 | - } catch(PDOException $e) { |
|
2476 | + } catch (PDOException $e) { |
|
2477 | 2477 | return "error : ".$e->getMessage(); |
2478 | 2478 | } |
2479 | 2479 | } |
@@ -2489,7 +2489,7 @@ discard block |
||
2489 | 2489 | $Connection = new Connection(); |
2490 | 2490 | $sth = $Connection->db->prepare($query); |
2491 | 2491 | $sth->execute(); |
2492 | - } catch(PDOException $e) { |
|
2492 | + } catch (PDOException $e) { |
|
2493 | 2493 | return "error : ".$e->getMessage(); |
2494 | 2494 | } |
2495 | 2495 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2504,7 +2504,7 @@ discard block |
||
2504 | 2504 | $Connection = new Connection(); |
2505 | 2505 | $sth = $Connection->db->prepare($query); |
2506 | 2506 | $sth->execute(); |
2507 | - } catch(PDOException $e) { |
|
2507 | + } catch (PDOException $e) { |
|
2508 | 2508 | return "error : ".$e->getMessage(); |
2509 | 2509 | } |
2510 | 2510 | } |
@@ -2519,7 +2519,7 @@ discard block |
||
2519 | 2519 | $Connection = new Connection(); |
2520 | 2520 | $sth = $Connection->db->prepare($query); |
2521 | 2521 | $sth->execute(); |
2522 | - } catch(PDOException $e) { |
|
2522 | + } catch (PDOException $e) { |
|
2523 | 2523 | return "error : ".$e->getMessage(); |
2524 | 2524 | } |
2525 | 2525 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2534,7 +2534,7 @@ discard block |
||
2534 | 2534 | $Connection = new Connection(); |
2535 | 2535 | $sth = $Connection->db->prepare($query); |
2536 | 2536 | $sth->execute(); |
2537 | - } catch(PDOException $e) { |
|
2537 | + } catch (PDOException $e) { |
|
2538 | 2538 | return "error : ".$e->getMessage(); |
2539 | 2539 | } |
2540 | 2540 | } |
@@ -2550,7 +2550,7 @@ discard block |
||
2550 | 2550 | $Connection = new Connection(); |
2551 | 2551 | $sth = $Connection->db->prepare($query); |
2552 | 2552 | $sth->execute(); |
2553 | - } catch(PDOException $e) { |
|
2553 | + } catch (PDOException $e) { |
|
2554 | 2554 | return "error : ".$e->getMessage(); |
2555 | 2555 | } |
2556 | 2556 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2565,7 +2565,7 @@ discard block |
||
2565 | 2565 | $Connection = new Connection(); |
2566 | 2566 | $sth = $Connection->db->prepare($query); |
2567 | 2567 | $sth->execute(); |
2568 | - } catch(PDOException $e) { |
|
2568 | + } catch (PDOException $e) { |
|
2569 | 2569 | return "error : ".$e->getMessage(); |
2570 | 2570 | } |
2571 | 2571 | } |
@@ -2580,7 +2580,7 @@ discard block |
||
2580 | 2580 | $Connection = new Connection(); |
2581 | 2581 | $sth = $Connection->db->prepare($query); |
2582 | 2582 | $sth->execute(); |
2583 | - } catch(PDOException $e) { |
|
2583 | + } catch (PDOException $e) { |
|
2584 | 2584 | return "error : ".$e->getMessage(); |
2585 | 2585 | } |
2586 | 2586 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2595,7 +2595,7 @@ discard block |
||
2595 | 2595 | $Connection = new Connection(); |
2596 | 2596 | $sth = $Connection->db->prepare($query); |
2597 | 2597 | $sth->execute(); |
2598 | - } catch(PDOException $e) { |
|
2598 | + } catch (PDOException $e) { |
|
2599 | 2599 | return "error : ".$e->getMessage(); |
2600 | 2600 | } |
2601 | 2601 | } |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | $Connection = new Connection(); |
2611 | 2611 | $sth = $Connection->db->prepare($query); |
2612 | 2612 | $sth->execute(); |
2613 | - } catch(PDOException $e) { |
|
2613 | + } catch (PDOException $e) { |
|
2614 | 2614 | return "error : ".$e->getMessage(); |
2615 | 2615 | } |
2616 | 2616 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2625,7 +2625,7 @@ discard block |
||
2625 | 2625 | $Connection = new Connection(); |
2626 | 2626 | $sth = $Connection->db->prepare($query); |
2627 | 2627 | $sth->execute(); |
2628 | - } catch(PDOException $e) { |
|
2628 | + } catch (PDOException $e) { |
|
2629 | 2629 | return "error : ".$e->getMessage(); |
2630 | 2630 | } |
2631 | 2631 | } |
@@ -2640,7 +2640,7 @@ discard block |
||
2640 | 2640 | $Connection = new Connection(); |
2641 | 2641 | $sth = $Connection->db->prepare($query); |
2642 | 2642 | $sth->execute(); |
2643 | - } catch(PDOException $e) { |
|
2643 | + } catch (PDOException $e) { |
|
2644 | 2644 | return "error : ".$e->getMessage(); |
2645 | 2645 | } |
2646 | 2646 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2655,7 +2655,7 @@ discard block |
||
2655 | 2655 | $Connection = new Connection(); |
2656 | 2656 | $sth = $Connection->db->prepare($query); |
2657 | 2657 | $sth->execute(); |
2658 | - } catch(PDOException $e) { |
|
2658 | + } catch (PDOException $e) { |
|
2659 | 2659 | return "error : ".$e->getMessage(); |
2660 | 2660 | } |
2661 | 2661 | } |
@@ -2670,7 +2670,7 @@ discard block |
||
2670 | 2670 | $Connection = new Connection(); |
2671 | 2671 | $sth = $Connection->db->prepare($query); |
2672 | 2672 | $sth->execute(); |
2673 | - } catch(PDOException $e) { |
|
2673 | + } catch (PDOException $e) { |
|
2674 | 2674 | return "error : ".$e->getMessage(); |
2675 | 2675 | } |
2676 | 2676 | } |
@@ -2685,7 +2685,7 @@ discard block |
||
2685 | 2685 | $Connection = new Connection(); |
2686 | 2686 | $sth = $Connection->db->prepare($query); |
2687 | 2687 | $sth->execute(); |
2688 | - } catch(PDOException $e) { |
|
2688 | + } catch (PDOException $e) { |
|
2689 | 2689 | return "error : ".$e->getMessage(); |
2690 | 2690 | } |
2691 | 2691 | } |
@@ -13,62 +13,62 @@ discard block |
||
13 | 13 | * @param Array $filter the filter |
14 | 14 | * @return Array the SQL part |
15 | 15 | */ |
16 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
16 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
18 | 18 | $filters = array(); |
19 | 19 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
20 | 20 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
21 | 21 | $filters = $globalStatsFilters[$globalFilterName]; |
22 | 22 | } else { |
23 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
23 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | if (isset($filter[0]['source'])) { |
27 | - $filters = array_merge($filters,$filter); |
|
27 | + $filters = array_merge($filters, $filter); |
|
28 | 28 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
29 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
30 | 30 | $filter_query_join = ''; |
31 | 31 | $filter_query_where = ''; |
32 | - foreach($filters as $flt) { |
|
32 | + foreach ($filters as $flt) { |
|
33 | 33 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
34 | 34 | if ($flt['airlines'][0] != '') { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
43 | 43 | if (isset($flt['source'])) { |
44 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
44 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | 45 | } else { |
46 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
50 | 50 | if (isset($flt['source'])) { |
51 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
51 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | 52 | } else { |
53 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
57 | 57 | if (isset($flt['source'])) { |
58 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
58 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | 59 | } else { |
60 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
64 | 64 | if (isset($flt['source'])) { |
65 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
65 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
69 | 69 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
70 | 70 | if ($filter['airlines'][0] != '') { |
71 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
71 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
82 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
83 | 83 | } |
84 | 84 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
85 | 85 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
86 | 86 | } |
87 | 87 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
88 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
88 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
89 | 89 | } |
90 | 90 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
91 | 91 | $filter_query_date = ''; |
@@ -111,41 +111,41 @@ discard block |
||
111 | 111 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
112 | 112 | } |
113 | 113 | } |
114 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
114 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
115 | 115 | } |
116 | 116 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
117 | 117 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
118 | 118 | if ($filter_query_where != '') { |
119 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
119 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
120 | 120 | } |
121 | 121 | $filter_query = $filter_query_join.$filter_query_where; |
122 | 122 | return $filter_query; |
123 | 123 | } |
124 | 124 | |
125 | 125 | // Spotter_archive |
126 | - public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
126 | + public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
127 | 127 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
128 | 128 | if ($over_country == '') { |
129 | 129 | $Spotter = new Spotter($this->db); |
130 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
130 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
131 | 131 | if (!empty($data_country)) $country = $data_country['iso2']; |
132 | 132 | else $country = ''; |
133 | 133 | } else $country = $over_country; |
134 | - if ($airline_type === NULL) $airline_type =''; |
|
134 | + if ($airline_type === NULL) $airline_type = ''; |
|
135 | 135 | |
136 | 136 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
137 | 137 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
138 | 138 | |
139 | 139 | // Route is not added in spotter_archive |
140 | - $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name) |
|
140 | + $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name) |
|
141 | 141 | VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name)"; |
142 | 142 | |
143 | - $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name); |
|
143 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name); |
|
144 | 144 | try { |
145 | 145 | $sth = $this->db->prepare($query); |
146 | 146 | $sth->execute($query_values); |
147 | 147 | $sth->closeCursor(); |
148 | - } catch(PDOException $e) { |
|
148 | + } catch (PDOException $e) { |
|
149 | 149 | return "error : ".$e->getMessage(); |
150 | 150 | } |
151 | 151 | return "success"; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
167 | 167 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
168 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
168 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
169 | 169 | |
170 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
170 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
171 | 171 | |
172 | 172 | return $spotter_array; |
173 | 173 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
187 | 187 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
188 | 188 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
189 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
189 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
190 | 190 | |
191 | 191 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
192 | 192 | /* |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
201 | 201 | */ |
202 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
202 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
203 | 203 | |
204 | 204 | return $spotter_array; |
205 | 205 | } |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | { |
215 | 215 | date_default_timezone_set('UTC'); |
216 | 216 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
217 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
217 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
218 | 218 | |
219 | 219 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
220 | 220 | |
221 | 221 | try { |
222 | 222 | $sth = $this->db->prepare($query); |
223 | 223 | $sth->execute(array(':id' => $id)); |
224 | - } catch(PDOException $e) { |
|
224 | + } catch (PDOException $e) { |
|
225 | 225 | echo $e->getMessage(); |
226 | 226 | die; |
227 | 227 | } |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | { |
241 | 241 | date_default_timezone_set('UTC'); |
242 | 242 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
243 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
243 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
244 | 244 | |
245 | 245 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
246 | 246 | |
247 | 247 | try { |
248 | 248 | $sth = $this->db->prepare($query); |
249 | 249 | $sth->execute(array(':id' => $id)); |
250 | - } catch(PDOException $e) { |
|
250 | + } catch (PDOException $e) { |
|
251 | 251 | echo $e->getMessage(); |
252 | 252 | die; |
253 | 253 | } |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | date_default_timezone_set('UTC'); |
270 | 270 | |
271 | 271 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
272 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
272 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
273 | 273 | |
274 | 274 | try { |
275 | 275 | $sth = $this->db->prepare($query); |
276 | 276 | $sth->execute(array(':ident' => $ident)); |
277 | - } catch(PDOException $e) { |
|
277 | + } catch (PDOException $e) { |
|
278 | 278 | echo $e->getMessage(); |
279 | 279 | die; |
280 | 280 | } |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | date_default_timezone_set('UTC'); |
296 | 296 | |
297 | 297 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
298 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
298 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
299 | 299 | |
300 | 300 | try { |
301 | 301 | $sth = $this->db->prepare($query); |
302 | 302 | $sth->execute(array(':id' => $id)); |
303 | - } catch(PDOException $e) { |
|
303 | + } catch (PDOException $e) { |
|
304 | 304 | echo $e->getMessage(); |
305 | 305 | die; |
306 | 306 | } |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | date_default_timezone_set('UTC'); |
322 | 322 | |
323 | 323 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
324 | - $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
324 | + $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
325 | 325 | |
326 | 326 | try { |
327 | 327 | $sth = $this->db->prepare($query); |
328 | 328 | $sth->execute(array(':id' => $id)); |
329 | - } catch(PDOException $e) { |
|
329 | + } catch (PDOException $e) { |
|
330 | 330 | echo $e->getMessage(); |
331 | 331 | die; |
332 | 332 | } |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | date_default_timezone_set('UTC'); |
349 | 349 | |
350 | 350 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
351 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
351 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
352 | 352 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
353 | 353 | |
354 | 354 | try { |
355 | 355 | $sth = $this->db->prepare($query); |
356 | 356 | $sth->execute(array(':ident' => $ident)); |
357 | - } catch(PDOException $e) { |
|
357 | + } catch (PDOException $e) { |
|
358 | 358 | echo $e->getMessage(); |
359 | 359 | die; |
360 | 360 | } |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | * @return Array the spotter information |
372 | 372 | * |
373 | 373 | */ |
374 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
374 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) |
|
375 | 375 | { |
376 | 376 | $Spotter = new Spotter($this->db); |
377 | 377 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
378 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
378 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
379 | 379 | |
380 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
380 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
381 | 381 | |
382 | 382 | return $spotter_array; |
383 | 383 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | try { |
391 | 391 | $sth = $this->db->prepare($query); |
392 | 392 | $sth->execute(); |
393 | - } catch(PDOException $e) { |
|
393 | + } catch (PDOException $e) { |
|
394 | 394 | echo $e->getMessage(); |
395 | 395 | die; |
396 | 396 | } |
@@ -402,24 +402,24 @@ discard block |
||
402 | 402 | * @return Array the spotter information |
403 | 403 | * |
404 | 404 | */ |
405 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
405 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array()) |
|
406 | 406 | { |
407 | 407 | global $globalDBdriver, $globalLiveInterval; |
408 | 408 | date_default_timezone_set('UTC'); |
409 | 409 | |
410 | 410 | $filter_query = ''; |
411 | 411 | if (isset($filter['source']) && !empty($filter['source'])) { |
412 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
412 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
413 | 413 | } |
414 | 414 | // Use spotter_output also ? |
415 | 415 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
416 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
416 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
417 | 417 | } |
418 | 418 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
419 | 419 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
420 | 420 | } |
421 | 421 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
422 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
422 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -438,14 +438,14 @@ discard block |
||
438 | 438 | GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id |
439 | 439 | AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
440 | 440 | */ |
441 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
441 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
442 | 442 | FROM spotter_archive |
443 | 443 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
444 | 444 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
445 | 445 | '.$filter_query.' ORDER BY flightaware_id'; |
446 | 446 | } else { |
447 | 447 | //$query = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
448 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
448 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
449 | 449 | FROM spotter_archive |
450 | 450 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
451 | 451 | WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".' |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | try { |
456 | 456 | $sth = $this->db->prepare($query); |
457 | 457 | $sth->execute(); |
458 | - } catch(PDOException $e) { |
|
458 | + } catch (PDOException $e) { |
|
459 | 459 | echo $e->getMessage(); |
460 | 460 | die; |
461 | 461 | } |
@@ -470,24 +470,24 @@ discard block |
||
470 | 470 | * @return Array the spotter information |
471 | 471 | * |
472 | 472 | */ |
473 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
473 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) |
|
474 | 474 | { |
475 | 475 | global $globalDBdriver, $globalLiveInterval; |
476 | 476 | date_default_timezone_set('UTC'); |
477 | 477 | |
478 | 478 | $filter_query = ''; |
479 | 479 | if (isset($filter['source']) && !empty($filter['source'])) { |
480 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
480 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
481 | 481 | } |
482 | 482 | // Should use spotter_output also ? |
483 | 483 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
484 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
484 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
485 | 485 | } |
486 | 486 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
487 | 487 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
488 | 488 | } |
489 | 489 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
490 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
490 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | FROM spotter_archive |
498 | 498 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
499 | 499 | */ |
500 | - $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
500 | + $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
501 | 501 | FROM spotter_archive_output |
502 | 502 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
503 | 503 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
513 | 513 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
514 | 514 | */ |
515 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
515 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
516 | 516 | FROM spotter_archive_output |
517 | 517 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
518 | 518 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | try { |
525 | 525 | $sth = $this->db->prepare($query); |
526 | 526 | $sth->execute(); |
527 | - } catch(PDOException $e) { |
|
527 | + } catch (PDOException $e) { |
|
528 | 528 | echo $e->getMessage(); |
529 | 529 | die; |
530 | 530 | } |
@@ -539,23 +539,23 @@ discard block |
||
539 | 539 | * @return Array the spotter information |
540 | 540 | * |
541 | 541 | */ |
542 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
542 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) |
|
543 | 543 | { |
544 | 544 | global $globalDBdriver, $globalLiveInterval; |
545 | 545 | date_default_timezone_set('UTC'); |
546 | 546 | |
547 | 547 | $filter_query = ''; |
548 | 548 | if (isset($filter['source']) && !empty($filter['source'])) { |
549 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
549 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
550 | 550 | } |
551 | 551 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
552 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
552 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
553 | 553 | } |
554 | 554 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
555 | 555 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
556 | 556 | } |
557 | 557 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
558 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
558 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | try { |
571 | 571 | $sth = $this->db->prepare($query); |
572 | 572 | $sth->execute(); |
573 | - } catch(PDOException $e) { |
|
573 | + } catch (PDOException $e) { |
|
574 | 574 | echo $e->getMessage(); |
575 | 575 | die; |
576 | 576 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | * @return Array the spotter information |
591 | 591 | * |
592 | 592 | */ |
593 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
593 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
594 | 594 | { |
595 | 595 | global $globalTimezone, $globalDBdriver; |
596 | 596 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | |
613 | 613 | $q_array = explode(" ", $q); |
614 | 614 | |
615 | - foreach ($q_array as $q_item){ |
|
615 | + foreach ($q_array as $q_item) { |
|
616 | 616 | $additional_query .= " AND ("; |
617 | 617 | $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
618 | 618 | $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | |
645 | 645 | if ($registration != "") |
646 | 646 | { |
647 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
647 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
648 | 648 | if (!is_string($registration)) |
649 | 649 | { |
650 | 650 | return false; |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | if ($aircraft_icao != "") |
657 | 657 | { |
658 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
658 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
659 | 659 | if (!is_string($aircraft_icao)) |
660 | 660 | { |
661 | 661 | return false; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | |
667 | 667 | if ($aircraft_manufacturer != "") |
668 | 668 | { |
669 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
669 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
670 | 670 | if (!is_string($aircraft_manufacturer)) |
671 | 671 | { |
672 | 672 | return false; |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | |
688 | 688 | if ($airline_icao != "") |
689 | 689 | { |
690 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
690 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
691 | 691 | if (!is_string($airline_icao)) |
692 | 692 | { |
693 | 693 | return false; |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | |
699 | 699 | if ($airline_country != "") |
700 | 700 | { |
701 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
701 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
702 | 702 | if (!is_string($airline_country)) |
703 | 703 | { |
704 | 704 | return false; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | if ($airline_type != "") |
711 | 711 | { |
712 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
712 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
713 | 713 | if (!is_string($airline_type)) |
714 | 714 | { |
715 | 715 | return false; |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | |
732 | 732 | if ($airport != "") |
733 | 733 | { |
734 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
734 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
735 | 735 | if (!is_string($airport)) |
736 | 736 | { |
737 | 737 | return false; |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | |
743 | 743 | if ($airport_country != "") |
744 | 744 | { |
745 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
745 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
746 | 746 | if (!is_string($airport_country)) |
747 | 747 | { |
748 | 748 | return false; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | |
754 | 754 | if ($callsign != "") |
755 | 755 | { |
756 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
756 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
757 | 757 | if (!is_string($callsign)) |
758 | 758 | { |
759 | 759 | return false; |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | $translate = $Translation->ident2icao($callsign); |
762 | 762 | if ($translate != $callsign) { |
763 | 763 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
764 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
764 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
765 | 765 | } else { |
766 | 766 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
767 | 767 | } |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | |
771 | 771 | if ($owner != "") |
772 | 772 | { |
773 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
773 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
774 | 774 | if (!is_string($owner)) |
775 | 775 | { |
776 | 776 | return false; |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | |
782 | 782 | if ($pilot_name != "") |
783 | 783 | { |
784 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
784 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
785 | 785 | if (!is_string($pilot_name)) |
786 | 786 | { |
787 | 787 | return false; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | if ($pilot_id != "") |
794 | 794 | { |
795 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
795 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
796 | 796 | if (!is_string($pilot_id)) |
797 | 797 | { |
798 | 798 | return false; |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | |
804 | 804 | if ($departure_airport_route != "") |
805 | 805 | { |
806 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
806 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
807 | 807 | if (!is_string($departure_airport_route)) |
808 | 808 | { |
809 | 809 | return false; |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | |
815 | 815 | if ($arrival_airport_route != "") |
816 | 816 | { |
817 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
817 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
818 | 818 | if (!is_string($arrival_airport_route)) |
819 | 819 | { |
820 | 820 | return false; |
@@ -827,8 +827,8 @@ discard block |
||
827 | 827 | { |
828 | 828 | $altitude_array = explode(",", $altitude); |
829 | 829 | |
830 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
831 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
830 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
831 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
832 | 832 | |
833 | 833 | |
834 | 834 | if ($altitude_array[1] != "") |
@@ -846,8 +846,8 @@ discard block |
||
846 | 846 | { |
847 | 847 | $date_array = explode(",", $date_posted); |
848 | 848 | |
849 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
850 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
849 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
850 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
851 | 851 | |
852 | 852 | if ($globalTimezone != '') { |
853 | 853 | date_default_timezone_set($globalTimezone); |
@@ -879,8 +879,8 @@ discard block |
||
879 | 879 | { |
880 | 880 | $limit_array = explode(",", $limit); |
881 | 881 | |
882 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
883 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
882 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
883 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
884 | 884 | |
885 | 885 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
886 | 886 | { |
@@ -891,8 +891,8 @@ discard block |
||
891 | 891 | |
892 | 892 | |
893 | 893 | if ($origLat != "" && $origLon != "" && $dist != "") { |
894 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
895 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
894 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
895 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
896 | 896 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
897 | 897 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
898 | 898 | } else { |
@@ -909,12 +909,12 @@ discard block |
||
909 | 909 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
910 | 910 | } |
911 | 911 | |
912 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
912 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
913 | 913 | WHERE spotter_archive_output.ident <> '' |
914 | 914 | ".$additional_query." |
915 | 915 | ".$filter_query.$orderby_query; |
916 | 916 | } |
917 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
917 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
918 | 918 | |
919 | 919 | return $spotter_array; |
920 | 920 | } |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | try { |
932 | 932 | $sth = $this->db->prepare($query); |
933 | 933 | $sth->execute(); |
934 | - } catch(PDOException $e) { |
|
934 | + } catch (PDOException $e) { |
|
935 | 935 | return "error"; |
936 | 936 | } |
937 | 937 | } |
@@ -968,8 +968,8 @@ discard block |
||
968 | 968 | { |
969 | 969 | $limit_array = explode(",", $limit); |
970 | 970 | |
971 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
972 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
971 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
972 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
973 | 973 | |
974 | 974 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
975 | 975 | { |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | $query_values = array(); |
1011 | 1011 | $limit_query = ''; |
1012 | 1012 | $additional_query = ''; |
1013 | - $filter_query = $this->getFilter($filter,true,true); |
|
1013 | + $filter_query = $this->getFilter($filter, true, true); |
|
1014 | 1014 | |
1015 | 1015 | if ($owner != "") |
1016 | 1016 | { |
@@ -1027,8 +1027,8 @@ discard block |
||
1027 | 1027 | { |
1028 | 1028 | $limit_array = explode(",", $limit); |
1029 | 1029 | |
1030 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1031 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1030 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1031 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1032 | 1032 | |
1033 | 1033 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1034 | 1034 | { |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | $query_values = array(); |
1069 | 1069 | $limit_query = ''; |
1070 | 1070 | $additional_query = ''; |
1071 | - $filter_query = $this->getFilter($filter,true,true); |
|
1071 | + $filter_query = $this->getFilter($filter, true, true); |
|
1072 | 1072 | |
1073 | 1073 | if ($pilot != "") |
1074 | 1074 | { |
@@ -1080,8 +1080,8 @@ discard block |
||
1080 | 1080 | { |
1081 | 1081 | $limit_array = explode(",", $limit); |
1082 | 1082 | |
1083 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1084 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1083 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1084 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1085 | 1085 | |
1086 | 1086 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1087 | 1087 | { |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | * @return Array the airline country list |
1112 | 1112 | * |
1113 | 1113 | */ |
1114 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1114 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1115 | 1115 | { |
1116 | 1116 | global $globalDBdriver; |
1117 | 1117 | /* |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | $flight_array = array(); |
1141 | 1141 | $temp_array = array(); |
1142 | 1142 | |
1143 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1143 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1144 | 1144 | { |
1145 | 1145 | $temp_array['flight_count'] = $row['nb']; |
1146 | 1146 | $temp_array['flight_country'] = $row['name']; |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | * @return Array the airline country list |
1158 | 1158 | * |
1159 | 1159 | */ |
1160 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1160 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1161 | 1161 | { |
1162 | 1162 | global $globalDBdriver; |
1163 | 1163 | /* |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | $flight_array = array(); |
1187 | 1187 | $temp_array = array(); |
1188 | 1188 | |
1189 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1189 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1190 | 1190 | { |
1191 | 1191 | $temp_array['airline_icao'] = $row['airline_icao']; |
1192 | 1192 | $temp_array['flight_count'] = $row['nb']; |
@@ -1204,14 +1204,14 @@ discard block |
||
1204 | 1204 | * @return Array the spotter information |
1205 | 1205 | * |
1206 | 1206 | */ |
1207 | - public function getDateArchiveSpotterDataById($id,$date) |
|
1207 | + public function getDateArchiveSpotterDataById($id, $date) |
|
1208 | 1208 | { |
1209 | 1209 | $Spotter = new Spotter($this->db); |
1210 | 1210 | date_default_timezone_set('UTC'); |
1211 | 1211 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1212 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1213 | - $date = date('c',$date); |
|
1214 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1212 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1213 | + $date = date('c', $date); |
|
1214 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1215 | 1215 | return $spotter_array; |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1221,14 +1221,14 @@ discard block |
||
1221 | 1221 | * @return Array the spotter information |
1222 | 1222 | * |
1223 | 1223 | */ |
1224 | - public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1224 | + public function getDateArchiveSpotterDataByIdent($ident, $date) |
|
1225 | 1225 | { |
1226 | 1226 | $Spotter = new Spotter($this->db); |
1227 | 1227 | date_default_timezone_set('UTC'); |
1228 | 1228 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1229 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1230 | - $date = date('c',$date); |
|
1231 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1229 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1230 | + $date = date('c', $date); |
|
1231 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1232 | 1232 | return $spotter_array; |
1233 | 1233 | } |
1234 | 1234 | |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * @return Array the spotter information |
1239 | 1239 | * |
1240 | 1240 | */ |
1241 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1241 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1242 | 1242 | { |
1243 | 1243 | global $global_query; |
1244 | 1244 | $Spotter = new Spotter(); |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | $query_values = array(); |
1247 | 1247 | $limit_query = ''; |
1248 | 1248 | $additional_query = ''; |
1249 | - $filter_query = $this->getFilter($filters,true,true); |
|
1249 | + $filter_query = $this->getFilter($filters, true, true); |
|
1250 | 1250 | |
1251 | 1251 | if ($airport != "") |
1252 | 1252 | { |
@@ -1263,8 +1263,8 @@ discard block |
||
1263 | 1263 | { |
1264 | 1264 | $limit_array = explode(",", $limit); |
1265 | 1265 | |
1266 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1267 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1266 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1267 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1268 | 1268 | |
1269 | 1269 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1270 | 1270 | { |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | $s3 = sin($bank/2); |
44 | 44 | $c1c2 = $c1*$c2; |
45 | 45 | $s1s2 = $s1*$s2; |
46 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
47 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
48 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
49 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
50 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
46 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
47 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
48 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
49 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
50 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
51 | 51 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
52 | 52 | |
53 | 53 | } |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | $min = false; |
69 | 69 | $allhistory = false; |
70 | 70 | $filter['source'] = array(); |
71 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
72 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
73 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
74 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
75 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
76 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
79 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
80 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
71 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
72 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
73 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
75 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
76 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
77 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
78 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
79 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
80 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
81 | 81 | /* |
82 | 82 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
83 | 83 | $min = true; |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | $from_archive = true; |
125 | 125 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
126 | 126 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
127 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
128 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
129 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
131 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
132 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
127 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
128 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
129 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
131 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
132 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
133 | 133 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
134 | 134 | $from_archive = true; |
135 | 135 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $begindate = $_COOKIE['archive_begin']; |
140 | 140 | $enddate = $_COOKIE['archive_end']; |
141 | 141 | |
142 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
143 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
144 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
142 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
143 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
144 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
145 | 145 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
146 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
146 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
147 | 147 | } elseif ($tracker) { |
148 | 148 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($filter); |
149 | 149 | } elseif ($marine) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | if (!empty($spotter_array)) { |
156 | 156 | if (isset($_GET['archive'])) { |
157 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
157 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
158 | 158 | } elseif ($tracker) { |
159 | 159 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
160 | 160 | } elseif ($marine) { |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | if ($flightcnt == '') $flightcnt = 0; |
166 | 166 | } else $flightcnt = 0; |
167 | 167 | |
168 | -$sqltime = round(microtime(true)-$begintime,2); |
|
168 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
169 | 169 | $minitime = time(); |
170 | 170 | $maxitime = 0; |
171 | 171 | |
172 | 172 | |
173 | 173 | $modelsdb = array(); |
174 | 174 | if (file_exists('models/modelsdb')) { |
175 | - if (($handle = fopen('models/modelsdb','r')) !== FALSE) { |
|
176 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
177 | - if (isset($row[1]) ){ |
|
175 | + if (($handle = fopen('models/modelsdb', 'r')) !== FALSE) { |
|
176 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
177 | + if (isset($row[1])) { |
|
178 | 178 | $model = $row[0]; |
179 | 179 | $modelsdb[$model] = $row[1]; |
180 | 180 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER","interval": "%minitime%/%maxitime%"}'; |
204 | 204 | } else { |
205 | 205 | if (isset($globalArchive) && $globalArchive === TRUE) { |
206 | - $output .= ',"clock": {"currentTime" : "'.date("c",time()-$globalLiveInterval).'","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
|
206 | + $output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
|
207 | 207 | } else { |
208 | 208 | $output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
209 | 209 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $output .= '},'; |
214 | 214 | if (!empty($spotter_array) && is_array($spotter_array)) |
215 | 215 | { |
216 | - foreach($spotter_array as $spotter_item) |
|
216 | + foreach ($spotter_array as $spotter_item) |
|
217 | 217 | { |
218 | 218 | $j++; |
219 | 219 | date_default_timezone_set('UTC'); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $output .= '"cartographicDegrees": ['; |
502 | 502 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
503 | 503 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
504 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
504 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
505 | 505 | $output .= $spotter_item['longitude'].', '; |
506 | 506 | $output .= $spotter_item['latitude']; |
507 | 507 | $prevlong = $spotter_item['longitude']; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
516 | 516 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
517 | 517 | } else { |
518 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
518 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
519 | 519 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
520 | 520 | if ($spotter_item['ground_speed'] == 0) { |
521 | 521 | $output .= $prevlong.', '; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $output = substr($output, 0, -1); |
548 | 548 | } |
549 | 549 | $output .= ']'; |
550 | -$output = str_replace('%minitime%',date("c",$minitime),$output); |
|
551 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
550 | +$output = str_replace('%minitime%', date("c", $minitime), $output); |
|
551 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
552 | 552 | print $output; |
553 | 553 | ?> |
@@ -16,62 +16,62 @@ discard block |
||
16 | 16 | * @param Array $filter the filter |
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
25 | 25 | } else { |
26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | if (isset($filter[0]['source'])) { |
30 | - $filters = array_merge($filters,$filter); |
|
30 | + $filters = array_merge($filters, $filter); |
|
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
33 | 33 | $filter_query_join = ''; |
34 | 34 | $filter_query_where = ''; |
35 | - foreach($filters as $flt) { |
|
35 | + foreach ($filters as $flt) { |
|
36 | 36 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
37 | 37 | if ($flt['airlines'][0] != '') { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
46 | 46 | if (isset($flt['source'])) { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
48 | 48 | } else { |
49 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
49 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
53 | 53 | if (isset($flt['source'])) { |
54 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
54 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
55 | 55 | } else { |
56 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
56 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
60 | 60 | if (isset($flt['source'])) { |
61 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
61 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
62 | 62 | } else { |
63 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
63 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
67 | 67 | if (isset($flt['source'])) { |
68 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
68 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |
72 | 72 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
73 | 73 | if ($filter['airlines'][0] != '') { |
74 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
74 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
82 | 82 | } |
83 | 83 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
84 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
84 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
85 | 85 | } |
86 | 86 | if (isset($filter['source']) && !empty($filter['source'])) { |
87 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
87 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
88 | 88 | } |
89 | 89 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
90 | 90 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
114 | 114 | } |
115 | 115 | } |
116 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
116 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
117 | 117 | } |
118 | 118 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
119 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
119 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
120 | 120 | } |
121 | 121 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
122 | 122 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
123 | 123 | if ($filter_query_where != '') { |
124 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
124 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
125 | 125 | } |
126 | 126 | $filter_query = $filter_query_join.$filter_query_where; |
127 | 127 | return $filter_query; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | if ($limit != '') |
145 | 145 | { |
146 | 146 | $limit_array = explode(',', $limit); |
147 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
148 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
147 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
149 | 149 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
150 | 150 | { |
151 | 151 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } else { |
169 | 169 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
170 | 170 | } |
171 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
171 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
172 | 172 | |
173 | 173 | return $spotter_array; |
174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | { |
184 | 184 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
185 | 185 | date_default_timezone_set('UTC'); |
186 | - $filter_query = $this->getFilter($filter,true,true); |
|
186 | + $filter_query = $this->getFilter($filter, true, true); |
|
187 | 187 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
188 | 188 | if ($globalDBdriver == 'mysql') { |
189 | 189 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | try { |
207 | 207 | $sth = $this->db->prepare($query); |
208 | 208 | $sth->execute(); |
209 | - } catch(PDOException $e) { |
|
209 | + } catch (PDOException $e) { |
|
210 | 210 | echo $e->getMessage(); |
211 | 211 | die; |
212 | 212 | } |
@@ -225,26 +225,26 @@ discard block |
||
225 | 225 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
226 | 226 | date_default_timezone_set('UTC'); |
227 | 227 | |
228 | - $filter_query = $this->getFilter($filter,true,true); |
|
228 | + $filter_query = $this->getFilter($filter, true, true); |
|
229 | 229 | |
230 | 230 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
231 | 231 | if ($globalDBdriver == 'mysql') { |
232 | 232 | if (isset($globalArchive) && $globalArchive === TRUE) { |
233 | - $query = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
233 | + $query = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
234 | 234 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id AND spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
235 | 235 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
236 | 236 | } else { |
237 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
237 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
238 | 238 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
239 | 239 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
240 | 240 | } |
241 | 241 | } else { |
242 | 242 | if (isset($globalArchive) && $globalArchive === TRUE) { |
243 | - $query = "SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
243 | + $query = "SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
244 | 244 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
245 | 245 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
246 | 246 | } else { |
247 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
247 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
248 | 248 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
249 | 249 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
250 | 250 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | try { |
254 | 254 | $sth = $this->db->prepare($query); |
255 | 255 | $sth->execute(); |
256 | - } catch(PDOException $e) { |
|
256 | + } catch (PDOException $e) { |
|
257 | 257 | echo $e->getMessage(); |
258 | 258 | die; |
259 | 259 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | public function getLiveSpotterCount($filter = array()) |
271 | 271 | { |
272 | 272 | global $globalDBdriver, $globalLiveInterval; |
273 | - $filter_query = $this->getFilter($filter,true,true); |
|
273 | + $filter_query = $this->getFilter($filter, true, true); |
|
274 | 274 | |
275 | 275 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
276 | 276 | if ($globalDBdriver == 'mysql') { |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | try { |
284 | 284 | $sth = $this->db->prepare($query); |
285 | 285 | $sth->execute(); |
286 | - } catch(PDOException $e) { |
|
286 | + } catch (PDOException $e) { |
|
287 | 287 | echo $e->getMessage(); |
288 | 288 | die; |
289 | 289 | } |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | $filter_query = $this->getFilter($filter); |
307 | 307 | |
308 | 308 | if (is_array($coord)) { |
309 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
310 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
311 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
312 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
309 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
310 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
311 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
312 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
313 | 313 | } else return array(); |
314 | 314 | if ($globalDBdriver == 'mysql') { |
315 | 315 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -332,23 +332,23 @@ discard block |
||
332 | 332 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
333 | 333 | $Spotter = new Spotter($this->db); |
334 | 334 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
335 | - $filter_query = $this->getFilter($filter,true,true); |
|
335 | + $filter_query = $this->getFilter($filter, true, true); |
|
336 | 336 | |
337 | 337 | if (is_array($coord)) { |
338 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
339 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
340 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
341 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
338 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
339 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
340 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
341 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
342 | 342 | } else return array(); |
343 | 343 | if ($globalDBdriver == 'mysql') { |
344 | 344 | if (isset($globalArchive) && $globalArchive === TRUE) { |
345 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
345 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
346 | 346 | FROM spotter_live |
347 | 347 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
348 | 348 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
349 | 349 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
350 | 350 | } else { |
351 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
351 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
352 | 352 | FROM spotter_live |
353 | 353 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
354 | 354 | FROM spotter_live l |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | } |
361 | 361 | } else { |
362 | 362 | if (isset($globalArchive) && $globalArchive === TRUE) { |
363 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
363 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
364 | 364 | FROM spotter_live |
365 | 365 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
366 | 366 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
367 | 367 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
368 | 368 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
369 | 369 | } else { |
370 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
370 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
371 | 371 | FROM spotter_live |
372 | 372 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
373 | 373 | FROM spotter_live l |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | try { |
383 | 383 | $sth = $this->db->prepare($query); |
384 | 384 | $sth->execute(); |
385 | - } catch(PDOException $e) { |
|
385 | + } catch (PDOException $e) { |
|
386 | 386 | echo $e->getMessage(); |
387 | 387 | die; |
388 | 388 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | if ($interval == '1m') |
432 | 432 | { |
433 | 433 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
434 | - } else if ($interval == '15m'){ |
|
434 | + } else if ($interval == '15m') { |
|
435 | 435 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
436 | 436 | } |
437 | 437 | } |
@@ -439,14 +439,14 @@ discard block |
||
439 | 439 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
440 | 440 | } |
441 | 441 | |
442 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
442 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
443 | 443 | WHERE spotter_live.latitude <> '' |
444 | 444 | AND spotter_live.longitude <> '' |
445 | 445 | ".$additional_query." |
446 | 446 | HAVING distance < :radius |
447 | 447 | ORDER BY distance"; |
448 | 448 | |
449 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
449 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
450 | 450 | |
451 | 451 | return $spotter_array; |
452 | 452 | } |
@@ -464,9 +464,9 @@ discard block |
||
464 | 464 | date_default_timezone_set('UTC'); |
465 | 465 | |
466 | 466 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
467 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
467 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
468 | 468 | |
469 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
469 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
470 | 470 | |
471 | 471 | return $spotter_array; |
472 | 472 | } |
@@ -477,16 +477,16 @@ discard block |
||
477 | 477 | * @return Array the spotter information |
478 | 478 | * |
479 | 479 | */ |
480 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
480 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
481 | 481 | { |
482 | 482 | $Spotter = new Spotter($this->db); |
483 | 483 | date_default_timezone_set('UTC'); |
484 | 484 | |
485 | 485 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
486 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
486 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
487 | 487 | |
488 | - $date = date('c',$date); |
|
489 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
488 | + $date = date('c', $date); |
|
489 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
490 | 490 | |
491 | 491 | return $spotter_array; |
492 | 492 | } |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | date_default_timezone_set('UTC'); |
504 | 504 | |
505 | 505 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
506 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
506 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
507 | 507 | |
508 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
508 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
509 | 509 | |
510 | 510 | return $spotter_array; |
511 | 511 | } |
@@ -516,15 +516,15 @@ discard block |
||
516 | 516 | * @return Array the spotter information |
517 | 517 | * |
518 | 518 | */ |
519 | - public function getDateLiveSpotterDataById($id,$date) |
|
519 | + public function getDateLiveSpotterDataById($id, $date) |
|
520 | 520 | { |
521 | 521 | $Spotter = new Spotter($this->db); |
522 | 522 | date_default_timezone_set('UTC'); |
523 | 523 | |
524 | 524 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
525 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
526 | - $date = date('c',$date); |
|
527 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
525 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
526 | + $date = date('c', $date); |
|
527 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
528 | 528 | |
529 | 529 | return $spotter_array; |
530 | 530 | } |
@@ -541,13 +541,13 @@ discard block |
||
541 | 541 | date_default_timezone_set('UTC'); |
542 | 542 | |
543 | 543 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
544 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
544 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
545 | 545 | |
546 | 546 | try { |
547 | 547 | |
548 | 548 | $sth = $this->db->prepare($query); |
549 | 549 | $sth->execute(array(':ident' => $ident)); |
550 | - } catch(PDOException $e) { |
|
550 | + } catch (PDOException $e) { |
|
551 | 551 | echo $e->getMessage(); |
552 | 552 | die; |
553 | 553 | } |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | * @return Array the spotter information |
563 | 563 | * |
564 | 564 | */ |
565 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
565 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
566 | 566 | { |
567 | 567 | global $globalDBdriver, $globalLiveInterval; |
568 | 568 | date_default_timezone_set('UTC'); |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | try { |
582 | 582 | $sth = $this->db->prepare($query); |
583 | 583 | $sth->execute(array(':id' => $id)); |
584 | - } catch(PDOException $e) { |
|
584 | + } catch (PDOException $e) { |
|
585 | 585 | echo $e->getMessage(); |
586 | 586 | die; |
587 | 587 | } |
@@ -599,12 +599,12 @@ discard block |
||
599 | 599 | { |
600 | 600 | date_default_timezone_set('UTC'); |
601 | 601 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
602 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
602 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
603 | 603 | try { |
604 | 604 | |
605 | 605 | $sth = $this->db->prepare($query); |
606 | 606 | $sth->execute(array(':ident' => $ident)); |
607 | - } catch(PDOException $e) { |
|
607 | + } catch (PDOException $e) { |
|
608 | 608 | echo $e->getMessage(); |
609 | 609 | die; |
610 | 610 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | |
635 | 635 | $sth = $this->db->prepare($query); |
636 | 636 | $sth->execute(); |
637 | - } catch(PDOException $e) { |
|
637 | + } catch (PDOException $e) { |
|
638 | 638 | return "error"; |
639 | 639 | } |
640 | 640 | |
@@ -657,14 +657,14 @@ discard block |
||
657 | 657 | |
658 | 658 | $sth = $this->db->prepare($query); |
659 | 659 | $sth->execute(); |
660 | - } catch(PDOException $e) { |
|
660 | + } catch (PDOException $e) { |
|
661 | 661 | return "error"; |
662 | 662 | } |
663 | 663 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
664 | 664 | $i = 0; |
665 | - $j =0; |
|
665 | + $j = 0; |
|
666 | 666 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
667 | - foreach($all as $row) |
|
667 | + foreach ($all as $row) |
|
668 | 668 | { |
669 | 669 | $i++; |
670 | 670 | $j++; |
@@ -672,9 +672,9 @@ discard block |
||
672 | 672 | if ($globalDebug) echo "."; |
673 | 673 | try { |
674 | 674 | |
675 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
675 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
676 | 676 | $sth->execute(); |
677 | - } catch(PDOException $e) { |
|
677 | + } catch (PDOException $e) { |
|
678 | 678 | return "error"; |
679 | 679 | } |
680 | 680 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -685,9 +685,9 @@ discard block |
||
685 | 685 | if ($i > 0) { |
686 | 686 | try { |
687 | 687 | |
688 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
688 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
689 | 689 | $sth->execute(); |
690 | - } catch(PDOException $e) { |
|
690 | + } catch (PDOException $e) { |
|
691 | 691 | return "error"; |
692 | 692 | } |
693 | 693 | } |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | |
701 | 701 | $sth = $this->db->prepare($query); |
702 | 702 | $sth->execute(); |
703 | - } catch(PDOException $e) { |
|
703 | + } catch (PDOException $e) { |
|
704 | 704 | return "error"; |
705 | 705 | } |
706 | 706 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -748,13 +748,13 @@ discard block |
||
748 | 748 | public function deleteLiveSpotterDataByIdent($ident) |
749 | 749 | { |
750 | 750 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
751 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
751 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
752 | 752 | |
753 | 753 | try { |
754 | 754 | |
755 | 755 | $sth = $this->db->prepare($query); |
756 | 756 | $sth->execute(array(':ident' => $ident)); |
757 | - } catch(PDOException $e) { |
|
757 | + } catch (PDOException $e) { |
|
758 | 758 | return "error"; |
759 | 759 | } |
760 | 760 | |
@@ -770,13 +770,13 @@ discard block |
||
770 | 770 | public function deleteLiveSpotterDataById($id) |
771 | 771 | { |
772 | 772 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
773 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
773 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
774 | 774 | |
775 | 775 | try { |
776 | 776 | |
777 | 777 | $sth = $this->db->prepare($query); |
778 | 778 | $sth->execute(array(':id' => $id)); |
779 | - } catch(PDOException $e) { |
|
779 | + } catch (PDOException $e) { |
|
780 | 780 | return "error"; |
781 | 781 | } |
782 | 782 | |
@@ -794,13 +794,13 @@ discard block |
||
794 | 794 | { |
795 | 795 | global $globalDBdriver, $globalTimezone; |
796 | 796 | if ($globalDBdriver == 'mysql') { |
797 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
797 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
798 | 798 | WHERE spotter_live.ident = :ident |
799 | 799 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
800 | 800 | AND spotter_live.date < UTC_TIMESTAMP()'; |
801 | 801 | $query_data = array(':ident' => $ident); |
802 | 802 | } else { |
803 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
803 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
804 | 804 | WHERE spotter_live.ident = :ident |
805 | 805 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
806 | 806 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -809,8 +809,8 @@ discard block |
||
809 | 809 | |
810 | 810 | $sth = $this->db->prepare($query); |
811 | 811 | $sth->execute($query_data); |
812 | - $ident_result=''; |
|
813 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
812 | + $ident_result = ''; |
|
813 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
814 | 814 | { |
815 | 815 | $ident_result = $row['ident']; |
816 | 816 | } |
@@ -827,13 +827,13 @@ discard block |
||
827 | 827 | { |
828 | 828 | global $globalDBdriver, $globalTimezone; |
829 | 829 | if ($globalDBdriver == 'mysql') { |
830 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
830 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
831 | 831 | WHERE spotter_live.ident = :ident |
832 | 832 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
833 | 833 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
834 | 834 | $query_data = array(':ident' => $ident); |
835 | 835 | } else { |
836 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
836 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
837 | 837 | WHERE spotter_live.ident = :ident |
838 | 838 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
839 | 839 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -842,8 +842,8 @@ discard block |
||
842 | 842 | |
843 | 843 | $sth = $this->db->prepare($query); |
844 | 844 | $sth->execute($query_data); |
845 | - $ident_result=''; |
|
846 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
845 | + $ident_result = ''; |
|
846 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
847 | 847 | { |
848 | 848 | $ident_result = $row['flightaware_id']; |
849 | 849 | } |
@@ -860,13 +860,13 @@ discard block |
||
860 | 860 | { |
861 | 861 | global $globalDBdriver, $globalTimezone; |
862 | 862 | if ($globalDBdriver == 'mysql') { |
863 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
863 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
864 | 864 | WHERE spotter_live.flightaware_id = :id |
865 | 865 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
866 | 866 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
867 | 867 | $query_data = array(':id' => $id); |
868 | 868 | } else { |
869 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
869 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
870 | 870 | WHERE spotter_live.flightaware_id = :id |
871 | 871 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
872 | 872 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -875,8 +875,8 @@ discard block |
||
875 | 875 | |
876 | 876 | $sth = $this->db->prepare($query); |
877 | 877 | $sth->execute($query_data); |
878 | - $ident_result=''; |
|
879 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
878 | + $ident_result = ''; |
|
879 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
880 | 880 | { |
881 | 881 | $ident_result = $row['flightaware_id']; |
882 | 882 | } |
@@ -893,13 +893,13 @@ discard block |
||
893 | 893 | { |
894 | 894 | global $globalDBdriver, $globalTimezone; |
895 | 895 | if ($globalDBdriver == 'mysql') { |
896 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
896 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
897 | 897 | WHERE spotter_live.ModeS = :modes |
898 | 898 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
899 | 899 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
900 | 900 | $query_data = array(':modes' => $modes); |
901 | 901 | } else { |
902 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
902 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
903 | 903 | WHERE spotter_live.ModeS = :modes |
904 | 904 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
905 | 905 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -908,8 +908,8 @@ discard block |
||
908 | 908 | |
909 | 909 | $sth = $this->db->prepare($query); |
910 | 910 | $sth->execute($query_data); |
911 | - $ident_result=''; |
|
912 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
911 | + $ident_result = ''; |
|
912 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
913 | 913 | { |
914 | 914 | //$ident_result = $row['spotter_live_id']; |
915 | 915 | $ident_result = $row['flightaware_id']; |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | * @return String success or false |
929 | 929 | * |
930 | 930 | */ |
931 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
931 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
932 | 932 | { |
933 | 933 | global $globalURL, $globalArchive, $globalDebug; |
934 | 934 | $Common = new Common(); |
@@ -1021,26 +1021,26 @@ discard block |
||
1021 | 1021 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1022 | 1022 | |
1023 | 1023 | |
1024 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1025 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1026 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1027 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1028 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1029 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1030 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1031 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1032 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1033 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1034 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1035 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1036 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1037 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1038 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1039 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1040 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1041 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1042 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1043 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
1024 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
1025 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1026 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
1027 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1028 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1029 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1030 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1031 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
1032 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1033 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1034 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1035 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
1036 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
1037 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
1038 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
1039 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
1040 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1041 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1042 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1043 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1044 | 1044 | |
1045 | 1045 | $airline_name = ''; |
1046 | 1046 | $airline_icao = ''; |
@@ -1062,10 +1062,10 @@ discard block |
||
1062 | 1062 | $arrival_airport_country = ''; |
1063 | 1063 | |
1064 | 1064 | |
1065 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1066 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1067 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1068 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1065 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
1066 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
1067 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
1068 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1069 | 1069 | |
1070 | 1070 | $query = ''; |
1071 | 1071 | if ($globalArchive) { |
@@ -1076,19 +1076,19 @@ discard block |
||
1076 | 1076 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
1077 | 1077 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
1078 | 1078 | |
1079 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
1079 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
1080 | 1080 | try { |
1081 | 1081 | |
1082 | 1082 | $sth = $this->db->prepare($query); |
1083 | 1083 | $sth->execute($query_values); |
1084 | 1084 | $sth->closeCursor(); |
1085 | - } catch(PDOException $e) { |
|
1085 | + } catch (PDOException $e) { |
|
1086 | 1086 | return "error : ".$e->getMessage(); |
1087 | 1087 | } |
1088 | 1088 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1089 | 1089 | if ($globalDebug) echo '(Add to SBS archive : '; |
1090 | 1090 | $SpotterArchive = new SpotterArchive($this->db); |
1091 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1091 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
1092 | 1092 | if ($globalDebug) echo $result.')'; |
1093 | 1093 | } |
1094 | 1094 | return "success"; |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | public function getOrderBy() |
1099 | 1099 | { |
1100 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1100 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1101 | 1101 | return $orderby; |
1102 | 1102 | } |
1103 | 1103 |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | $min = true; |
56 | 56 | $allhistory = false; |
57 | 57 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
58 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
61 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
63 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
64 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
65 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
66 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
67 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
68 | 68 | |
69 | 69 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 70 | $min = true; |
71 | 71 | } else $min = false; |
72 | 72 | |
73 | 73 | if (isset($_GET['ident'])) { |
74 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
74 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
75 | 75 | if ($tracker) { |
76 | 76 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
77 | 77 | } elseif ($marine) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | $allhistory = true; |
87 | 87 | } elseif (isset($_GET['flightaware_id'])) { |
88 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
88 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
89 | 89 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
90 | 90 | if (empty($spotter_array)) { |
91 | 91 | $from_archive = true; |
@@ -93,44 +93,44 @@ discard block |
||
93 | 93 | } |
94 | 94 | $allhistory = true; |
95 | 95 | } elseif (isset($_GET['famtrack_id'])) { |
96 | - $famtrack_id = filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING); |
|
96 | + $famtrack_id = filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING); |
|
97 | 97 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
98 | 98 | $allhistory = true; |
99 | 99 | } elseif (isset($_GET['fammarine_id'])) { |
100 | - $fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING); |
|
100 | + $fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING); |
|
101 | 101 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
102 | 102 | $allhistory = true; |
103 | 103 | } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
104 | 104 | //} elseif (isset($_GET['coord'])) { |
105 | 105 | $usecoord = true; |
106 | - $coord = explode(',',$_GET['coord']); |
|
106 | + $coord = explode(',', $_GET['coord']); |
|
107 | 107 | if ($tracker) { |
108 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
108 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
109 | 109 | } elseif ($marine) { |
110 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
110 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
111 | 111 | } else { |
112 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
112 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
113 | 113 | } |
114 | 114 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
115 | 115 | $usecoord = true; |
116 | - $coord = explode(',',$_GET['coord']); |
|
116 | + $coord = explode(',', $_GET['coord']); |
|
117 | 117 | if ($tracker) { |
118 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
118 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
119 | 119 | } elseif ($marine) { |
120 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
120 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
121 | 121 | } else { |
122 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
122 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
123 | 123 | } |
124 | 124 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
125 | 125 | $from_archive = true; |
126 | 126 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
127 | 127 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
128 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
129 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
131 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
132 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
133 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
128 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
129 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
131 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
132 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
133 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
134 | 134 | } elseif ($min) { |
135 | 135 | if ($tracker) { |
136 | 136 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | # $min = true; |
143 | 143 | } else { |
144 | 144 | if ($tracker) { |
145 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
145 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
146 | 146 | } elseif ($marine) { |
147 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
147 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
148 | 148 | } else { |
149 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
149 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | if (!empty($spotter_array) || $usecoord) { |
154 | 154 | if ($usecoord) { |
155 | 155 | if (isset($_GET['archive'])) { |
156 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
156 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
157 | 157 | } else { |
158 | 158 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
159 | 159 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | if ($flightcnt == '') $flightcnt = 0; |
162 | 162 | } else $flightcnt = 0; |
163 | 163 | |
164 | -$sqltime = round(microtime(true)-$begintime,2); |
|
164 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
165 | 165 | |
166 | 166 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
167 | 167 | else $usenextlatlon = true; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if (!empty($spotter_array) && is_array($spotter_array)) |
179 | 179 | { |
180 | 180 | $output .= '"features": ['; |
181 | - foreach($spotter_array as $spotter_item) |
|
181 | + foreach ($spotter_array as $spotter_item) |
|
182 | 182 | { |
183 | 183 | $j++; |
184 | 184 | date_default_timezone_set('UTC'); |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | */ |
235 | 235 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
236 | 236 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
237 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
238 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
237 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
238 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
239 | 239 | //" |
240 | 240 | } else { |
241 | 241 | if ($compress) $output .= '"c": "NA",'; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
245 | 245 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
246 | 246 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
247 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
247 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
248 | 248 | } elseif (isset($spotter_item['aircraft_type'])) { |
249 | 249 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
250 | 250 | } elseif (!$min) { |
@@ -384,16 +384,16 @@ discard block |
||
384 | 384 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
385 | 385 | |
386 | 386 | if (isset($archivespeed)) { |
387 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
387 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
388 | 388 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
389 | 389 | } elseif ($usenextlatlon) { |
390 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
390 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
391 | 391 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
392 | 392 | } |
393 | 393 | |
394 | 394 | if (!$min) $output .= '"image": "'.$image.'",'; |
395 | 395 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
396 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
396 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
397 | 397 | } |
398 | 398 | if (isset($spotter_item['image_source_website'])) { |
399 | 399 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
416 | 416 | } |
417 | 417 | if (isset($spotter_item['acars'])) { |
418 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
418 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
419 | 419 | } |
420 | 420 | // type when not aircraft ? |
421 | 421 | if (isset($spotter_item['type'])) { |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | } |
495 | 495 | */ |
496 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
496 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
497 | 497 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
498 | 498 | |
499 | 499 | if ( |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
502 | 502 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
503 | 503 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
504 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
504 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
505 | 505 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
506 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
506 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
507 | 507 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
508 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
508 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
509 | 509 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
510 | 510 | ) { |
511 | 511 | if ($tracker) { |
@@ -538,9 +538,9 @@ discard block |
||
538 | 538 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
539 | 539 | } |
540 | 540 | $output_history .= '['; |
541 | - $output_history .= $spotter_history['longitude'].', '; |
|
542 | - $output_history .= $spotter_history['latitude'].', '; |
|
543 | - $output_history .= $spotter_history['altitude']*30.48; |
|
541 | + $output_history .= $spotter_history['longitude'].', '; |
|
542 | + $output_history .= $spotter_history['latitude'].', '; |
|
543 | + $output_history .= $spotter_history['altitude']*30.48; |
|
544 | 544 | $output_history .= '],'; |
545 | 545 | /* |
546 | 546 | if ($from_archive === false) { |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
559 | 559 | } else $d = true; |
560 | 560 | $output_history .= '['; |
561 | - $output_history .= $spotter_history['longitude'].', '; |
|
562 | - $output_history .= $spotter_history['latitude']; |
|
561 | + $output_history .= $spotter_history['longitude'].', '; |
|
562 | + $output_history .= $spotter_history['latitude']; |
|
563 | 563 | $output_history .= '],'; |
564 | 564 | /* |
565 | 565 | if ($from_archive === false) { |
@@ -575,9 +575,9 @@ discard block |
||
575 | 575 | |
576 | 576 | if ($from_archive === false) { |
577 | 577 | $output_historyd = '['; |
578 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
579 | - $output_historyd .= $spotter_item['latitude']; |
|
580 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
578 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
579 | + $output_historyd .= $spotter_item['latitude']; |
|
580 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
581 | 581 | $output_historyd .= '],'; |
582 | 582 | //$output_history = $output_historyd.$output_history; |
583 | 583 | $output_history = $output_history.$output_historyd; |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $output = substr($output, 0, -1); |
618 | 618 | $output .= ']'; |
619 | 619 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
620 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
620 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
621 | 621 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
622 | 622 | $output .= '"fc": "'.$j.'"'; |
623 | 623 | } else { |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | * @param String $date get data for a date |
30 | 30 | * @return Array Return Accidents data in array |
31 | 31 | */ |
32 | - public function getAccidentData($limit = '',$type = '',$date = '') { |
|
32 | + public function getAccidentData($limit = '', $type = '', $date = '') { |
|
33 | 33 | global $globalURL, $globalDBdriver; |
34 | 34 | $Image = new Image($this->db); |
35 | 35 | $Spotter = new Spotter($this->db); |
36 | 36 | $Translation = new Translation($this->db); |
37 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
37 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
38 | 38 | date_default_timezone_set('UTC'); |
39 | 39 | $result = array(); |
40 | 40 | $limit_query = ''; |
41 | 41 | if ($limit != "") |
42 | 42 | { |
43 | 43 | $limit_array = explode(",", $limit); |
44 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
45 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
44 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
45 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
46 | 46 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
47 | 47 | { |
48 | 48 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -51,29 +51,29 @@ discard block |
||
51 | 51 | |
52 | 52 | if ($type != '') { |
53 | 53 | if ($date != '') { |
54 | - if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) { |
|
54 | + if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) { |
|
55 | 55 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
56 | 56 | //$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
57 | - $query_values = array(':type' => $type,':date' => $date); |
|
58 | - } elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/",$date)) { |
|
57 | + $query_values = array(':type' => $type, ':date' => $date); |
|
58 | + } elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/", $date)) { |
|
59 | 59 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date BETWEEN :dated AND :datef GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
60 | - $query_values = array(':type' => $type,':dated' => $date.'-01', ':datef' => $date.'-31'); |
|
61 | - } elseif (preg_match("/^[0-9]{4}$/",$date)) { |
|
60 | + $query_values = array(':type' => $type, ':dated' => $date.'-01', ':datef' => $date.'-31'); |
|
61 | + } elseif (preg_match("/^[0-9]{4}$/", $date)) { |
|
62 | 62 | if ($globalDBdriver == 'mysql') { |
63 | 63 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND YEAR(date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
64 | 64 | } else { |
65 | 65 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND EXTRACT(YEAR FROM date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
66 | 66 | } |
67 | - $query_values = array(':type' => $type,':date' => $date); |
|
67 | + $query_values = array(':type' => $type, ':date' => $date); |
|
68 | 68 | } else { |
69 | 69 | $date = $date.'%'; |
70 | 70 | if ($globalDBdriver == 'mysql') { |
71 | 71 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND DATE_FORMAT(date,'%Y-%m-%d') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
72 | - $query_values = array(':type' => $type,':date' => $date); |
|
72 | + $query_values = array(':type' => $type, ':date' => $date); |
|
73 | 73 | } else { |
74 | 74 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
75 | 75 | //$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
76 | - $query_values = array(':type' => $type,':date' => $date); |
|
76 | + $query_values = array(':type' => $type, ':date' => $date); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | } else { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | } else { |
85 | 85 | if ($date != '') { |
86 | - if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) { |
|
86 | + if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) { |
|
87 | 87 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
88 | 88 | //$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
89 | 89 | } else { |
@@ -102,19 +102,19 @@ discard block |
||
102 | 102 | try { |
103 | 103 | $sth = $this->db->prepare($query); |
104 | 104 | $sth->execute($query_values); |
105 | - } catch(PDOException $e) { |
|
105 | + } catch (PDOException $e) { |
|
106 | 106 | echo "error : ".$e->getMessage(); |
107 | 107 | } |
108 | 108 | $i = 0; |
109 | 109 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
110 | 110 | //print_r($row); |
111 | 111 | //echo $row['flightaware_id']; |
112 | - if (preg_match('/^[\w\-]+$/',$row['registration'])) { |
|
112 | + if (preg_match('/^[\w\-]+$/', $row['registration'])) { |
|
113 | 113 | $data = array(); |
114 | 114 | if ($row['registration'] != '') { |
115 | 115 | $image_array = $Image->getSpotterImage($row['registration']); |
116 | - 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'])); |
|
117 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
116 | + 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'])); |
|
117 | + else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
118 | 118 | $aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']); |
119 | 119 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
120 | 120 | if (!empty($aircraft_info)) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $data['aircraft_name'] = $aircraft_info[0]['type']; |
123 | 123 | $data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer']; |
124 | 124 | } else { |
125 | - $data = array_merge($data,array('aircraft_type' => 'NA')); |
|
125 | + $data = array_merge($data, array('aircraft_type' => 'NA')); |
|
126 | 126 | } |
127 | 127 | $owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']); |
128 | 128 | if (!empty($owner_data)) { |
@@ -130,18 +130,18 @@ discard block |
||
130 | 130 | $data['aircraft_base'] = $owner_data['base']; |
131 | 131 | $data['aircraft_date_first_reg'] = $owner_data['date_first_reg']; |
132 | 132 | } |
133 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
133 | + } else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
134 | 134 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
135 | 135 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
136 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3)); |
|
136 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 3)); |
|
137 | 137 | if (isset($identicao[0])) { |
138 | - if (substr($row['ident'],0,2) == 'AF') { |
|
139 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
140 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
141 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
142 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
138 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
139 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
140 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
141 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
142 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
143 | 143 | } else $icao = $row['ident']; |
144 | - $icao = $Translation->checkTranslation($icao,false); |
|
144 | + $icao = $Translation->checkTranslation($icao, false); |
|
145 | 145 | //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url'])); |
146 | 146 | if ($row['airline_name'] != '' && !isset($data['airline_name'])) { |
147 | 147 | //echo 'Check airline info... for '.$row['airline_name'].' '; |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | if (!empty($airline_info)) { |
151 | 151 | //echo 'data found !'."\n"; |
152 | 152 | //print_r($airline_info); |
153 | - $data = array_merge($data,$airline_info); |
|
153 | + $data = array_merge($data, $airline_info); |
|
154 | 154 | } |
155 | 155 | //else echo 'No data...'."\n"; |
156 | 156 | } |
157 | - $data = array_merge($row,$data); |
|
157 | + $data = array_merge($row, $data); |
|
158 | 158 | if ($data['ident'] == null) $data['ident'] = $icao; |
159 | 159 | if ($data['title'] == null) { |
160 | 160 | $data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country']; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | try { |
191 | 191 | $sth = $this->db->prepare($query); |
192 | 192 | $sth->execute(); |
193 | - } catch(PDOException $e) { |
|
193 | + } catch (PDOException $e) { |
|
194 | 194 | echo "Error : ".$e->getMessage(); |
195 | 195 | } |
196 | 196 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | try { |
211 | 211 | $sth = $this->db->prepare($query); |
212 | 212 | $sth->execute(); |
213 | - } catch(PDOException $e) { |
|
213 | + } catch (PDOException $e) { |
|
214 | 214 | echo "Error : ".$e->getMessage(); |
215 | 215 | } |
216 | 216 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -225,15 +225,15 @@ discard block |
||
225 | 225 | if ($globalDebug) echo 'Import '.$file."\n"; |
226 | 226 | $result = array(); |
227 | 227 | if (file_exists($file)) { |
228 | - if (($handle = fopen($file,'r')) !== FALSE) { |
|
229 | - while (($data = fgetcsv($handle,2000,",")) !== FALSE) { |
|
228 | + if (($handle = fopen($file, 'r')) !== FALSE) { |
|
229 | + while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) { |
|
230 | 230 | if (isset($data[1]) && $data[1] != '0000-00-00 00:00:00') { |
231 | - $result[] = array('registration' => $data[0],'date' => strtotime($data[1]),'url' => $data[2],'country' => $data[3],'place' => $data[4],'title' => $data[5],'fatalities' => $data[6],'latitude' => $data[7],'longitude' => $data[8],'type' => $data[9],'ident' => $data[10],'aircraft_manufacturer' => $data[11],'aircraft_name' => $data[12],'operator' => $data[13],'source' => 'website_fam'); |
|
231 | + $result[] = array('registration' => $data[0], 'date' => strtotime($data[1]), 'url' => $data[2], 'country' => $data[3], 'place' => $data[4], 'title' => $data[5], 'fatalities' => $data[6], 'latitude' => $data[7], 'longitude' => $data[8], 'type' => $data[9], 'ident' => $data[10], 'aircraft_manufacturer' => $data[11], 'aircraft_name' => $data[12], 'operator' => $data[13], 'source' => 'website_fam'); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | fclose($handle); |
235 | 235 | } |
236 | - if (!empty($result)) $this->add($result,true); |
|
236 | + if (!empty($result)) $this->add($result, true); |
|
237 | 237 | elseif ($globalDebug) echo 'Nothing to import'; |
238 | 238 | } |
239 | 239 | } |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | $all_md5_new = array(); |
250 | 250 | if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) { |
251 | 251 | if ($this->check_accidents_nb() > 0) { |
252 | - if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) { |
|
253 | - while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) { |
|
252 | + if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) { |
|
253 | + while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) { |
|
254 | 254 | if (isset($data[1])) { |
255 | 255 | $year = $data[0]; |
256 | 256 | $all_md5[$year] = $data[1]; |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | } |
261 | 261 | } |
262 | 262 | } |
263 | - $Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5',dirname(__FILE__).'/../install/tmp/cr-all.md5'); |
|
263 | + $Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5', dirname(__FILE__).'/../install/tmp/cr-all.md5'); |
|
264 | 264 | if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) { |
265 | - if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) { |
|
266 | - while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) { |
|
265 | + if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) { |
|
266 | + while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) { |
|
267 | 267 | if (isset($data[1])) { |
268 | 268 | $year = $data[0]; |
269 | 269 | $all_md5_new[$year] = $data[1]; |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | fclose($handle); |
273 | 273 | } elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
274 | 274 | } elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
275 | - $result = $Common->arr_diff($all_md5_new,$all_md5); |
|
275 | + $result = $Common->arr_diff($all_md5_new, $all_md5); |
|
276 | 276 | if (empty($result) && $globalDebug) echo 'Nothing to update'; |
277 | 277 | foreach ($result as $file => $md5) { |
278 | - $Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file); |
|
278 | + $Common->download('http://data.flightairmap.fr/data/cr/'.$file, dirname(__FILE__).'/../install/tmp/'.$file); |
|
279 | 279 | if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
280 | 280 | elseif ($globalDebug) echo 'Download '.$file.' failed'; |
281 | 281 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * Add data to DB |
286 | 286 | * @param Array $crash An array with accidents/incidents data |
287 | 287 | */ |
288 | - public function add($crash,$new = false) { |
|
288 | + public function add($crash, $new = false) { |
|
289 | 289 | global $globalTransaction, $globalDebug; |
290 | 290 | require_once('class.Connection.php'); |
291 | 291 | require_once('class.Image.php'); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $sthd->execute(array(':source' => $crash[0]['source'])); |
302 | 302 | } |
303 | 303 | if ($globalTransaction) $Connection->db->beginTransaction(); |
304 | - $initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null); |
|
304 | + $initial_array = array('ident' => null, 'type' => 'accident', 'url' => null, 'registration' => null, 'date' => null, 'place' => null, 'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '', 'source' => '', 'aircraft_manufacturer' => null, 'aircraft_name' => null, 'operator' => null); |
|
305 | 305 | $query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source'; |
306 | 306 | $sth_check = $Connection->db->prepare($query_check); |
307 | 307 | $query = 'INSERT INTO accidents (aircraft_manufacturer,aircraft_name,ident,registration,date,url,country,place,title,fatalities,latitude,longitude,type,airline_name,source) VALUES (:aircraft_manufacturer,:aircraft_name,:ident,:registration,:date,:url,:country,:place,:title,:fatalities,:latitude,:longitude,:type,:airline_name,:source)'; |
@@ -314,31 +314,31 @@ discard block |
||
314 | 314 | $cr = array_map(function($value) { |
315 | 315 | return $value === "" ? NULL : $value; |
316 | 316 | }, $cr); |
317 | - if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) { |
|
318 | - if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
319 | - $query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']); |
|
317 | + if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/', $cr['registration'])) { |
|
318 | + if (strpos($cr['registration'], '-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
319 | + $query_check_values = array(':registration' => $cr['registration'], ':date' => date('Y-m-d', $cr['date']), ':type' => $cr['type'], ':source' => $cr['source']); |
|
320 | 320 | $sth_check->execute($query_check_values); |
321 | 321 | $result_check = $sth_check->fetch(PDO::FETCH_ASSOC); |
322 | 322 | if ($result_check['nb'] == 0) { |
323 | - $query_values = array(':registration' => trim($cr['registration']),':date' => date('Y-m-d',$cr['date']),':url' => $cr['url'],':country' => $cr['country'],':place' => $cr['place'],':title' => $cr['title'],':fatalities' => $cr['fatalities'],':latitude' => $cr['latitude'],':longitude' => $cr['longitude'],':type' => $cr['type'],':source' => $cr['source'],':ident' => $cr['ident'],':aircraft_manufacturer' => $cr['aircraft_manufacturer'],':aircraft_name' => $cr['aircraft_name'],':airline_name' => $cr['operator']); |
|
323 | + $query_values = array(':registration' => trim($cr['registration']), ':date' => date('Y-m-d', $cr['date']), ':url' => $cr['url'], ':country' => $cr['country'], ':place' => $cr['place'], ':title' => $cr['title'], ':fatalities' => $cr['fatalities'], ':latitude' => $cr['latitude'], ':longitude' => $cr['longitude'], ':type' => $cr['type'], ':source' => $cr['source'], ':ident' => $cr['ident'], ':aircraft_manufacturer' => $cr['aircraft_manufacturer'], ':aircraft_name' => $cr['aircraft_name'], ':airline_name' => $cr['operator']); |
|
324 | 324 | $sth->execute($query_values); |
325 | - if ($cr['date'] > time()-(30*86400)) { |
|
325 | + if ($cr['date'] > time() - (30*86400)) { |
|
326 | 326 | if (empty($Image->getSpotterImage($cr['registration']))) { |
327 | 327 | //if ($globalDebug) echo 'Get image...'."\n"; |
328 | 328 | $Image->addSpotterImage($cr['registration']); |
329 | 329 | } |
330 | 330 | // elseif ($globalDebug) echo 'Image already in DB'."\n"; |
331 | 331 | } |
332 | - $Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date'])); |
|
332 | + $Spotter->setHighlightFlightByRegistration($cr['registration'], $cr['title'], date('Y-m-d', $cr['date'])); |
|
333 | 333 | } |
334 | 334 | } |
335 | - if ($globalTransaction && $j % 1000 == 0) { |
|
335 | + if ($globalTransaction && $j%1000 == 0) { |
|
336 | 336 | $Connection->db->commit(); |
337 | 337 | $Connection->db->beginTransaction(); |
338 | 338 | } |
339 | 339 | } |
340 | 340 | if ($globalTransaction) $Connection->db->commit(); |
341 | - } catch(PDOException $e) { |
|
341 | + } catch (PDOException $e) { |
|
342 | 342 | if ($globalTransaction) $Connection->db->rollBack(); |
343 | 343 | echo $e->getMessage(); |
344 | 344 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $Connection = new Connection(); |
357 | 357 | $sth = $Connection->db->prepare($query); |
358 | 358 | $sth->execute(); |
359 | - } catch(PDOException $e) { |
|
359 | + } catch (PDOException $e) { |
|
360 | 360 | return "error : ".$e->getMessage(); |
361 | 361 | } |
362 | 362 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $Connection = new Connection(); |
375 | 375 | $sth = $Connection->db->prepare($query); |
376 | 376 | $sth->execute(); |
377 | - } catch(PDOException $e) { |
|
377 | + } catch (PDOException $e) { |
|
378 | 378 | return "error : ".$e->getMessage(); |
379 | 379 | } |
380 | 380 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $Connection = new Connection(); |
390 | 390 | $sth = $Connection->db->prepare($query); |
391 | 391 | $sth->execute(); |
392 | - } catch(PDOException $e) { |
|
392 | + } catch (PDOException $e) { |
|
393 | 393 | return "error : ".$e->getMessage(); |
394 | 394 | } |
395 | 395 | } |
@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | |
10 | 10 | $from_archive = false; |
11 | 11 | if (isset($_GET['ident'])) { |
12 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
13 | 13 | if (isset($_GET['currenttime'])) { |
14 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
14 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
15 | 15 | $currenttime = round($currenttime/1000); |
16 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime); |
|
16 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime); |
|
17 | 17 | if (empty($spotter_array)) { |
18 | 18 | $from_archive = true; |
19 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime); |
|
19 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime); |
|
20 | 20 | } |
21 | 21 | } else { |
22 | 22 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | if (isset($_GET['flightaware_id'])) { |
30 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
30 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
31 | 31 | if (isset($_GET['currenttime'])) { |
32 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
32 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
33 | 33 | $currenttime = round($currenttime/1000); |
34 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime); |
|
34 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime); |
|
35 | 35 | if (empty($spotter_array)) { |
36 | 36 | $from_archive = true; |
37 | 37 | // $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
38 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime); |
|
38 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime); |
|
39 | 39 | } |
40 | 40 | } else { |
41 | 41 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
55 | 55 | { |
56 | 56 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
57 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
57 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
58 | 58 | } else $image = $spotter_item['image_thumbnail']; |
59 | 59 | |
60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
73 | 73 | if (isset($spotter_item['departure_airport_time'])) { |
74 | 74 | if ($spotter_item['departure_airport_time'] > 2460) { |
75 | - print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>'; |
|
75 | + print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>'; |
|
76 | 76 | } else { |
77 | 77 | print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>'; |
78 | 78 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country']; |
82 | 82 | if (isset($spotter_item['arrival_airport_time'])) { |
83 | 83 | if ($spotter_item['arrival_airport_time'] > 2460) { |
84 | - print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>'; |
|
84 | + print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>'; |
|
85 | 85 | } else { |
86 | 86 | print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>'; |
87 | 87 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
153 | 153 | if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
154 | -if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
154 | +if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>'; |
|
155 | 155 | if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
156 | 156 | print '</div>'; |
157 | 157 | ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | require_once(dirname(__FILE__).'/class.create_db.php'); |
11 | 11 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
12 | 12 | require_once(dirname(__FILE__).'/class.settings.php'); |
13 | -$title="Install"; |
|
13 | +$title = "Install"; |
|
14 | 14 | require(dirname(__FILE__).'/../require/settings.php'); |
15 | 15 | require(dirname(__FILE__).'/header.php'); |
16 | 16 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | if (!extension_loaded('curl')) { |
70 | 70 | $error[] = "Curl is not loaded."; |
71 | 71 | } |
72 | -if(function_exists('apache_get_modules') ){ |
|
73 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
72 | +if (function_exists('apache_get_modules')) { |
|
73 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
74 | 74 | $error[] = "mod_rewrite is not available."; |
75 | 75 | } |
76 | 76 | /* |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
87 | 87 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
88 | 88 | if (function_exists('get_headers')) { |
89 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
90 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
89 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
90 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
91 | 91 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
92 | 92 | } |
93 | 93 | } |
@@ -441,13 +441,13 @@ discard block |
||
441 | 441 | ?> |
442 | 442 | <tr> |
443 | 443 | <?php |
444 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
444 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
445 | 445 | ?> |
446 | 446 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
447 | 447 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
448 | 448 | <?php |
449 | 449 | } else { |
450 | - $hostport = explode(':',$source['host']); |
|
450 | + $hostport = explode(':', $source['host']); |
|
451 | 451 | if (isset($hostport[1])) { |
452 | 452 | $host = $hostport[0]; |
453 | 453 | $port = $hostport[1]; |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | <br /> |
792 | 792 | <p> |
793 | 793 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
794 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
794 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
795 | 795 | </p> |
796 | 796 | <br /> |
797 | 797 | <p> |
@@ -842,14 +842,14 @@ discard block |
||
842 | 842 | $error = ''; |
843 | 843 | |
844 | 844 | if (isset($_POST['dbtype'])) { |
845 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
846 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
847 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
848 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
849 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
850 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
851 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
852 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
845 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
846 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
847 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
848 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
849 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
850 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
851 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
852 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
853 | 853 | |
854 | 854 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
855 | 855 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -869,48 +869,48 @@ discard block |
||
869 | 869 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
870 | 870 | */ |
871 | 871 | |
872 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
872 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
873 | 873 | |
874 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
875 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
876 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
877 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
878 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
874 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
875 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
876 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
877 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
878 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
879 | 879 | |
880 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
881 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
882 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
883 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
884 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
885 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
886 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
887 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
888 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey)); |
|
880 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
881 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
882 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
883 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
884 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
885 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
886 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
887 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
888 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey)); |
|
889 | 889 | |
890 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
891 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
892 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
893 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
894 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
895 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
890 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
891 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
892 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
893 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
894 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
895 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
896 | 896 | |
897 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
898 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
897 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
898 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
899 | 899 | |
900 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
901 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
902 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
900 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
901 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
902 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
903 | 903 | |
904 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
904 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
905 | 905 | if ($acars == 'acars') { |
906 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
906 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
907 | 907 | } else { |
908 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
908 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
909 | 909 | } |
910 | 910 | |
911 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
912 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
913 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
911 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
912 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
913 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
914 | 914 | |
915 | 915 | $source_name = $_POST['source_name']; |
916 | 916 | $source_latitude = $_POST['source_latitude']; |
@@ -924,8 +924,8 @@ discard block |
||
924 | 924 | |
925 | 925 | $sources = array(); |
926 | 926 | foreach ($source_name as $keys => $name) { |
927 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
928 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
927 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
928 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
929 | 929 | } |
930 | 930 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
931 | 931 | |
@@ -938,24 +938,24 @@ discard block |
||
938 | 938 | $sbsurl = $_POST['sbsurl']; |
939 | 939 | */ |
940 | 940 | |
941 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
942 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
943 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
944 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
945 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
946 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
947 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
948 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
941 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
942 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
943 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
944 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
945 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
946 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
947 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
948 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
949 | 949 | |
950 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
951 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
952 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
953 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
954 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
955 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
956 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
957 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
958 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
950 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
951 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
952 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
953 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
954 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
955 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
956 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
957 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
958 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
959 | 959 | |
960 | 960 | /* |
961 | 961 | $globalSBS1Hosts = array(); |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | } |
972 | 972 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
973 | 973 | */ |
974 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
974 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
975 | 975 | $host = $_POST['host']; |
976 | 976 | $port = $_POST['port']; |
977 | 977 | $name = $_POST['name']; |
@@ -986,96 +986,96 @@ discard block |
||
986 | 986 | else $cov = 'FALSE'; |
987 | 987 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
988 | 988 | else $arch = 'FALSE'; |
989 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch); |
|
989 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch); |
|
990 | 990 | } |
991 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
991 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
992 | 992 | |
993 | 993 | /* |
994 | 994 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
995 | 995 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
996 | 996 | */ |
997 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
998 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
999 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
997 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
998 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
999 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1000 | 1000 | |
1001 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1002 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1001 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1002 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1003 | 1003 | |
1004 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1005 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1006 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1007 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1004 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1005 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1006 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1007 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1008 | 1008 | |
1009 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1010 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1011 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1009 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1010 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1011 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1012 | 1012 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1013 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1014 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1013 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1014 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1015 | 1015 | |
1016 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1017 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1018 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1019 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1020 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1021 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1022 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1023 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1016 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1017 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1018 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1019 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1020 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1021 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1022 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1023 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1024 | 1024 | |
1025 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1026 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1025 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1026 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1027 | 1027 | |
1028 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1029 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1028 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1029 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1030 | 1030 | |
1031 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1031 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1032 | 1032 | if ($archiveyear == "archiveyear") { |
1033 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1033 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1034 | 1034 | } else { |
1035 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1035 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1036 | 1036 | } |
1037 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1038 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1039 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1040 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1037 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1038 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1039 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1040 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1041 | 1041 | |
1042 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1043 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1044 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1045 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1042 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1043 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1044 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1045 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1046 | 1046 | |
1047 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1048 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1049 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1047 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1048 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1049 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1050 | 1050 | |
1051 | 1051 | // Create in settings.php keys not yet configurable if not already here |
1052 | 1052 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1053 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1053 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1054 | 1054 | |
1055 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1055 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1056 | 1056 | if ($resetyearstats == 'resetyearstats') { |
1057 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1057 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1058 | 1058 | } else { |
1059 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1059 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1062 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1063 | 1063 | if ($archive == 'archive') { |
1064 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1064 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1065 | 1065 | } else { |
1066 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1066 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1067 | 1067 | } |
1068 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1068 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1069 | 1069 | if ($daemon == 'daemon') { |
1070 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1070 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1071 | 1071 | } else { |
1072 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1072 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1073 | 1073 | } |
1074 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1074 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1075 | 1075 | if ($schedules == 'schedules') { |
1076 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1076 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1077 | 1077 | } else { |
1078 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1078 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | /* |
@@ -1086,195 +1086,195 @@ discard block |
||
1086 | 1086 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1087 | 1087 | } |
1088 | 1088 | */ |
1089 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1090 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1091 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1092 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1093 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1089 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1090 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1091 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1092 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1093 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1094 | 1094 | $va = false; |
1095 | 1095 | if ($globalivao == 'ivao') { |
1096 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1096 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1097 | 1097 | $va = true; |
1098 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1098 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1099 | 1099 | if ($globalvatsim == 'vatsim') { |
1100 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1100 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1101 | 1101 | $va = true; |
1102 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1102 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1103 | 1103 | if ($globalphpvms == 'phpvms') { |
1104 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1104 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1105 | 1105 | $va = true; |
1106 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1106 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1107 | 1107 | if ($globalvam == 'vam') { |
1108 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1108 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1109 | 1109 | $va = true; |
1110 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1110 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1111 | 1111 | if ($va) { |
1112 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1113 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1112 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1113 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1114 | 1114 | if ($globalva == 'va' || $va) { |
1115 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1116 | - } else $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1115 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1116 | + } else $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1117 | 1117 | |
1118 | 1118 | |
1119 | 1119 | |
1120 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1120 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1121 | 1121 | if ($notam == 'notam') { |
1122 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1122 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1123 | 1123 | } else { |
1124 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1124 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1125 | 1125 | } |
1126 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1126 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1127 | 1127 | if ($owner == 'owner') { |
1128 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1128 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1129 | 1129 | } else { |
1130 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1130 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1131 | 1131 | } |
1132 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1132 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1133 | 1133 | if ($map3d == 'map3d') { |
1134 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1134 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1135 | 1135 | } else { |
1136 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1136 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1137 | 1137 | } |
1138 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1138 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1139 | 1139 | if ($crash == 'crash') { |
1140 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1140 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1141 | 1141 | } else { |
1142 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1142 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1143 | 1143 | } |
1144 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1144 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1145 | 1145 | if ($mapsatellites == 'mapsatellites') { |
1146 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1146 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1147 | 1147 | } else { |
1148 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1148 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1149 | 1149 | } |
1150 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1150 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1151 | 1151 | if ($map3ddefault == 'map3ddefault') { |
1152 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1152 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1153 | 1153 | } else { |
1154 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1154 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1155 | 1155 | } |
1156 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1156 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1157 | 1157 | if ($translate == 'translate') { |
1158 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1158 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1159 | 1159 | } else { |
1160 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1160 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1161 | 1161 | } |
1162 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1162 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1163 | 1163 | if ($realairlines == 'realairlines') { |
1164 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1164 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1165 | 1165 | } else { |
1166 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1166 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1167 | 1167 | } |
1168 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1168 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1169 | 1169 | if ($estimation == 'estimation') { |
1170 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1170 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1171 | 1171 | } else { |
1172 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1172 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1173 | 1173 | } |
1174 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1174 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1175 | 1175 | if ($metar == 'metar') { |
1176 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1176 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1177 | 1177 | } else { |
1178 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1178 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1179 | 1179 | } |
1180 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1180 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1181 | 1181 | if ($metarcycle == 'metarcycle') { |
1182 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1182 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1183 | 1183 | } else { |
1184 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1184 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1185 | 1185 | } |
1186 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1186 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1187 | 1187 | if ($fork == 'fork') { |
1188 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1188 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1189 | 1189 | } else { |
1190 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1190 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1193 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1194 | 1194 | if ($colormap == 'colormap') { |
1195 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1195 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1196 | 1196 | } else { |
1197 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1197 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | if (isset($_POST['aircrafticoncolor'])) { |
1201 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1202 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1201 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1202 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1206 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1205 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1206 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1207 | 1207 | |
1208 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1209 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1210 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1211 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1212 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1213 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1208 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1209 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1210 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1211 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1212 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1213 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1214 | 1214 | |
1215 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1215 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1216 | 1216 | if ($mappopup == 'mappopup') { |
1217 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1217 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1218 | 1218 | } else { |
1219 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1219 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1220 | 1220 | } |
1221 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1221 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1222 | 1222 | if ($airportpopup == 'airportpopup') { |
1223 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1223 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1224 | 1224 | } else { |
1225 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1225 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1226 | 1226 | } |
1227 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1227 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1228 | 1228 | if ($maphistory == 'maphistory') { |
1229 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1229 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1230 | 1230 | } else { |
1231 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1231 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1232 | 1232 | } |
1233 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1233 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1234 | 1234 | if ($flightroute == 'flightroute') { |
1235 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1235 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1236 | 1236 | } else { |
1237 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1237 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1238 | 1238 | } |
1239 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1239 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1240 | 1240 | if ($allflights == 'allflights') { |
1241 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1241 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1242 | 1242 | } else { |
1243 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1243 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1244 | 1244 | } |
1245 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1245 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1246 | 1246 | if ($bbox == 'bbox') { |
1247 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1247 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1248 | 1248 | } else { |
1249 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1249 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1250 | 1250 | } |
1251 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1251 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1252 | 1252 | if ($waypoints == 'waypoints') { |
1253 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1253 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1254 | 1254 | } else { |
1255 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1255 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1256 | 1256 | } |
1257 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1257 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1258 | 1258 | if ($noairlines == 'noairlines') { |
1259 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1259 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1260 | 1260 | } else { |
1261 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1261 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1262 | 1262 | } |
1263 | 1263 | |
1264 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1264 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1265 | 1265 | |
1266 | 1266 | // Set some defaults values... |
1267 | 1267 | if (!isset($globalAircraftImageSources)) { |
1268 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1269 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1268 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1269 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1270 | 1270 | } |
1271 | 1271 | |
1272 | 1272 | if (!isset($globalSchedulesSources)) { |
1273 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1274 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1273 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1274 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1277 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1278 | 1278 | |
1279 | 1279 | if ($error == '') settings::modify_settings($settings); |
1280 | 1280 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once(dirname(__FILE__).'/settings.php'); |
3 | 3 | |
4 | -class Connection{ |
|
4 | +class Connection { |
|
5 | 5 | public $db = null; |
6 | 6 | public $dbs = array(); |
7 | 7 | public $latest_schema = 39; |
8 | 8 | |
9 | - public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
|
9 | + public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) { |
|
10 | 10 | global $globalDBdriver, $globalNoDB; |
11 | 11 | if (isset($globalNoDB) && $globalNoDB === TRUE) { |
12 | 12 | $this->db = null; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | if ($user === null && $pass === null) { |
17 | 17 | $this->createDBConnection(); |
18 | 18 | } else { |
19 | - $this->createDBConnection(null,$user,$pass); |
|
19 | + $this->createDBConnection(null, $user, $pass); |
|
20 | 20 | } |
21 | 21 | } else { |
22 | 22 | $this->createDBConnection($dbname); |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | while (true) { |
101 | 101 | try { |
102 | 102 | if ($globalDBSdriver == 'mysql') { |
103 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
103 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
104 | 104 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
105 | 105 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
106 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
107 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
108 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
109 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
110 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
106 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
107 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
108 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
109 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
110 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
111 | 111 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
112 | 112 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
113 | 113 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -117,19 +117,19 @@ discard block |
||
117 | 117 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
118 | 118 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
119 | 119 | } else { |
120 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
120 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
121 | 121 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
122 | 122 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
123 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
124 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
125 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
126 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
127 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
123 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
124 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
125 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
126 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
127 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
128 | 128 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
129 | 129 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
130 | 130 | } |
131 | 131 | break; |
132 | - } catch(PDOException $e) { |
|
132 | + } catch (PDOException $e) { |
|
133 | 133 | $i++; |
134 | 134 | if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
135 | 135 | //exit; |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | try { |
154 | 154 | //$Connection = new Connection(); |
155 | 155 | $results = $this->db->query($query); |
156 | - } catch(PDOException $e) { |
|
156 | + } catch (PDOException $e) { |
|
157 | 157 | return false; |
158 | 158 | } |
159 | - if($results->rowCount()>0) { |
|
159 | + if ($results->rowCount() > 0) { |
|
160 | 160 | return true; |
161 | 161 | } |
162 | 162 | else return false; |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | return false; |
178 | 178 | } |
179 | 179 | |
180 | - } catch(PDOException $e) { |
|
181 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
180 | + } catch (PDOException $e) { |
|
181 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
182 | 182 | throw $e; |
183 | 183 | } |
184 | 184 | //echo 'error ! '.$e->getMessage(); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | /* |
191 | 191 | * Check if index exist |
192 | 192 | */ |
193 | - public function indexExists($table,$index) |
|
193 | + public function indexExists($table, $index) |
|
194 | 194 | { |
195 | 195 | global $globalDBdriver, $globalDBname; |
196 | 196 | if ($globalDBdriver == 'mysql') { |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | try { |
202 | 202 | //$Connection = new Connection(); |
203 | 203 | $results = $this->db->query($query); |
204 | - } catch(PDOException $e) { |
|
204 | + } catch (PDOException $e) { |
|
205 | 205 | return false; |
206 | 206 | } |
207 | 207 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
208 | - if($nb[0]['nb'] > 0) { |
|
208 | + if ($nb[0]['nb'] > 0) { |
|
209 | 209 | return true; |
210 | 210 | } |
211 | 211 | else return false; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
221 | 221 | try { |
222 | 222 | $results = $this->db->query($query); |
223 | - } catch(PDOException $e) { |
|
223 | + } catch (PDOException $e) { |
|
224 | 224 | return "error : ".$e->getMessage()."\n"; |
225 | 225 | } |
226 | 226 | $columns = array(); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | return $columns; |
233 | 233 | } |
234 | 234 | |
235 | - public function getColumnType($table,$column) { |
|
235 | + public function getColumnType($table, $column) { |
|
236 | 236 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
237 | 237 | $tomet = $select->getColumnMeta(0); |
238 | 238 | return $tomet['native_type']; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * Check if a column name exist in a table |
243 | 243 | * @return Boolean column exist or not |
244 | 244 | */ |
245 | - public function checkColumnName($table,$name) |
|
245 | + public function checkColumnName($table, $name) |
|
246 | 246 | { |
247 | 247 | global $globalDBdriver, $globalDBname; |
248 | 248 | if ($globalDBdriver == 'mysql') { |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | } |
253 | 253 | try { |
254 | 254 | $sth = $this->db()->prepare($query); |
255 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
256 | - } catch(PDOException $e) { |
|
255 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
256 | + } catch (PDOException $e) { |
|
257 | 257 | echo "error : ".$e->getMessage()."\n"; |
258 | 258 | } |
259 | 259 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | try { |
293 | 293 | $sth = $this->db->prepare($query); |
294 | 294 | $sth->execute(); |
295 | - } catch(PDOException $e) { |
|
295 | + } catch (PDOException $e) { |
|
296 | 296 | return "error : ".$e->getMessage()."\n"; |
297 | 297 | } |
298 | 298 | $result = $sth->fetch(PDO::FETCH_ASSOC); |