@@ -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) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)'; |
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); |
|
308 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file); |
|
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) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source)'; |
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); |
|
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); |
|
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; |
400 | 400 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
401 | 401 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -403,11 +403,11 @@ 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 | |
410 | - if ($fh = fopen($database_file,"r")) { |
|
410 | + if ($fh = fopen($database_file, "r")) { |
|
411 | 411 | //$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)'; |
412 | 412 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
413 | 413 | |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | $sth_dest = $Connection->db->prepare($query_dest); |
416 | 416 | try { |
417 | 417 | if ($globalTransaction) $Connection->db->beginTransaction(); |
418 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
418 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
419 | 419 | while (!feof($fh)) { |
420 | - $line = fgetcsv($fh,9999,',','"'); |
|
420 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
421 | 421 | $values = array(); |
422 | 422 | //print_r($line); |
423 | 423 | if ($country == 'F') { |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | $values['base'] = $line[4]; |
426 | 426 | $values['owner'] = $line[5]; |
427 | 427 | if ($line[6] == '') $values['date_first_reg'] = null; |
428 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
428 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
429 | 429 | $values['cancel'] = $line[7]; |
430 | 430 | } elseif ($country == 'EI') { |
431 | 431 | // TODO : add modeS & reg to aircraft_modes |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $values['base'] = $line[3]; |
434 | 434 | $values['owner'] = $line[2]; |
435 | 435 | if ($line[1] == '') $values['date_first_reg'] = null; |
436 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
436 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
437 | 437 | $values['cancel'] = ''; |
438 | 438 | } elseif ($country == 'HB') { |
439 | 439 | // TODO : add modeS & reg to aircraft_modes |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $values['base'] = null; |
449 | 449 | $values['owner'] = $line[5]; |
450 | 450 | if ($line[18] == '') $values['date_first_reg'] = null; |
451 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
451 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
452 | 452 | $values['cancel'] = ''; |
453 | 453 | } elseif ($country == 'VH') { |
454 | 454 | // TODO : add modeS & reg to aircraft_modes |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $values['base'] = null; |
457 | 457 | $values['owner'] = $line[12]; |
458 | 458 | if ($line[28] == '') $values['date_first_reg'] = null; |
459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
459 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
460 | 460 | |
461 | 461 | $values['cancel'] = $line[39]; |
462 | 462 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -476,28 +476,28 @@ discard block |
||
476 | 476 | $values['base'] = null; |
477 | 477 | $values['owner'] = $line[8]; |
478 | 478 | if ($line[7] == '') $values['date_first_reg'] = null; |
479 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
479 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
480 | 480 | $values['cancel'] = ''; |
481 | 481 | } elseif ($country == 'PP') { |
482 | 482 | $values['registration'] = $line[0]; |
483 | 483 | $values['base'] = null; |
484 | 484 | $values['owner'] = $line[4]; |
485 | 485 | if ($line[6] == '') $values['date_first_reg'] = null; |
486 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
486 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
487 | 487 | $values['cancel'] = $line[7]; |
488 | 488 | } elseif ($country == 'E7') { |
489 | 489 | $values['registration'] = $line[0]; |
490 | 490 | $values['base'] = null; |
491 | 491 | $values['owner'] = $line[4]; |
492 | 492 | if ($line[5] == '') $values['date_first_reg'] = null; |
493 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
493 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
494 | 494 | $values['cancel'] = ''; |
495 | 495 | } elseif ($country == '8Q') { |
496 | 496 | $values['registration'] = $line[0]; |
497 | 497 | $values['base'] = null; |
498 | 498 | $values['owner'] = $line[3]; |
499 | 499 | if ($line[7] == '') $values['date_first_reg'] = null; |
500 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
500 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
501 | 501 | $values['cancel'] = ''; |
502 | 502 | } elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
503 | 503 | $values['registration'] = $line[0]; |
@@ -507,12 +507,12 @@ discard block |
||
507 | 507 | $values['cancel'] = ''; |
508 | 508 | } |
509 | 509 | if ($values['cancel'] == '' && $values['registration'] != null) { |
510 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
510 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
511 | 511 | $sth_dest->execute($query_dest_values); |
512 | 512 | } |
513 | 513 | } |
514 | 514 | if ($globalTransaction) $Connection->db->commit(); |
515 | - } catch(PDOException $e) { |
|
515 | + } catch (PDOException $e) { |
|
516 | 516 | return "error : ".$e->getMessage(); |
517 | 517 | } |
518 | 518 | } |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | $Connection = new Connection(); |
628 | 628 | $sth = $Connection->db->prepare($query); |
629 | 629 | $sth->execute(); |
630 | - } catch(PDOException $e) { |
|
630 | + } catch (PDOException $e) { |
|
631 | 631 | return "error : ".$e->getMessage(); |
632 | 632 | } |
633 | 633 | |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $Connection = new Connection(); |
638 | 638 | $sth = $Connection->db->prepare($query); |
639 | 639 | $sth->execute(); |
640 | - } catch(PDOException $e) { |
|
640 | + } catch (PDOException $e) { |
|
641 | 641 | return "error : ".$e->getMessage(); |
642 | 642 | } |
643 | 643 | |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | if ($globalTransaction) $Connection->db->beginTransaction(); |
649 | 649 | |
650 | 650 | $i = 0; |
651 | - while($row = sparql_fetch_array($result)) |
|
651 | + while ($row = sparql_fetch_array($result)) |
|
652 | 652 | { |
653 | 653 | if ($i >= 1) { |
654 | 654 | //print_r($row); |
@@ -668,31 +668,31 @@ discard block |
||
668 | 668 | $row['image'] = ''; |
669 | 669 | $row['image_thumb'] = ''; |
670 | 670 | } else { |
671 | - $image = str_replace(' ','_',$row['image']); |
|
671 | + $image = str_replace(' ', '_', $row['image']); |
|
672 | 672 | $digest = md5($image); |
673 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
674 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
675 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
676 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
673 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
674 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
675 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
676 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
677 | 677 | } |
678 | 678 | |
679 | - $country = explode('-',$row['country']); |
|
679 | + $country = explode('-', $row['country']); |
|
680 | 680 | $row['country'] = $country[0]; |
681 | 681 | |
682 | 682 | $row['type'] = trim($row['type']); |
683 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
683 | + 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'])) { |
|
684 | 684 | $row['type'] = 'Military'; |
685 | 685 | } 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') { |
686 | 686 | $row['type'] = 'small_airport'; |
687 | 687 | } |
688 | 688 | |
689 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
690 | - $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']); |
|
689 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
690 | + $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']); |
|
691 | 691 | //print_r($query_dest_values); |
692 | 692 | |
693 | 693 | try { |
694 | 694 | $sth_dest->execute($query_dest_values); |
695 | - } catch(PDOException $e) { |
|
695 | + } catch (PDOException $e) { |
|
696 | 696 | return "error : ".$e->getMessage(); |
697 | 697 | } |
698 | 698 | } |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | $Connection = new Connection(); |
707 | 707 | $sth = $Connection->db->prepare($query); |
708 | 708 | $sth->execute(); |
709 | - } catch(PDOException $e) { |
|
709 | + } catch (PDOException $e) { |
|
710 | 710 | return "error : ".$e->getMessage(); |
711 | 711 | } |
712 | 712 | |
@@ -714,12 +714,12 @@ discard block |
||
714 | 714 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
715 | 715 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
716 | 716 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
717 | - $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
|
717 | + $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' => ''); |
|
718 | 718 | try { |
719 | 719 | $Connection = new Connection(); |
720 | 720 | $sth = $Connection->db->prepare($query); |
721 | 721 | $sth->execute($query_values); |
722 | - } catch(PDOException $e) { |
|
722 | + } catch (PDOException $e) { |
|
723 | 723 | return "error : ".$e->getMessage(); |
724 | 724 | } |
725 | 725 | $i++; |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | echo "Download data from ourairports.com...\n"; |
738 | 738 | $delimiter = ','; |
739 | 739 | $out_file = $tmp_dir.'airports.csv'; |
740 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
740 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
741 | 741 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
742 | 742 | echo "Add data from ourairports.com...\n"; |
743 | 743 | |
@@ -748,32 +748,32 @@ discard block |
||
748 | 748 | //$Connection->db->beginTransaction(); |
749 | 749 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
750 | 750 | { |
751 | - if(!$header) $header = $row; |
|
751 | + if (!$header) $header = $row; |
|
752 | 752 | else { |
753 | 753 | $data = array(); |
754 | 754 | $data = array_combine($header, $row); |
755 | 755 | try { |
756 | 756 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
757 | 757 | $sth->execute(array(':icao' => $data['gps_code'])); |
758 | - } catch(PDOException $e) { |
|
758 | + } catch (PDOException $e) { |
|
759 | 759 | return "error : ".$e->getMessage(); |
760 | 760 | } |
761 | 761 | if ($sth->fetchColumn() > 0) { |
762 | 762 | $query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
763 | 763 | try { |
764 | 764 | $sth = $Connection->db->prepare($query); |
765 | - $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
766 | - } catch(PDOException $e) { |
|
765 | + $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
766 | + } catch (PDOException $e) { |
|
767 | 767 | return "error : ".$e->getMessage(); |
768 | 768 | } |
769 | 769 | } else { |
770 | 770 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
771 | 771 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
772 | - $query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
772 | + $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']); |
|
773 | 773 | try { |
774 | 774 | $sth = $Connection->db->prepare($query); |
775 | 775 | $sth->execute($query_values); |
776 | - } catch(PDOException $e) { |
|
776 | + } catch (PDOException $e) { |
|
777 | 777 | return "error : ".$e->getMessage(); |
778 | 778 | } |
779 | 779 | $i++; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | |
787 | 787 | echo "Download data from another free database...\n"; |
788 | 788 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
789 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
789 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
790 | 790 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
791 | 791 | update_db::unzip($out_file); |
792 | 792 | $header = NULL; |
@@ -798,15 +798,15 @@ discard block |
||
798 | 798 | //$Connection->db->beginTransaction(); |
799 | 799 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
800 | 800 | { |
801 | - if(!$header) $header = $row; |
|
801 | + if (!$header) $header = $row; |
|
802 | 802 | else { |
803 | 803 | $data = $row; |
804 | 804 | |
805 | 805 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
806 | 806 | try { |
807 | 807 | $sth = $Connection->db->prepare($query); |
808 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
809 | - } catch(PDOException $e) { |
|
808 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
809 | + } catch (PDOException $e) { |
|
810 | 810 | return "error : ".$e->getMessage(); |
811 | 811 | } |
812 | 812 | } |
@@ -820,15 +820,15 @@ discard block |
||
820 | 820 | try { |
821 | 821 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
822 | 822 | $sth->execute(); |
823 | - } catch(PDOException $e) { |
|
823 | + } catch (PDOException $e) { |
|
824 | 824 | return "error : ".$e->getMessage(); |
825 | 825 | } |
826 | 826 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
827 | 827 | $query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
828 | 828 | try { |
829 | 829 | $sth2 = $Connection->db->prepare($query2); |
830 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
831 | - } catch(PDOException $e) { |
|
830 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
831 | + } catch (PDOException $e) { |
|
832 | 832 | return "error : ".$e->getMessage(); |
833 | 833 | } |
834 | 834 | } |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | $Connection = new Connection(); |
853 | 853 | $sth = $Connection->db->prepare($query); |
854 | 854 | $sth->execute(array(':source' => 'translation.csv')); |
855 | - } catch(PDOException $e) { |
|
855 | + } catch (PDOException $e) { |
|
856 | 856 | return "error : ".$e->getMessage(); |
857 | 857 | } |
858 | 858 | |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
870 | 870 | { |
871 | 871 | $i++; |
872 | - if($i > 12) { |
|
872 | + if ($i > 12) { |
|
873 | 873 | $data = $row; |
874 | 874 | $operator = $data[2]; |
875 | 875 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | //echo substr($operator, 0, 2)."\n";; |
878 | 878 | if (count($airline_array) > 0) { |
879 | 879 | //print_r($airline_array); |
880 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
880 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
@@ -885,14 +885,14 @@ discard block |
||
885 | 885 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
886 | 886 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
887 | 887 | if (count($airline_array) > 0) { |
888 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
888 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
889 | 889 | } |
890 | 890 | } |
891 | 891 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
892 | 892 | try { |
893 | 893 | $sth = $Connection->db->prepare($query); |
894 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
895 | - } catch(PDOException $e) { |
|
894 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
895 | + } catch (PDOException $e) { |
|
896 | 896 | return "error : ".$e->getMessage(); |
897 | 897 | } |
898 | 898 | } |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | $Connection = new Connection(); |
913 | 913 | $sth = $Connection->db->prepare($query); |
914 | 914 | $sth->execute(array(':source' => 'website_fam')); |
915 | - } catch(PDOException $e) { |
|
915 | + } catch (PDOException $e) { |
|
916 | 916 | return "error : ".$e->getMessage(); |
917 | 917 | } |
918 | 918 | |
@@ -932,8 +932,8 @@ discard block |
||
932 | 932 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
933 | 933 | try { |
934 | 934 | $sth = $Connection->db->prepare($query); |
935 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
936 | - } catch(PDOException $e) { |
|
935 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
936 | + } catch (PDOException $e) { |
|
937 | 937 | return "error : ".$e->getMessage(); |
938 | 938 | } |
939 | 939 | } |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | $Connection = new Connection(); |
957 | 957 | $sth = $Connection->db->prepare($query); |
958 | 958 | $sth->execute(array(':source' => 'website_faa')); |
959 | - } catch(PDOException $e) { |
|
959 | + } catch (PDOException $e) { |
|
960 | 960 | return "error : ".$e->getMessage(); |
961 | 961 | } |
962 | 962 | |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | $Connection = new Connection(); |
966 | 966 | $sth = $Connection->db->prepare($query); |
967 | 967 | $sth->execute(array(':source' => 'website_faa')); |
968 | - } catch(PDOException $e) { |
|
968 | + } catch (PDOException $e) { |
|
969 | 969 | return "error : ".$e->getMessage(); |
970 | 970 | } |
971 | 971 | |
@@ -982,8 +982,8 @@ discard block |
||
982 | 982 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
983 | 983 | try { |
984 | 984 | $sths = $Connection->db->prepare($query_search); |
985 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
986 | - } catch(PDOException $e) { |
|
985 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
986 | + } catch (PDOException $e) { |
|
987 | 987 | return "error s : ".$e->getMessage(); |
988 | 988 | } |
989 | 989 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -996,8 +996,8 @@ discard block |
||
996 | 996 | //} |
997 | 997 | try { |
998 | 998 | $sthi = $Connection->db->prepare($queryi); |
999 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1000 | - } catch(PDOException $e) { |
|
999 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1000 | + } catch (PDOException $e) { |
|
1001 | 1001 | return "error u : ".$e->getMessage(); |
1002 | 1002 | } |
1003 | 1003 | } else { |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | try { |
1006 | 1006 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1007 | 1007 | $sthsm->execute(array(':mfr' => $data[2])); |
1008 | - } catch(PDOException $e) { |
|
1008 | + } catch (PDOException $e) { |
|
1009 | 1009 | return "error mfr : ".$e->getMessage(); |
1010 | 1010 | } |
1011 | 1011 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1015,8 +1015,8 @@ discard block |
||
1015 | 1015 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1016 | 1016 | try { |
1017 | 1017 | $sthf = $Connection->db->prepare($queryf); |
1018 | - $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')); |
|
1019 | - } catch(PDOException $e) { |
|
1018 | + $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')); |
|
1019 | + } catch (PDOException $e) { |
|
1020 | 1020 | return "error f : ".$e->getMessage(); |
1021 | 1021 | } |
1022 | 1022 | } |
@@ -1026,13 +1026,13 @@ discard block |
||
1026 | 1026 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1027 | 1027 | try { |
1028 | 1028 | $sth = $Connection->db->prepare($query); |
1029 | - $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')); |
|
1030 | - } catch(PDOException $e) { |
|
1029 | + $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')); |
|
1030 | + } catch (PDOException $e) { |
|
1031 | 1031 | return "error i : ".$e->getMessage(); |
1032 | 1032 | } |
1033 | 1033 | } |
1034 | 1034 | } |
1035 | - if ($i % 90 == 0) { |
|
1035 | + if ($i%90 == 0) { |
|
1036 | 1036 | if ($globalTransaction) $Connection->db->commit(); |
1037 | 1037 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1038 | 1038 | } |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | $Connection = new Connection(); |
1052 | 1052 | $sth = $Connection->db->prepare($query); |
1053 | 1053 | $sth->execute(array(':source' => 'website_fam')); |
1054 | - } catch(PDOException $e) { |
|
1054 | + } catch (PDOException $e) { |
|
1055 | 1055 | return "error : ".$e->getMessage(); |
1056 | 1056 | } |
1057 | 1057 | |
@@ -1071,8 +1071,8 @@ discard block |
||
1071 | 1071 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1072 | 1072 | try { |
1073 | 1073 | $sth = $Connection->db->prepare($query); |
1074 | - $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')); |
|
1075 | - } catch(PDOException $e) { |
|
1074 | + $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')); |
|
1075 | + } catch (PDOException $e) { |
|
1076 | 1076 | return "error : ".$e->getMessage(); |
1077 | 1077 | } |
1078 | 1078 | } |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | $Connection = new Connection(); |
1092 | 1092 | $sth = $Connection->db->prepare($query); |
1093 | 1093 | $sth->execute(array(':source' => 'website_fam')); |
1094 | - } catch(PDOException $e) { |
|
1094 | + } catch (PDOException $e) { |
|
1095 | 1095 | return "error : ".$e->getMessage(); |
1096 | 1096 | } |
1097 | 1097 | |
@@ -1107,8 +1107,8 @@ discard block |
||
1107 | 1107 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1108 | 1108 | try { |
1109 | 1109 | $sth = $Connection->db->prepare($query); |
1110 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1111 | - } catch(PDOException $e) { |
|
1110 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1111 | + } catch (PDOException $e) { |
|
1112 | 1112 | print_r($data); |
1113 | 1113 | return "error : ".$e->getMessage(); |
1114 | 1114 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | $Connection = new Connection(); |
1129 | 1129 | $sth = $Connection->db->prepare($query); |
1130 | 1130 | $sth->execute(array(':source' => 'website_fam')); |
1131 | - } catch(PDOException $e) { |
|
1131 | + } catch (PDOException $e) { |
|
1132 | 1132 | return "error : ".$e->getMessage(); |
1133 | 1133 | } |
1134 | 1134 | |
@@ -1148,8 +1148,8 @@ discard block |
||
1148 | 1148 | $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)'; |
1149 | 1149 | try { |
1150 | 1150 | $sth = $Connection->db->prepare($query); |
1151 | - $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')); |
|
1152 | - } catch(PDOException $e) { |
|
1151 | + $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')); |
|
1152 | + } catch (PDOException $e) { |
|
1153 | 1153 | return "error : ".$e->getMessage(); |
1154 | 1154 | } |
1155 | 1155 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | return ''; |
1162 | 1162 | } |
1163 | 1163 | |
1164 | - public static function tle($filename,$tletype) { |
|
1164 | + public static function tle($filename, $tletype) { |
|
1165 | 1165 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1166 | 1166 | global $tmp_dir, $globalTransaction; |
1167 | 1167 | //$Spotter = new Spotter(); |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | $Connection = new Connection(); |
1172 | 1172 | $sth = $Connection->db->prepare($query); |
1173 | 1173 | $sth->execute(array(':source' => $filename)); |
1174 | - } catch(PDOException $e) { |
|
1174 | + } catch (PDOException $e) { |
|
1175 | 1175 | return "error : ".$e->getMessage(); |
1176 | 1176 | } |
1177 | 1177 | |
@@ -1196,8 +1196,8 @@ discard block |
||
1196 | 1196 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1197 | 1197 | try { |
1198 | 1198 | $sth = $Connection->db->prepare($query); |
1199 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1200 | - } catch(PDOException $e) { |
|
1199 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1200 | + } catch (PDOException $e) { |
|
1201 | 1201 | return "error : ".$e->getMessage(); |
1202 | 1202 | } |
1203 | 1203 | |
@@ -1217,28 +1217,28 @@ discard block |
||
1217 | 1217 | */ |
1218 | 1218 | private static function table2array($data) { |
1219 | 1219 | $html = str_get_html($data); |
1220 | - $tabledata=array(); |
|
1221 | - foreach($html->find('tr') as $element) |
|
1220 | + $tabledata = array(); |
|
1221 | + foreach ($html->find('tr') as $element) |
|
1222 | 1222 | { |
1223 | 1223 | $td = array(); |
1224 | - foreach( $element->find('th') as $row) |
|
1224 | + foreach ($element->find('th') as $row) |
|
1225 | 1225 | { |
1226 | 1226 | $td [] = trim($row->plaintext); |
1227 | 1227 | } |
1228 | - $td=array_filter($td); |
|
1228 | + $td = array_filter($td); |
|
1229 | 1229 | $tabledata[] = $td; |
1230 | 1230 | |
1231 | 1231 | $td = array(); |
1232 | 1232 | $tdi = array(); |
1233 | - foreach( $element->find('td') as $row) |
|
1233 | + foreach ($element->find('td') as $row) |
|
1234 | 1234 | { |
1235 | 1235 | $td [] = trim($row->plaintext); |
1236 | 1236 | $tdi [] = trim($row->innertext); |
1237 | 1237 | } |
1238 | - $td=array_filter($td); |
|
1239 | - $tdi=array_filter($tdi); |
|
1238 | + $td = array_filter($td); |
|
1239 | + $tdi = array_filter($tdi); |
|
1240 | 1240 | // $tabledata[]=array_merge($td,$tdi); |
1241 | - $tabledata[]=$td; |
|
1241 | + $tabledata[] = $td; |
|
1242 | 1242 | } |
1243 | 1243 | return(array_filter($tabledata)); |
1244 | 1244 | } |
@@ -1311,13 +1311,13 @@ discard block |
||
1311 | 1311 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1312 | 1312 | { |
1313 | 1313 | $i++; |
1314 | - if($i > 3 && count($row) > 2) { |
|
1314 | + if ($i > 3 && count($row) > 2) { |
|
1315 | 1315 | $data = array_values(array_filter($row)); |
1316 | 1316 | $cntdata = count($data); |
1317 | 1317 | if ($cntdata > 10) { |
1318 | 1318 | $value = $data[9]; |
1319 | 1319 | |
1320 | - for ($i =10;$i < $cntdata;$i++) { |
|
1320 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1321 | 1321 | $value .= ' '.$data[$i]; |
1322 | 1322 | } |
1323 | 1323 | $data[9] = $value; |
@@ -1327,8 +1327,8 @@ discard block |
||
1327 | 1327 | $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)'; |
1328 | 1328 | try { |
1329 | 1329 | $sth = $Connection->db->prepare($query); |
1330 | - $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])); |
|
1331 | - } catch(PDOException $e) { |
|
1330 | + $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])); |
|
1331 | + } catch (PDOException $e) { |
|
1332 | 1332 | return "error : ".$e->getMessage(); |
1333 | 1333 | } |
1334 | 1334 | } |
@@ -1349,7 +1349,7 @@ discard block |
||
1349 | 1349 | $Connection = new Connection(); |
1350 | 1350 | $sth = $Connection->db->prepare($query); |
1351 | 1351 | $sth->execute(); |
1352 | - } catch(PDOException $e) { |
|
1352 | + } catch (PDOException $e) { |
|
1353 | 1353 | return "error : ".$e->getMessage(); |
1354 | 1354 | } |
1355 | 1355 | |
@@ -1361,12 +1361,12 @@ discard block |
||
1361 | 1361 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1362 | 1362 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1363 | 1363 | { |
1364 | - if(count($row) > 1) { |
|
1364 | + if (count($row) > 1) { |
|
1365 | 1365 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1366 | 1366 | try { |
1367 | 1367 | $sth = $Connection->db->prepare($query); |
1368 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1369 | - } catch(PDOException $e) { |
|
1368 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1369 | + } catch (PDOException $e) { |
|
1370 | 1370 | return "error : ".$e->getMessage(); |
1371 | 1371 | } |
1372 | 1372 | } |
@@ -1386,21 +1386,21 @@ discard block |
||
1386 | 1386 | try { |
1387 | 1387 | $sth = $Connection->db->prepare($query); |
1388 | 1388 | $sth->execute(); |
1389 | - } catch(PDOException $e) { |
|
1389 | + } catch (PDOException $e) { |
|
1390 | 1390 | return "error : ".$e->getMessage(); |
1391 | 1391 | } |
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | |
1395 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1395 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1396 | 1396 | else { |
1397 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1397 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1398 | 1398 | $query = "CREATE EXTENSION postgis"; |
1399 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1399 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1400 | 1400 | try { |
1401 | 1401 | $sth = $Connection->db->prepare($query); |
1402 | 1402 | $sth->execute(); |
1403 | - } catch(PDOException $e) { |
|
1403 | + } catch (PDOException $e) { |
|
1404 | 1404 | return "error : ".$e->getMessage(); |
1405 | 1405 | } |
1406 | 1406 | } |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | include_once('class.create_db.php'); |
1414 | 1414 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1415 | 1415 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1416 | - update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1416 | + update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1417 | 1417 | $error = ''; |
1418 | 1418 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1419 | 1419 | if ($globalDebug) echo "Gunzip..."; |
@@ -1445,14 +1445,14 @@ discard block |
||
1445 | 1445 | try { |
1446 | 1446 | $sth = $Connection->db->prepare($query); |
1447 | 1447 | $sth->execute(); |
1448 | - } catch(PDOException $e) { |
|
1448 | + } catch (PDOException $e) { |
|
1449 | 1449 | echo "error : ".$e->getMessage(); |
1450 | 1450 | } |
1451 | 1451 | } |
1452 | 1452 | if ($globalDBdriver == 'mysql') { |
1453 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1453 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1454 | 1454 | } else { |
1455 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1455 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1456 | 1456 | } |
1457 | 1457 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1458 | 1458 | return $error; |
@@ -1465,7 +1465,7 @@ discard block |
||
1465 | 1465 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1466 | 1466 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1467 | 1467 | // 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'); |
1468 | - 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'); |
|
1468 | + 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'); |
|
1469 | 1469 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1470 | 1470 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1471 | 1471 | return $error; |
@@ -1485,7 +1485,7 @@ discard block |
||
1485 | 1485 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1486 | 1486 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
1487 | 1487 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1488 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1488 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1489 | 1489 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
1490 | 1490 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
1491 | 1491 | if ($error != '') { |
@@ -1498,7 +1498,7 @@ discard block |
||
1498 | 1498 | global $tmp_dir, $globalDebug; |
1499 | 1499 | $error = ''; |
1500 | 1500 | if ($globalDebug) echo "Routes : Download..."; |
1501 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
1501 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1502 | 1502 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1503 | 1503 | if ($globalDebug) echo "Gunzip..."; |
1504 | 1504 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1514,7 +1514,7 @@ discard block |
||
1514 | 1514 | global $tmp_dir, $globalDebug; |
1515 | 1515 | $error = ''; |
1516 | 1516 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
1517 | - update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
1517 | + update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1518 | 1518 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1519 | 1519 | if ($globalDebug) echo "Gunzip..."; |
1520 | 1520 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1530,7 +1530,7 @@ discard block |
||
1530 | 1530 | global $tmp_dir, $globalDebug; |
1531 | 1531 | $error = ''; |
1532 | 1532 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
1533 | - update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
1533 | + update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1534 | 1534 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1535 | 1535 | if ($globalDebug) echo "Gunzip..."; |
1536 | 1536 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -1558,7 +1558,7 @@ discard block |
||
1558 | 1558 | */ |
1559 | 1559 | if ($globalDebug) echo "Modes : Download..."; |
1560 | 1560 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
1561 | - update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
1561 | + update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
1562 | 1562 | |
1563 | 1563 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
1564 | 1564 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | public static function update_ModeS_faa() { |
1579 | 1579 | global $tmp_dir, $globalDebug; |
1580 | 1580 | if ($globalDebug) echo "Modes FAA: Download..."; |
1581 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
1581 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
1582 | 1582 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
1583 | 1583 | if ($globalDebug) echo "Unzip..."; |
1584 | 1584 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -1594,7 +1594,7 @@ discard block |
||
1594 | 1594 | public static function update_ModeS_flarm() { |
1595 | 1595 | global $tmp_dir, $globalDebug; |
1596 | 1596 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
1597 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
1597 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
1598 | 1598 | if (file_exists($tmp_dir.'data.fln')) { |
1599 | 1599 | if ($globalDebug) echo "Add to DB..."; |
1600 | 1600 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | public static function update_ModeS_ogn() { |
1609 | 1609 | global $tmp_dir, $globalDebug; |
1610 | 1610 | if ($globalDebug) echo "Modes OGN: Download..."; |
1611 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
1611 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
1612 | 1612 | if (file_exists($tmp_dir.'ogn.csv')) { |
1613 | 1613 | if ($globalDebug) echo "Add to DB..."; |
1614 | 1614 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -1623,173 +1623,173 @@ discard block |
||
1623 | 1623 | global $tmp_dir, $globalDebug; |
1624 | 1624 | |
1625 | 1625 | if ($globalDebug) echo "Owner France: Download..."; |
1626 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
1626 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
1627 | 1627 | if (file_exists($tmp_dir.'owner_f.csv')) { |
1628 | 1628 | if ($globalDebug) echo "Add to DB..."; |
1629 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
1629 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
1630 | 1630 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
1631 | 1631 | if ($error != '') { |
1632 | 1632 | return $error; |
1633 | 1633 | } elseif ($globalDebug) echo "Done\n"; |
1634 | 1634 | |
1635 | 1635 | if ($globalDebug) echo "Owner Ireland: Download..."; |
1636 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
1636 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
1637 | 1637 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
1638 | 1638 | if ($globalDebug) echo "Add to DB..."; |
1639 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
1639 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
1640 | 1640 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
1641 | 1641 | if ($error != '') { |
1642 | 1642 | return $error; |
1643 | 1643 | } elseif ($globalDebug) echo "Done\n"; |
1644 | 1644 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
1645 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
1645 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
1646 | 1646 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
1647 | 1647 | if ($globalDebug) echo "Add to DB..."; |
1648 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
1648 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
1649 | 1649 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
1650 | 1650 | if ($error != '') { |
1651 | 1651 | return $error; |
1652 | 1652 | } elseif ($globalDebug) echo "Done\n"; |
1653 | 1653 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
1654 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
1654 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
1655 | 1655 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
1656 | 1656 | if ($globalDebug) echo "Add to DB..."; |
1657 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
1657 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
1658 | 1658 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
1659 | 1659 | if ($error != '') { |
1660 | 1660 | return $error; |
1661 | 1661 | } elseif ($globalDebug) echo "Done\n"; |
1662 | 1662 | if ($globalDebug) echo "Owner Australia: Download..."; |
1663 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
1663 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
1664 | 1664 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
1665 | 1665 | if ($globalDebug) echo "Add to DB..."; |
1666 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
1666 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
1667 | 1667 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
1668 | 1668 | if ($error != '') { |
1669 | 1669 | return $error; |
1670 | 1670 | } elseif ($globalDebug) echo "Done\n"; |
1671 | 1671 | if ($globalDebug) echo "Owner Austria: Download..."; |
1672 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
1672 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
1673 | 1673 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
1674 | 1674 | if ($globalDebug) echo "Add to DB..."; |
1675 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
1675 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
1676 | 1676 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
1677 | 1677 | if ($error != '') { |
1678 | 1678 | return $error; |
1679 | 1679 | } elseif ($globalDebug) echo "Done\n"; |
1680 | 1680 | if ($globalDebug) echo "Owner Chile: Download..."; |
1681 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
1681 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
1682 | 1682 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
1683 | 1683 | if ($globalDebug) echo "Add to DB..."; |
1684 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
1684 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
1685 | 1685 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
1686 | 1686 | if ($error != '') { |
1687 | 1687 | return $error; |
1688 | 1688 | } elseif ($globalDebug) echo "Done\n"; |
1689 | 1689 | if ($globalDebug) echo "Owner Colombia: Download..."; |
1690 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
1690 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
1691 | 1691 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
1692 | 1692 | if ($globalDebug) echo "Add to DB..."; |
1693 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
1693 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
1694 | 1694 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
1695 | 1695 | if ($error != '') { |
1696 | 1696 | return $error; |
1697 | 1697 | } elseif ($globalDebug) echo "Done\n"; |
1698 | 1698 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
1699 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
1699 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
1700 | 1700 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
1701 | 1701 | if ($globalDebug) echo "Add to DB..."; |
1702 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
1702 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
1703 | 1703 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
1704 | 1704 | if ($error != '') { |
1705 | 1705 | return $error; |
1706 | 1706 | } elseif ($globalDebug) echo "Done\n"; |
1707 | 1707 | if ($globalDebug) echo "Owner Brazil: Download..."; |
1708 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
1708 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
1709 | 1709 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
1710 | 1710 | if ($globalDebug) echo "Add to DB..."; |
1711 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
1711 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
1712 | 1712 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
1713 | 1713 | if ($error != '') { |
1714 | 1714 | return $error; |
1715 | 1715 | } elseif ($globalDebug) echo "Done\n"; |
1716 | 1716 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
1717 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
1717 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
1718 | 1718 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
1719 | 1719 | if ($globalDebug) echo "Add to DB..."; |
1720 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
1720 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
1721 | 1721 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
1722 | 1722 | if ($error != '') { |
1723 | 1723 | return $error; |
1724 | 1724 | } elseif ($globalDebug) echo "Done\n"; |
1725 | 1725 | if ($globalDebug) echo "Owner Croatia: Download..."; |
1726 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
1726 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
1727 | 1727 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
1728 | 1728 | if ($globalDebug) echo "Add to DB..."; |
1729 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
1729 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
1730 | 1730 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
1731 | 1731 | if ($error != '') { |
1732 | 1732 | return $error; |
1733 | 1733 | } elseif ($globalDebug) echo "Done\n"; |
1734 | 1734 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
1735 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
1735 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
1736 | 1736 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
1737 | 1737 | if ($globalDebug) echo "Add to DB..."; |
1738 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
1738 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
1739 | 1739 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
1740 | 1740 | if ($error != '') { |
1741 | 1741 | return $error; |
1742 | 1742 | } elseif ($globalDebug) echo "Done\n"; |
1743 | 1743 | if ($globalDebug) echo "Owner Maldives: Download..."; |
1744 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
1744 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
1745 | 1745 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
1746 | 1746 | if ($globalDebug) echo "Add to DB..."; |
1747 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
1747 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
1748 | 1748 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
1749 | 1749 | if ($error != '') { |
1750 | 1750 | return $error; |
1751 | 1751 | } elseif ($globalDebug) echo "Done\n"; |
1752 | 1752 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
1753 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
1753 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
1754 | 1754 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
1755 | 1755 | if ($globalDebug) echo "Add to DB..."; |
1756 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
1756 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
1757 | 1757 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
1758 | 1758 | if ($error != '') { |
1759 | 1759 | return $error; |
1760 | 1760 | } elseif ($globalDebug) echo "Done\n"; |
1761 | 1761 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
1762 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
1762 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
1763 | 1763 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
1764 | 1764 | if ($globalDebug) echo "Add to DB..."; |
1765 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
1765 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
1766 | 1766 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
1767 | 1767 | if ($error != '') { |
1768 | 1768 | return $error; |
1769 | 1769 | } elseif ($globalDebug) echo "Done\n"; |
1770 | 1770 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
1771 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
1771 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
1772 | 1772 | if (file_exists($tmp_dir.'owner_om.csv')) { |
1773 | 1773 | if ($globalDebug) echo "Add to DB..."; |
1774 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
1774 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
1775 | 1775 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
1776 | 1776 | if ($error != '') { |
1777 | 1777 | return $error; |
1778 | 1778 | } elseif ($globalDebug) echo "Done\n"; |
1779 | 1779 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
1780 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
1780 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
1781 | 1781 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
1782 | 1782 | if ($globalDebug) echo "Add to DB..."; |
1783 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
1783 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
1784 | 1784 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
1785 | 1785 | if ($error != '') { |
1786 | 1786 | return $error; |
1787 | 1787 | } elseif ($globalDebug) echo "Done\n"; |
1788 | 1788 | if ($globalDebug) echo "Owner Iceland: Download..."; |
1789 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
1789 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
1790 | 1790 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
1791 | 1791 | if ($globalDebug) echo "Add to DB..."; |
1792 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
1792 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
1793 | 1793 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
1794 | 1794 | if ($error != '') { |
1795 | 1795 | return $error; |
@@ -1801,7 +1801,7 @@ discard block |
||
1801 | 1801 | global $tmp_dir, $globalDebug; |
1802 | 1802 | $error = ''; |
1803 | 1803 | if ($globalDebug) echo "Translation : Download..."; |
1804 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
1804 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
1805 | 1805 | if (file_exists($tmp_dir.'translation.zip')) { |
1806 | 1806 | if ($globalDebug) echo "Unzip..."; |
1807 | 1807 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -1817,7 +1817,7 @@ discard block |
||
1817 | 1817 | public static function update_translation_fam() { |
1818 | 1818 | global $tmp_dir, $globalDebug; |
1819 | 1819 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
1820 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
1820 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
1821 | 1821 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
1822 | 1822 | if ($globalDebug) echo "Gunzip..."; |
1823 | 1823 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | public static function update_ModeS_fam() { |
1833 | 1833 | global $tmp_dir, $globalDebug; |
1834 | 1834 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
1835 | - update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
1835 | + update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
1836 | 1836 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
1837 | 1837 | if ($globalDebug) echo "Gunzip..."; |
1838 | 1838 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -1848,9 +1848,9 @@ discard block |
||
1848 | 1848 | global $tmp_dir, $globalDebug, $globalOwner; |
1849 | 1849 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
1850 | 1850 | if ($globalOwner === TRUE) { |
1851 | - update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1851 | + update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1852 | 1852 | } else { |
1853 | - update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1853 | + update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1854 | 1854 | } |
1855 | 1855 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
1856 | 1856 | if ($globalDebug) echo "Gunzip..."; |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | public static function update_routes_fam() { |
1867 | 1867 | global $tmp_dir, $globalDebug; |
1868 | 1868 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
1869 | - update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
1869 | + update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
1870 | 1870 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
1871 | 1871 | if ($globalDebug) echo "Gunzip..."; |
1872 | 1872 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -1885,18 +1885,18 @@ discard block |
||
1885 | 1885 | $error = ''; |
1886 | 1886 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
1887 | 1887 | if ($globalDBdriver == 'mysql') { |
1888 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
1888 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
1889 | 1889 | } else { |
1890 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
1890 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
1891 | 1891 | } |
1892 | 1892 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
1893 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
1893 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
1894 | 1894 | $airspace_md5 = $airspace_md5_file[0]; |
1895 | 1895 | if (!update_db::check_airspace_version($airspace_md5)) { |
1896 | 1896 | if ($globalDBdriver == 'mysql') { |
1897 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
1897 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
1898 | 1898 | } else { |
1899 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
1899 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
1900 | 1900 | } |
1901 | 1901 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
1902 | 1902 | if ($globalDebug) echo "Gunzip..."; |
@@ -1908,7 +1908,7 @@ discard block |
||
1908 | 1908 | try { |
1909 | 1909 | $sth = $Connection->db->prepare($query); |
1910 | 1910 | $sth->execute(); |
1911 | - } catch(PDOException $e) { |
|
1911 | + } catch (PDOException $e) { |
|
1912 | 1912 | return "error : ".$e->getMessage(); |
1913 | 1913 | } |
1914 | 1914 | } |
@@ -1926,15 +1926,15 @@ discard block |
||
1926 | 1926 | public static function update_tle() { |
1927 | 1927 | global $tmp_dir, $globalDebug; |
1928 | 1928 | if ($globalDebug) echo "Download TLE : Download..."; |
1929 | - $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', |
|
1930 | - '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', |
|
1931 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
1929 | + $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', |
|
1930 | + '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', |
|
1931 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
1932 | 1932 | foreach ($alltle as $filename) { |
1933 | 1933 | if ($globalDebug) echo "downloading ".$filename.'...'; |
1934 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
1934 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
1935 | 1935 | if (file_exists($tmp_dir.$filename)) { |
1936 | 1936 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
1937 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
1937 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
1938 | 1938 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
1939 | 1939 | if ($error != '') { |
1940 | 1940 | echo $error."\n"; |
@@ -1947,32 +1947,32 @@ discard block |
||
1947 | 1947 | global $tmp_dir, $globalDebug; |
1948 | 1948 | $error = ''; |
1949 | 1949 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
1950 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
1950 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
1951 | 1951 | if (file_exists($tmp_dir.'models.md5sum')) { |
1952 | 1952 | if ($globalDebug) echo "Check files...\n"; |
1953 | 1953 | $newmodelsdb = array(); |
1954 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
1955 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
1954 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
1955 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1956 | 1956 | $model = trim($row[2]); |
1957 | 1957 | $newmodelsdb[$model] = trim($row[0]); |
1958 | 1958 | } |
1959 | 1959 | } |
1960 | 1960 | $modelsdb = array(); |
1961 | 1961 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
1962 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
1963 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
1962 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
1963 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1964 | 1964 | $model = trim($row[2]); |
1965 | 1965 | $modelsdb[$model] = trim($row[0]); |
1966 | 1966 | } |
1967 | 1967 | } |
1968 | 1968 | } |
1969 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
1969 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
1970 | 1970 | foreach ($diff as $key => $value) { |
1971 | 1971 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
1972 | - update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
1972 | + update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
1973 | 1973 | |
1974 | 1974 | } |
1975 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
1975 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
1976 | 1976 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
1977 | 1977 | if ($error != '') { |
1978 | 1978 | return $error; |
@@ -1984,32 +1984,32 @@ discard block |
||
1984 | 1984 | global $tmp_dir, $globalDebug; |
1985 | 1985 | $error = ''; |
1986 | 1986 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
1987 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
1987 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
1988 | 1988 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
1989 | 1989 | if ($globalDebug) echo "Check files...\n"; |
1990 | 1990 | $newmodelsdb = array(); |
1991 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
1992 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
1991 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
1992 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
1993 | 1993 | $model = trim($row[2]); |
1994 | 1994 | $newmodelsdb[$model] = trim($row[0]); |
1995 | 1995 | } |
1996 | 1996 | } |
1997 | 1997 | $modelsdb = array(); |
1998 | 1998 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
1999 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2000 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
1999 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2000 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2001 | 2001 | $model = trim($row[2]); |
2002 | 2002 | $modelsdb[$model] = trim($row[0]); |
2003 | 2003 | } |
2004 | 2004 | } |
2005 | 2005 | } |
2006 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2006 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2007 | 2007 | foreach ($diff as $key => $value) { |
2008 | 2008 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2009 | - update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2009 | + update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2010 | 2010 | |
2011 | 2011 | } |
2012 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2012 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2013 | 2013 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2014 | 2014 | if ($error != '') { |
2015 | 2015 | return $error; |
@@ -2032,8 +2032,8 @@ discard block |
||
2032 | 2032 | */ |
2033 | 2033 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2034 | 2034 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
2035 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2036 | - $result = fread($fh,100000000); |
|
2035 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
2036 | + $result = fread($fh, 100000000); |
|
2037 | 2037 | //echo $result; |
2038 | 2038 | //var_dump(str_get_html($result)); |
2039 | 2039 | //print_r(self::table2array($result)); |
@@ -2051,23 +2051,23 @@ discard block |
||
2051 | 2051 | $Connection = new Connection(); |
2052 | 2052 | $sth = $Connection->db->prepare($query); |
2053 | 2053 | $sth->execute(); |
2054 | - } catch(PDOException $e) { |
|
2054 | + } catch (PDOException $e) { |
|
2055 | 2055 | return "error : ".$e->getMessage(); |
2056 | 2056 | } |
2057 | 2057 | |
2058 | 2058 | $error = ''; |
2059 | 2059 | if ($globalDebug) echo "Notam : Download..."; |
2060 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
2060 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2061 | 2061 | if (file_exists($tmp_dir.'notam.rss')) { |
2062 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
2062 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2063 | 2063 | foreach ($notams['channel']['item'] as $notam) { |
2064 | - $title = explode(':',$notam['title']); |
|
2064 | + $title = explode(':', $notam['title']); |
|
2065 | 2065 | $data['ref'] = trim($title[0]); |
2066 | 2066 | unset($title[0]); |
2067 | - $data['title'] = trim(implode(':',$title)); |
|
2068 | - $description = strip_tags($notam['description'],'<pre>'); |
|
2069 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
2070 | - $q = explode('/',$match[1]); |
|
2067 | + $data['title'] = trim(implode(':', $title)); |
|
2068 | + $description = strip_tags($notam['description'], '<pre>'); |
|
2069 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
2070 | + $q = explode('/', $match[1]); |
|
2071 | 2071 | $data['fir'] = $q[0]; |
2072 | 2072 | $data['code'] = $q[1]; |
2073 | 2073 | $ifrvfr = $q[2]; |
@@ -2083,30 +2083,30 @@ discard block |
||
2083 | 2083 | $data['lower_limit'] = $q[5]; |
2084 | 2084 | $data['upper_limit'] = $q[6]; |
2085 | 2085 | $latlonrad = $q[7]; |
2086 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2087 | - $latitude = $Common->convertDec($las,'latitude'); |
|
2088 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
2086 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
2087 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
2088 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
2089 | 2089 | if ($lac == 'S') $latitude = '-'.$latitude; |
2090 | 2090 | if ($lnc == 'W') $longitude = '-'.$longitude; |
2091 | 2091 | $data['center_latitude'] = $latitude; |
2092 | 2092 | $data['center_longitude'] = $longitude; |
2093 | 2093 | $data['radius'] = intval($radius); |
2094 | 2094 | |
2095 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
2095 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2096 | 2096 | $data['text'] = $match[1]; |
2097 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
2097 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
2098 | 2098 | $fromto = $match[1]; |
2099 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
2099 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2100 | 2100 | $fromall = trim($match[1]); |
2101 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
2101 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2102 | 2102 | $from = trim($match[1]); |
2103 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2104 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
2103 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
2104 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2105 | 2105 | $toall = trim($match[1]); |
2106 | - if (!preg_match(':Permanent:',$toall)) { |
|
2107 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
2106 | + if (!preg_match(':Permanent:', $toall)) { |
|
2107 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2108 | 2108 | $to = trim($match[1]); |
2109 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
2109 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2110 | 2110 | $data['permanent'] = 0; |
2111 | 2111 | } else { |
2112 | 2112 | $data['date_end'] = NULL; |
@@ -2114,7 +2114,7 @@ discard block |
||
2114 | 2114 | } |
2115 | 2115 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2116 | 2116 | $NOTAM = new NOTAM(); |
2117 | - $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']); |
|
2117 | + $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']); |
|
2118 | 2118 | unset($data); |
2119 | 2119 | } |
2120 | 2120 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2137,16 +2137,16 @@ discard block |
||
2137 | 2137 | $Connection = new Connection(); |
2138 | 2138 | $sth = $Connection->db->prepare($query); |
2139 | 2139 | $sth->execute(); |
2140 | - } catch(PDOException $e) { |
|
2140 | + } catch (PDOException $e) { |
|
2141 | 2141 | return "error : ".$e->getMessage(); |
2142 | 2142 | } |
2143 | 2143 | } |
2144 | 2144 | $Common = new Common(); |
2145 | 2145 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2146 | - $airspace_json = json_decode($airspace_lst,true); |
|
2146 | + $airspace_json = json_decode($airspace_lst, true); |
|
2147 | 2147 | foreach ($airspace_json['records'] as $airspace) { |
2148 | 2148 | if ($globalDebug) echo $airspace['name']."...\n"; |
2149 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
2149 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2150 | 2150 | if (file_exists($tmp_dir.$airspace['name'])) { |
2151 | 2151 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
2152 | 2152 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2170,7 +2170,7 @@ discard block |
||
2170 | 2170 | $Connection = new Connection(); |
2171 | 2171 | $sth = $Connection->db->prepare($query); |
2172 | 2172 | $sth->execute(); |
2173 | - } catch(PDOException $e) { |
|
2173 | + } catch (PDOException $e) { |
|
2174 | 2174 | return "error : ".$e->getMessage(); |
2175 | 2175 | } |
2176 | 2176 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2185,7 +2185,7 @@ discard block |
||
2185 | 2185 | $Connection = new Connection(); |
2186 | 2186 | $sth = $Connection->db->prepare($query); |
2187 | 2187 | $sth->execute(); |
2188 | - } catch(PDOException $e) { |
|
2188 | + } catch (PDOException $e) { |
|
2189 | 2189 | return "error : ".$e->getMessage(); |
2190 | 2190 | } |
2191 | 2191 | } |
@@ -2196,7 +2196,7 @@ discard block |
||
2196 | 2196 | $Connection = new Connection(); |
2197 | 2197 | $sth = $Connection->db->prepare($query); |
2198 | 2198 | $sth->execute(array(':version' => $version)); |
2199 | - } catch(PDOException $e) { |
|
2199 | + } catch (PDOException $e) { |
|
2200 | 2200 | return "error : ".$e->getMessage(); |
2201 | 2201 | } |
2202 | 2202 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2212,7 +2212,7 @@ discard block |
||
2212 | 2212 | $Connection = new Connection(); |
2213 | 2213 | $sth = $Connection->db->prepare($query); |
2214 | 2214 | $sth->execute(array(':version' => $version)); |
2215 | - } catch(PDOException $e) { |
|
2215 | + } catch (PDOException $e) { |
|
2216 | 2216 | return "error : ".$e->getMessage(); |
2217 | 2217 | } |
2218 | 2218 | } |
@@ -2228,7 +2228,7 @@ discard block |
||
2228 | 2228 | $Connection = new Connection(); |
2229 | 2229 | $sth = $Connection->db->prepare($query); |
2230 | 2230 | $sth->execute(); |
2231 | - } catch(PDOException $e) { |
|
2231 | + } catch (PDOException $e) { |
|
2232 | 2232 | return "error : ".$e->getMessage(); |
2233 | 2233 | } |
2234 | 2234 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2243,7 +2243,7 @@ discard block |
||
2243 | 2243 | $Connection = new Connection(); |
2244 | 2244 | $sth = $Connection->db->prepare($query); |
2245 | 2245 | $sth->execute(); |
2246 | - } catch(PDOException $e) { |
|
2246 | + } catch (PDOException $e) { |
|
2247 | 2247 | return "error : ".$e->getMessage(); |
2248 | 2248 | } |
2249 | 2249 | } |
@@ -2258,7 +2258,7 @@ discard block |
||
2258 | 2258 | $Connection = new Connection(); |
2259 | 2259 | $sth = $Connection->db->prepare($query); |
2260 | 2260 | $sth->execute(); |
2261 | - } catch(PDOException $e) { |
|
2261 | + } catch (PDOException $e) { |
|
2262 | 2262 | return "error : ".$e->getMessage(); |
2263 | 2263 | } |
2264 | 2264 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2273,7 +2273,7 @@ discard block |
||
2273 | 2273 | $Connection = new Connection(); |
2274 | 2274 | $sth = $Connection->db->prepare($query); |
2275 | 2275 | $sth->execute(); |
2276 | - } catch(PDOException $e) { |
|
2276 | + } catch (PDOException $e) { |
|
2277 | 2277 | return "error : ".$e->getMessage(); |
2278 | 2278 | } |
2279 | 2279 | } |
@@ -2289,7 +2289,7 @@ discard block |
||
2289 | 2289 | $Connection = new Connection(); |
2290 | 2290 | $sth = $Connection->db->prepare($query); |
2291 | 2291 | $sth->execute(); |
2292 | - } catch(PDOException $e) { |
|
2292 | + } catch (PDOException $e) { |
|
2293 | 2293 | return "error : ".$e->getMessage(); |
2294 | 2294 | } |
2295 | 2295 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2304,7 +2304,7 @@ discard block |
||
2304 | 2304 | $Connection = new Connection(); |
2305 | 2305 | $sth = $Connection->db->prepare($query); |
2306 | 2306 | $sth->execute(); |
2307 | - } catch(PDOException $e) { |
|
2307 | + } catch (PDOException $e) { |
|
2308 | 2308 | return "error : ".$e->getMessage(); |
2309 | 2309 | } |
2310 | 2310 | } |
@@ -2319,7 +2319,7 @@ discard block |
||
2319 | 2319 | $Connection = new Connection(); |
2320 | 2320 | $sth = $Connection->db->prepare($query); |
2321 | 2321 | $sth->execute(); |
2322 | - } catch(PDOException $e) { |
|
2322 | + } catch (PDOException $e) { |
|
2323 | 2323 | return "error : ".$e->getMessage(); |
2324 | 2324 | } |
2325 | 2325 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2334,7 +2334,7 @@ discard block |
||
2334 | 2334 | $Connection = new Connection(); |
2335 | 2335 | $sth = $Connection->db->prepare($query); |
2336 | 2336 | $sth->execute(); |
2337 | - } catch(PDOException $e) { |
|
2337 | + } catch (PDOException $e) { |
|
2338 | 2338 | return "error : ".$e->getMessage(); |
2339 | 2339 | } |
2340 | 2340 | } |
@@ -2349,7 +2349,7 @@ discard block |
||
2349 | 2349 | $Connection = new Connection(); |
2350 | 2350 | $sth = $Connection->db->prepare($query); |
2351 | 2351 | $sth->execute(); |
2352 | - } catch(PDOException $e) { |
|
2352 | + } catch (PDOException $e) { |
|
2353 | 2353 | return "error : ".$e->getMessage(); |
2354 | 2354 | } |
2355 | 2355 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2364,7 +2364,7 @@ discard block |
||
2364 | 2364 | $Connection = new Connection(); |
2365 | 2365 | $sth = $Connection->db->prepare($query); |
2366 | 2366 | $sth->execute(); |
2367 | - } catch(PDOException $e) { |
|
2367 | + } catch (PDOException $e) { |
|
2368 | 2368 | return "error : ".$e->getMessage(); |
2369 | 2369 | } |
2370 | 2370 | } |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | $Connection = new Connection(); |
2380 | 2380 | $sth = $Connection->db->prepare($query); |
2381 | 2381 | $sth->execute(); |
2382 | - } catch(PDOException $e) { |
|
2382 | + } catch (PDOException $e) { |
|
2383 | 2383 | return "error : ".$e->getMessage(); |
2384 | 2384 | } |
2385 | 2385 | } |
@@ -2394,7 +2394,7 @@ discard block |
||
2394 | 2394 | $Connection = new Connection(); |
2395 | 2395 | $sth = $Connection->db->prepare($query); |
2396 | 2396 | $sth->execute(); |
2397 | - } catch(PDOException $e) { |
|
2397 | + } catch (PDOException $e) { |
|
2398 | 2398 | return "error : ".$e->getMessage(); |
2399 | 2399 | } |
2400 | 2400 | } |
@@ -5,11 +5,11 @@ |
||
5 | 5 | |
6 | 6 | if ($_POST['aircraft_manufacturer'] != "") |
7 | 7 | { |
8 | - $aircraft_manufacturer = filter_input(INPUT_POST,'aircraft_manufacturer',FILTER_SANITIZE_STRING); |
|
8 | + $aircraft_manufacturer = filter_input(INPUT_POST, 'aircraft_manufacturer', FILTER_SANITIZE_STRING); |
|
9 | 9 | header('Location: '.$globalURL.'/manufacturer/'.$aircraft_manufacturer); |
10 | 10 | } elseif ($_GET['aircraft_manufacturer'] != "") |
11 | 11 | { |
12 | - $aircraft_manufacturer = filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING); |
|
12 | + $aircraft_manufacturer = filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING); |
|
13 | 13 | header('Location: '.$globalURL.'/manufacturer/'.$aircraft_manufacturer); |
14 | 14 | } else { |
15 | 15 | header('Location: '.$globalURL); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | if ($_POST['registration'] != "") |
7 | 7 | { |
8 | - $registration = filter_input(INPUT_POST,'registration',FILTER_SANITIZE_STRING); |
|
8 | + $registration = filter_input(INPUT_POST, 'registration', FILTER_SANITIZE_STRING); |
|
9 | 9 | header('Location: '.$globalURL.'/registration/'.$registration); |
10 | 10 | } else { |
11 | 11 | header('Location: '.$globalURL); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
6 | 6 | |
7 | -class Spotter{ |
|
7 | +class Spotter { |
|
8 | 8 | public $db; |
9 | 9 | |
10 | 10 | public function __construct($dbc = null) { |
@@ -17,64 +17,64 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
35 | 35 | if ($flt['airlines'][0] != '') { |
36 | 36 | if (isset($flt['source'])) { |
37 | - $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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
37 | + $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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
38 | 38 | } else { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
44 | 44 | if (isset($flt['source'])) { |
45 | - $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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
45 | + $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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
46 | 46 | } else { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
51 | 51 | if (isset($flt['source'])) { |
52 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
52 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
56 | 56 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
57 | 57 | if ($filter['airlines'][0] != '') { |
58 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
58 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
62 | 62 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id "; |
63 | 63 | } |
64 | 64 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
65 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
65 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
66 | 66 | } |
67 | 67 | if (isset($filter['source']) && !empty($filter['source'])) { |
68 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
68 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
69 | 69 | } |
70 | 70 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
71 | 71 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
72 | 72 | } |
73 | 73 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
74 | 74 | if ($filter_query_where == '') { |
75 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
75 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
76 | 76 | } else { |
77 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
77 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @return Array the spotter information |
93 | 93 | * |
94 | 94 | */ |
95 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
95 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
96 | 96 | { |
97 | 97 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
98 | 98 | $Image = new Image($this->db); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $sth = $this->db->prepare($query.$limitQuery); |
123 | 123 | $sth->execute($params); |
124 | 124 | } catch (PDOException $e) { |
125 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
125 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
126 | 126 | exit(); |
127 | 127 | } |
128 | 128 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $spotter_array = array(); |
133 | 133 | |
134 | 134 | |
135 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
135 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
136 | 136 | { |
137 | 137 | $num_rows++; |
138 | 138 | $temp_array = array(); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | if (isset($row['route_stop'])) { |
178 | 178 | $temp_array['route_stop'] = $row['route_stop']; |
179 | 179 | if ($row['route_stop'] != '') { |
180 | - $allroute = explode(' ',$row['route_stop']); |
|
180 | + $allroute = explode(' ', $row['route_stop']); |
|
181 | 181 | |
182 | 182 | foreach ($allroute as $route) { |
183 | 183 | $route_airport_array = $this->getAllAirportInfo($route); |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | { |
233 | 233 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
234 | 234 | } else { |
235 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
235 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
236 | 236 | } |
237 | 237 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
238 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
239 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
238 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
239 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
240 | 240 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
241 | 241 | } |
242 | 242 | |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
271 | 271 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
272 | 272 | if (is_numeric(substr($row['ident'], 2, 1))) { |
273 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
273 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
274 | 274 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
275 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
275 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
276 | 276 | } else { |
277 | 277 | $airline_array = $this->getAllAirlineInfo('NA'); |
278 | 278 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | } |
310 | 310 | } |
311 | 311 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
312 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
312 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
313 | 313 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
314 | 314 | if (count($acars_array) > 0) { |
315 | 315 | $temp_array['acars'] = $acars_array; |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
327 | 327 | } |
328 | 328 | |
329 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
329 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
330 | 330 | { |
331 | 331 | if ($globalIVAO) { |
332 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
333 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
332 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
333 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
334 | 334 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
335 | 335 | if (count($image_array) > 0) { |
336 | 336 | $temp_array['image'] = $image_array[0]['image']; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
355 | 355 | } |
356 | 356 | |
357 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
357 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
358 | 358 | if ($schedules === true) { |
359 | 359 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
360 | 360 | //print_r($schedule_array); |
@@ -436,12 +436,12 @@ discard block |
||
436 | 436 | if (isset($row['squawk'])) { |
437 | 437 | $temp_array['squawk'] = $row['squawk']; |
438 | 438 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
439 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
440 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
439 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
440 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
441 | 441 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
442 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
443 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
444 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
442 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
443 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
444 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | $temp_array['query_number_rows'] = $num_rows; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return Array the spotter information |
461 | 461 | * |
462 | 462 | */ |
463 | - 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()) |
|
463 | + 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()) |
|
464 | 464 | { |
465 | 465 | global $globalTimezone, $globalDBdriver; |
466 | 466 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | $query_values = array(); |
472 | 472 | $additional_query = ''; |
473 | - $filter_query = $this->getFilter($filters,true,true); |
|
473 | + $filter_query = $this->getFilter($filters, true, true); |
|
474 | 474 | if ($q != "") |
475 | 475 | { |
476 | 476 | if (!is_string($q)) |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | return false; |
479 | 479 | } else { |
480 | 480 | $q_array = explode(" ", $q); |
481 | - foreach ($q_array as $q_item){ |
|
482 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
481 | + foreach ($q_array as $q_item) { |
|
482 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
483 | 483 | $additional_query .= " AND ("; |
484 | 484 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
485 | 485 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -511,37 +511,37 @@ discard block |
||
511 | 511 | |
512 | 512 | if ($registration != "") |
513 | 513 | { |
514 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
514 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
515 | 515 | if (!is_string($registration)) |
516 | 516 | { |
517 | 517 | return false; |
518 | 518 | } else { |
519 | 519 | $additional_query .= " AND spotter_output.registration = :registration"; |
520 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
520 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | 524 | if ($aircraft_icao != "") |
525 | 525 | { |
526 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
526 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
527 | 527 | if (!is_string($aircraft_icao)) |
528 | 528 | { |
529 | 529 | return false; |
530 | 530 | } else { |
531 | 531 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
532 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
532 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | 536 | if ($aircraft_manufacturer != "") |
537 | 537 | { |
538 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
538 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
539 | 539 | if (!is_string($aircraft_manufacturer)) |
540 | 540 | { |
541 | 541 | return false; |
542 | 542 | } else { |
543 | 543 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
544 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
544 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
@@ -557,25 +557,25 @@ discard block |
||
557 | 557 | |
558 | 558 | if ($airline_icao != "") |
559 | 559 | { |
560 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
560 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
561 | 561 | if (!is_string($airline_icao)) |
562 | 562 | { |
563 | 563 | return false; |
564 | 564 | } else { |
565 | 565 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
566 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
566 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | 570 | if ($airline_country != "") |
571 | 571 | { |
572 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
572 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
573 | 573 | if (!is_string($airline_country)) |
574 | 574 | { |
575 | 575 | return false; |
576 | 576 | } else { |
577 | 577 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
578 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
578 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
579 | 579 | } |
580 | 580 | } |
581 | 581 | |
@@ -602,31 +602,31 @@ discard block |
||
602 | 602 | |
603 | 603 | if ($airport != "") |
604 | 604 | { |
605 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
605 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
606 | 606 | if (!is_string($airport)) |
607 | 607 | { |
608 | 608 | return false; |
609 | 609 | } else { |
610 | 610 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
611 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
611 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | 615 | if ($airport_country != "") |
616 | 616 | { |
617 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
617 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
618 | 618 | if (!is_string($airport_country)) |
619 | 619 | { |
620 | 620 | return false; |
621 | 621 | } else { |
622 | 622 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
623 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
623 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
627 | 627 | if ($callsign != "") |
628 | 628 | { |
629 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
629 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
630 | 630 | if (!is_string($callsign)) |
631 | 631 | { |
632 | 632 | return false; |
@@ -634,79 +634,79 @@ discard block |
||
634 | 634 | $translate = $Translation->ident2icao($callsign); |
635 | 635 | if ($translate != $callsign) { |
636 | 636 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
637 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
637 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
638 | 638 | } else { |
639 | 639 | $additional_query .= " AND spotter_output.ident = :callsign"; |
640 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
640 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
641 | 641 | } |
642 | 642 | } |
643 | 643 | } |
644 | 644 | |
645 | 645 | if ($owner != "") |
646 | 646 | { |
647 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
647 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
648 | 648 | if (!is_string($owner)) |
649 | 649 | { |
650 | 650 | return false; |
651 | 651 | } else { |
652 | 652 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
653 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
653 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
654 | 654 | } |
655 | 655 | } |
656 | 656 | |
657 | 657 | if ($pilot_name != "") |
658 | 658 | { |
659 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
659 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
660 | 660 | if (!is_string($pilot_name)) |
661 | 661 | { |
662 | 662 | return false; |
663 | 663 | } else { |
664 | 664 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
665 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
665 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
666 | 666 | } |
667 | 667 | } |
668 | 668 | |
669 | 669 | if ($pilot_id != "") |
670 | 670 | { |
671 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
671 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
672 | 672 | if (!is_string($pilot_id)) |
673 | 673 | { |
674 | 674 | return false; |
675 | 675 | } else { |
676 | 676 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
677 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
677 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
678 | 678 | } |
679 | 679 | } |
680 | 680 | |
681 | 681 | if ($departure_airport_route != "") |
682 | 682 | { |
683 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
683 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
684 | 684 | if (!is_string($departure_airport_route)) |
685 | 685 | { |
686 | 686 | return false; |
687 | 687 | } else { |
688 | 688 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
689 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
689 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
690 | 690 | } |
691 | 691 | } |
692 | 692 | |
693 | 693 | if ($arrival_airport_route != "") |
694 | 694 | { |
695 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
695 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
696 | 696 | if (!is_string($arrival_airport_route)) |
697 | 697 | { |
698 | 698 | return false; |
699 | 699 | } else { |
700 | 700 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
701 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
701 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | |
705 | 705 | if ($altitude != "") |
706 | 706 | { |
707 | 707 | $altitude_array = explode(",", $altitude); |
708 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
709 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
708 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
709 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
710 | 710 | |
711 | 711 | if ($altitude_array[1] != "") |
712 | 712 | { |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | if ($date_posted != "") |
723 | 723 | { |
724 | 724 | $date_array = explode(",", $date_posted); |
725 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
726 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
725 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
726 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
727 | 727 | |
728 | 728 | if ($globalTimezone != '') { |
729 | 729 | date_default_timezone_set($globalTimezone); |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | { |
755 | 755 | $limit_array = explode(",", $limit); |
756 | 756 | |
757 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
758 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
757 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
758 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
759 | 759 | |
760 | 760 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
761 | 761 | { |
@@ -784,23 +784,23 @@ discard block |
||
784 | 784 | |
785 | 785 | |
786 | 786 | if ($origLat != "" && $origLon != "" && $dist != "") { |
787 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
787 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
788 | 788 | |
789 | 789 | if ($globalDBdriver == 'mysql') { |
790 | - $query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
790 | + $query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
791 | 791 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
792 | 792 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
793 | 793 | } else { |
794 | - $query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(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 |
|
794 | + $query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(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 |
|
795 | 795 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
796 | 796 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(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.$orderby_query; |
797 | 797 | } |
798 | 798 | } else { |
799 | - $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
799 | + $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
800 | 800 | ".$additional_query." |
801 | 801 | ".$orderby_query; |
802 | 802 | } |
803 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
803 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
804 | 804 | return $spotter_array; |
805 | 805 | } |
806 | 806 | |
@@ -823,8 +823,8 @@ discard block |
||
823 | 823 | { |
824 | 824 | $limit_array = explode(",", $limit); |
825 | 825 | |
826 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
827 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
826 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
827 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
828 | 828 | |
829 | 829 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
830 | 830 | { |
@@ -841,9 +841,9 @@ discard block |
||
841 | 841 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
842 | 842 | } |
843 | 843 | |
844 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
844 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
845 | 845 | |
846 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
846 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
847 | 847 | |
848 | 848 | return $spotter_array; |
849 | 849 | } |
@@ -889,34 +889,34 @@ discard block |
||
889 | 889 | { |
890 | 890 | return false; |
891 | 891 | } else { |
892 | - if ($interval == "30m"){ |
|
892 | + if ($interval == "30m") { |
|
893 | 893 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
894 | - } else if ($interval == "1h"){ |
|
894 | + } else if ($interval == "1h") { |
|
895 | 895 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
896 | - } else if ($interval == "3h"){ |
|
896 | + } else if ($interval == "3h") { |
|
897 | 897 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
898 | - } else if ($interval == "6h"){ |
|
898 | + } else if ($interval == "6h") { |
|
899 | 899 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
900 | - } else if ($interval == "12h"){ |
|
900 | + } else if ($interval == "12h") { |
|
901 | 901 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
902 | - } else if ($interval == "24h"){ |
|
902 | + } else if ($interval == "24h") { |
|
903 | 903 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
904 | - } else if ($interval == "7d"){ |
|
904 | + } else if ($interval == "7d") { |
|
905 | 905 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
906 | - } else if ($interval == "30d"){ |
|
906 | + } else if ($interval == "30d") { |
|
907 | 907 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
908 | 908 | } |
909 | 909 | } |
910 | 910 | } |
911 | 911 | |
912 | - $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
912 | + $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
913 | 913 | WHERE spotter_output.latitude <> '' |
914 | 914 | AND spotter_output.longitude <> '' |
915 | 915 | ".$additional_query." |
916 | 916 | HAVING distance < :radius |
917 | 917 | ORDER BY distance"; |
918 | 918 | |
919 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
919 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
920 | 920 | |
921 | 921 | return $spotter_array; |
922 | 922 | } |
@@ -928,21 +928,21 @@ discard block |
||
928 | 928 | * @return Array the spotter information |
929 | 929 | * |
930 | 930 | */ |
931 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
931 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
932 | 932 | { |
933 | 933 | global $global_query; |
934 | 934 | |
935 | 935 | date_default_timezone_set('UTC'); |
936 | 936 | |
937 | - $filter_query = $this->getFilter($filter,true,true); |
|
937 | + $filter_query = $this->getFilter($filter, true, true); |
|
938 | 938 | |
939 | 939 | $limit_query = ''; |
940 | 940 | if ($limit != "") |
941 | 941 | { |
942 | 942 | $limit_array = explode(",", $limit); |
943 | 943 | |
944 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
945 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
944 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
945 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
946 | 946 | |
947 | 947 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
948 | 948 | { |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
960 | 960 | } |
961 | 961 | |
962 | - $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
962 | + $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
963 | 963 | |
964 | 964 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
965 | 965 | |
@@ -978,15 +978,15 @@ discard block |
||
978 | 978 | global $global_query; |
979 | 979 | |
980 | 980 | date_default_timezone_set('UTC'); |
981 | - $filter_query = $this->getFilter($filter,true,true); |
|
981 | + $filter_query = $this->getFilter($filter, true, true); |
|
982 | 982 | |
983 | 983 | $limit_query = ''; |
984 | 984 | if ($limit != "") |
985 | 985 | { |
986 | 986 | $limit_array = explode(",", $limit); |
987 | 987 | |
988 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
989 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
988 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
989 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
990 | 990 | |
991 | 991 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
992 | 992 | { |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1004 | 1004 | } |
1005 | 1005 | |
1006 | - $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1006 | + $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1007 | 1007 | |
1008 | 1008 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1009 | 1009 | |
@@ -1017,20 +1017,20 @@ discard block |
||
1017 | 1017 | * @return Array the spotter information |
1018 | 1018 | * |
1019 | 1019 | */ |
1020 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
1020 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
1021 | 1021 | { |
1022 | 1022 | global $global_query; |
1023 | 1023 | |
1024 | 1024 | date_default_timezone_set('UTC'); |
1025 | - $filter_query = $this->getFilter($filter,true,true); |
|
1025 | + $filter_query = $this->getFilter($filter, true, true); |
|
1026 | 1026 | |
1027 | 1027 | $limit_query = ''; |
1028 | 1028 | if ($limit != "") |
1029 | 1029 | { |
1030 | 1030 | $limit_array = explode(",", $limit); |
1031 | 1031 | |
1032 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1033 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1032 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1033 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1034 | 1034 | |
1035 | 1035 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1036 | 1036 | { |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1048 | 1048 | } |
1049 | 1049 | |
1050 | - $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1050 | + $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1051 | 1051 | |
1052 | 1052 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1053 | 1053 | |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | |
1068 | 1068 | date_default_timezone_set('UTC'); |
1069 | 1069 | |
1070 | - $filter_query = $this->getFilter($filter,true,true); |
|
1070 | + $filter_query = $this->getFilter($filter, true, true); |
|
1071 | 1071 | |
1072 | 1072 | $limit_query = ''; |
1073 | 1073 | |
@@ -1075,8 +1075,8 @@ discard block |
||
1075 | 1075 | { |
1076 | 1076 | $limit_array = explode(",", $limit); |
1077 | 1077 | |
1078 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1079 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1078 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1079 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1080 | 1080 | |
1081 | 1081 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1082 | 1082 | { |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1094 | 1094 | } |
1095 | 1095 | |
1096 | - $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1096 | + $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1097 | 1097 | |
1098 | 1098 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1099 | 1099 | |
@@ -1112,14 +1112,14 @@ discard block |
||
1112 | 1112 | global $global_query; |
1113 | 1113 | |
1114 | 1114 | date_default_timezone_set('UTC'); |
1115 | - $filter_query = $this->getFilter($filter,true,true); |
|
1115 | + $filter_query = $this->getFilter($filter, true, true); |
|
1116 | 1116 | $limit_query = ''; |
1117 | 1117 | if ($limit != "") |
1118 | 1118 | { |
1119 | 1119 | $limit_array = explode(",", $limit); |
1120 | 1120 | |
1121 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1122 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1121 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1122 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1123 | 1123 | |
1124 | 1124 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1125 | 1125 | { |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1137 | 1137 | } |
1138 | 1138 | |
1139 | - $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1139 | + $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1140 | 1140 | |
1141 | 1141 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1142 | 1142 | |
@@ -1160,9 +1160,9 @@ discard block |
||
1160 | 1160 | $query_values = array(':id' => $id); |
1161 | 1161 | |
1162 | 1162 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
1163 | - $query = $global_query." WHERE ".$additional_query." "; |
|
1163 | + $query = $global_query." WHERE ".$additional_query." "; |
|
1164 | 1164 | |
1165 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
1165 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
1166 | 1166 | |
1167 | 1167 | return $spotter_array; |
1168 | 1168 | } |
@@ -1200,8 +1200,8 @@ discard block |
||
1200 | 1200 | { |
1201 | 1201 | $limit_array = explode(",", $limit); |
1202 | 1202 | |
1203 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1204 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1203 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1204 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1205 | 1205 | |
1206 | 1206 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1207 | 1207 | { |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | $query_values = array(); |
1243 | 1243 | $limit_query = ''; |
1244 | 1244 | $additional_query = ''; |
1245 | - $filter_query = $this->getFilter($filter,true,true); |
|
1245 | + $filter_query = $this->getFilter($filter, true, true); |
|
1246 | 1246 | |
1247 | 1247 | if ($aircraft_type != "") |
1248 | 1248 | { |
@@ -1259,8 +1259,8 @@ discard block |
||
1259 | 1259 | { |
1260 | 1260 | $limit_array = explode(",", $limit); |
1261 | 1261 | |
1262 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1263 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1262 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1263 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1264 | 1264 | |
1265 | 1265 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1266 | 1266 | { |
@@ -1316,8 +1316,8 @@ discard block |
||
1316 | 1316 | { |
1317 | 1317 | $limit_array = explode(",", $limit); |
1318 | 1318 | |
1319 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1320 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1319 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1320 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1321 | 1321 | |
1322 | 1322 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1323 | 1323 | { |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | } else { |
1334 | 1334 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
1335 | 1335 | } |
1336 | - $filter_query = $this->getFilter($filter,true,true); |
|
1336 | + $filter_query = $this->getFilter($filter, true, true); |
|
1337 | 1337 | |
1338 | 1338 | //$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query; |
1339 | 1339 | $query = $global_query.$filter_query." ".$additional_query." ".$orderby_query; |
@@ -1352,7 +1352,7 @@ discard block |
||
1352 | 1352 | * @return Array the spotter information |
1353 | 1353 | * |
1354 | 1354 | */ |
1355 | - public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
|
1355 | + public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array()) |
|
1356 | 1356 | { |
1357 | 1357 | global $global_query; |
1358 | 1358 | |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | $query_values = array(); |
1362 | 1362 | $limit_query = ''; |
1363 | 1363 | $additional_query = ''; |
1364 | - $filter_query = $this->getFilter($filters,true,true); |
|
1364 | + $filter_query = $this->getFilter($filters, true, true); |
|
1365 | 1365 | |
1366 | 1366 | if ($airline != "") |
1367 | 1367 | { |
@@ -1378,8 +1378,8 @@ discard block |
||
1378 | 1378 | { |
1379 | 1379 | $limit_array = explode(",", $limit); |
1380 | 1380 | |
1381 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1382 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1381 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1382 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1383 | 1383 | |
1384 | 1384 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1385 | 1385 | { |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | * @return Array the spotter information |
1410 | 1410 | * |
1411 | 1411 | */ |
1412 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1412 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1413 | 1413 | { |
1414 | 1414 | global $global_query; |
1415 | 1415 | |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | $query_values = array(); |
1418 | 1418 | $limit_query = ''; |
1419 | 1419 | $additional_query = ''; |
1420 | - $filter_query = $this->getFilter($filters,true,true); |
|
1420 | + $filter_query = $this->getFilter($filters, true, true); |
|
1421 | 1421 | |
1422 | 1422 | if ($airport != "") |
1423 | 1423 | { |
@@ -1434,8 +1434,8 @@ discard block |
||
1434 | 1434 | { |
1435 | 1435 | $limit_array = explode(",", $limit); |
1436 | 1436 | |
1437 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1438 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1437 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1438 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1439 | 1439 | |
1440 | 1440 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1441 | 1441 | { |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | * @return Array the spotter information |
1468 | 1468 | * |
1469 | 1469 | */ |
1470 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
1470 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
1471 | 1471 | { |
1472 | 1472 | global $global_query, $globalTimezone, $globalDBdriver; |
1473 | 1473 | |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | $limit_query = ''; |
1476 | 1476 | $additional_query = ''; |
1477 | 1477 | |
1478 | - $filter_query = $this->getFilter($filter,true,true); |
|
1478 | + $filter_query = $this->getFilter($filter, true, true); |
|
1479 | 1479 | |
1480 | 1480 | if ($date != "") |
1481 | 1481 | { |
@@ -1504,8 +1504,8 @@ discard block |
||
1504 | 1504 | { |
1505 | 1505 | $limit_array = explode(",", $limit); |
1506 | 1506 | |
1507 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1508 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1507 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1508 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1509 | 1509 | |
1510 | 1510 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1511 | 1511 | { |
@@ -1535,7 +1535,7 @@ discard block |
||
1535 | 1535 | * @return Array the spotter information |
1536 | 1536 | * |
1537 | 1537 | */ |
1538 | - public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
|
1538 | + public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array()) |
|
1539 | 1539 | { |
1540 | 1540 | global $global_query; |
1541 | 1541 | |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | $query_values = array(); |
1545 | 1545 | $limit_query = ''; |
1546 | 1546 | $additional_query = ''; |
1547 | - $filter_query = $this->getFilter($filters,true,true); |
|
1547 | + $filter_query = $this->getFilter($filters, true, true); |
|
1548 | 1548 | if ($country != "") |
1549 | 1549 | { |
1550 | 1550 | if (!is_string($country)) |
@@ -1561,8 +1561,8 @@ discard block |
||
1561 | 1561 | { |
1562 | 1562 | $limit_array = explode(",", $limit); |
1563 | 1563 | |
1564 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1565 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1564 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1565 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1566 | 1566 | |
1567 | 1567 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1568 | 1568 | { |
@@ -1602,7 +1602,7 @@ discard block |
||
1602 | 1602 | $query_values = array(); |
1603 | 1603 | $additional_query = ''; |
1604 | 1604 | $limit_query = ''; |
1605 | - $filter_query = $this->getFilter($filters,true,true); |
|
1605 | + $filter_query = $this->getFilter($filters, true, true); |
|
1606 | 1606 | |
1607 | 1607 | if ($aircraft_manufacturer != "") |
1608 | 1608 | { |
@@ -1619,8 +1619,8 @@ discard block |
||
1619 | 1619 | { |
1620 | 1620 | $limit_array = explode(",", $limit); |
1621 | 1621 | |
1622 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1623 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1622 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1623 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1624 | 1624 | |
1625 | 1625 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1626 | 1626 | { |
@@ -1662,14 +1662,14 @@ discard block |
||
1662 | 1662 | $query_values = array(); |
1663 | 1663 | $additional_query = ''; |
1664 | 1664 | $limit_query = ''; |
1665 | - $filter_query = $this->getFilter($filters,true,true); |
|
1665 | + $filter_query = $this->getFilter($filters, true, true); |
|
1666 | 1666 | if ($departure_airport_icao != "") |
1667 | 1667 | { |
1668 | 1668 | if (!is_string($departure_airport_icao)) |
1669 | 1669 | { |
1670 | 1670 | return false; |
1671 | 1671 | } else { |
1672 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1672 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1673 | 1673 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
1674 | 1674 | //$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao"; |
1675 | 1675 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
@@ -1682,10 +1682,10 @@ discard block |
||
1682 | 1682 | { |
1683 | 1683 | return false; |
1684 | 1684 | } else { |
1685 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1685 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1686 | 1686 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
1687 | 1687 | //$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)"; |
1688 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
1688 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
1689 | 1689 | } |
1690 | 1690 | } |
1691 | 1691 | |
@@ -1693,8 +1693,8 @@ discard block |
||
1693 | 1693 | { |
1694 | 1694 | $limit_array = explode(",", $limit); |
1695 | 1695 | |
1696 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1697 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1696 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1697 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1698 | 1698 | |
1699 | 1699 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1700 | 1700 | { |
@@ -1733,15 +1733,15 @@ discard block |
||
1733 | 1733 | global $global_query; |
1734 | 1734 | |
1735 | 1735 | date_default_timezone_set('UTC'); |
1736 | - $filter_query = $this->getFilter($filter,true,true); |
|
1736 | + $filter_query = $this->getFilter($filter, true, true); |
|
1737 | 1737 | $limit_query = ''; |
1738 | 1738 | |
1739 | 1739 | if ($limit != "") |
1740 | 1740 | { |
1741 | 1741 | $limit_array = explode(",", $limit); |
1742 | 1742 | |
1743 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1744 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1743 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1744 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1745 | 1745 | |
1746 | 1746 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1747 | 1747 | { |
@@ -1758,7 +1758,7 @@ discard block |
||
1758 | 1758 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
1759 | 1759 | } |
1760 | 1760 | |
1761 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
1761 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
1762 | 1762 | |
1763 | 1763 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1764 | 1764 | |
@@ -1771,19 +1771,19 @@ discard block |
||
1771 | 1771 | * @return String the highlight text |
1772 | 1772 | * |
1773 | 1773 | */ |
1774 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
1774 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
1775 | 1775 | { |
1776 | 1776 | global $global_query; |
1777 | 1777 | |
1778 | 1778 | date_default_timezone_set('UTC'); |
1779 | - $filter_query = $this->getFilter($filter,true,true); |
|
1780 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
1779 | + $filter_query = $this->getFilter($filter, true, true); |
|
1780 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
1781 | 1781 | |
1782 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
1782 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
1783 | 1783 | $sth = $this->db->prepare($query); |
1784 | 1784 | $sth->execute(array(':registration' => $registration)); |
1785 | 1785 | |
1786 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1786 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1787 | 1787 | { |
1788 | 1788 | $highlight = $row['highlight']; |
1789 | 1789 | } |
@@ -1799,14 +1799,14 @@ discard block |
||
1799 | 1799 | * @return String usage |
1800 | 1800 | * |
1801 | 1801 | */ |
1802 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
1802 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
1803 | 1803 | { |
1804 | 1804 | |
1805 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
1806 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
1805 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
1806 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
1807 | 1807 | |
1808 | 1808 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
1809 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
1809 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
1810 | 1810 | |
1811 | 1811 | $sth = $this->db->prepare($query); |
1812 | 1812 | $sth->execute($query_values); |
@@ -1828,9 +1828,9 @@ discard block |
||
1828 | 1828 | public function getAirportIcao($airport_iata = '') |
1829 | 1829 | { |
1830 | 1830 | |
1831 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
1831 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
1832 | 1832 | |
1833 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
1833 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
1834 | 1834 | $query_values = array(':airport' => $airport_iata); |
1835 | 1835 | |
1836 | 1836 | $sth = $this->db->prepare($query); |
@@ -1852,12 +1852,12 @@ discard block |
||
1852 | 1852 | * @return Float distance to the airport |
1853 | 1853 | * |
1854 | 1854 | */ |
1855 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
1855 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
1856 | 1856 | { |
1857 | 1857 | |
1858 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
1858 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
1859 | 1859 | |
1860 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
1860 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
1861 | 1861 | $query_values = array(':airport' => $airport_icao); |
1862 | 1862 | $sth = $this->db->prepare($query); |
1863 | 1863 | $sth->execute($query_values); |
@@ -1867,7 +1867,7 @@ discard block |
||
1867 | 1867 | $airport_latitude = $row['latitude']; |
1868 | 1868 | $airport_longitude = $row['longitude']; |
1869 | 1869 | $Common = new Common(); |
1870 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
1870 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
1871 | 1871 | } else return ''; |
1872 | 1872 | } |
1873 | 1873 | |
@@ -1881,11 +1881,11 @@ discard block |
||
1881 | 1881 | public function getAllAirportInfo($airport = '') |
1882 | 1882 | { |
1883 | 1883 | |
1884 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
1884 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
1885 | 1885 | |
1886 | 1886 | $query_values = array(); |
1887 | 1887 | if ($airport == 'NA') { |
1888 | - return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => '')); |
|
1888 | + return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => '')); |
|
1889 | 1889 | } elseif ($airport == '') { |
1890 | 1890 | $query = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport"; |
1891 | 1891 | } else { |
@@ -1933,14 +1933,14 @@ discard block |
||
1933 | 1933 | { |
1934 | 1934 | $lst_countries = ''; |
1935 | 1935 | foreach ($countries as $country) { |
1936 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
1936 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
1937 | 1937 | if ($lst_countries == '') { |
1938 | 1938 | $lst_countries = "'".$country."'"; |
1939 | 1939 | } else { |
1940 | 1940 | $lst_countries .= ",'".$country."'"; |
1941 | 1941 | } |
1942 | 1942 | } |
1943 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
1943 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
1944 | 1944 | |
1945 | 1945 | $sth = $this->db->prepare($query); |
1946 | 1946 | $sth->execute(); |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | $airport_array = array(); |
1949 | 1949 | $temp_array = array(); |
1950 | 1950 | |
1951 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1951 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1952 | 1952 | { |
1953 | 1953 | $temp_array['name'] = $row['name']; |
1954 | 1954 | $temp_array['city'] = $row['city']; |
@@ -1976,10 +1976,10 @@ discard block |
||
1976 | 1976 | { |
1977 | 1977 | global $globalDBdriver; |
1978 | 1978 | if (is_array($coord)) { |
1979 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1980 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1981 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1982 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1979 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1980 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1981 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1982 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1983 | 1983 | } else return array(); |
1984 | 1984 | if ($globalDBdriver == 'mysql') { |
1985 | 1985 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -1991,7 +1991,7 @@ discard block |
||
1991 | 1991 | |
1992 | 1992 | $airport_array = array(); |
1993 | 1993 | |
1994 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1994 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1995 | 1995 | { |
1996 | 1996 | $temp_array = $row; |
1997 | 1997 | |
@@ -2011,13 +2011,13 @@ discard block |
||
2011 | 2011 | public function getAllWaypointsInfobyCoord($coord) |
2012 | 2012 | { |
2013 | 2013 | if (is_array($coord)) { |
2014 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
2015 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
2016 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
2017 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
2014 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
2015 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
2016 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
2017 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
2018 | 2018 | } else return array(); |
2019 | 2019 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
2020 | - $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
2020 | + $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
2021 | 2021 | //$query = "SELECT waypoints.* FROM waypoints"; |
2022 | 2022 | //$query = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end"; |
2023 | 2023 | //$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | |
2030 | 2030 | $waypoints_array = array(); |
2031 | 2031 | |
2032 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2032 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2033 | 2033 | { |
2034 | 2034 | $temp_array = $row; |
2035 | 2035 | |
@@ -2051,10 +2051,10 @@ discard block |
||
2051 | 2051 | { |
2052 | 2052 | global $globalUseRealAirlines; |
2053 | 2053 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
2054 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
2054 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
2055 | 2055 | if ($airline_icao == 'NA') { |
2056 | 2056 | $airline_array = array(); |
2057 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
2057 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
2058 | 2058 | return $airline_array; |
2059 | 2059 | } else { |
2060 | 2060 | if (strlen($airline_icao) == 2) { |
@@ -2075,7 +2075,7 @@ discard block |
||
2075 | 2075 | if ($fromsource === NULL) { |
2076 | 2076 | $sth->execute(array(':airline_icao' => $airline_icao)); |
2077 | 2077 | } else { |
2078 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
2078 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
2079 | 2079 | } |
2080 | 2080 | /* |
2081 | 2081 | $airline_array = array(); |
@@ -2117,13 +2117,13 @@ discard block |
||
2117 | 2117 | { |
2118 | 2118 | global $globalUseRealAirlines; |
2119 | 2119 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
2120 | - $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
|
2121 | - $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
|
2120 | + $airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING)); |
|
2121 | + $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
|
2122 | 2122 | $sth = $this->db->prepare($query); |
2123 | 2123 | if ($fromsource === NULL) { |
2124 | 2124 | $sth->execute(array(':airline_name' => $airline_name)); |
2125 | 2125 | } else { |
2126 | - $sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource)); |
|
2126 | + $sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource)); |
|
2127 | 2127 | } |
2128 | 2128 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2129 | 2129 | if (empty($result) && $fromsource !== NULL) { |
@@ -2148,12 +2148,12 @@ discard block |
||
2148 | 2148 | */ |
2149 | 2149 | public function getAllAircraftInfo($aircraft_type) |
2150 | 2150 | { |
2151 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
2151 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
2152 | 2152 | |
2153 | 2153 | if ($aircraft_type == 'NA') { |
2154 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
2154 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
2155 | 2155 | } |
2156 | - $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
2156 | + $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
2157 | 2157 | |
2158 | 2158 | $sth = $this->db->prepare($query); |
2159 | 2159 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2185,7 +2185,7 @@ discard block |
||
2185 | 2185 | */ |
2186 | 2186 | public function getAircraftIcao($aircraft_type) |
2187 | 2187 | { |
2188 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
2188 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
2189 | 2189 | $all_aircraft = array('737-300' => 'B733', |
2190 | 2190 | '777-200' => 'B772', |
2191 | 2191 | '777-200ER' => 'B772', |
@@ -2197,10 +2197,10 @@ discard block |
||
2197 | 2197 | 'A380' => 'A388'); |
2198 | 2198 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
2199 | 2199 | |
2200 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
2200 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
2201 | 2201 | $aircraft_type = strtoupper($aircraft_type); |
2202 | 2202 | $sth = $this->db->prepare($query); |
2203 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
2203 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
2204 | 2204 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2205 | 2205 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
2206 | 2206 | else return ''; |
@@ -2215,9 +2215,9 @@ discard block |
||
2215 | 2215 | */ |
2216 | 2216 | public function getAllAircraftType($aircraft_modes) |
2217 | 2217 | { |
2218 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
2218 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
2219 | 2219 | |
2220 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
2220 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
2221 | 2221 | |
2222 | 2222 | $sth = $this->db->prepare($query); |
2223 | 2223 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -2238,9 +2238,9 @@ discard block |
||
2238 | 2238 | */ |
2239 | 2239 | public function getAllAircraftTypeByRegistration($registration) |
2240 | 2240 | { |
2241 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
2241 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
2242 | 2242 | |
2243 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
2243 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
2244 | 2244 | |
2245 | 2245 | $sth = $this->db->prepare($query); |
2246 | 2246 | $sth->execute(array(':registration' => $registration)); |
@@ -2261,8 +2261,8 @@ discard block |
||
2261 | 2261 | */ |
2262 | 2262 | public function getOperator($operator) |
2263 | 2263 | { |
2264 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
2265 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
2264 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
2265 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
2266 | 2266 | |
2267 | 2267 | $sth = $this->db->prepare($query); |
2268 | 2268 | $sth->execute(array(':operator' => $operator)); |
@@ -2283,9 +2283,9 @@ discard block |
||
2283 | 2283 | */ |
2284 | 2284 | public function getRouteInfo($callsign) |
2285 | 2285 | { |
2286 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
2286 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
2287 | 2287 | if ($callsign == '') return array(); |
2288 | - $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
2288 | + $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
2289 | 2289 | |
2290 | 2290 | $sth = $this->db->prepare($query); |
2291 | 2291 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2306,9 +2306,9 @@ discard block |
||
2306 | 2306 | */ |
2307 | 2307 | public function getAircraftInfoByRegistration($registration) |
2308 | 2308 | { |
2309 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
2309 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
2310 | 2310 | |
2311 | - $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
2311 | + $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
2312 | 2312 | |
2313 | 2313 | $sth = $this->db->prepare($query); |
2314 | 2314 | $sth->execute(array(':registration' => $registration)); |
@@ -2316,7 +2316,7 @@ discard block |
||
2316 | 2316 | $aircraft_array = array(); |
2317 | 2317 | $temp_array = array(); |
2318 | 2318 | |
2319 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2319 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2320 | 2320 | { |
2321 | 2321 | $temp_array['airline_icao'] = $row['airline_icao']; |
2322 | 2322 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2338,7 +2338,7 @@ discard block |
||
2338 | 2338 | */ |
2339 | 2339 | public function getAircraftOwnerByRegistration($registration) |
2340 | 2340 | { |
2341 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
2341 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
2342 | 2342 | $Connection = new Connection($this->db); |
2343 | 2343 | if ($Connection->tableExists('aircraft_owner')) { |
2344 | 2344 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2360,7 +2360,7 @@ discard block |
||
2360 | 2360 | public function getAllFlightsforSitemap() |
2361 | 2361 | { |
2362 | 2362 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
2363 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
2363 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
2364 | 2364 | |
2365 | 2365 | $sth = $this->db->prepare($query); |
2366 | 2366 | $sth->execute(); |
@@ -2407,7 +2407,7 @@ discard block |
||
2407 | 2407 | $manufacturer_array = array(); |
2408 | 2408 | $temp_array = array(); |
2409 | 2409 | |
2410 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2410 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2411 | 2411 | { |
2412 | 2412 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
2413 | 2413 | |
@@ -2444,7 +2444,7 @@ discard block |
||
2444 | 2444 | $aircraft_array = array(); |
2445 | 2445 | $temp_array = array(); |
2446 | 2446 | |
2447 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2447 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2448 | 2448 | { |
2449 | 2449 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
2450 | 2450 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2465,8 +2465,8 @@ discard block |
||
2465 | 2465 | */ |
2466 | 2466 | public function getAllAircraftRegistrations($filters = array()) |
2467 | 2467 | { |
2468 | - $filter_query = $this->getFilter($filters,true,true); |
|
2469 | - $query = "SELECT DISTINCT spotter_output.registration |
|
2468 | + $filter_query = $this->getFilter($filters, true, true); |
|
2469 | + $query = "SELECT DISTINCT spotter_output.registration |
|
2470 | 2470 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
2471 | 2471 | ORDER BY spotter_output.registration ASC"; |
2472 | 2472 | |
@@ -2476,7 +2476,7 @@ discard block |
||
2476 | 2476 | $aircraft_array = array(); |
2477 | 2477 | $temp_array = array(); |
2478 | 2478 | |
2479 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2479 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2480 | 2480 | { |
2481 | 2481 | $temp_array['registration'] = $row['registration']; |
2482 | 2482 | |
@@ -2493,11 +2493,11 @@ discard block |
||
2493 | 2493 | * @return Array list of source name |
2494 | 2494 | * |
2495 | 2495 | */ |
2496 | - public function getAllSourceName($type = '',$filters = array()) |
|
2496 | + public function getAllSourceName($type = '', $filters = array()) |
|
2497 | 2497 | { |
2498 | - $filter_query = $this->getFilter($filters,true,true); |
|
2498 | + $filter_query = $this->getFilter($filters, true, true); |
|
2499 | 2499 | $query_values = array(); |
2500 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
2500 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
2501 | 2501 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
2502 | 2502 | if ($type != '') { |
2503 | 2503 | $query_values = array(':type' => $type); |
@@ -2512,7 +2512,7 @@ discard block |
||
2512 | 2512 | $source_array = array(); |
2513 | 2513 | $temp_array = array(); |
2514 | 2514 | |
2515 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2515 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2516 | 2516 | { |
2517 | 2517 | $temp_array['source_name'] = $row['source_name']; |
2518 | 2518 | $source_array[] = $temp_array; |
@@ -2528,11 +2528,11 @@ discard block |
||
2528 | 2528 | * @return Array list of airline names |
2529 | 2529 | * |
2530 | 2530 | */ |
2531 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
2531 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
2532 | 2532 | { |
2533 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
2534 | - $filter_query = $this->getFilter($filters,true,true); |
|
2535 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
2533 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
2534 | + $filter_query = $this->getFilter($filters, true, true); |
|
2535 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
2536 | 2536 | if ($airline_type == '' || $airline_type == 'all') { |
2537 | 2537 | /* |
2538 | 2538 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2551,7 +2551,7 @@ discard block |
||
2551 | 2551 | $query_data = array(':forsource' => $forsource); |
2552 | 2552 | } |
2553 | 2553 | } else { |
2554 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
2554 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
2555 | 2555 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
2556 | 2556 | AND spotter_output.airline_type = :airline_type |
2557 | 2557 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2564,7 +2564,7 @@ discard block |
||
2564 | 2564 | $airline_array = array(); |
2565 | 2565 | $temp_array = array(); |
2566 | 2566 | |
2567 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2567 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2568 | 2568 | { |
2569 | 2569 | $temp_array['airline_icao'] = $row['airline_icao']; |
2570 | 2570 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2584,8 +2584,8 @@ discard block |
||
2584 | 2584 | */ |
2585 | 2585 | public function getAllAirlineCountries($filters = array()) |
2586 | 2586 | { |
2587 | - $filter_query = $this->getFilter($filters,true,true); |
|
2588 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2587 | + $filter_query = $this->getFilter($filters, true, true); |
|
2588 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2589 | 2589 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
2590 | 2590 | ORDER BY spotter_output.airline_country ASC"; |
2591 | 2591 | |
@@ -2596,7 +2596,7 @@ discard block |
||
2596 | 2596 | $airline_array = array(); |
2597 | 2597 | $temp_array = array(); |
2598 | 2598 | |
2599 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2599 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2600 | 2600 | { |
2601 | 2601 | $temp_array['airline_country'] = $row['airline_country']; |
2602 | 2602 | |
@@ -2616,9 +2616,9 @@ discard block |
||
2616 | 2616 | */ |
2617 | 2617 | public function getAllAirportNames($filters = array()) |
2618 | 2618 | { |
2619 | - $filter_query = $this->getFilter($filters,true,true); |
|
2619 | + $filter_query = $this->getFilter($filters, true, true); |
|
2620 | 2620 | $airport_array = array(); |
2621 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
2621 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
2622 | 2622 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
2623 | 2623 | ORDER BY spotter_output.departure_airport_city ASC"; |
2624 | 2624 | |
@@ -2627,7 +2627,7 @@ discard block |
||
2627 | 2627 | $sth->execute(); |
2628 | 2628 | |
2629 | 2629 | $temp_array = array(); |
2630 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2630 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2631 | 2631 | { |
2632 | 2632 | $temp_array['airport_icao'] = $row['airport_icao']; |
2633 | 2633 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2637,14 +2637,14 @@ discard block |
||
2637 | 2637 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
2638 | 2638 | } |
2639 | 2639 | |
2640 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
2640 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
2641 | 2641 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
2642 | 2642 | ORDER BY spotter_output.arrival_airport_city ASC"; |
2643 | 2643 | |
2644 | 2644 | $sth = $this->db->prepare($query); |
2645 | 2645 | $sth->execute(); |
2646 | 2646 | |
2647 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2647 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2648 | 2648 | { |
2649 | 2649 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
2650 | 2650 | // { |
@@ -2684,21 +2684,21 @@ discard block |
||
2684 | 2684 | |
2685 | 2685 | $temp_array = array(); |
2686 | 2686 | |
2687 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2687 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2688 | 2688 | { |
2689 | 2689 | $temp_array['airport_country'] = $row['airport_country']; |
2690 | 2690 | |
2691 | 2691 | $airport_array[$row['airport_country']] = $temp_array; |
2692 | 2692 | } |
2693 | - $filter_query = $this->getFilter($filters,true,true); |
|
2694 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2693 | + $filter_query = $this->getFilter($filters, true, true); |
|
2694 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2695 | 2695 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
2696 | 2696 | ORDER BY spotter_output.arrival_airport_country ASC"; |
2697 | 2697 | |
2698 | 2698 | $sth = $this->db->prepare($query); |
2699 | 2699 | $sth->execute(); |
2700 | 2700 | |
2701 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2701 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2702 | 2702 | { |
2703 | 2703 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
2704 | 2704 | { |
@@ -2721,9 +2721,9 @@ discard block |
||
2721 | 2721 | */ |
2722 | 2722 | public function getAllCountries($filters = array()) |
2723 | 2723 | { |
2724 | - $Connection= new Connection($this->db); |
|
2724 | + $Connection = new Connection($this->db); |
|
2725 | 2725 | if ($Connection->tableExists('countries')) { |
2726 | - $query = "SELECT countries.name AS airport_country |
|
2726 | + $query = "SELECT countries.name AS airport_country |
|
2727 | 2727 | FROM countries |
2728 | 2728 | ORDER BY countries.name ASC"; |
2729 | 2729 | $sth = $this->db->prepare($query); |
@@ -2732,14 +2732,14 @@ discard block |
||
2732 | 2732 | $temp_array = array(); |
2733 | 2733 | $country_array = array(); |
2734 | 2734 | |
2735 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2735 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2736 | 2736 | { |
2737 | 2737 | $temp_array['country'] = $row['airport_country']; |
2738 | 2738 | $country_array[$row['airport_country']] = $temp_array; |
2739 | 2739 | } |
2740 | 2740 | } else { |
2741 | - $filter_query = $this->getFilter($filters,true,true); |
|
2742 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
2741 | + $filter_query = $this->getFilter($filters, true, true); |
|
2742 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
2743 | 2743 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
2744 | 2744 | ORDER BY spotter_output.departure_airport_country ASC"; |
2745 | 2745 | |
@@ -2748,20 +2748,20 @@ discard block |
||
2748 | 2748 | |
2749 | 2749 | $temp_array = array(); |
2750 | 2750 | $country_array = array(); |
2751 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2751 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2752 | 2752 | { |
2753 | 2753 | $temp_array['country'] = $row['airport_country']; |
2754 | 2754 | $country_array[$row['airport_country']] = $temp_array; |
2755 | 2755 | } |
2756 | 2756 | |
2757 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2757 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2758 | 2758 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
2759 | 2759 | ORDER BY spotter_output.arrival_airport_country ASC"; |
2760 | 2760 | |
2761 | 2761 | $sth = $this->db->prepare($query); |
2762 | 2762 | $sth->execute(); |
2763 | 2763 | |
2764 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2764 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2765 | 2765 | { |
2766 | 2766 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
2767 | 2767 | { |
@@ -2771,14 +2771,14 @@ discard block |
||
2771 | 2771 | } |
2772 | 2772 | } |
2773 | 2773 | |
2774 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2774 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2775 | 2775 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
2776 | 2776 | ORDER BY spotter_output.airline_country ASC"; |
2777 | 2777 | |
2778 | 2778 | $sth = $this->db->prepare($query); |
2779 | 2779 | $sth->execute(); |
2780 | 2780 | |
2781 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2781 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2782 | 2782 | { |
2783 | 2783 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
2784 | 2784 | { |
@@ -2802,8 +2802,8 @@ discard block |
||
2802 | 2802 | */ |
2803 | 2803 | public function getAllIdents($filters = array()) |
2804 | 2804 | { |
2805 | - $filter_query = $this->getFilter($filters,true,true); |
|
2806 | - $query = "SELECT DISTINCT spotter_output.ident |
|
2805 | + $filter_query = $this->getFilter($filters, true, true); |
|
2806 | + $query = "SELECT DISTINCT spotter_output.ident |
|
2807 | 2807 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
2808 | 2808 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
2809 | 2809 | |
@@ -2813,7 +2813,7 @@ discard block |
||
2813 | 2813 | $ident_array = array(); |
2814 | 2814 | $temp_array = array(); |
2815 | 2815 | |
2816 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2816 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2817 | 2817 | { |
2818 | 2818 | $temp_array['ident'] = $row['ident']; |
2819 | 2819 | $ident_array[] = $temp_array; |
@@ -2827,9 +2827,9 @@ discard block |
||
2827 | 2827 | * @return Array number, icao, name and city of airports |
2828 | 2828 | */ |
2829 | 2829 | |
2830 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
2830 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
2831 | 2831 | global $globalTimezone, $globalDBdriver; |
2832 | - $filter_query = $this->getFilter($filters,true,true); |
|
2832 | + $filter_query = $this->getFilter($filters, true, true); |
|
2833 | 2833 | if ($globalTimezone != '') { |
2834 | 2834 | date_default_timezone_set($globalTimezone); |
2835 | 2835 | $datetime = new DateTime(); |
@@ -2894,7 +2894,7 @@ discard block |
||
2894 | 2894 | |
2895 | 2895 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
2896 | 2896 | global $globalTimezone, $globalDBdriver; |
2897 | - $filter_query = $this->getFilter($filters,true,true); |
|
2897 | + $filter_query = $this->getFilter($filters, true, true); |
|
2898 | 2898 | if ($globalTimezone != '') { |
2899 | 2899 | date_default_timezone_set($globalTimezone); |
2900 | 2900 | $datetime = new DateTime(); |
@@ -2978,7 +2978,7 @@ discard block |
||
2978 | 2978 | |
2979 | 2979 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
2980 | 2980 | global $globalTimezone, $globalDBdriver; |
2981 | - $filter_query = $this->getFilter($filters,true,true); |
|
2981 | + $filter_query = $this->getFilter($filters, true, true); |
|
2982 | 2982 | if ($globalTimezone != '') { |
2983 | 2983 | date_default_timezone_set($globalTimezone); |
2984 | 2984 | $datetime = new DateTime(); |
@@ -3011,9 +3011,9 @@ discard block |
||
3011 | 3011 | * @return Array number, icao, name and city of airports |
3012 | 3012 | */ |
3013 | 3013 | |
3014 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
3014 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
3015 | 3015 | global $globalTimezone, $globalDBdriver; |
3016 | - $filter_query = $this->getFilter($filters,true,true); |
|
3016 | + $filter_query = $this->getFilter($filters, true, true); |
|
3017 | 3017 | if ($globalTimezone != '') { |
3018 | 3018 | date_default_timezone_set($globalTimezone); |
3019 | 3019 | $datetime = new DateTime(); |
@@ -3145,12 +3145,12 @@ discard block |
||
3145 | 3145 | } else $offset = '+00:00'; |
3146 | 3146 | |
3147 | 3147 | if ($globalDBdriver == 'mysql') { |
3148 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
3148 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
3149 | 3149 | FROM spotter_output |
3150 | 3150 | WHERE spotter_output.date <> '' |
3151 | 3151 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
3152 | 3152 | } else { |
3153 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
3153 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
3154 | 3154 | FROM spotter_output |
3155 | 3155 | WHERE spotter_output.date <> '' |
3156 | 3156 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3162,7 +3162,7 @@ discard block |
||
3162 | 3162 | $date_array = array(); |
3163 | 3163 | $temp_array = array(); |
3164 | 3164 | |
3165 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3165 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3166 | 3166 | { |
3167 | 3167 | $temp_array['date'] = $row['date']; |
3168 | 3168 | |
@@ -3182,7 +3182,7 @@ discard block |
||
3182 | 3182 | */ |
3183 | 3183 | public function getAllRoutes() |
3184 | 3184 | { |
3185 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
3185 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
3186 | 3186 | FROM spotter_output |
3187 | 3187 | WHERE spotter_output.ident <> '' |
3188 | 3188 | GROUP BY route |
@@ -3193,7 +3193,7 @@ discard block |
||
3193 | 3193 | |
3194 | 3194 | $routes_array = array(); |
3195 | 3195 | $temp_array = array(); |
3196 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3196 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3197 | 3197 | { |
3198 | 3198 | $temp_array['route'] = $row['route']; |
3199 | 3199 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3212,21 +3212,21 @@ discard block |
||
3212 | 3212 | * @return String success or false |
3213 | 3213 | * |
3214 | 3214 | */ |
3215 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
3215 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
3216 | 3216 | { |
3217 | 3217 | if (!is_numeric(substr($ident, 0, 3))) |
3218 | 3218 | { |
3219 | 3219 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
3220 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
3220 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
3221 | 3221 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
3222 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
3222 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
3223 | 3223 | } else { |
3224 | 3224 | $airline_array = $this->getAllAirlineInfo("NA"); |
3225 | 3225 | } |
3226 | 3226 | if (count($airline_array) == 0) { |
3227 | 3227 | $airline_array = $this->getAllAirlineInfo("NA"); |
3228 | 3228 | } |
3229 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
3229 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
3230 | 3230 | $airline_array = $this->getAllAirlineInfo("NA"); |
3231 | 3231 | } |
3232 | 3232 | } else { |
@@ -3239,7 +3239,7 @@ discard block |
||
3239 | 3239 | |
3240 | 3240 | |
3241 | 3241 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
3242 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
3242 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type); |
|
3243 | 3243 | |
3244 | 3244 | try { |
3245 | 3245 | $sth = $this->db->prepare($query); |
@@ -3260,11 +3260,11 @@ discard block |
||
3260 | 3260 | * @return String success or false |
3261 | 3261 | * |
3262 | 3262 | */ |
3263 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
3263 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
3264 | 3264 | { |
3265 | 3265 | if ($groundspeed == '') $groundspeed = NULL; |
3266 | 3266 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
3267 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
3267 | + $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
3268 | 3268 | |
3269 | 3269 | try { |
3270 | 3270 | $sth = $this->db->prepare($query); |
@@ -3304,7 +3304,7 @@ discard block |
||
3304 | 3304 | * @param String $verticalrate vertival rate of flight |
3305 | 3305 | * @return String success or false |
3306 | 3306 | */ |
3307 | - public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
|
3307 | + public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '') |
|
3308 | 3308 | { |
3309 | 3309 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
3310 | 3310 | |
@@ -3328,13 +3328,13 @@ discard block |
||
3328 | 3328 | if ($ModeS != '') { |
3329 | 3329 | $timeelapsed = microtime(true); |
3330 | 3330 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
3331 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3331 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3332 | 3332 | } else { |
3333 | - $myhex = explode('-',$flightaware_id); |
|
3333 | + $myhex = explode('-', $flightaware_id); |
|
3334 | 3334 | if (count($myhex) > 0) { |
3335 | 3335 | $timeelapsed = microtime(true); |
3336 | 3336 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
3337 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3337 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3338 | 3338 | } |
3339 | 3339 | } |
3340 | 3340 | } |
@@ -3356,24 +3356,24 @@ discard block |
||
3356 | 3356 | { |
3357 | 3357 | $timeelapsed = microtime(true); |
3358 | 3358 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
3359 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
3359 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
3360 | 3360 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
3361 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
3361 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
3362 | 3362 | } else { |
3363 | 3363 | $airline_array = $this->getAllAirlineInfo("NA"); |
3364 | 3364 | } |
3365 | 3365 | if (count($airline_array) == 0) { |
3366 | 3366 | $airline_array = $this->getAllAirlineInfo("NA"); |
3367 | 3367 | } |
3368 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
3368 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
3369 | 3369 | $airline_array = $this->getAllAirlineInfo("NA"); |
3370 | 3370 | } |
3371 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3371 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3372 | 3372 | |
3373 | 3373 | } else { |
3374 | 3374 | $timeelapsed = microtime(true); |
3375 | 3375 | $airline_array = $this->getAllAirlineInfo("NA"); |
3376 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3376 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3377 | 3377 | } |
3378 | 3378 | } |
3379 | 3379 | } else $airline_array = array(); |
@@ -3390,27 +3390,27 @@ discard block |
||
3390 | 3390 | { |
3391 | 3391 | $timeelapsed = microtime(true); |
3392 | 3392 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3393 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3393 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3394 | 3394 | } else { |
3395 | 3395 | $timeelapsed = microtime(true); |
3396 | 3396 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3397 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3397 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3398 | 3398 | } |
3399 | 3399 | } |
3400 | 3400 | } else { |
3401 | 3401 | if ($ModeS != '') { |
3402 | 3402 | $timeelapsed = microtime(true); |
3403 | 3403 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
3404 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3404 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3405 | 3405 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
3406 | 3406 | { |
3407 | 3407 | $timeelapsed = microtime(true); |
3408 | 3408 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3409 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3409 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3410 | 3410 | } else { |
3411 | 3411 | $timeelapsed = microtime(true); |
3412 | 3412 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3413 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3413 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3414 | 3414 | } |
3415 | 3415 | } |
3416 | 3416 | } |
@@ -3426,7 +3426,7 @@ discard block |
||
3426 | 3426 | } else { |
3427 | 3427 | $timeelapsed = microtime(true); |
3428 | 3428 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
3429 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3429 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3430 | 3430 | } |
3431 | 3431 | } |
3432 | 3432 | |
@@ -3441,7 +3441,7 @@ discard block |
||
3441 | 3441 | } else { |
3442 | 3442 | $timeelapsed = microtime(true); |
3443 | 3443 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
3444 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3444 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3445 | 3445 | } |
3446 | 3446 | } |
3447 | 3447 | |
@@ -3504,7 +3504,7 @@ discard block |
||
3504 | 3504 | { |
3505 | 3505 | $timeelapsed = microtime(true); |
3506 | 3506 | $image_array = $Image->getSpotterImage($registration); |
3507 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3507 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3508 | 3508 | if (!isset($image_array[0]['registration'])) |
3509 | 3509 | { |
3510 | 3510 | //echo "Add image !!!! \n"; |
@@ -3512,7 +3512,7 @@ discard block |
||
3512 | 3512 | } |
3513 | 3513 | $timeelapsed = microtime(true); |
3514 | 3514 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
3515 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3515 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3516 | 3516 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
3517 | 3517 | } |
3518 | 3518 | |
@@ -3520,33 +3520,33 @@ discard block |
||
3520 | 3520 | { |
3521 | 3521 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
3522 | 3522 | else $airline_icao = ''; |
3523 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
3523 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
3524 | 3524 | if (!isset($image_array[0]['registration'])) |
3525 | 3525 | { |
3526 | 3526 | //echo "Add image !!!! \n"; |
3527 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
3527 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
3528 | 3528 | } |
3529 | 3529 | } |
3530 | 3530 | |
3531 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
3532 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
3533 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
3534 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
3535 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
3536 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
3537 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3538 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3539 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
3540 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3541 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
3542 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3543 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
3544 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
3545 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
3546 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
3547 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
3548 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
3549 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
3531 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
3532 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
3533 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
3534 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
3535 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
3536 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
3537 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3538 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3539 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
3540 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3541 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
3542 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3543 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
3544 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
3545 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
3546 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
3547 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
3548 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
3549 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
3550 | 3550 | |
3551 | 3551 | if (count($airline_array) == 0) |
3552 | 3552 | { |
@@ -3574,7 +3574,7 @@ discard block |
||
3574 | 3574 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
3575 | 3575 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
3576 | 3576 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
3577 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
3577 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
3578 | 3578 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,: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, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
3579 | 3579 | |
3580 | 3580 | $airline_name = $airline_array[0]['name']; |
@@ -3584,7 +3584,7 @@ discard block |
||
3584 | 3584 | if ($airline_type == '') { |
3585 | 3585 | $timeelapsed = microtime(true); |
3586 | 3586 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3587 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3587 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3588 | 3588 | } |
3589 | 3589 | if ($airline_type == null) $airline_type = ''; |
3590 | 3590 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3596,7 +3596,7 @@ discard block |
||
3596 | 3596 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
3597 | 3597 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
3598 | 3598 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
3599 | - $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_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, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
3599 | + $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_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, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
3600 | 3600 | |
3601 | 3601 | try { |
3602 | 3602 | |
@@ -3622,13 +3622,13 @@ discard block |
||
3622 | 3622 | { |
3623 | 3623 | global $globalDBdriver, $globalTimezone; |
3624 | 3624 | if ($globalDBdriver == 'mysql') { |
3625 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
3625 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
3626 | 3626 | WHERE spotter_output.ident = :ident |
3627 | 3627 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
3628 | 3628 | AND spotter_output.date < UTC_TIMESTAMP()"; |
3629 | 3629 | $query_data = array(':ident' => $ident); |
3630 | 3630 | } else { |
3631 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
3631 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
3632 | 3632 | WHERE spotter_output.ident = :ident |
3633 | 3633 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
3634 | 3634 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3637,8 +3637,8 @@ discard block |
||
3637 | 3637 | |
3638 | 3638 | $sth = $this->db->prepare($query); |
3639 | 3639 | $sth->execute($query_data); |
3640 | - $ident_result=''; |
|
3641 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3640 | + $ident_result = ''; |
|
3641 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3642 | 3642 | { |
3643 | 3643 | $ident_result = $row['ident']; |
3644 | 3644 | } |
@@ -3664,8 +3664,8 @@ discard block |
||
3664 | 3664 | return false; |
3665 | 3665 | } else { |
3666 | 3666 | $q_array = explode(" ", $q); |
3667 | - foreach ($q_array as $q_item){ |
|
3668 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
3667 | + foreach ($q_array as $q_item) { |
|
3668 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
3669 | 3669 | $additional_query .= " AND ("; |
3670 | 3670 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
3671 | 3671 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3680,11 +3680,11 @@ discard block |
||
3680 | 3680 | } |
3681 | 3681 | } |
3682 | 3682 | if ($globalDBdriver == 'mysql') { |
3683 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
3683 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
3684 | 3684 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
3685 | 3685 | AND spotter_output.date < UTC_TIMESTAMP()"; |
3686 | 3686 | } else { |
3687 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
3687 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
3688 | 3688 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
3689 | 3689 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
3690 | 3690 | } |
@@ -3701,11 +3701,11 @@ discard block |
||
3701 | 3701 | * @return Array the airline list |
3702 | 3702 | * |
3703 | 3703 | */ |
3704 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3704 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3705 | 3705 | { |
3706 | 3706 | global $globalDBdriver; |
3707 | - $filter_query = $this->getFilter($filters,true,true); |
|
3708 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3707 | + $filter_query = $this->getFilter($filters, true, true); |
|
3708 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3709 | 3709 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' "; |
3710 | 3710 | if ($olderthanmonths > 0) { |
3711 | 3711 | if ($globalDBdriver == 'mysql') { |
@@ -3729,7 +3729,7 @@ discard block |
||
3729 | 3729 | |
3730 | 3730 | $airline_array = array(); |
3731 | 3731 | $temp_array = array(); |
3732 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3732 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3733 | 3733 | { |
3734 | 3734 | $temp_array['airline_name'] = $row['airline_name']; |
3735 | 3735 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3746,11 +3746,11 @@ discard block |
||
3746 | 3746 | * @return Array the pilots list |
3747 | 3747 | * |
3748 | 3748 | */ |
3749 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3749 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3750 | 3750 | { |
3751 | 3751 | global $globalDBdriver; |
3752 | - $filter_query = $this->getFilter($filters,true,true); |
|
3753 | - $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
3752 | + $filter_query = $this->getFilter($filters, true, true); |
|
3753 | + $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
3754 | 3754 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
3755 | 3755 | if ($olderthanmonths > 0) { |
3756 | 3756 | if ($globalDBdriver == 'mysql') { |
@@ -3776,7 +3776,7 @@ discard block |
||
3776 | 3776 | $airline_array = array(); |
3777 | 3777 | $temp_array = array(); |
3778 | 3778 | |
3779 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3779 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3780 | 3780 | { |
3781 | 3781 | $temp_array['pilot_name'] = $row['pilot_name']; |
3782 | 3782 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3796,7 +3796,7 @@ discard block |
||
3796 | 3796 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
3797 | 3797 | { |
3798 | 3798 | global $globalDBdriver; |
3799 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
3799 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
3800 | 3800 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
3801 | 3801 | if ($olderthanmonths > 0) { |
3802 | 3802 | if ($globalDBdriver == 'mysql') { |
@@ -3822,7 +3822,7 @@ discard block |
||
3822 | 3822 | $airline_array = array(); |
3823 | 3823 | $temp_array = array(); |
3824 | 3824 | |
3825 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3825 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3826 | 3826 | { |
3827 | 3827 | $temp_array['pilot_name'] = $row['pilot_name']; |
3828 | 3828 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3840,11 +3840,11 @@ discard block |
||
3840 | 3840 | * @return Array the pilots list |
3841 | 3841 | * |
3842 | 3842 | */ |
3843 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3843 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3844 | 3844 | { |
3845 | 3845 | global $globalDBdriver; |
3846 | - $filter_query = $this->getFilter($filters,true,true); |
|
3847 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3846 | + $filter_query = $this->getFilter($filters, true, true); |
|
3847 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3848 | 3848 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3849 | 3849 | if ($olderthanmonths > 0) { |
3850 | 3850 | if ($globalDBdriver == 'mysql') { |
@@ -3870,7 +3870,7 @@ discard block |
||
3870 | 3870 | $airline_array = array(); |
3871 | 3871 | $temp_array = array(); |
3872 | 3872 | |
3873 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3873 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3874 | 3874 | { |
3875 | 3875 | $temp_array['owner_name'] = $row['owner_name']; |
3876 | 3876 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3885,11 +3885,11 @@ discard block |
||
3885 | 3885 | * @return Array the pilots list |
3886 | 3886 | * |
3887 | 3887 | */ |
3888 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3888 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3889 | 3889 | { |
3890 | 3890 | global $globalDBdriver; |
3891 | - $filter_query = $this->getFilter($filters,true,true); |
|
3892 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3891 | + $filter_query = $this->getFilter($filters, true, true); |
|
3892 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3893 | 3893 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3894 | 3894 | if ($olderthanmonths > 0) { |
3895 | 3895 | if ($globalDBdriver == 'mysql') { |
@@ -3915,7 +3915,7 @@ discard block |
||
3915 | 3915 | $airline_array = array(); |
3916 | 3916 | $temp_array = array(); |
3917 | 3917 | |
3918 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3918 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3919 | 3919 | { |
3920 | 3920 | $temp_array['owner_name'] = $row['owner_name']; |
3921 | 3921 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3931,11 +3931,11 @@ discard block |
||
3931 | 3931 | * @return Array the airline list |
3932 | 3932 | * |
3933 | 3933 | */ |
3934 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
3934 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
3935 | 3935 | { |
3936 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
3937 | - $filter_query = $this->getFilter($filters,true,true); |
|
3938 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3936 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
3937 | + $filter_query = $this->getFilter($filters, true, true); |
|
3938 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3939 | 3939 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
3940 | 3940 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
3941 | 3941 | ORDER BY airline_count DESC"; |
@@ -3947,7 +3947,7 @@ discard block |
||
3947 | 3947 | $airline_array = array(); |
3948 | 3948 | $temp_array = array(); |
3949 | 3949 | |
3950 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3950 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3951 | 3951 | { |
3952 | 3952 | $temp_array['airline_name'] = $row['airline_name']; |
3953 | 3953 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3967,11 +3967,11 @@ discard block |
||
3967 | 3967 | * @return Array the airline country list |
3968 | 3968 | * |
3969 | 3969 | */ |
3970 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
3970 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
3971 | 3971 | { |
3972 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
3973 | - $filter_query = $this->getFilter($filters,true,true); |
|
3974 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3972 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
3973 | + $filter_query = $this->getFilter($filters, true, true); |
|
3974 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3975 | 3975 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
3976 | 3976 | GROUP BY spotter_output.airline_country |
3977 | 3977 | ORDER BY airline_country_count DESC |
@@ -3984,7 +3984,7 @@ discard block |
||
3984 | 3984 | $airline_country_array = array(); |
3985 | 3985 | $temp_array = array(); |
3986 | 3986 | |
3987 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3987 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3988 | 3988 | { |
3989 | 3989 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
3990 | 3990 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4003,11 +4003,11 @@ discard block |
||
4003 | 4003 | * @return Array the airline list |
4004 | 4004 | * |
4005 | 4005 | */ |
4006 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
4006 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
4007 | 4007 | { |
4008 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4009 | - $filter_query = $this->getFilter($filters,true,true); |
|
4010 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4008 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4009 | + $filter_query = $this->getFilter($filters, true, true); |
|
4010 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4011 | 4011 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
4012 | 4012 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
4013 | 4013 | ORDER BY airline_count DESC"; |
@@ -4019,7 +4019,7 @@ discard block |
||
4019 | 4019 | $airline_array = array(); |
4020 | 4020 | $temp_array = array(); |
4021 | 4021 | |
4022 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4022 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4023 | 4023 | { |
4024 | 4024 | $temp_array['airline_name'] = $row['airline_name']; |
4025 | 4025 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4038,11 +4038,11 @@ discard block |
||
4038 | 4038 | * @return Array the airline country list |
4039 | 4039 | * |
4040 | 4040 | */ |
4041 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
4041 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
4042 | 4042 | { |
4043 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4044 | - $filter_query = $this->getFilter($filters,true,true); |
|
4045 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4043 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4044 | + $filter_query = $this->getFilter($filters, true, true); |
|
4045 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4046 | 4046 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
4047 | 4047 | GROUP BY spotter_output.airline_country |
4048 | 4048 | ORDER BY airline_country_count DESC |
@@ -4055,7 +4055,7 @@ discard block |
||
4055 | 4055 | $airline_country_array = array(); |
4056 | 4056 | $temp_array = array(); |
4057 | 4057 | |
4058 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4058 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4059 | 4059 | { |
4060 | 4060 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4061 | 4061 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4072,11 +4072,11 @@ discard block |
||
4072 | 4072 | * @return Array the airline list |
4073 | 4073 | * |
4074 | 4074 | */ |
4075 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
4075 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
4076 | 4076 | { |
4077 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4078 | - $filter_query = $this->getFilter($filters,true,true); |
|
4079 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4077 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4078 | + $filter_query = $this->getFilter($filters, true, true); |
|
4079 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4080 | 4080 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4081 | 4081 | GROUP BY spotter_output.airline_name |
4082 | 4082 | ORDER BY airline_count DESC"; |
@@ -4087,7 +4087,7 @@ discard block |
||
4087 | 4087 | $airline_array = array(); |
4088 | 4088 | $temp_array = array(); |
4089 | 4089 | |
4090 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4090 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4091 | 4091 | { |
4092 | 4092 | $temp_array['airline_name'] = $row['airline_name']; |
4093 | 4093 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4107,11 +4107,11 @@ discard block |
||
4107 | 4107 | * @return Array the airline country list |
4108 | 4108 | * |
4109 | 4109 | */ |
4110 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
4110 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
4111 | 4111 | { |
4112 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4113 | - $filter_query = $this->getFilter($filters,true,true); |
|
4114 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4112 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4113 | + $filter_query = $this->getFilter($filters, true, true); |
|
4114 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4115 | 4115 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4116 | 4116 | GROUP BY spotter_output.airline_country |
4117 | 4117 | ORDER BY airline_country_count DESC |
@@ -4124,7 +4124,7 @@ discard block |
||
4124 | 4124 | $airline_country_array = array(); |
4125 | 4125 | $temp_array = array(); |
4126 | 4126 | |
4127 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4127 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4128 | 4128 | { |
4129 | 4129 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4130 | 4130 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4140,11 +4140,11 @@ discard block |
||
4140 | 4140 | * @return Array the airline list |
4141 | 4141 | * |
4142 | 4142 | */ |
4143 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
4143 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
4144 | 4144 | { |
4145 | 4145 | global $globalTimezone, $globalDBdriver; |
4146 | - $filter_query = $this->getFilter($filters,true,true); |
|
4147 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4146 | + $filter_query = $this->getFilter($filters, true, true); |
|
4147 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4148 | 4148 | if ($globalTimezone != '') { |
4149 | 4149 | date_default_timezone_set($globalTimezone); |
4150 | 4150 | $datetime = new DateTime($date); |
@@ -4152,12 +4152,12 @@ discard block |
||
4152 | 4152 | } else $offset = '+00:00'; |
4153 | 4153 | |
4154 | 4154 | if ($globalDBdriver == 'mysql') { |
4155 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4155 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4156 | 4156 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4157 | 4157 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
4158 | 4158 | ORDER BY airline_count DESC"; |
4159 | 4159 | } else { |
4160 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4160 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4161 | 4161 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4162 | 4162 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
4163 | 4163 | ORDER BY airline_count DESC"; |
@@ -4168,7 +4168,7 @@ discard block |
||
4168 | 4168 | |
4169 | 4169 | $airline_array = array(); |
4170 | 4170 | $temp_array = array(); |
4171 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4171 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4172 | 4172 | { |
4173 | 4173 | $temp_array['airline_name'] = $row['airline_name']; |
4174 | 4174 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4188,11 +4188,11 @@ discard block |
||
4188 | 4188 | * @return Array the airline country list |
4189 | 4189 | * |
4190 | 4190 | */ |
4191 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
4191 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
4192 | 4192 | { |
4193 | 4193 | global $globalTimezone, $globalDBdriver; |
4194 | - $filter_query = $this->getFilter($filters,true,true); |
|
4195 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4194 | + $filter_query = $this->getFilter($filters, true, true); |
|
4195 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4196 | 4196 | if ($globalTimezone != '') { |
4197 | 4197 | date_default_timezone_set($globalTimezone); |
4198 | 4198 | $datetime = new DateTime($date); |
@@ -4200,13 +4200,13 @@ discard block |
||
4200 | 4200 | } else $offset = '+00:00'; |
4201 | 4201 | |
4202 | 4202 | if ($globalDBdriver == 'mysql') { |
4203 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4203 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4204 | 4204 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4205 | 4205 | GROUP BY spotter_output.airline_country |
4206 | 4206 | ORDER BY airline_country_count DESC |
4207 | 4207 | LIMIT 10 OFFSET 0"; |
4208 | 4208 | } else { |
4209 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4209 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4210 | 4210 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4211 | 4211 | GROUP BY spotter_output.airline_country |
4212 | 4212 | ORDER BY airline_country_count DESC |
@@ -4218,7 +4218,7 @@ discard block |
||
4218 | 4218 | |
4219 | 4219 | $airline_country_array = array(); |
4220 | 4220 | $temp_array = array(); |
4221 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4221 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4222 | 4222 | { |
4223 | 4223 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4224 | 4224 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4235,11 +4235,11 @@ discard block |
||
4235 | 4235 | * @return Array the airline list |
4236 | 4236 | * |
4237 | 4237 | */ |
4238 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
4238 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
4239 | 4239 | { |
4240 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
4241 | - $filter_query = $this->getFilter($filters,true,true); |
|
4242 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4240 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
4241 | + $filter_query = $this->getFilter($filters, true, true); |
|
4242 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4243 | 4243 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
4244 | 4244 | GROUP BY spotter_output.airline_name |
4245 | 4245 | ORDER BY airline_count DESC"; |
@@ -4251,7 +4251,7 @@ discard block |
||
4251 | 4251 | $airline_array = array(); |
4252 | 4252 | $temp_array = array(); |
4253 | 4253 | |
4254 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4254 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4255 | 4255 | { |
4256 | 4256 | $temp_array['airline_name'] = $row['airline_name']; |
4257 | 4257 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4269,25 +4269,25 @@ discard block |
||
4269 | 4269 | * @return Array the airline list |
4270 | 4270 | * |
4271 | 4271 | */ |
4272 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
4272 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
4273 | 4273 | { |
4274 | - $filter_query = $this->getFilter($filters,true,true); |
|
4275 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
4276 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
4274 | + $filter_query = $this->getFilter($filters, true, true); |
|
4275 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
4276 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
4277 | 4277 | |
4278 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4278 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4279 | 4279 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
4280 | 4280 | GROUP BY spotter_output.airline_name |
4281 | 4281 | ORDER BY airline_count DESC"; |
4282 | 4282 | |
4283 | 4283 | |
4284 | 4284 | $sth = $this->db->prepare($query); |
4285 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
4285 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
4286 | 4286 | |
4287 | 4287 | $airline_array = array(); |
4288 | 4288 | $temp_array = array(); |
4289 | 4289 | |
4290 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4290 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4291 | 4291 | { |
4292 | 4292 | $temp_array['airline_name'] = $row['airline_name']; |
4293 | 4293 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4305,13 +4305,13 @@ discard block |
||
4305 | 4305 | * @return Array the airline country list |
4306 | 4306 | * |
4307 | 4307 | */ |
4308 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
4308 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
4309 | 4309 | { |
4310 | - $filter_query = $this->getFilter($filters,true,true); |
|
4311 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
4312 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
4310 | + $filter_query = $this->getFilter($filters, true, true); |
|
4311 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
4312 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
4313 | 4313 | |
4314 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4314 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4315 | 4315 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
4316 | 4316 | GROUP BY spotter_output.airline_country |
4317 | 4317 | ORDER BY airline_country_count DESC |
@@ -4319,11 +4319,11 @@ discard block |
||
4319 | 4319 | |
4320 | 4320 | |
4321 | 4321 | $sth = $this->db->prepare($query); |
4322 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
4322 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
4323 | 4323 | |
4324 | 4324 | $airline_country_array = array(); |
4325 | 4325 | $temp_array = array(); |
4326 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4326 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4327 | 4327 | { |
4328 | 4328 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4329 | 4329 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4341,11 +4341,11 @@ discard block |
||
4341 | 4341 | * @return Array the airline list |
4342 | 4342 | * |
4343 | 4343 | */ |
4344 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
4344 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
4345 | 4345 | { |
4346 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
4347 | - $filter_query = $this->getFilter($filters,true,true); |
|
4348 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4346 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
4347 | + $filter_query = $this->getFilter($filters, true, true); |
|
4348 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4349 | 4349 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
4350 | 4350 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
4351 | 4351 | ORDER BY airline_count DESC"; |
@@ -4356,7 +4356,7 @@ discard block |
||
4356 | 4356 | |
4357 | 4357 | $airline_array = array(); |
4358 | 4358 | $temp_array = array(); |
4359 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4359 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4360 | 4360 | { |
4361 | 4361 | $temp_array['airline_name'] = $row['airline_name']; |
4362 | 4362 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4375,11 +4375,11 @@ discard block |
||
4375 | 4375 | * @return Array the airline country list |
4376 | 4376 | * |
4377 | 4377 | */ |
4378 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
4378 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
4379 | 4379 | { |
4380 | - $filter_query = $this->getFilter($filters,true,true); |
|
4381 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
4382 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4380 | + $filter_query = $this->getFilter($filters, true, true); |
|
4381 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
4382 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4383 | 4383 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
4384 | 4384 | GROUP BY spotter_output.airline_country |
4385 | 4385 | ORDER BY airline_country_count DESC |
@@ -4391,7 +4391,7 @@ discard block |
||
4391 | 4391 | |
4392 | 4392 | $airline_country_array = array(); |
4393 | 4393 | $temp_array = array(); |
4394 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4394 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4395 | 4395 | { |
4396 | 4396 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4397 | 4397 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4410,8 +4410,8 @@ discard block |
||
4410 | 4410 | */ |
4411 | 4411 | public function countAllAirlineCountries($limit = true, $filters = array()) |
4412 | 4412 | { |
4413 | - $filter_query = $this->getFilter($filters,true,true); |
|
4414 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4413 | + $filter_query = $this->getFilter($filters, true, true); |
|
4414 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4415 | 4415 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
4416 | 4416 | GROUP BY spotter_output.airline_country |
4417 | 4417 | ORDER BY airline_country_count DESC"; |
@@ -4422,7 +4422,7 @@ discard block |
||
4422 | 4422 | |
4423 | 4423 | $airline_array = array(); |
4424 | 4424 | $temp_array = array(); |
4425 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4425 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4426 | 4426 | { |
4427 | 4427 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4428 | 4428 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4438,11 +4438,11 @@ discard block |
||
4438 | 4438 | * @return Array the airline country list |
4439 | 4439 | * |
4440 | 4440 | */ |
4441 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
4441 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
4442 | 4442 | { |
4443 | 4443 | global $globalDBdriver; |
4444 | 4444 | //$filter_query = $this->getFilter($filters,true,true); |
4445 | - $Connection= new Connection($this->db); |
|
4445 | + $Connection = new Connection($this->db); |
|
4446 | 4446 | if (!$Connection->tableExists('countries')) return array(); |
4447 | 4447 | /* |
4448 | 4448 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -4457,7 +4457,7 @@ discard block |
||
4457 | 4457 | */ |
4458 | 4458 | require_once('class.SpotterLive.php'); |
4459 | 4459 | $SpotterLive = new SpotterLive(); |
4460 | - $filter_query = $SpotterLive->getFilter($filters,true,true); |
|
4460 | + $filter_query = $SpotterLive->getFilter($filters, true, true); |
|
4461 | 4461 | $filter_query .= ' over_country IS NOT NULL'; |
4462 | 4462 | if ($olderthanmonths > 0) { |
4463 | 4463 | if ($globalDBdriver == 'mysql') { |
@@ -4484,7 +4484,7 @@ discard block |
||
4484 | 4484 | $flight_array = array(); |
4485 | 4485 | $temp_array = array(); |
4486 | 4486 | |
4487 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4487 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4488 | 4488 | { |
4489 | 4489 | $temp_array['flight_count'] = $row['nb']; |
4490 | 4490 | $temp_array['flight_country'] = $row['name']; |
@@ -4502,12 +4502,12 @@ discard block |
||
4502 | 4502 | * @return Array the aircraft list |
4503 | 4503 | * |
4504 | 4504 | */ |
4505 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
4505 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
4506 | 4506 | { |
4507 | 4507 | global $globalDBdriver; |
4508 | - $filter_query = $this->getFilter($filters,true,true); |
|
4508 | + $filter_query = $this->getFilter($filters, true, true); |
|
4509 | 4509 | |
4510 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4510 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4511 | 4511 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
4512 | 4512 | if ($olderthanmonths > 0) { |
4513 | 4513 | if ($globalDBdriver == 'mysql') { |
@@ -4532,7 +4532,7 @@ discard block |
||
4532 | 4532 | |
4533 | 4533 | $aircraft_array = array(); |
4534 | 4534 | $temp_array = array(); |
4535 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4535 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4536 | 4536 | { |
4537 | 4537 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4538 | 4538 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4549,11 +4549,11 @@ discard block |
||
4549 | 4549 | * @return Array the aircraft list |
4550 | 4550 | * |
4551 | 4551 | */ |
4552 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
4552 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
4553 | 4553 | { |
4554 | 4554 | global $globalDBdriver; |
4555 | - $filter_query = $this->getFilter($filters,true,true); |
|
4556 | - $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4555 | + $filter_query = $this->getFilter($filters, true, true); |
|
4556 | + $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4557 | 4557 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
4558 | 4558 | if ($olderthanmonths > 0) { |
4559 | 4559 | if ($globalDBdriver == 'mysql') { |
@@ -4578,7 +4578,7 @@ discard block |
||
4578 | 4578 | |
4579 | 4579 | $aircraft_array = array(); |
4580 | 4580 | $temp_array = array(); |
4581 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4581 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4582 | 4582 | { |
4583 | 4583 | $temp_array['airline_icao'] = $row['airline_icao']; |
4584 | 4584 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4596,11 +4596,11 @@ discard block |
||
4596 | 4596 | * @return Array the aircraft list |
4597 | 4597 | * |
4598 | 4598 | */ |
4599 | - public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
4599 | + public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
4600 | 4600 | { |
4601 | 4601 | global $globalDBdriver; |
4602 | - $filter_query = $this->getFilter($filters,true,true); |
|
4603 | - $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4602 | + $filter_query = $this->getFilter($filters, true, true); |
|
4603 | + $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4604 | 4604 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
4605 | 4605 | if ($olderthanmonths > 0) { |
4606 | 4606 | if ($globalDBdriver == 'mysql') { |
@@ -4625,7 +4625,7 @@ discard block |
||
4625 | 4625 | |
4626 | 4626 | $aircraft_array = array(); |
4627 | 4627 | $temp_array = array(); |
4628 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4628 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4629 | 4629 | { |
4630 | 4630 | //$temp_array['airline_icao'] = $row['airline_icao']; |
4631 | 4631 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4644,13 +4644,13 @@ discard block |
||
4644 | 4644 | * @return Array the aircraft list |
4645 | 4645 | * |
4646 | 4646 | */ |
4647 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
4647 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
4648 | 4648 | { |
4649 | 4649 | $Image = new Image($this->db); |
4650 | - $filter_query = $this->getFilter($filters,true,true); |
|
4651 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
4650 | + $filter_query = $this->getFilter($filters, true, true); |
|
4651 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
4652 | 4652 | |
4653 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4653 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4654 | 4654 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
4655 | 4655 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
4656 | 4656 | ORDER BY registration_count DESC"; |
@@ -4661,14 +4661,14 @@ discard block |
||
4661 | 4661 | $aircraft_array = array(); |
4662 | 4662 | $temp_array = array(); |
4663 | 4663 | |
4664 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4664 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4665 | 4665 | { |
4666 | 4666 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4667 | 4667 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4668 | 4668 | $temp_array['registration'] = $row['registration']; |
4669 | 4669 | $temp_array['airline_name'] = $row['airline_name']; |
4670 | 4670 | $temp_array['image_thumbnail'] = ""; |
4671 | - if($row['registration'] != "") |
|
4671 | + if ($row['registration'] != "") |
|
4672 | 4672 | { |
4673 | 4673 | $image_array = $Image->getSpotterImage($row['registration']); |
4674 | 4674 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4687,11 +4687,11 @@ discard block |
||
4687 | 4687 | * @return Array the aircraft list |
4688 | 4688 | * |
4689 | 4689 | */ |
4690 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
4690 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
4691 | 4691 | { |
4692 | - $filter_query = $this->getFilter($filters,true,true); |
|
4693 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
4694 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4692 | + $filter_query = $this->getFilter($filters, true, true); |
|
4693 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
4694 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4695 | 4695 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
4696 | 4696 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4697 | 4697 | ORDER BY aircraft_icao_count DESC"; |
@@ -4702,7 +4702,7 @@ discard block |
||
4702 | 4702 | $aircraft_array = array(); |
4703 | 4703 | $temp_array = array(); |
4704 | 4704 | |
4705 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4705 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4706 | 4706 | { |
4707 | 4707 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4708 | 4708 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4720,13 +4720,13 @@ discard block |
||
4720 | 4720 | * @return Array the aircraft list |
4721 | 4721 | * |
4722 | 4722 | */ |
4723 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
4723 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
4724 | 4724 | { |
4725 | - $filter_query = $this->getFilter($filters,true,true); |
|
4725 | + $filter_query = $this->getFilter($filters, true, true); |
|
4726 | 4726 | $Image = new Image($this->db); |
4727 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
4727 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
4728 | 4728 | |
4729 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4729 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4730 | 4730 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
4731 | 4731 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
4732 | 4732 | ORDER BY registration_count DESC"; |
@@ -4736,14 +4736,14 @@ discard block |
||
4736 | 4736 | |
4737 | 4737 | $aircraft_array = array(); |
4738 | 4738 | $temp_array = array(); |
4739 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4739 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4740 | 4740 | { |
4741 | 4741 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4742 | 4742 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4743 | 4743 | $temp_array['registration'] = $row['registration']; |
4744 | 4744 | $temp_array['airline_name'] = $row['airline_name']; |
4745 | 4745 | $temp_array['image_thumbnail'] = ""; |
4746 | - if($row['registration'] != "") |
|
4746 | + if ($row['registration'] != "") |
|
4747 | 4747 | { |
4748 | 4748 | $image_array = $Image->getSpotterImage($row['registration']); |
4749 | 4749 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4762,11 +4762,11 @@ discard block |
||
4762 | 4762 | * @return Array the aircraft list |
4763 | 4763 | * |
4764 | 4764 | */ |
4765 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
4765 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
4766 | 4766 | { |
4767 | - $filter_query = $this->getFilter($filters,true,true); |
|
4768 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
4769 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4767 | + $filter_query = $this->getFilter($filters, true, true); |
|
4768 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
4769 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4770 | 4770 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
4771 | 4771 | GROUP BY spotter_output.aircraft_manufacturer |
4772 | 4772 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4777,7 +4777,7 @@ discard block |
||
4777 | 4777 | $aircraft_array = array(); |
4778 | 4778 | $temp_array = array(); |
4779 | 4779 | |
4780 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4780 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4781 | 4781 | { |
4782 | 4782 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
4783 | 4783 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4794,12 +4794,12 @@ discard block |
||
4794 | 4794 | * @return Array the aircraft list |
4795 | 4795 | * |
4796 | 4796 | */ |
4797 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
4797 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
4798 | 4798 | { |
4799 | - $filter_query = $this->getFilter($filters,true,true); |
|
4800 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4799 | + $filter_query = $this->getFilter($filters, true, true); |
|
4800 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4801 | 4801 | |
4802 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4802 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4803 | 4803 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
4804 | 4804 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4805 | 4805 | ORDER BY aircraft_icao_count DESC"; |
@@ -4809,7 +4809,7 @@ discard block |
||
4809 | 4809 | |
4810 | 4810 | $aircraft_array = array(); |
4811 | 4811 | $temp_array = array(); |
4812 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4812 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4813 | 4813 | { |
4814 | 4814 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4815 | 4815 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4827,13 +4827,13 @@ discard block |
||
4827 | 4827 | * @return Array the aircraft list |
4828 | 4828 | * |
4829 | 4829 | */ |
4830 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
4830 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
4831 | 4831 | { |
4832 | - $filter_query = $this->getFilter($filters,true,true); |
|
4832 | + $filter_query = $this->getFilter($filters, true, true); |
|
4833 | 4833 | $Image = new Image($this->db); |
4834 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4834 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4835 | 4835 | |
4836 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4836 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4837 | 4837 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
4838 | 4838 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
4839 | 4839 | ORDER BY registration_count DESC"; |
@@ -4843,14 +4843,14 @@ discard block |
||
4843 | 4843 | |
4844 | 4844 | $aircraft_array = array(); |
4845 | 4845 | $temp_array = array(); |
4846 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4846 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4847 | 4847 | { |
4848 | 4848 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4849 | 4849 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4850 | 4850 | $temp_array['registration'] = $row['registration']; |
4851 | 4851 | $temp_array['airline_name'] = $row['airline_name']; |
4852 | 4852 | $temp_array['image_thumbnail'] = ""; |
4853 | - if($row['registration'] != "") |
|
4853 | + if ($row['registration'] != "") |
|
4854 | 4854 | { |
4855 | 4855 | $image_array = $Image->getSpotterImage($row['registration']); |
4856 | 4856 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4868,11 +4868,11 @@ discard block |
||
4868 | 4868 | * @return Array the aircraft list |
4869 | 4869 | * |
4870 | 4870 | */ |
4871 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
4871 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
4872 | 4872 | { |
4873 | - $filter_query = $this->getFilter($filters,true,true); |
|
4874 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4875 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4873 | + $filter_query = $this->getFilter($filters, true, true); |
|
4874 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4875 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4876 | 4876 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
4877 | 4877 | GROUP BY spotter_output.aircraft_manufacturer |
4878 | 4878 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4883,7 +4883,7 @@ discard block |
||
4883 | 4883 | |
4884 | 4884 | $aircraft_array = array(); |
4885 | 4885 | $temp_array = array(); |
4886 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4886 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4887 | 4887 | { |
4888 | 4888 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
4889 | 4889 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4898,12 +4898,12 @@ discard block |
||
4898 | 4898 | * @return Array the aircraft list |
4899 | 4899 | * |
4900 | 4900 | */ |
4901 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
4901 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
4902 | 4902 | { |
4903 | - $filter_query = $this->getFilter($filters,true,true); |
|
4904 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4903 | + $filter_query = $this->getFilter($filters, true, true); |
|
4904 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4905 | 4905 | |
4906 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4906 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4907 | 4907 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4908 | 4908 | GROUP BY spotter_output.aircraft_name |
4909 | 4909 | ORDER BY aircraft_icao_count DESC"; |
@@ -4912,7 +4912,7 @@ discard block |
||
4912 | 4912 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
4913 | 4913 | $aircraft_array = array(); |
4914 | 4914 | $temp_array = array(); |
4915 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4915 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4916 | 4916 | { |
4917 | 4917 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4918 | 4918 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4931,11 +4931,11 @@ discard block |
||
4931 | 4931 | */ |
4932 | 4932 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
4933 | 4933 | { |
4934 | - $filter_query = $this->getFilter($filters,true,true); |
|
4934 | + $filter_query = $this->getFilter($filters, true, true); |
|
4935 | 4935 | $Image = new Image($this->db); |
4936 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4936 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4937 | 4937 | |
4938 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4938 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4939 | 4939 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4940 | 4940 | GROUP BY spotter_output.registration |
4941 | 4941 | ORDER BY registration_count DESC"; |
@@ -4945,14 +4945,14 @@ discard block |
||
4945 | 4945 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
4946 | 4946 | $aircraft_array = array(); |
4947 | 4947 | $temp_array = array(); |
4948 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4948 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4949 | 4949 | { |
4950 | 4950 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4951 | 4951 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4952 | 4952 | $temp_array['registration'] = $row['registration']; |
4953 | 4953 | $temp_array['airline_name'] = $row['airline_name']; |
4954 | 4954 | $temp_array['image_thumbnail'] = ""; |
4955 | - if($row['registration'] != "") |
|
4955 | + if ($row['registration'] != "") |
|
4956 | 4956 | { |
4957 | 4957 | $image_array = $Image->getSpotterImage($row['registration']); |
4958 | 4958 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4969,11 +4969,11 @@ discard block |
||
4969 | 4969 | * @return Array the aircraft list |
4970 | 4970 | * |
4971 | 4971 | */ |
4972 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
4972 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
4973 | 4973 | { |
4974 | 4974 | global $globalTimezone, $globalDBdriver; |
4975 | - $filter_query = $this->getFilter($filters,true,true); |
|
4976 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4975 | + $filter_query = $this->getFilter($filters, true, true); |
|
4976 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4977 | 4977 | if ($globalTimezone != '') { |
4978 | 4978 | date_default_timezone_set($globalTimezone); |
4979 | 4979 | $datetime = new DateTime($date); |
@@ -4981,12 +4981,12 @@ discard block |
||
4981 | 4981 | } else $offset = '+00:00'; |
4982 | 4982 | |
4983 | 4983 | if ($globalDBdriver == 'mysql') { |
4984 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4984 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4985 | 4985 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4986 | 4986 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4987 | 4987 | ORDER BY aircraft_icao_count DESC"; |
4988 | 4988 | } else { |
4989 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4989 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4990 | 4990 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4991 | 4991 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4992 | 4992 | ORDER BY aircraft_icao_count DESC"; |
@@ -4997,7 +4997,7 @@ discard block |
||
4997 | 4997 | |
4998 | 4998 | $aircraft_array = array(); |
4999 | 4999 | $temp_array = array(); |
5000 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5000 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5001 | 5001 | { |
5002 | 5002 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5003 | 5003 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5015,12 +5015,12 @@ discard block |
||
5015 | 5015 | * @return Array the aircraft list |
5016 | 5016 | * |
5017 | 5017 | */ |
5018 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
5018 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
5019 | 5019 | { |
5020 | 5020 | global $globalTimezone, $globalDBdriver; |
5021 | - $filter_query = $this->getFilter($filters,true,true); |
|
5021 | + $filter_query = $this->getFilter($filters, true, true); |
|
5022 | 5022 | $Image = new Image($this->db); |
5023 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
5023 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
5024 | 5024 | if ($globalTimezone != '') { |
5025 | 5025 | date_default_timezone_set($globalTimezone); |
5026 | 5026 | $datetime = new DateTime($date); |
@@ -5028,12 +5028,12 @@ discard block |
||
5028 | 5028 | } else $offset = '+00:00'; |
5029 | 5029 | |
5030 | 5030 | if ($globalDBdriver == 'mysql') { |
5031 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5031 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5032 | 5032 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
5033 | 5033 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
5034 | 5034 | ORDER BY registration_count DESC"; |
5035 | 5035 | } else { |
5036 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5036 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5037 | 5037 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
5038 | 5038 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
5039 | 5039 | ORDER BY registration_count DESC"; |
@@ -5044,14 +5044,14 @@ discard block |
||
5044 | 5044 | |
5045 | 5045 | $aircraft_array = array(); |
5046 | 5046 | $temp_array = array(); |
5047 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5047 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5048 | 5048 | { |
5049 | 5049 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5050 | 5050 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5051 | 5051 | $temp_array['registration'] = $row['registration']; |
5052 | 5052 | $temp_array['airline_name'] = $row['airline_name']; |
5053 | 5053 | $temp_array['image_thumbnail'] = ""; |
5054 | - if($row['registration'] != "") |
|
5054 | + if ($row['registration'] != "") |
|
5055 | 5055 | { |
5056 | 5056 | $image_array = $Image->getSpotterImage($row['registration']); |
5057 | 5057 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5070,11 +5070,11 @@ discard block |
||
5070 | 5070 | * @return Array the aircraft manufacturer list |
5071 | 5071 | * |
5072 | 5072 | */ |
5073 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
5073 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
5074 | 5074 | { |
5075 | 5075 | global $globalTimezone, $globalDBdriver; |
5076 | - $filter_query = $this->getFilter($filters,true,true); |
|
5077 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
5076 | + $filter_query = $this->getFilter($filters, true, true); |
|
5077 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
5078 | 5078 | if ($globalTimezone != '') { |
5079 | 5079 | date_default_timezone_set($globalTimezone); |
5080 | 5080 | $datetime = new DateTime($date); |
@@ -5082,12 +5082,12 @@ discard block |
||
5082 | 5082 | } else $offset = '+00:00'; |
5083 | 5083 | |
5084 | 5084 | if ($globalDBdriver == 'mysql') { |
5085 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5085 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5086 | 5086 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
5087 | 5087 | GROUP BY spotter_output.aircraft_manufacturer |
5088 | 5088 | ORDER BY aircraft_manufacturer_count DESC"; |
5089 | 5089 | } else { |
5090 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5090 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5091 | 5091 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
5092 | 5092 | GROUP BY spotter_output.aircraft_manufacturer |
5093 | 5093 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5099,7 +5099,7 @@ discard block |
||
5099 | 5099 | $aircraft_array = array(); |
5100 | 5100 | $temp_array = array(); |
5101 | 5101 | |
5102 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5102 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5103 | 5103 | { |
5104 | 5104 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5105 | 5105 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5116,11 +5116,11 @@ discard block |
||
5116 | 5116 | * @return Array the aircraft list |
5117 | 5117 | * |
5118 | 5118 | */ |
5119 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
5119 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
5120 | 5120 | { |
5121 | - $filter_query = $this->getFilter($filters,true,true); |
|
5122 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
5123 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5121 | + $filter_query = $this->getFilter($filters, true, true); |
|
5122 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
5123 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5124 | 5124 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
5125 | 5125 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
5126 | 5126 | ORDER BY aircraft_icao_count DESC"; |
@@ -5131,7 +5131,7 @@ discard block |
||
5131 | 5131 | $aircraft_array = array(); |
5132 | 5132 | $temp_array = array(); |
5133 | 5133 | |
5134 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5134 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5135 | 5135 | { |
5136 | 5136 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5137 | 5137 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5149,13 +5149,13 @@ discard block |
||
5149 | 5149 | * @return Array the aircraft list |
5150 | 5150 | * |
5151 | 5151 | */ |
5152 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
5152 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
5153 | 5153 | { |
5154 | - $filter_query = $this->getFilter($filters,true,true); |
|
5154 | + $filter_query = $this->getFilter($filters, true, true); |
|
5155 | 5155 | $Image = new Image($this->db); |
5156 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
5156 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
5157 | 5157 | |
5158 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5158 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5159 | 5159 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
5160 | 5160 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
5161 | 5161 | ORDER BY registration_count DESC"; |
@@ -5167,14 +5167,14 @@ discard block |
||
5167 | 5167 | $aircraft_array = array(); |
5168 | 5168 | $temp_array = array(); |
5169 | 5169 | |
5170 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5170 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5171 | 5171 | { |
5172 | 5172 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5173 | 5173 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5174 | 5174 | $temp_array['registration'] = $row['registration']; |
5175 | 5175 | $temp_array['airline_name'] = $row['airline_name']; |
5176 | 5176 | $temp_array['image_thumbnail'] = ""; |
5177 | - if($row['registration'] != "") |
|
5177 | + if ($row['registration'] != "") |
|
5178 | 5178 | { |
5179 | 5179 | $image_array = $Image->getSpotterImage($row['registration']); |
5180 | 5180 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5193,11 +5193,11 @@ discard block |
||
5193 | 5193 | * @return Array the aircraft manufacturer list |
5194 | 5194 | * |
5195 | 5195 | */ |
5196 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
5196 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
5197 | 5197 | { |
5198 | - $filter_query = $this->getFilter($filters,true,true); |
|
5199 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
5200 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5198 | + $filter_query = $this->getFilter($filters, true, true); |
|
5199 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
5200 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5201 | 5201 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident |
5202 | 5202 | GROUP BY spotter_output.aircraft_manufacturer |
5203 | 5203 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5207,7 +5207,7 @@ discard block |
||
5207 | 5207 | $sth->execute(array(':ident' => $ident)); |
5208 | 5208 | $aircraft_array = array(); |
5209 | 5209 | $temp_array = array(); |
5210 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5210 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5211 | 5211 | { |
5212 | 5212 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5213 | 5213 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5223,24 +5223,24 @@ discard block |
||
5223 | 5223 | * @return Array the aircraft list |
5224 | 5224 | * |
5225 | 5225 | */ |
5226 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
5226 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
5227 | 5227 | { |
5228 | - $filter_query = $this->getFilter($filters,true,true); |
|
5229 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
5230 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
5228 | + $filter_query = $this->getFilter($filters, true, true); |
|
5229 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
5230 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
5231 | 5231 | |
5232 | 5232 | |
5233 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5233 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5234 | 5234 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
5235 | 5235 | GROUP BY spotter_output.aircraft_name |
5236 | 5236 | ORDER BY aircraft_icao_count DESC"; |
5237 | 5237 | |
5238 | 5238 | |
5239 | 5239 | $sth = $this->db->prepare($query); |
5240 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
5240 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
5241 | 5241 | $aircraft_array = array(); |
5242 | 5242 | $temp_array = array(); |
5243 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5243 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5244 | 5244 | { |
5245 | 5245 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5246 | 5246 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5256,33 +5256,33 @@ discard block |
||
5256 | 5256 | * @return Array the aircraft list |
5257 | 5257 | * |
5258 | 5258 | */ |
5259 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
5259 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
5260 | 5260 | { |
5261 | - $filter_query = $this->getFilter($filters,true,true); |
|
5261 | + $filter_query = $this->getFilter($filters, true, true); |
|
5262 | 5262 | $Image = new Image($this->db); |
5263 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
5264 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
5263 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
5264 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
5265 | 5265 | |
5266 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5266 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5267 | 5267 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
5268 | 5268 | GROUP BY spotter_output.registration |
5269 | 5269 | ORDER BY registration_count DESC"; |
5270 | 5270 | |
5271 | 5271 | |
5272 | 5272 | $sth = $this->db->prepare($query); |
5273 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
5273 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
5274 | 5274 | |
5275 | 5275 | $aircraft_array = array(); |
5276 | 5276 | $temp_array = array(); |
5277 | 5277 | |
5278 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5278 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5279 | 5279 | { |
5280 | 5280 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5281 | 5281 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5282 | 5282 | $temp_array['registration'] = $row['registration']; |
5283 | 5283 | $temp_array['airline_name'] = $row['airline_name']; |
5284 | 5284 | $temp_array['image_thumbnail'] = ""; |
5285 | - if($row['registration'] != "") |
|
5285 | + if ($row['registration'] != "") |
|
5286 | 5286 | { |
5287 | 5287 | $image_array = $Image->getSpotterImage($row['registration']); |
5288 | 5288 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5302,25 +5302,25 @@ discard block |
||
5302 | 5302 | * @return Array the aircraft manufacturer list |
5303 | 5303 | * |
5304 | 5304 | */ |
5305 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
5305 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
5306 | 5306 | { |
5307 | - $filter_query = $this->getFilter($filters,true,true); |
|
5308 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
5309 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
5307 | + $filter_query = $this->getFilter($filters, true, true); |
|
5308 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
5309 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
5310 | 5310 | |
5311 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5311 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5312 | 5312 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
5313 | 5313 | GROUP BY spotter_output.aircraft_manufacturer |
5314 | 5314 | ORDER BY aircraft_manufacturer_count DESC"; |
5315 | 5315 | |
5316 | 5316 | |
5317 | 5317 | $sth = $this->db->prepare($query); |
5318 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
5318 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
5319 | 5319 | |
5320 | 5320 | $aircraft_array = array(); |
5321 | 5321 | $temp_array = array(); |
5322 | 5322 | |
5323 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5323 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5324 | 5324 | { |
5325 | 5325 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5326 | 5326 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5340,11 +5340,11 @@ discard block |
||
5340 | 5340 | * @return Array the aircraft list |
5341 | 5341 | * |
5342 | 5342 | */ |
5343 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
5343 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
5344 | 5344 | { |
5345 | - $filter_query = $this->getFilter($filters,true,true); |
|
5346 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
5347 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5345 | + $filter_query = $this->getFilter($filters, true, true); |
|
5346 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
5347 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5348 | 5348 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
5349 | 5349 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
5350 | 5350 | ORDER BY aircraft_icao_count DESC"; |
@@ -5356,7 +5356,7 @@ discard block |
||
5356 | 5356 | $aircraft_array = array(); |
5357 | 5357 | $temp_array = array(); |
5358 | 5358 | |
5359 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5359 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5360 | 5360 | { |
5361 | 5361 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5362 | 5362 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5375,12 +5375,12 @@ discard block |
||
5375 | 5375 | * @return Array the aircraft list |
5376 | 5376 | * |
5377 | 5377 | */ |
5378 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
5378 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
5379 | 5379 | { |
5380 | - $filter_query = $this->getFilter($filters,true,true); |
|
5380 | + $filter_query = $this->getFilter($filters, true, true); |
|
5381 | 5381 | $Image = new Image($this->db); |
5382 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
5383 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5382 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
5383 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5384 | 5384 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
5385 | 5385 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
5386 | 5386 | ORDER BY registration_count DESC"; |
@@ -5392,14 +5392,14 @@ discard block |
||
5392 | 5392 | $aircraft_array = array(); |
5393 | 5393 | $temp_array = array(); |
5394 | 5394 | |
5395 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5395 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5396 | 5396 | { |
5397 | 5397 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5398 | 5398 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5399 | 5399 | $temp_array['registration'] = $row['registration']; |
5400 | 5400 | $temp_array['airline_name'] = $row['airline_name']; |
5401 | 5401 | $temp_array['image_thumbnail'] = ""; |
5402 | - if($row['registration'] != "") |
|
5402 | + if ($row['registration'] != "") |
|
5403 | 5403 | { |
5404 | 5404 | $image_array = $Image->getSpotterImage($row['registration']); |
5405 | 5405 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5419,11 +5419,11 @@ discard block |
||
5419 | 5419 | * @return Array the aircraft manufacturer list |
5420 | 5420 | * |
5421 | 5421 | */ |
5422 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
5422 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
5423 | 5423 | { |
5424 | - $filter_query = $this->getFilter($filters,true,true); |
|
5425 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
5426 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5424 | + $filter_query = $this->getFilter($filters, true, true); |
|
5425 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
5426 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5427 | 5427 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
5428 | 5428 | GROUP BY spotter_output.aircraft_manufacturer |
5429 | 5429 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5435,7 +5435,7 @@ discard block |
||
5435 | 5435 | $aircraft_array = array(); |
5436 | 5436 | $temp_array = array(); |
5437 | 5437 | |
5438 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5438 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5439 | 5439 | { |
5440 | 5440 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5441 | 5441 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5456,8 +5456,8 @@ discard block |
||
5456 | 5456 | */ |
5457 | 5457 | public function countAllAircraftManufacturers($filters = array()) |
5458 | 5458 | { |
5459 | - $filter_query = $this->getFilter($filters,true,true); |
|
5460 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5459 | + $filter_query = $this->getFilter($filters, true, true); |
|
5460 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5461 | 5461 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
5462 | 5462 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
5463 | 5463 | ORDER BY aircraft_manufacturer_count DESC |
@@ -5470,7 +5470,7 @@ discard block |
||
5470 | 5470 | $manufacturer_array = array(); |
5471 | 5471 | $temp_array = array(); |
5472 | 5472 | |
5473 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5473 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5474 | 5474 | { |
5475 | 5475 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5476 | 5476 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5489,12 +5489,12 @@ discard block |
||
5489 | 5489 | * @return Array the aircraft list |
5490 | 5490 | * |
5491 | 5491 | */ |
5492 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
5492 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5493 | 5493 | { |
5494 | 5494 | global $globalDBdriver; |
5495 | 5495 | $Image = new Image($this->db); |
5496 | - $filter_query = $this->getFilter($filters,true,true); |
|
5497 | - $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5496 | + $filter_query = $this->getFilter($filters, true, true); |
|
5497 | + $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5498 | 5498 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
5499 | 5499 | if ($olderthanmonths > 0) { |
5500 | 5500 | if ($globalDBdriver == 'mysql') { |
@@ -5522,7 +5522,7 @@ discard block |
||
5522 | 5522 | $aircraft_array = array(); |
5523 | 5523 | $temp_array = array(); |
5524 | 5524 | |
5525 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5525 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5526 | 5526 | { |
5527 | 5527 | $temp_array['registration'] = $row['registration']; |
5528 | 5528 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5530,7 +5530,7 @@ discard block |
||
5530 | 5530 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5531 | 5531 | $temp_array['airline_name'] = $row['airline_name']; |
5532 | 5532 | $temp_array['image_thumbnail'] = ""; |
5533 | - if($row['registration'] != "") |
|
5533 | + if ($row['registration'] != "") |
|
5534 | 5534 | { |
5535 | 5535 | $image_array = $Image->getSpotterImage($row['registration']); |
5536 | 5536 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5549,12 +5549,12 @@ discard block |
||
5549 | 5549 | * @return Array the aircraft list |
5550 | 5550 | * |
5551 | 5551 | */ |
5552 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
5552 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5553 | 5553 | { |
5554 | 5554 | global $globalDBdriver; |
5555 | - $filter_query = $this->getFilter($filters,true,true); |
|
5555 | + $filter_query = $this->getFilter($filters, true, true); |
|
5556 | 5556 | $Image = new Image($this->db); |
5557 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5557 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5558 | 5558 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
5559 | 5559 | if ($olderthanmonths > 0) { |
5560 | 5560 | if ($globalDBdriver == 'mysql') { |
@@ -5582,7 +5582,7 @@ discard block |
||
5582 | 5582 | $aircraft_array = array(); |
5583 | 5583 | $temp_array = array(); |
5584 | 5584 | |
5585 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5585 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5586 | 5586 | { |
5587 | 5587 | $temp_array['registration'] = $row['registration']; |
5588 | 5588 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5591,7 +5591,7 @@ discard block |
||
5591 | 5591 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5592 | 5592 | $temp_array['airline_name'] = $row['airline_name']; |
5593 | 5593 | $temp_array['image_thumbnail'] = ""; |
5594 | - if($row['registration'] != "") |
|
5594 | + if ($row['registration'] != "") |
|
5595 | 5595 | { |
5596 | 5596 | $image_array = $Image->getSpotterImage($row['registration']); |
5597 | 5597 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5610,11 +5610,11 @@ discard block |
||
5610 | 5610 | * @return Array the airport list |
5611 | 5611 | * |
5612 | 5612 | */ |
5613 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5613 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5614 | 5614 | { |
5615 | 5615 | global $globalDBdriver; |
5616 | - $filter_query = $this->getFilter($filters,true,true); |
|
5617 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5616 | + $filter_query = $this->getFilter($filters, true, true); |
|
5617 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5618 | 5618 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
5619 | 5619 | if ($olderthanmonths > 0) { |
5620 | 5620 | if ($globalDBdriver == 'mysql') { |
@@ -5643,7 +5643,7 @@ discard block |
||
5643 | 5643 | $airport_array = array(); |
5644 | 5644 | $temp_array = array(); |
5645 | 5645 | |
5646 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5646 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5647 | 5647 | { |
5648 | 5648 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5649 | 5649 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5662,11 +5662,11 @@ discard block |
||
5662 | 5662 | * @return Array the airport list |
5663 | 5663 | * |
5664 | 5664 | */ |
5665 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5665 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5666 | 5666 | { |
5667 | 5667 | global $globalDBdriver; |
5668 | - $filter_query = $this->getFilter($filters,true,true); |
|
5669 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5668 | + $filter_query = $this->getFilter($filters, true, true); |
|
5669 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5670 | 5670 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' "; |
5671 | 5671 | if ($olderthanmonths > 0) { |
5672 | 5672 | if ($globalDBdriver == 'mysql') { |
@@ -5695,7 +5695,7 @@ discard block |
||
5695 | 5695 | $airport_array = array(); |
5696 | 5696 | $temp_array = array(); |
5697 | 5697 | |
5698 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5698 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5699 | 5699 | { |
5700 | 5700 | $temp_array['airline_icao'] = $row['airline_icao']; |
5701 | 5701 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5715,11 +5715,11 @@ discard block |
||
5715 | 5715 | * @return Array the airport list |
5716 | 5716 | * |
5717 | 5717 | */ |
5718 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5718 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5719 | 5719 | { |
5720 | 5720 | global $globalDBdriver; |
5721 | - $filter_query = $this->getFilter($filters,true,true); |
|
5722 | - $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5721 | + $filter_query = $this->getFilter($filters, true, true); |
|
5722 | + $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5723 | 5723 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
5724 | 5724 | if ($olderthanmonths > 0) { |
5725 | 5725 | if ($globalDBdriver == 'mysql') { |
@@ -5747,7 +5747,7 @@ discard block |
||
5747 | 5747 | $airport_array = array(); |
5748 | 5748 | $temp_array = array(); |
5749 | 5749 | |
5750 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5750 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5751 | 5751 | { |
5752 | 5752 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5753 | 5753 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5766,11 +5766,11 @@ discard block |
||
5766 | 5766 | * @return Array the airport list |
5767 | 5767 | * |
5768 | 5768 | */ |
5769 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5769 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5770 | 5770 | { |
5771 | 5771 | global $globalDBdriver; |
5772 | - $filter_query = $this->getFilter($filters,true,true); |
|
5773 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5772 | + $filter_query = $this->getFilter($filters, true, true); |
|
5773 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5774 | 5774 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
5775 | 5775 | if ($olderthanmonths > 0) { |
5776 | 5776 | if ($globalDBdriver == 'mysql') { |
@@ -5799,7 +5799,7 @@ discard block |
||
5799 | 5799 | $airport_array = array(); |
5800 | 5800 | $temp_array = array(); |
5801 | 5801 | |
5802 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5802 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5803 | 5803 | { |
5804 | 5804 | $temp_array['airline_icao'] = $row['airline_icao']; |
5805 | 5805 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5819,11 +5819,11 @@ discard block |
||
5819 | 5819 | * @return Array the airport list |
5820 | 5820 | * |
5821 | 5821 | */ |
5822 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
5822 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
5823 | 5823 | { |
5824 | - $filter_query = $this->getFilter($filters,true,true); |
|
5825 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
5826 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5824 | + $filter_query = $this->getFilter($filters, true, true); |
|
5825 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
5826 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5827 | 5827 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' |
5828 | 5828 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5829 | 5829 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5835,7 +5835,7 @@ discard block |
||
5835 | 5835 | $airport_array = array(); |
5836 | 5836 | $temp_array = array(); |
5837 | 5837 | |
5838 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5838 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5839 | 5839 | { |
5840 | 5840 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5841 | 5841 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5857,11 +5857,11 @@ discard block |
||
5857 | 5857 | * @return Array the airport list |
5858 | 5858 | * |
5859 | 5859 | */ |
5860 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
5860 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
5861 | 5861 | { |
5862 | - $filter_query = $this->getFilter($filters,true,true); |
|
5863 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
5864 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5862 | + $filter_query = $this->getFilter($filters, true, true); |
|
5863 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
5864 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5865 | 5865 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
5866 | 5866 | GROUP BY spotter_output.departure_airport_country |
5867 | 5867 | ORDER BY airport_departure_country_count DESC"; |
@@ -5873,7 +5873,7 @@ discard block |
||
5873 | 5873 | $airport_array = array(); |
5874 | 5874 | $temp_array = array(); |
5875 | 5875 | |
5876 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5876 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5877 | 5877 | { |
5878 | 5878 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5879 | 5879 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5892,11 +5892,11 @@ discard block |
||
5892 | 5892 | * @return Array the airport list |
5893 | 5893 | * |
5894 | 5894 | */ |
5895 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
5895 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
5896 | 5896 | { |
5897 | - $filter_query = $this->getFilter($filters,true,true); |
|
5898 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
5899 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5897 | + $filter_query = $this->getFilter($filters, true, true); |
|
5898 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
5899 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5900 | 5900 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' |
5901 | 5901 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5902 | 5902 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5908,7 +5908,7 @@ discard block |
||
5908 | 5908 | $airport_array = array(); |
5909 | 5909 | $temp_array = array(); |
5910 | 5910 | |
5911 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5911 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5912 | 5912 | { |
5913 | 5913 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5914 | 5914 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5929,11 +5929,11 @@ discard block |
||
5929 | 5929 | * @return Array the airport list |
5930 | 5930 | * |
5931 | 5931 | */ |
5932 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
5932 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
5933 | 5933 | { |
5934 | - $filter_query = $this->getFilter($filters,true,true); |
|
5935 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
5936 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5934 | + $filter_query = $this->getFilter($filters, true, true); |
|
5935 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
5936 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5937 | 5937 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
5938 | 5938 | GROUP BY spotter_output.departure_airport_country |
5939 | 5939 | ORDER BY airport_departure_country_count DESC"; |
@@ -5945,7 +5945,7 @@ discard block |
||
5945 | 5945 | $airport_array = array(); |
5946 | 5946 | $temp_array = array(); |
5947 | 5947 | |
5948 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5948 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5949 | 5949 | { |
5950 | 5950 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5951 | 5951 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5963,11 +5963,11 @@ discard block |
||
5963 | 5963 | * @return Array the airport list |
5964 | 5964 | * |
5965 | 5965 | */ |
5966 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
5966 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
5967 | 5967 | { |
5968 | - $filter_query = $this->getFilter($filters,true,true); |
|
5969 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
5970 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5968 | + $filter_query = $this->getFilter($filters, true, true); |
|
5969 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
5970 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5971 | 5971 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' |
5972 | 5972 | GROUP BY spotter_output.departure_airport_icao |
5973 | 5973 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5979,7 +5979,7 @@ discard block |
||
5979 | 5979 | $airport_array = array(); |
5980 | 5980 | $temp_array = array(); |
5981 | 5981 | |
5982 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5982 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5983 | 5983 | { |
5984 | 5984 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5985 | 5985 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6000,11 +6000,11 @@ discard block |
||
6000 | 6000 | * @return Array the airport list |
6001 | 6001 | * |
6002 | 6002 | */ |
6003 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
6003 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
6004 | 6004 | { |
6005 | - $filter_query = $this->getFilter($filters,true,true); |
|
6006 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
6007 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6005 | + $filter_query = $this->getFilter($filters, true, true); |
|
6006 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
6007 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6008 | 6008 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
6009 | 6009 | GROUP BY spotter_output.departure_airport_country |
6010 | 6010 | ORDER BY airport_departure_country_count DESC"; |
@@ -6016,7 +6016,7 @@ discard block |
||
6016 | 6016 | $airport_array = array(); |
6017 | 6017 | $temp_array = array(); |
6018 | 6018 | |
6019 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6019 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6020 | 6020 | { |
6021 | 6021 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6022 | 6022 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6034,11 +6034,11 @@ discard block |
||
6034 | 6034 | * @return Array the airport list |
6035 | 6035 | * |
6036 | 6036 | */ |
6037 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
6037 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
6038 | 6038 | { |
6039 | - $filter_query = $this->getFilter($filters,true,true); |
|
6040 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
6041 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6039 | + $filter_query = $this->getFilter($filters, true, true); |
|
6040 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
6041 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6042 | 6042 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' |
6043 | 6043 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6044 | 6044 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6050,7 +6050,7 @@ discard block |
||
6050 | 6050 | $airport_array = array(); |
6051 | 6051 | $temp_array = array(); |
6052 | 6052 | |
6053 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6053 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6054 | 6054 | { |
6055 | 6055 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6056 | 6056 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6071,11 +6071,11 @@ discard block |
||
6071 | 6071 | * @return Array the airport list |
6072 | 6072 | * |
6073 | 6073 | */ |
6074 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
6074 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
6075 | 6075 | { |
6076 | - $filter_query = $this->getFilter($filters,true,true); |
|
6077 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
6078 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6076 | + $filter_query = $this->getFilter($filters, true, true); |
|
6077 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
6078 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6079 | 6079 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
6080 | 6080 | GROUP BY spotter_output.departure_airport_country |
6081 | 6081 | ORDER BY airport_departure_country_count DESC"; |
@@ -6087,7 +6087,7 @@ discard block |
||
6087 | 6087 | $airport_array = array(); |
6088 | 6088 | $temp_array = array(); |
6089 | 6089 | |
6090 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6090 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6091 | 6091 | { |
6092 | 6092 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6093 | 6093 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6106,11 +6106,11 @@ discard block |
||
6106 | 6106 | * @return Array the airport list |
6107 | 6107 | * |
6108 | 6108 | */ |
6109 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
6109 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
6110 | 6110 | { |
6111 | - $filter_query = $this->getFilter($filters,true,true); |
|
6112 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
6113 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6111 | + $filter_query = $this->getFilter($filters, true, true); |
|
6112 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
6113 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6114 | 6114 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' |
6115 | 6115 | GROUP BY spotter_output.departure_airport_icao |
6116 | 6116 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6122,7 +6122,7 @@ discard block |
||
6122 | 6122 | $airport_array = array(); |
6123 | 6123 | $temp_array = array(); |
6124 | 6124 | |
6125 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6125 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6126 | 6126 | { |
6127 | 6127 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6128 | 6128 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6143,11 +6143,11 @@ discard block |
||
6143 | 6143 | * @return Array the airport list |
6144 | 6144 | * |
6145 | 6145 | */ |
6146 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
6146 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
6147 | 6147 | { |
6148 | - $filter_query = $this->getFilter($filters,true,true); |
|
6149 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
6150 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6148 | + $filter_query = $this->getFilter($filters, true, true); |
|
6149 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
6150 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6151 | 6151 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
6152 | 6152 | GROUP BY spotter_output.departure_airport_country |
6153 | 6153 | ORDER BY airport_departure_country_count DESC"; |
@@ -6159,7 +6159,7 @@ discard block |
||
6159 | 6159 | $airport_array = array(); |
6160 | 6160 | $temp_array = array(); |
6161 | 6161 | |
6162 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6162 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6163 | 6163 | { |
6164 | 6164 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6165 | 6165 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6177,11 +6177,11 @@ discard block |
||
6177 | 6177 | * @return Array the airport list |
6178 | 6178 | * |
6179 | 6179 | */ |
6180 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
6180 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
6181 | 6181 | { |
6182 | 6182 | global $globalTimezone, $globalDBdriver; |
6183 | - $filter_query = $this->getFilter($filters,true,true); |
|
6184 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6183 | + $filter_query = $this->getFilter($filters, true, true); |
|
6184 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6185 | 6185 | if ($globalTimezone != '') { |
6186 | 6186 | date_default_timezone_set($globalTimezone); |
6187 | 6187 | $datetime = new DateTime($date); |
@@ -6189,12 +6189,12 @@ discard block |
||
6189 | 6189 | } else $offset = '+00:00'; |
6190 | 6190 | |
6191 | 6191 | if ($globalDBdriver == 'mysql') { |
6192 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6192 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6193 | 6193 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6194 | 6194 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6195 | 6195 | ORDER BY airport_departure_icao_count DESC"; |
6196 | 6196 | } else { |
6197 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6197 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6198 | 6198 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6199 | 6199 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6200 | 6200 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6206,7 +6206,7 @@ discard block |
||
6206 | 6206 | $airport_array = array(); |
6207 | 6207 | $temp_array = array(); |
6208 | 6208 | |
6209 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6209 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6210 | 6210 | { |
6211 | 6211 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6212 | 6212 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6227,11 +6227,11 @@ discard block |
||
6227 | 6227 | * @return Array the airport list |
6228 | 6228 | * |
6229 | 6229 | */ |
6230 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
6230 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
6231 | 6231 | { |
6232 | 6232 | global $globalTimezone, $globalDBdriver; |
6233 | - $filter_query = $this->getFilter($filters,true,true); |
|
6234 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6233 | + $filter_query = $this->getFilter($filters, true, true); |
|
6234 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6235 | 6235 | if ($globalTimezone != '') { |
6236 | 6236 | date_default_timezone_set($globalTimezone); |
6237 | 6237 | $datetime = new DateTime($date); |
@@ -6239,12 +6239,12 @@ discard block |
||
6239 | 6239 | } else $offset = '+00:00'; |
6240 | 6240 | |
6241 | 6241 | if ($globalDBdriver == 'mysql') { |
6242 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6242 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6243 | 6243 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6244 | 6244 | GROUP BY spotter_output.departure_airport_country |
6245 | 6245 | ORDER BY airport_departure_country_count DESC"; |
6246 | 6246 | } else { |
6247 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6247 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6248 | 6248 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6249 | 6249 | GROUP BY spotter_output.departure_airport_country |
6250 | 6250 | ORDER BY airport_departure_country_count DESC"; |
@@ -6256,7 +6256,7 @@ discard block |
||
6256 | 6256 | $airport_array = array(); |
6257 | 6257 | $temp_array = array(); |
6258 | 6258 | |
6259 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6259 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6260 | 6260 | { |
6261 | 6261 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6262 | 6262 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6274,11 +6274,11 @@ discard block |
||
6274 | 6274 | * @return Array the airport list |
6275 | 6275 | * |
6276 | 6276 | */ |
6277 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
6277 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
6278 | 6278 | { |
6279 | - $filter_query = $this->getFilter($filters,true,true); |
|
6280 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
6281 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6279 | + $filter_query = $this->getFilter($filters, true, true); |
|
6280 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
6281 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6282 | 6282 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident |
6283 | 6283 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6284 | 6284 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6290,7 +6290,7 @@ discard block |
||
6290 | 6290 | $airport_array = array(); |
6291 | 6291 | $temp_array = array(); |
6292 | 6292 | |
6293 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6293 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6294 | 6294 | { |
6295 | 6295 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6296 | 6296 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6312,11 +6312,11 @@ discard block |
||
6312 | 6312 | * @return Array the airport list |
6313 | 6313 | * |
6314 | 6314 | */ |
6315 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
6315 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
6316 | 6316 | { |
6317 | - $filter_query = $this->getFilter($filters,true,true); |
|
6318 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
6319 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6317 | + $filter_query = $this->getFilter($filters, true, true); |
|
6318 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
6319 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6320 | 6320 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
6321 | 6321 | GROUP BY spotter_output.departure_airport_country |
6322 | 6322 | ORDER BY airport_departure_country_count DESC"; |
@@ -6328,7 +6328,7 @@ discard block |
||
6328 | 6328 | $airport_array = array(); |
6329 | 6329 | $temp_array = array(); |
6330 | 6330 | |
6331 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6331 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6332 | 6332 | { |
6333 | 6333 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6334 | 6334 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6347,12 +6347,12 @@ discard block |
||
6347 | 6347 | * @return Array the airport list |
6348 | 6348 | * |
6349 | 6349 | */ |
6350 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
6350 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
6351 | 6351 | { |
6352 | - $filter_query = $this->getFilter($filters,true,true); |
|
6353 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
6352 | + $filter_query = $this->getFilter($filters, true, true); |
|
6353 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
6354 | 6354 | |
6355 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6355 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6356 | 6356 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
6357 | 6357 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6358 | 6358 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6364,7 +6364,7 @@ discard block |
||
6364 | 6364 | $airport_array = array(); |
6365 | 6365 | $temp_array = array(); |
6366 | 6366 | |
6367 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6367 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6368 | 6368 | { |
6369 | 6369 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6370 | 6370 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6385,11 +6385,11 @@ discard block |
||
6385 | 6385 | * @return Array the airport list |
6386 | 6386 | * |
6387 | 6387 | */ |
6388 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
6388 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
6389 | 6389 | { |
6390 | - $filter_query = $this->getFilter($filters,true,true); |
|
6391 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
6392 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6390 | + $filter_query = $this->getFilter($filters, true, true); |
|
6391 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
6392 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6393 | 6393 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
6394 | 6394 | GROUP BY spotter_output.departure_airport_country |
6395 | 6395 | ORDER BY airport_departure_country_count DESC"; |
@@ -6401,7 +6401,7 @@ discard block |
||
6401 | 6401 | $airport_array = array(); |
6402 | 6402 | $temp_array = array(); |
6403 | 6403 | |
6404 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6404 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6405 | 6405 | { |
6406 | 6406 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6407 | 6407 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6424,11 +6424,11 @@ discard block |
||
6424 | 6424 | * @return Array the airport list |
6425 | 6425 | * |
6426 | 6426 | */ |
6427 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
6427 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6428 | 6428 | { |
6429 | 6429 | global $globalDBdriver; |
6430 | - $filter_query = $this->getFilter($filters,true,true); |
|
6431 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6430 | + $filter_query = $this->getFilter($filters, true, true); |
|
6431 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6432 | 6432 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
6433 | 6433 | if ($olderthanmonths > 0) { |
6434 | 6434 | if ($globalDBdriver == 'mysql') { |
@@ -6458,7 +6458,7 @@ discard block |
||
6458 | 6458 | $airport_array = array(); |
6459 | 6459 | $temp_array = array(); |
6460 | 6460 | |
6461 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6461 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6462 | 6462 | { |
6463 | 6463 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6464 | 6464 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6481,11 +6481,11 @@ discard block |
||
6481 | 6481 | * @return Array the airport list |
6482 | 6482 | * |
6483 | 6483 | */ |
6484 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
6484 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6485 | 6485 | { |
6486 | 6486 | global $globalDBdriver; |
6487 | - $filter_query = $this->getFilter($filters,true,true); |
|
6488 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6487 | + $filter_query = $this->getFilter($filters, true, true); |
|
6488 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6489 | 6489 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' "; |
6490 | 6490 | if ($olderthanmonths > 0) { |
6491 | 6491 | if ($globalDBdriver == 'mysql') { |
@@ -6515,7 +6515,7 @@ discard block |
||
6515 | 6515 | $airport_array = array(); |
6516 | 6516 | $temp_array = array(); |
6517 | 6517 | |
6518 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6518 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6519 | 6519 | { |
6520 | 6520 | $temp_array['airline_icao'] = $row['airline_icao']; |
6521 | 6521 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -6540,11 +6540,11 @@ discard block |
||
6540 | 6540 | * @return Array the airport list |
6541 | 6541 | * |
6542 | 6542 | */ |
6543 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
6543 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6544 | 6544 | { |
6545 | 6545 | global $globalDBdriver; |
6546 | - $filter_query = $this->getFilter($filters,true,true); |
|
6547 | - $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6546 | + $filter_query = $this->getFilter($filters, true, true); |
|
6547 | + $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6548 | 6548 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
6549 | 6549 | if ($olderthanmonths > 0) { |
6550 | 6550 | if ($globalDBdriver == 'mysql') { |
@@ -6573,7 +6573,7 @@ discard block |
||
6573 | 6573 | $airport_array = array(); |
6574 | 6574 | $temp_array = array(); |
6575 | 6575 | |
6576 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6576 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6577 | 6577 | { |
6578 | 6578 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6579 | 6579 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6596,11 +6596,11 @@ discard block |
||
6596 | 6596 | * @return Array the airport list |
6597 | 6597 | * |
6598 | 6598 | */ |
6599 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
6599 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6600 | 6600 | { |
6601 | 6601 | global $globalDBdriver; |
6602 | - $filter_query = $this->getFilter($filters,true,true); |
|
6603 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6602 | + $filter_query = $this->getFilter($filters, true, true); |
|
6603 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6604 | 6604 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
6605 | 6605 | if ($olderthanmonths > 0) { |
6606 | 6606 | if ($globalDBdriver == 'mysql') { |
@@ -6630,7 +6630,7 @@ discard block |
||
6630 | 6630 | $airport_array = array(); |
6631 | 6631 | $temp_array = array(); |
6632 | 6632 | |
6633 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6633 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6634 | 6634 | { |
6635 | 6635 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6636 | 6636 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6656,9 +6656,9 @@ discard block |
||
6656 | 6656 | */ |
6657 | 6657 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
6658 | 6658 | { |
6659 | - $filter_query = $this->getFilter($filters,true,true); |
|
6660 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
6661 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6659 | + $filter_query = $this->getFilter($filters, true, true); |
|
6660 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
6661 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6662 | 6662 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao |
6663 | 6663 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6664 | 6664 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6669,7 +6669,7 @@ discard block |
||
6669 | 6669 | $airport_array = array(); |
6670 | 6670 | $temp_array = array(); |
6671 | 6671 | |
6672 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6672 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6673 | 6673 | { |
6674 | 6674 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6675 | 6675 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6690,12 +6690,12 @@ discard block |
||
6690 | 6690 | * @return Array the airport list |
6691 | 6691 | * |
6692 | 6692 | */ |
6693 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
6693 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
6694 | 6694 | { |
6695 | - $filter_query = $this->getFilter($filters,true,true); |
|
6696 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
6695 | + $filter_query = $this->getFilter($filters, true, true); |
|
6696 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
6697 | 6697 | |
6698 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6698 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6699 | 6699 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
6700 | 6700 | GROUP BY spotter_output.arrival_airport_country |
6701 | 6701 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6707,7 +6707,7 @@ discard block |
||
6707 | 6707 | $airport_array = array(); |
6708 | 6708 | $temp_array = array(); |
6709 | 6709 | |
6710 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6710 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6711 | 6711 | { |
6712 | 6712 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6713 | 6713 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6725,11 +6725,11 @@ discard block |
||
6725 | 6725 | * @return Array the airport list |
6726 | 6726 | * |
6727 | 6727 | */ |
6728 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
6728 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
6729 | 6729 | { |
6730 | - $filter_query = $this->getFilter($filters,true,true); |
|
6731 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
6732 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6730 | + $filter_query = $this->getFilter($filters, true, true); |
|
6731 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
6732 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6733 | 6733 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
6734 | 6734 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6735 | 6735 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6741,7 +6741,7 @@ discard block |
||
6741 | 6741 | $airport_array = array(); |
6742 | 6742 | $temp_array = array(); |
6743 | 6743 | |
6744 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6744 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6745 | 6745 | { |
6746 | 6746 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6747 | 6747 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6763,11 +6763,11 @@ discard block |
||
6763 | 6763 | * @return Array the airport list |
6764 | 6764 | * |
6765 | 6765 | */ |
6766 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
6766 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
6767 | 6767 | { |
6768 | - $filter_query = $this->getFilter($filters,true,true); |
|
6769 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
6770 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6768 | + $filter_query = $this->getFilter($filters, true, true); |
|
6769 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
6770 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6771 | 6771 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
6772 | 6772 | GROUP BY spotter_output.arrival_airport_country |
6773 | 6773 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6779,7 +6779,7 @@ discard block |
||
6779 | 6779 | $airport_array = array(); |
6780 | 6780 | $temp_array = array(); |
6781 | 6781 | |
6782 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6782 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6783 | 6783 | { |
6784 | 6784 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6785 | 6785 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6797,12 +6797,12 @@ discard block |
||
6797 | 6797 | * @return Array the airport list |
6798 | 6798 | * |
6799 | 6799 | */ |
6800 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
6800 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
6801 | 6801 | { |
6802 | - $filter_query = $this->getFilter($filters,true,true); |
|
6803 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
6802 | + $filter_query = $this->getFilter($filters, true, true); |
|
6803 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
6804 | 6804 | |
6805 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6805 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6806 | 6806 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration |
6807 | 6807 | GROUP BY spotter_output.arrival_airport_icao |
6808 | 6808 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6814,7 +6814,7 @@ discard block |
||
6814 | 6814 | $airport_array = array(); |
6815 | 6815 | $temp_array = array(); |
6816 | 6816 | |
6817 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6817 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6818 | 6818 | { |
6819 | 6819 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6820 | 6820 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6835,11 +6835,11 @@ discard block |
||
6835 | 6835 | * @return Array the airport list |
6836 | 6836 | * |
6837 | 6837 | */ |
6838 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
6838 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
6839 | 6839 | { |
6840 | - $filter_query = $this->getFilter($filters,true,true); |
|
6841 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
6842 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6840 | + $filter_query = $this->getFilter($filters, true, true); |
|
6841 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
6842 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6843 | 6843 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
6844 | 6844 | GROUP BY spotter_output.arrival_airport_country |
6845 | 6845 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6851,7 +6851,7 @@ discard block |
||
6851 | 6851 | $airport_array = array(); |
6852 | 6852 | $temp_array = array(); |
6853 | 6853 | |
6854 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6854 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6855 | 6855 | { |
6856 | 6856 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6857 | 6857 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6870,11 +6870,11 @@ discard block |
||
6870 | 6870 | * @return Array the airport list |
6871 | 6871 | * |
6872 | 6872 | */ |
6873 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
6873 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
6874 | 6874 | { |
6875 | - $filter_query = $this->getFilter($filters,true,true); |
|
6876 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
6877 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6875 | + $filter_query = $this->getFilter($filters, true, true); |
|
6876 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
6877 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6878 | 6878 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao |
6879 | 6879 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6880 | 6880 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6886,7 +6886,7 @@ discard block |
||
6886 | 6886 | $airport_array = array(); |
6887 | 6887 | $temp_array = array(); |
6888 | 6888 | |
6889 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6889 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6890 | 6890 | { |
6891 | 6891 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6892 | 6892 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6907,11 +6907,11 @@ discard block |
||
6907 | 6907 | * @return Array the airport list |
6908 | 6908 | * |
6909 | 6909 | */ |
6910 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
6910 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
6911 | 6911 | { |
6912 | - $filter_query = $this->getFilter($filters,true,true); |
|
6913 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
6914 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6912 | + $filter_query = $this->getFilter($filters, true, true); |
|
6913 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
6914 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6915 | 6915 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
6916 | 6916 | GROUP BY spotter_output.arrival_airport_country |
6917 | 6917 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6923,7 +6923,7 @@ discard block |
||
6923 | 6923 | $airport_array = array(); |
6924 | 6924 | $temp_array = array(); |
6925 | 6925 | |
6926 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6926 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6927 | 6927 | { |
6928 | 6928 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6929 | 6929 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6941,11 +6941,11 @@ discard block |
||
6941 | 6941 | * @return Array the airport list |
6942 | 6942 | * |
6943 | 6943 | */ |
6944 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
6944 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
6945 | 6945 | { |
6946 | - $filter_query = $this->getFilter($filters,true,true); |
|
6947 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
6948 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6946 | + $filter_query = $this->getFilter($filters, true, true); |
|
6947 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
6948 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6949 | 6949 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
6950 | 6950 | GROUP BY spotter_output.arrival_airport_icao |
6951 | 6951 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6957,7 +6957,7 @@ discard block |
||
6957 | 6957 | $airport_array = array(); |
6958 | 6958 | $temp_array = array(); |
6959 | 6959 | |
6960 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6960 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6961 | 6961 | { |
6962 | 6962 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6963 | 6963 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6979,11 +6979,11 @@ discard block |
||
6979 | 6979 | * @return Array the airport list |
6980 | 6980 | * |
6981 | 6981 | */ |
6982 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
6982 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
6983 | 6983 | { |
6984 | - $filter_query = $this->getFilter($filters,true,true); |
|
6985 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
6986 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6984 | + $filter_query = $this->getFilter($filters, true, true); |
|
6985 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
6986 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6987 | 6987 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
6988 | 6988 | GROUP BY spotter_output.arrival_airport_country |
6989 | 6989 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6995,7 +6995,7 @@ discard block |
||
6995 | 6995 | $airport_array = array(); |
6996 | 6996 | $temp_array = array(); |
6997 | 6997 | |
6998 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6998 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6999 | 6999 | { |
7000 | 7000 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
7001 | 7001 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7014,11 +7014,11 @@ discard block |
||
7014 | 7014 | * @return Array the airport list |
7015 | 7015 | * |
7016 | 7016 | */ |
7017 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
7017 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
7018 | 7018 | { |
7019 | 7019 | global $globalTimezone, $globalDBdriver; |
7020 | - $filter_query = $this->getFilter($filters,true,true); |
|
7021 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
7020 | + $filter_query = $this->getFilter($filters, true, true); |
|
7021 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
7022 | 7022 | if ($globalTimezone != '') { |
7023 | 7023 | date_default_timezone_set($globalTimezone); |
7024 | 7024 | $datetime = new DateTime($date); |
@@ -7026,12 +7026,12 @@ discard block |
||
7026 | 7026 | } else $offset = '+00:00'; |
7027 | 7027 | |
7028 | 7028 | if ($globalDBdriver == 'mysql') { |
7029 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7029 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7030 | 7030 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
7031 | 7031 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7032 | 7032 | ORDER BY airport_arrival_icao_count DESC"; |
7033 | 7033 | } else { |
7034 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7034 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7035 | 7035 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
7036 | 7036 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7037 | 7037 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7043,7 +7043,7 @@ discard block |
||
7043 | 7043 | $airport_array = array(); |
7044 | 7044 | $temp_array = array(); |
7045 | 7045 | |
7046 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7046 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7047 | 7047 | { |
7048 | 7048 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
7049 | 7049 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7067,8 +7067,8 @@ discard block |
||
7067 | 7067 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
7068 | 7068 | { |
7069 | 7069 | global $globalTimezone, $globalDBdriver; |
7070 | - $filter_query = $this->getFilter($filters,true,true); |
|
7071 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
7070 | + $filter_query = $this->getFilter($filters, true, true); |
|
7071 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
7072 | 7072 | if ($globalTimezone != '') { |
7073 | 7073 | date_default_timezone_set($globalTimezone); |
7074 | 7074 | $datetime = new DateTime($date); |
@@ -7076,12 +7076,12 @@ discard block |
||
7076 | 7076 | } else $offset = '+00:00'; |
7077 | 7077 | |
7078 | 7078 | if ($globalDBdriver == 'mysql') { |
7079 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7079 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7080 | 7080 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
7081 | 7081 | GROUP BY spotter_output.arrival_airport_country |
7082 | 7082 | ORDER BY airport_arrival_country_count DESC"; |
7083 | 7083 | } else { |
7084 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7084 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7085 | 7085 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
7086 | 7086 | GROUP BY spotter_output.arrival_airport_country |
7087 | 7087 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7093,7 +7093,7 @@ discard block |
||
7093 | 7093 | $airport_array = array(); |
7094 | 7094 | $temp_array = array(); |
7095 | 7095 | |
7096 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7096 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7097 | 7097 | { |
7098 | 7098 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
7099 | 7099 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7111,11 +7111,11 @@ discard block |
||
7111 | 7111 | * @return Array the airport list |
7112 | 7112 | * |
7113 | 7113 | */ |
7114 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
7114 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
7115 | 7115 | { |
7116 | - $filter_query = $this->getFilter($filters,true,true); |
|
7117 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
7118 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7116 | + $filter_query = $this->getFilter($filters, true, true); |
|
7117 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
7118 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7119 | 7119 | FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident |
7120 | 7120 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7121 | 7121 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7127,7 +7127,7 @@ discard block |
||
7127 | 7127 | $airport_array = array(); |
7128 | 7128 | $temp_array = array(); |
7129 | 7129 | |
7130 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7130 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7131 | 7131 | { |
7132 | 7132 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
7133 | 7133 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7150,9 +7150,9 @@ discard block |
||
7150 | 7150 | */ |
7151 | 7151 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
7152 | 7152 | { |
7153 | - $filter_query = $this->getFilter($filters,true,true); |
|
7154 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
7155 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7153 | + $filter_query = $this->getFilter($filters, true, true); |
|
7154 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
7155 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7156 | 7156 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
7157 | 7157 | GROUP BY spotter_output.arrival_airport_country |
7158 | 7158 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7164,7 +7164,7 @@ discard block |
||
7164 | 7164 | $airport_array = array(); |
7165 | 7165 | $temp_array = array(); |
7166 | 7166 | |
7167 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7167 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7168 | 7168 | { |
7169 | 7169 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
7170 | 7170 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7183,11 +7183,11 @@ discard block |
||
7183 | 7183 | * @return Array the airport list |
7184 | 7184 | * |
7185 | 7185 | */ |
7186 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
7186 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
7187 | 7187 | { |
7188 | - $filter_query = $this->getFilter($filters,true,true); |
|
7189 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
7190 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7188 | + $filter_query = $this->getFilter($filters, true, true); |
|
7189 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
7190 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7191 | 7191 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
7192 | 7192 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7193 | 7193 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7199,7 +7199,7 @@ discard block |
||
7199 | 7199 | $airport_array = array(); |
7200 | 7200 | $temp_array = array(); |
7201 | 7201 | |
7202 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7202 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7203 | 7203 | { |
7204 | 7204 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
7205 | 7205 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7220,11 +7220,11 @@ discard block |
||
7220 | 7220 | * @return Array the airport list |
7221 | 7221 | * |
7222 | 7222 | */ |
7223 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
7223 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
7224 | 7224 | { |
7225 | - $filter_query = $this->getFilter($filters,true,true); |
|
7226 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
7227 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7225 | + $filter_query = $this->getFilter($filters, true, true); |
|
7226 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
7227 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7228 | 7228 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
7229 | 7229 | GROUP BY spotter_output.arrival_airport_country |
7230 | 7230 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7236,7 +7236,7 @@ discard block |
||
7236 | 7236 | $airport_array = array(); |
7237 | 7237 | $temp_array = array(); |
7238 | 7238 | |
7239 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7239 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7240 | 7240 | { |
7241 | 7241 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
7242 | 7242 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7257,7 +7257,7 @@ discard block |
||
7257 | 7257 | */ |
7258 | 7258 | public function countAllDepartureCountries($filters = array()) |
7259 | 7259 | { |
7260 | - $filter_query = $this->getFilter($filters,true,true); |
|
7260 | + $filter_query = $this->getFilter($filters, true, true); |
|
7261 | 7261 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
7262 | 7262 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
7263 | 7263 | $query .= " GROUP BY spotter_output.departure_airport_country |
@@ -7271,7 +7271,7 @@ discard block |
||
7271 | 7271 | $airport_array = array(); |
7272 | 7272 | $temp_array = array(); |
7273 | 7273 | |
7274 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7274 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7275 | 7275 | { |
7276 | 7276 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
7277 | 7277 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -7289,9 +7289,9 @@ discard block |
||
7289 | 7289 | * @return Array the airport arrival list |
7290 | 7290 | * |
7291 | 7291 | */ |
7292 | - public function countAllArrivalCountries($limit = true,$filters = array()) |
|
7292 | + public function countAllArrivalCountries($limit = true, $filters = array()) |
|
7293 | 7293 | { |
7294 | - $filter_query = $this->getFilter($filters,true,true); |
|
7294 | + $filter_query = $this->getFilter($filters, true, true); |
|
7295 | 7295 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
7296 | 7296 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
7297 | 7297 | $query .= " GROUP BY spotter_output.arrival_airport_country |
@@ -7305,7 +7305,7 @@ discard block |
||
7305 | 7305 | $airport_array = array(); |
7306 | 7306 | $temp_array = array(); |
7307 | 7307 | |
7308 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7308 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7309 | 7309 | { |
7310 | 7310 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
7311 | 7311 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -7328,8 +7328,8 @@ discard block |
||
7328 | 7328 | */ |
7329 | 7329 | public function countAllRoutes($filters = array()) |
7330 | 7330 | { |
7331 | - $filter_query = $this->getFilter($filters,true,true); |
|
7332 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7331 | + $filter_query = $this->getFilter($filters, true, true); |
|
7332 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7333 | 7333 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' |
7334 | 7334 | GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
7335 | 7335 | ORDER BY route_count DESC |
@@ -7342,7 +7342,7 @@ discard block |
||
7342 | 7342 | $routes_array = array(); |
7343 | 7343 | $temp_array = array(); |
7344 | 7344 | |
7345 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7345 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7346 | 7346 | { |
7347 | 7347 | $temp_array['route_count'] = $row['route_count']; |
7348 | 7348 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7369,11 +7369,11 @@ discard block |
||
7369 | 7369 | * @return Array the route list |
7370 | 7370 | * |
7371 | 7371 | */ |
7372 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
7372 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
7373 | 7373 | { |
7374 | - $filter_query = $this->getFilter($filters,true,true); |
|
7375 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
7376 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7374 | + $filter_query = $this->getFilter($filters, true, true); |
|
7375 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
7376 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7377 | 7377 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
7378 | 7378 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7379 | 7379 | ORDER BY route_count DESC"; |
@@ -7384,7 +7384,7 @@ discard block |
||
7384 | 7384 | $routes_array = array(); |
7385 | 7385 | $temp_array = array(); |
7386 | 7386 | |
7387 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7387 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7388 | 7388 | { |
7389 | 7389 | $temp_array['route_count'] = $row['route_count']; |
7390 | 7390 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7411,9 +7411,9 @@ discard block |
||
7411 | 7411 | */ |
7412 | 7412 | public function countAllRoutesByRegistration($registration, $filters = array()) |
7413 | 7413 | { |
7414 | - $filter_query = $this->getFilter($filters,true,true); |
|
7414 | + $filter_query = $this->getFilter($filters, true, true); |
|
7415 | 7415 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
7416 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7416 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7417 | 7417 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
7418 | 7418 | GROUP BY route |
7419 | 7419 | ORDER BY route_count DESC"; |
@@ -7425,7 +7425,7 @@ discard block |
||
7425 | 7425 | $routes_array = array(); |
7426 | 7426 | $temp_array = array(); |
7427 | 7427 | |
7428 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7428 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7429 | 7429 | { |
7430 | 7430 | $temp_array['route_count'] = $row['route_count']; |
7431 | 7431 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7453,9 +7453,9 @@ discard block |
||
7453 | 7453 | */ |
7454 | 7454 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
7455 | 7455 | { |
7456 | - $filter_query = $this->getFilter($filters,true,true); |
|
7457 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
7458 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7456 | + $filter_query = $this->getFilter($filters, true, true); |
|
7457 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
7458 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7459 | 7459 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
7460 | 7460 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7461 | 7461 | ORDER BY route_count DESC"; |
@@ -7467,7 +7467,7 @@ discard block |
||
7467 | 7467 | $routes_array = array(); |
7468 | 7468 | $temp_array = array(); |
7469 | 7469 | |
7470 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7470 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7471 | 7471 | { |
7472 | 7472 | $temp_array['route_count'] = $row['route_count']; |
7473 | 7473 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7495,9 +7495,9 @@ discard block |
||
7495 | 7495 | */ |
7496 | 7496 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
7497 | 7497 | { |
7498 | - $filter_query = $this->getFilter($filters,true,true); |
|
7499 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
7500 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7498 | + $filter_query = $this->getFilter($filters, true, true); |
|
7499 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
7500 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7501 | 7501 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
7502 | 7502 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7503 | 7503 | ORDER BY route_count DESC"; |
@@ -7508,7 +7508,7 @@ discard block |
||
7508 | 7508 | $routes_array = array(); |
7509 | 7509 | $temp_array = array(); |
7510 | 7510 | |
7511 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7511 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7512 | 7512 | { |
7513 | 7513 | $temp_array['route_count'] = $row['route_count']; |
7514 | 7514 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7536,9 +7536,9 @@ discard block |
||
7536 | 7536 | */ |
7537 | 7537 | public function countAllRoutesByCountry($country, $filters = array()) |
7538 | 7538 | { |
7539 | - $filter_query = $this->getFilter($filters,true,true); |
|
7540 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
7541 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7539 | + $filter_query = $this->getFilter($filters, true, true); |
|
7540 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
7541 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7542 | 7542 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
7543 | 7543 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7544 | 7544 | ORDER BY route_count DESC"; |
@@ -7549,7 +7549,7 @@ discard block |
||
7549 | 7549 | $routes_array = array(); |
7550 | 7550 | $temp_array = array(); |
7551 | 7551 | |
7552 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7552 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7553 | 7553 | { |
7554 | 7554 | $temp_array['route_count'] = $row['route_count']; |
7555 | 7555 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7577,8 +7577,8 @@ discard block |
||
7577 | 7577 | public function countAllRoutesByDate($date, $filters = array()) |
7578 | 7578 | { |
7579 | 7579 | global $globalTimezone, $globalDBdriver; |
7580 | - $filter_query = $this->getFilter($filters,true,true); |
|
7581 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
7580 | + $filter_query = $this->getFilter($filters, true, true); |
|
7581 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
7582 | 7582 | if ($globalTimezone != '') { |
7583 | 7583 | date_default_timezone_set($globalTimezone); |
7584 | 7584 | $datetime = new DateTime($date); |
@@ -7586,12 +7586,12 @@ discard block |
||
7586 | 7586 | } else $offset = '+00:00'; |
7587 | 7587 | |
7588 | 7588 | if ($globalDBdriver == 'mysql') { |
7589 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7589 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7590 | 7590 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
7591 | 7591 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7592 | 7592 | ORDER BY route_count DESC"; |
7593 | 7593 | } else { |
7594 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7594 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7595 | 7595 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
7596 | 7596 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7597 | 7597 | ORDER BY route_count DESC"; |
@@ -7603,7 +7603,7 @@ discard block |
||
7603 | 7603 | $routes_array = array(); |
7604 | 7604 | $temp_array = array(); |
7605 | 7605 | |
7606 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7606 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7607 | 7607 | { |
7608 | 7608 | $temp_array['route_count'] = $row['route_count']; |
7609 | 7609 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7630,9 +7630,9 @@ discard block |
||
7630 | 7630 | */ |
7631 | 7631 | public function countAllRoutesByIdent($ident, $filters = array()) |
7632 | 7632 | { |
7633 | - $filter_query = $this->getFilter($filters,true,true); |
|
7634 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
7635 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7633 | + $filter_query = $this->getFilter($filters, true, true); |
|
7634 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
7635 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7636 | 7636 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
7637 | 7637 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7638 | 7638 | ORDER BY route_count DESC"; |
@@ -7644,7 +7644,7 @@ discard block |
||
7644 | 7644 | $routes_array = array(); |
7645 | 7645 | $temp_array = array(); |
7646 | 7646 | |
7647 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7647 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7648 | 7648 | { |
7649 | 7649 | $temp_array['route_count'] = $row['route_count']; |
7650 | 7650 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7671,9 +7671,9 @@ discard block |
||
7671 | 7671 | */ |
7672 | 7672 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
7673 | 7673 | { |
7674 | - $filter_query = $this->getFilter($filters,true,true); |
|
7675 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
7676 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7674 | + $filter_query = $this->getFilter($filters, true, true); |
|
7675 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
7676 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7677 | 7677 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
7678 | 7678 | GROUP BY route |
7679 | 7679 | ORDER BY route_count DESC"; |
@@ -7685,7 +7685,7 @@ discard block |
||
7685 | 7685 | $routes_array = array(); |
7686 | 7686 | $temp_array = array(); |
7687 | 7687 | |
7688 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7688 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7689 | 7689 | { |
7690 | 7690 | $temp_array['route_count'] = $row['route_count']; |
7691 | 7691 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7713,8 +7713,8 @@ discard block |
||
7713 | 7713 | */ |
7714 | 7714 | public function countAllRoutesWithWaypoints($filters = array()) |
7715 | 7715 | { |
7716 | - $filter_query = $this->getFilter($filters,true,true); |
|
7717 | - $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7716 | + $filter_query = $this->getFilter($filters, true, true); |
|
7717 | + $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7718 | 7718 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
7719 | 7719 | GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7720 | 7720 | ORDER BY route_count DESC |
@@ -7727,7 +7727,7 @@ discard block |
||
7727 | 7727 | $routes_array = array(); |
7728 | 7728 | $temp_array = array(); |
7729 | 7729 | |
7730 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7730 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7731 | 7731 | { |
7732 | 7732 | $temp_array['spotter_id'] = $row['spotter_id']; |
7733 | 7733 | $temp_array['route_count'] = $row['route_count']; |
@@ -7752,11 +7752,11 @@ discard block |
||
7752 | 7752 | * @return Array the callsign list |
7753 | 7753 | * |
7754 | 7754 | */ |
7755 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
7755 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
7756 | 7756 | { |
7757 | 7757 | global $globalDBdriver; |
7758 | - $filter_query = $this->getFilter($filters,true,true); |
|
7759 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
7758 | + $filter_query = $this->getFilter($filters, true, true); |
|
7759 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
7760 | 7760 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
7761 | 7761 | if ($olderthanmonths > 0) { |
7762 | 7762 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -7775,7 +7775,7 @@ discard block |
||
7775 | 7775 | $callsign_array = array(); |
7776 | 7776 | $temp_array = array(); |
7777 | 7777 | |
7778 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7778 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7779 | 7779 | { |
7780 | 7780 | $temp_array['callsign_icao'] = $row['ident']; |
7781 | 7781 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7797,8 +7797,8 @@ discard block |
||
7797 | 7797 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
7798 | 7798 | { |
7799 | 7799 | global $globalDBdriver; |
7800 | - $filter_query = $this->getFilter($filters,true,true); |
|
7801 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
7800 | + $filter_query = $this->getFilter($filters, true, true); |
|
7801 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
7802 | 7802 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
7803 | 7803 | if ($olderthanmonths > 0) { |
7804 | 7804 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -7817,7 +7817,7 @@ discard block |
||
7817 | 7817 | $callsign_array = array(); |
7818 | 7818 | $temp_array = array(); |
7819 | 7819 | |
7820 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7820 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7821 | 7821 | { |
7822 | 7822 | $temp_array['callsign_icao'] = $row['ident']; |
7823 | 7823 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7871,7 +7871,7 @@ discard block |
||
7871 | 7871 | $date_array = array(); |
7872 | 7872 | $temp_array = array(); |
7873 | 7873 | |
7874 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7874 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7875 | 7875 | { |
7876 | 7876 | $temp_array['date_name'] = $row['date_name']; |
7877 | 7877 | $temp_array['date_count'] = $row['date_count']; |
@@ -7896,15 +7896,15 @@ discard block |
||
7896 | 7896 | $datetime = new DateTime(); |
7897 | 7897 | $offset = $datetime->format('P'); |
7898 | 7898 | } else $offset = '+00:00'; |
7899 | - $filter_query = $this->getFilter($filters,true,true); |
|
7899 | + $filter_query = $this->getFilter($filters, true, true); |
|
7900 | 7900 | if ($globalDBdriver == 'mysql') { |
7901 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7901 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7902 | 7902 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
7903 | 7903 | GROUP BY spotter_output.airline_icao, date_name |
7904 | 7904 | ORDER BY date_count DESC |
7905 | 7905 | LIMIT 10 OFFSET 0"; |
7906 | 7906 | } else { |
7907 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7907 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7908 | 7908 | FROM spotter_output |
7909 | 7909 | WHERE spotter_output.airline_icao <> '' |
7910 | 7910 | GROUP BY spotter_output.airline_icao, date_name |
@@ -7919,7 +7919,7 @@ discard block |
||
7919 | 7919 | $date_array = array(); |
7920 | 7920 | $temp_array = array(); |
7921 | 7921 | |
7922 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7922 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7923 | 7923 | { |
7924 | 7924 | $temp_array['date_name'] = $row['date_name']; |
7925 | 7925 | $temp_array['date_count'] = $row['date_count']; |
@@ -7945,7 +7945,7 @@ discard block |
||
7945 | 7945 | $datetime = new DateTime(); |
7946 | 7946 | $offset = $datetime->format('P'); |
7947 | 7947 | } else $offset = '+00:00'; |
7948 | - $filter_query = $this->getFilter($filters,true,true); |
|
7948 | + $filter_query = $this->getFilter($filters, true, true); |
|
7949 | 7949 | if ($globalDBdriver == 'mysql') { |
7950 | 7950 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
7951 | 7951 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -7966,7 +7966,7 @@ discard block |
||
7966 | 7966 | $date_array = array(); |
7967 | 7967 | $temp_array = array(); |
7968 | 7968 | |
7969 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7969 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7970 | 7970 | { |
7971 | 7971 | $temp_array['date_name'] = $row['date_name']; |
7972 | 7972 | $temp_array['date_count'] = $row['date_count']; |
@@ -7991,7 +7991,7 @@ discard block |
||
7991 | 7991 | $datetime = new DateTime(); |
7992 | 7992 | $offset = $datetime->format('P'); |
7993 | 7993 | } else $offset = '+00:00'; |
7994 | - $filter_query = $this->getFilter($filters,true,true); |
|
7994 | + $filter_query = $this->getFilter($filters, true, true); |
|
7995 | 7995 | if ($globalDBdriver == 'mysql') { |
7996 | 7996 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
7997 | 7997 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -8012,7 +8012,7 @@ discard block |
||
8012 | 8012 | $date_array = array(); |
8013 | 8013 | $temp_array = array(); |
8014 | 8014 | |
8015 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8015 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8016 | 8016 | { |
8017 | 8017 | $temp_array['date_name'] = $row['date_name']; |
8018 | 8018 | $temp_array['date_count'] = $row['date_count']; |
@@ -8033,7 +8033,7 @@ discard block |
||
8033 | 8033 | public function countAllDatesLastMonthByAirlines($filters = array()) |
8034 | 8034 | { |
8035 | 8035 | global $globalTimezone, $globalDBdriver; |
8036 | - $filter_query = $this->getFilter($filters,true,true); |
|
8036 | + $filter_query = $this->getFilter($filters, true, true); |
|
8037 | 8037 | if ($globalTimezone != '') { |
8038 | 8038 | date_default_timezone_set($globalTimezone); |
8039 | 8039 | $datetime = new DateTime(); |
@@ -8041,13 +8041,13 @@ discard block |
||
8041 | 8041 | } else $offset = '+00:00'; |
8042 | 8042 | |
8043 | 8043 | if ($globalDBdriver == 'mysql') { |
8044 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
8044 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
8045 | 8045 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
8046 | 8046 | GROUP BY spotter_output.airline_icao, date_name |
8047 | 8047 | ORDER BY spotter_output.date ASC"; |
8048 | 8048 | $query_data = array(':offset' => $offset); |
8049 | 8049 | } else { |
8050 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
8050 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
8051 | 8051 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
8052 | 8052 | GROUP BY spotter_output.airline_icao, date_name |
8053 | 8053 | ORDER BY date_name ASC"; |
@@ -8060,7 +8060,7 @@ discard block |
||
8060 | 8060 | $date_array = array(); |
8061 | 8061 | $temp_array = array(); |
8062 | 8062 | |
8063 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8063 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8064 | 8064 | { |
8065 | 8065 | $temp_array['date_name'] = $row['date_name']; |
8066 | 8066 | $temp_array['date_count'] = $row['date_count']; |
@@ -8107,7 +8107,7 @@ discard block |
||
8107 | 8107 | $date_array = array(); |
8108 | 8108 | $temp_array = array(); |
8109 | 8109 | |
8110 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8110 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8111 | 8111 | { |
8112 | 8112 | $temp_array['month_name'] = $row['month_name']; |
8113 | 8113 | $temp_array['year_name'] = $row['year_name']; |
@@ -8128,7 +8128,7 @@ discard block |
||
8128 | 8128 | public function countAllMonthsByAirlines($filters = array()) |
8129 | 8129 | { |
8130 | 8130 | global $globalTimezone, $globalDBdriver; |
8131 | - $filter_query = $this->getFilter($filters,true,true); |
|
8131 | + $filter_query = $this->getFilter($filters, true, true); |
|
8132 | 8132 | if ($globalTimezone != '') { |
8133 | 8133 | date_default_timezone_set($globalTimezone); |
8134 | 8134 | $datetime = new DateTime(); |
@@ -8136,12 +8136,12 @@ discard block |
||
8136 | 8136 | } else $offset = '+00:00'; |
8137 | 8137 | |
8138 | 8138 | if ($globalDBdriver == 'mysql') { |
8139 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8139 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8140 | 8140 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
8141 | 8141 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8142 | 8142 | ORDER BY date_count DESC"; |
8143 | 8143 | } else { |
8144 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8144 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8145 | 8145 | FROM spotter_output |
8146 | 8146 | WHERE spotter_output.airline_icao <> '' |
8147 | 8147 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -8155,7 +8155,7 @@ discard block |
||
8155 | 8155 | $date_array = array(); |
8156 | 8156 | $temp_array = array(); |
8157 | 8157 | |
8158 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8158 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8159 | 8159 | { |
8160 | 8160 | $temp_array['month_name'] = $row['month_name']; |
8161 | 8161 | $temp_array['year_name'] = $row['year_name']; |
@@ -8182,14 +8182,14 @@ discard block |
||
8182 | 8182 | $datetime = new DateTime(); |
8183 | 8183 | $offset = $datetime->format('P'); |
8184 | 8184 | } else $offset = '+00:00'; |
8185 | - $filter_query = $this->getFilter($filters,true,true); |
|
8185 | + $filter_query = $this->getFilter($filters, true, true); |
|
8186 | 8186 | if ($globalDBdriver == 'mysql') { |
8187 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8187 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8188 | 8188 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
8189 | 8189 | GROUP BY year_name, month_name |
8190 | 8190 | ORDER BY date_count DESC"; |
8191 | 8191 | } else { |
8192 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8192 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8193 | 8193 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
8194 | 8194 | GROUP BY year_name, month_name |
8195 | 8195 | ORDER BY date_count DESC"; |
@@ -8201,7 +8201,7 @@ discard block |
||
8201 | 8201 | $date_array = array(); |
8202 | 8202 | $temp_array = array(); |
8203 | 8203 | |
8204 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8204 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8205 | 8205 | { |
8206 | 8206 | $temp_array['month_name'] = $row['month_name']; |
8207 | 8207 | $temp_array['year_name'] = $row['year_name']; |
@@ -8227,15 +8227,15 @@ discard block |
||
8227 | 8227 | $datetime = new DateTime(); |
8228 | 8228 | $offset = $datetime->format('P'); |
8229 | 8229 | } else $offset = '+00:00'; |
8230 | - $filter_query = $this->getFilter($filters,true,true); |
|
8230 | + $filter_query = $this->getFilter($filters, true, true); |
|
8231 | 8231 | |
8232 | 8232 | if ($globalDBdriver == 'mysql') { |
8233 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8233 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8234 | 8234 | FROM spotter_output".$filter_query." owner_name <> '' |
8235 | 8235 | GROUP BY year_name, month_name |
8236 | 8236 | ORDER BY date_count DESC"; |
8237 | 8237 | } else { |
8238 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8238 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8239 | 8239 | FROM spotter_output".$filter_query." owner_name <> '' |
8240 | 8240 | GROUP BY year_name, month_name |
8241 | 8241 | ORDER BY date_count DESC"; |
@@ -8247,7 +8247,7 @@ discard block |
||
8247 | 8247 | $date_array = array(); |
8248 | 8248 | $temp_array = array(); |
8249 | 8249 | |
8250 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8250 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8251 | 8251 | { |
8252 | 8252 | $temp_array['month_name'] = $row['month_name']; |
8253 | 8253 | $temp_array['year_name'] = $row['year_name']; |
@@ -8268,7 +8268,7 @@ discard block |
||
8268 | 8268 | public function countAllMonthsOwnersByAirlines($filters = array()) |
8269 | 8269 | { |
8270 | 8270 | global $globalTimezone, $globalDBdriver; |
8271 | - $filter_query = $this->getFilter($filters,true,true); |
|
8271 | + $filter_query = $this->getFilter($filters, true, true); |
|
8272 | 8272 | if ($globalTimezone != '') { |
8273 | 8273 | date_default_timezone_set($globalTimezone); |
8274 | 8274 | $datetime = new DateTime(); |
@@ -8276,12 +8276,12 @@ discard block |
||
8276 | 8276 | } else $offset = '+00:00'; |
8277 | 8277 | |
8278 | 8278 | if ($globalDBdriver == 'mysql') { |
8279 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8279 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8280 | 8280 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
8281 | 8281 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8282 | 8282 | ORDER BY date_count DESC"; |
8283 | 8283 | } else { |
8284 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8284 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8285 | 8285 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
8286 | 8286 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8287 | 8287 | ORDER BY date_count DESC"; |
@@ -8293,7 +8293,7 @@ discard block |
||
8293 | 8293 | $date_array = array(); |
8294 | 8294 | $temp_array = array(); |
8295 | 8295 | |
8296 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8296 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8297 | 8297 | { |
8298 | 8298 | $temp_array['month_name'] = $row['month_name']; |
8299 | 8299 | $temp_array['year_name'] = $row['year_name']; |
@@ -8320,15 +8320,15 @@ discard block |
||
8320 | 8320 | $datetime = new DateTime(); |
8321 | 8321 | $offset = $datetime->format('P'); |
8322 | 8322 | } else $offset = '+00:00'; |
8323 | - $filter_query = $this->getFilter($filters,true,true); |
|
8323 | + $filter_query = $this->getFilter($filters, true, true); |
|
8324 | 8324 | |
8325 | 8325 | if ($globalDBdriver == 'mysql') { |
8326 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8326 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8327 | 8327 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
8328 | 8328 | GROUP BY year_name, month_name |
8329 | 8329 | ORDER BY date_count DESC"; |
8330 | 8330 | } else { |
8331 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8331 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8332 | 8332 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
8333 | 8333 | GROUP BY year_name, month_name |
8334 | 8334 | ORDER BY date_count DESC"; |
@@ -8340,7 +8340,7 @@ discard block |
||
8340 | 8340 | $date_array = array(); |
8341 | 8341 | $temp_array = array(); |
8342 | 8342 | |
8343 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8343 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8344 | 8344 | { |
8345 | 8345 | $temp_array['month_name'] = $row['month_name']; |
8346 | 8346 | $temp_array['year_name'] = $row['year_name']; |
@@ -8361,7 +8361,7 @@ discard block |
||
8361 | 8361 | public function countAllMonthsPilotsByAirlines($filters = array()) |
8362 | 8362 | { |
8363 | 8363 | global $globalTimezone, $globalDBdriver; |
8364 | - $filter_query = $this->getFilter($filters,true,true); |
|
8364 | + $filter_query = $this->getFilter($filters, true, true); |
|
8365 | 8365 | if ($globalTimezone != '') { |
8366 | 8366 | date_default_timezone_set($globalTimezone); |
8367 | 8367 | $datetime = new DateTime(); |
@@ -8369,12 +8369,12 @@ discard block |
||
8369 | 8369 | } else $offset = '+00:00'; |
8370 | 8370 | |
8371 | 8371 | if ($globalDBdriver == 'mysql') { |
8372 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8372 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8373 | 8373 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
8374 | 8374 | GROUP BY spotter_output.airline_icao,year_name, month_name |
8375 | 8375 | ORDER BY date_count DESC"; |
8376 | 8376 | } else { |
8377 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8377 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8378 | 8378 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
8379 | 8379 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8380 | 8380 | ORDER BY date_count DESC"; |
@@ -8386,7 +8386,7 @@ discard block |
||
8386 | 8386 | $date_array = array(); |
8387 | 8387 | $temp_array = array(); |
8388 | 8388 | |
8389 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8389 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8390 | 8390 | { |
8391 | 8391 | $temp_array['month_name'] = $row['month_name']; |
8392 | 8392 | $temp_array['year_name'] = $row['year_name']; |
@@ -8408,7 +8408,7 @@ discard block |
||
8408 | 8408 | public function countAllMonthsAirlines($filters = array()) |
8409 | 8409 | { |
8410 | 8410 | global $globalTimezone, $globalDBdriver; |
8411 | - $filter_query = $this->getFilter($filters,true,true); |
|
8411 | + $filter_query = $this->getFilter($filters, true, true); |
|
8412 | 8412 | if ($globalTimezone != '') { |
8413 | 8413 | date_default_timezone_set($globalTimezone); |
8414 | 8414 | $datetime = new DateTime(); |
@@ -8416,12 +8416,12 @@ discard block |
||
8416 | 8416 | } else $offset = '+00:00'; |
8417 | 8417 | |
8418 | 8418 | if ($globalDBdriver == 'mysql') { |
8419 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
8419 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
8420 | 8420 | FROM spotter_output".$filter_query." airline_icao <> '' |
8421 | 8421 | GROUP BY year_name, month_name |
8422 | 8422 | ORDER BY date_count DESC"; |
8423 | 8423 | } else { |
8424 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
8424 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
8425 | 8425 | FROM spotter_output".$filter_query." airline_icao <> '' |
8426 | 8426 | GROUP BY year_name, month_name |
8427 | 8427 | ORDER BY date_count DESC"; |
@@ -8433,7 +8433,7 @@ discard block |
||
8433 | 8433 | $date_array = array(); |
8434 | 8434 | $temp_array = array(); |
8435 | 8435 | |
8436 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8436 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8437 | 8437 | { |
8438 | 8438 | $temp_array['month_name'] = $row['month_name']; |
8439 | 8439 | $temp_array['year_name'] = $row['year_name']; |
@@ -8459,15 +8459,15 @@ discard block |
||
8459 | 8459 | $datetime = new DateTime(); |
8460 | 8460 | $offset = $datetime->format('P'); |
8461 | 8461 | } else $offset = '+00:00'; |
8462 | - $filter_query = $this->getFilter($filters,true,true); |
|
8462 | + $filter_query = $this->getFilter($filters, true, true); |
|
8463 | 8463 | |
8464 | 8464 | if ($globalDBdriver == 'mysql') { |
8465 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8465 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8466 | 8466 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
8467 | 8467 | GROUP BY year_name, month_name |
8468 | 8468 | ORDER BY date_count DESC"; |
8469 | 8469 | } else { |
8470 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8470 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8471 | 8471 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
8472 | 8472 | GROUP BY year_name, month_name |
8473 | 8473 | ORDER BY date_count DESC"; |
@@ -8479,7 +8479,7 @@ discard block |
||
8479 | 8479 | $date_array = array(); |
8480 | 8480 | $temp_array = array(); |
8481 | 8481 | |
8482 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8482 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8483 | 8483 | { |
8484 | 8484 | $temp_array['month_name'] = $row['month_name']; |
8485 | 8485 | $temp_array['year_name'] = $row['year_name']; |
@@ -8501,7 +8501,7 @@ discard block |
||
8501 | 8501 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
8502 | 8502 | { |
8503 | 8503 | global $globalTimezone, $globalDBdriver; |
8504 | - $filter_query = $this->getFilter($filters,true,true); |
|
8504 | + $filter_query = $this->getFilter($filters, true, true); |
|
8505 | 8505 | if ($globalTimezone != '') { |
8506 | 8506 | date_default_timezone_set($globalTimezone); |
8507 | 8507 | $datetime = new DateTime(); |
@@ -8509,12 +8509,12 @@ discard block |
||
8509 | 8509 | } else $offset = '+00:00'; |
8510 | 8510 | |
8511 | 8511 | if ($globalDBdriver == 'mysql') { |
8512 | - $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8512 | + $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8513 | 8513 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
8514 | 8514 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8515 | 8515 | ORDER BY date_count DESC"; |
8516 | 8516 | } else { |
8517 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8517 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8518 | 8518 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
8519 | 8519 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8520 | 8520 | ORDER BY date_count DESC"; |
@@ -8526,7 +8526,7 @@ discard block |
||
8526 | 8526 | $date_array = array(); |
8527 | 8527 | $temp_array = array(); |
8528 | 8528 | |
8529 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8529 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8530 | 8530 | { |
8531 | 8531 | $temp_array['month_name'] = $row['month_name']; |
8532 | 8532 | $temp_array['year_name'] = $row['year_name']; |
@@ -8553,15 +8553,15 @@ discard block |
||
8553 | 8553 | $datetime = new DateTime(); |
8554 | 8554 | $offset = $datetime->format('P'); |
8555 | 8555 | } else $offset = '+00:00'; |
8556 | - $filter_query = $this->getFilter($filters,true,true); |
|
8556 | + $filter_query = $this->getFilter($filters, true, true); |
|
8557 | 8557 | |
8558 | 8558 | if ($globalDBdriver == 'mysql') { |
8559 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8559 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8560 | 8560 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
8561 | 8561 | GROUP BY year_name, month_name |
8562 | 8562 | ORDER BY date_count DESC"; |
8563 | 8563 | } else { |
8564 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8564 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8565 | 8565 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
8566 | 8566 | GROUP BY year_name, month_name |
8567 | 8567 | ORDER BY date_count DESC"; |
@@ -8573,7 +8573,7 @@ discard block |
||
8573 | 8573 | $date_array = array(); |
8574 | 8574 | $temp_array = array(); |
8575 | 8575 | |
8576 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8576 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8577 | 8577 | { |
8578 | 8578 | $temp_array['month_name'] = $row['month_name']; |
8579 | 8579 | $temp_array['year_name'] = $row['year_name']; |
@@ -8595,7 +8595,7 @@ discard block |
||
8595 | 8595 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
8596 | 8596 | { |
8597 | 8597 | global $globalTimezone, $globalDBdriver; |
8598 | - $filter_query = $this->getFilter($filters,true,true); |
|
8598 | + $filter_query = $this->getFilter($filters, true, true); |
|
8599 | 8599 | if ($globalTimezone != '') { |
8600 | 8600 | date_default_timezone_set($globalTimezone); |
8601 | 8601 | $datetime = new DateTime(); |
@@ -8603,12 +8603,12 @@ discard block |
||
8603 | 8603 | } else $offset = '+00:00'; |
8604 | 8604 | |
8605 | 8605 | if ($globalDBdriver == 'mysql') { |
8606 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8606 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8607 | 8607 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
8608 | 8608 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8609 | 8609 | ORDER BY date_count DESC"; |
8610 | 8610 | } else { |
8611 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8611 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8612 | 8612 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
8613 | 8613 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8614 | 8614 | ORDER BY date_count DESC"; |
@@ -8620,7 +8620,7 @@ discard block |
||
8620 | 8620 | $date_array = array(); |
8621 | 8621 | $temp_array = array(); |
8622 | 8622 | |
8623 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8623 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8624 | 8624 | { |
8625 | 8625 | $temp_array['month_name'] = $row['month_name']; |
8626 | 8626 | $temp_array['year_name'] = $row['year_name']; |
@@ -8648,7 +8648,7 @@ discard block |
||
8648 | 8648 | $datetime = new DateTime(); |
8649 | 8649 | $offset = $datetime->format('P'); |
8650 | 8650 | } else $offset = '+00:00'; |
8651 | - $filter_query = $this->getFilter($filters,true,true); |
|
8651 | + $filter_query = $this->getFilter($filters, true, true); |
|
8652 | 8652 | if ($globalDBdriver == 'mysql') { |
8653 | 8653 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
8654 | 8654 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -8669,7 +8669,7 @@ discard block |
||
8669 | 8669 | $date_array = array(); |
8670 | 8670 | $temp_array = array(); |
8671 | 8671 | |
8672 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8672 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8673 | 8673 | { |
8674 | 8674 | $temp_array['year_name'] = $row['year_name']; |
8675 | 8675 | $temp_array['month_name'] = $row['month_name']; |
@@ -8689,7 +8689,7 @@ discard block |
||
8689 | 8689 | * @return Array the hour list |
8690 | 8690 | * |
8691 | 8691 | */ |
8692 | - public function countAllHours($orderby,$filters = array()) |
|
8692 | + public function countAllHours($orderby, $filters = array()) |
|
8693 | 8693 | { |
8694 | 8694 | global $globalTimezone, $globalDBdriver; |
8695 | 8695 | if ($globalTimezone != '') { |
@@ -8737,7 +8737,7 @@ discard block |
||
8737 | 8737 | $hour_array = array(); |
8738 | 8738 | $temp_array = array(); |
8739 | 8739 | |
8740 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8740 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8741 | 8741 | { |
8742 | 8742 | $temp_array['hour_name'] = $row['hour_name']; |
8743 | 8743 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8757,7 +8757,7 @@ discard block |
||
8757 | 8757 | public function countAllHoursByAirlines($orderby, $filters = array()) |
8758 | 8758 | { |
8759 | 8759 | global $globalTimezone, $globalDBdriver; |
8760 | - $filter_query = $this->getFilter($filters,true,true); |
|
8760 | + $filter_query = $this->getFilter($filters, true, true); |
|
8761 | 8761 | if ($globalTimezone != '') { |
8762 | 8762 | date_default_timezone_set($globalTimezone); |
8763 | 8763 | $datetime = new DateTime(); |
@@ -8775,7 +8775,7 @@ discard block |
||
8775 | 8775 | } |
8776 | 8776 | |
8777 | 8777 | if ($globalDBdriver == 'mysql') { |
8778 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8778 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8779 | 8779 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
8780 | 8780 | GROUP BY spotter_output.airline_icao, hour_name |
8781 | 8781 | ".$orderby_sql; |
@@ -8788,7 +8788,7 @@ discard block |
||
8788 | 8788 | */ |
8789 | 8789 | $query_data = array(':offset' => $offset); |
8790 | 8790 | } else { |
8791 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8791 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8792 | 8792 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
8793 | 8793 | GROUP BY spotter_output.airline_icao, hour_name |
8794 | 8794 | ".$orderby_sql; |
@@ -8801,7 +8801,7 @@ discard block |
||
8801 | 8801 | $hour_array = array(); |
8802 | 8802 | $temp_array = array(); |
8803 | 8803 | |
8804 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8804 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8805 | 8805 | { |
8806 | 8806 | $temp_array['hour_name'] = $row['hour_name']; |
8807 | 8807 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8824,34 +8824,34 @@ discard block |
||
8824 | 8824 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
8825 | 8825 | { |
8826 | 8826 | global $globalTimezone, $globalDBdriver; |
8827 | - $filter_query = $this->getFilter($filters,true,true); |
|
8827 | + $filter_query = $this->getFilter($filters, true, true); |
|
8828 | 8828 | if ($globalTimezone != '') { |
8829 | 8829 | date_default_timezone_set($globalTimezone); |
8830 | 8830 | $datetime = new DateTime(); |
8831 | 8831 | $offset = $datetime->format('P'); |
8832 | 8832 | } else $offset = '+00:00'; |
8833 | 8833 | |
8834 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
8834 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
8835 | 8835 | |
8836 | 8836 | if ($globalDBdriver == 'mysql') { |
8837 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8837 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8838 | 8838 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
8839 | 8839 | GROUP BY hour_name |
8840 | 8840 | ORDER BY hour_name ASC"; |
8841 | 8841 | } else { |
8842 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8842 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8843 | 8843 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
8844 | 8844 | GROUP BY hour_name |
8845 | 8845 | ORDER BY hour_name ASC"; |
8846 | 8846 | } |
8847 | 8847 | |
8848 | 8848 | $sth = $this->db->prepare($query); |
8849 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
8849 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
8850 | 8850 | |
8851 | 8851 | $hour_array = array(); |
8852 | 8852 | $temp_array = array(); |
8853 | 8853 | |
8854 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8854 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8855 | 8855 | { |
8856 | 8856 | $temp_array['hour_name'] = $row['hour_name']; |
8857 | 8857 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8874,8 +8874,8 @@ discard block |
||
8874 | 8874 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
8875 | 8875 | { |
8876 | 8876 | global $globalTimezone, $globalDBdriver; |
8877 | - $filter_query = $this->getFilter($filters,true,true); |
|
8878 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
8877 | + $filter_query = $this->getFilter($filters, true, true); |
|
8878 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
8879 | 8879 | if ($globalTimezone != '') { |
8880 | 8880 | date_default_timezone_set($globalTimezone); |
8881 | 8881 | $datetime = new DateTime(); |
@@ -8883,24 +8883,24 @@ discard block |
||
8883 | 8883 | } else $offset = '+00:00'; |
8884 | 8884 | |
8885 | 8885 | if ($globalDBdriver == 'mysql') { |
8886 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8886 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8887 | 8887 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
8888 | 8888 | GROUP BY hour_name |
8889 | 8889 | ORDER BY hour_name ASC"; |
8890 | 8890 | } else { |
8891 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8891 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8892 | 8892 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
8893 | 8893 | GROUP BY hour_name |
8894 | 8894 | ORDER BY hour_name ASC"; |
8895 | 8895 | } |
8896 | 8896 | |
8897 | 8897 | $sth = $this->db->prepare($query); |
8898 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
8898 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
8899 | 8899 | |
8900 | 8900 | $hour_array = array(); |
8901 | 8901 | $temp_array = array(); |
8902 | 8902 | |
8903 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8903 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8904 | 8904 | { |
8905 | 8905 | $temp_array['hour_name'] = $row['hour_name']; |
8906 | 8906 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8921,8 +8921,8 @@ discard block |
||
8921 | 8921 | public function countAllHoursByRegistration($registration, $filters = array()) |
8922 | 8922 | { |
8923 | 8923 | global $globalTimezone, $globalDBdriver; |
8924 | - $filter_query = $this->getFilter($filters,true,true); |
|
8925 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
8924 | + $filter_query = $this->getFilter($filters, true, true); |
|
8925 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
8926 | 8926 | if ($globalTimezone != '') { |
8927 | 8927 | date_default_timezone_set($globalTimezone); |
8928 | 8928 | $datetime = new DateTime(); |
@@ -8930,24 +8930,24 @@ discard block |
||
8930 | 8930 | } else $offset = '+00:00'; |
8931 | 8931 | |
8932 | 8932 | if ($globalDBdriver == 'mysql') { |
8933 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8933 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8934 | 8934 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
8935 | 8935 | GROUP BY hour_name |
8936 | 8936 | ORDER BY hour_name ASC"; |
8937 | 8937 | } else { |
8938 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8938 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8939 | 8939 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
8940 | 8940 | GROUP BY hour_name |
8941 | 8941 | ORDER BY hour_name ASC"; |
8942 | 8942 | } |
8943 | 8943 | |
8944 | 8944 | $sth = $this->db->prepare($query); |
8945 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
8945 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
8946 | 8946 | |
8947 | 8947 | $hour_array = array(); |
8948 | 8948 | $temp_array = array(); |
8949 | 8949 | |
8950 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8950 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8951 | 8951 | { |
8952 | 8952 | $temp_array['hour_name'] = $row['hour_name']; |
8953 | 8953 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8968,8 +8968,8 @@ discard block |
||
8968 | 8968 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
8969 | 8969 | { |
8970 | 8970 | global $globalTimezone, $globalDBdriver; |
8971 | - $filter_query = $this->getFilter($filters,true,true); |
|
8972 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
8971 | + $filter_query = $this->getFilter($filters, true, true); |
|
8972 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
8973 | 8973 | if ($globalTimezone != '') { |
8974 | 8974 | date_default_timezone_set($globalTimezone); |
8975 | 8975 | $datetime = new DateTime(); |
@@ -8977,24 +8977,24 @@ discard block |
||
8977 | 8977 | } else $offset = '+00:00'; |
8978 | 8978 | |
8979 | 8979 | if ($globalDBdriver == 'mysql') { |
8980 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8980 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8981 | 8981 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
8982 | 8982 | GROUP BY hour_name |
8983 | 8983 | ORDER BY hour_name ASC"; |
8984 | 8984 | } else { |
8985 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8985 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8986 | 8986 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
8987 | 8987 | GROUP BY hour_name |
8988 | 8988 | ORDER BY hour_name ASC"; |
8989 | 8989 | } |
8990 | 8990 | |
8991 | 8991 | $sth = $this->db->prepare($query); |
8992 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
8992 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
8993 | 8993 | |
8994 | 8994 | $hour_array = array(); |
8995 | 8995 | $temp_array = array(); |
8996 | 8996 | |
8997 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8997 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8998 | 8998 | { |
8999 | 8999 | $temp_array['hour_name'] = $row['hour_name']; |
9000 | 9000 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9013,11 +9013,11 @@ discard block |
||
9013 | 9013 | * @return Array the hour list |
9014 | 9014 | * |
9015 | 9015 | */ |
9016 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
9016 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
9017 | 9017 | { |
9018 | 9018 | global $globalTimezone, $globalDBdriver; |
9019 | - $filter_query = $this->getFilter($filters,true,true); |
|
9020 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
9019 | + $filter_query = $this->getFilter($filters, true, true); |
|
9020 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
9021 | 9021 | if ($globalTimezone != '') { |
9022 | 9022 | date_default_timezone_set($globalTimezone); |
9023 | 9023 | $datetime = new DateTime(); |
@@ -9025,24 +9025,24 @@ discard block |
||
9025 | 9025 | } else $offset = '+00:00'; |
9026 | 9026 | |
9027 | 9027 | if ($globalDBdriver == 'mysql') { |
9028 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9028 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9029 | 9029 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
9030 | 9030 | GROUP BY hour_name |
9031 | 9031 | ORDER BY hour_name ASC"; |
9032 | 9032 | } else { |
9033 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9033 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9034 | 9034 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
9035 | 9035 | GROUP BY hour_name |
9036 | 9036 | ORDER BY hour_name ASC"; |
9037 | 9037 | } |
9038 | 9038 | |
9039 | 9039 | $sth = $this->db->prepare($query); |
9040 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
9040 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
9041 | 9041 | |
9042 | 9042 | $hour_array = array(); |
9043 | 9043 | $temp_array = array(); |
9044 | 9044 | |
9045 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9045 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9046 | 9046 | { |
9047 | 9047 | $temp_array['hour_name'] = $row['hour_name']; |
9048 | 9048 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9064,8 +9064,8 @@ discard block |
||
9064 | 9064 | public function countAllHoursByDate($date, $filters = array()) |
9065 | 9065 | { |
9066 | 9066 | global $globalTimezone, $globalDBdriver; |
9067 | - $filter_query = $this->getFilter($filters,true,true); |
|
9068 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
9067 | + $filter_query = $this->getFilter($filters, true, true); |
|
9068 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
9069 | 9069 | if ($globalTimezone != '') { |
9070 | 9070 | date_default_timezone_set($globalTimezone); |
9071 | 9071 | $datetime = new DateTime($date); |
@@ -9073,12 +9073,12 @@ discard block |
||
9073 | 9073 | } else $offset = '+00:00'; |
9074 | 9074 | |
9075 | 9075 | if ($globalDBdriver == 'mysql') { |
9076 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9076 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9077 | 9077 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
9078 | 9078 | GROUP BY hour_name |
9079 | 9079 | ORDER BY hour_name ASC"; |
9080 | 9080 | } else { |
9081 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9081 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9082 | 9082 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
9083 | 9083 | GROUP BY hour_name |
9084 | 9084 | ORDER BY hour_name ASC"; |
@@ -9090,7 +9090,7 @@ discard block |
||
9090 | 9090 | $hour_array = array(); |
9091 | 9091 | $temp_array = array(); |
9092 | 9092 | |
9093 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9093 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9094 | 9094 | { |
9095 | 9095 | $temp_array['hour_name'] = $row['hour_name']; |
9096 | 9096 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9112,8 +9112,8 @@ discard block |
||
9112 | 9112 | public function countAllHoursByIdent($ident, $filters = array()) |
9113 | 9113 | { |
9114 | 9114 | global $globalTimezone, $globalDBdriver; |
9115 | - $filter_query = $this->getFilter($filters,true,true); |
|
9116 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
9115 | + $filter_query = $this->getFilter($filters, true, true); |
|
9116 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
9117 | 9117 | if ($globalTimezone != '') { |
9118 | 9118 | date_default_timezone_set($globalTimezone); |
9119 | 9119 | $datetime = new DateTime(); |
@@ -9121,12 +9121,12 @@ discard block |
||
9121 | 9121 | } else $offset = '+00:00'; |
9122 | 9122 | |
9123 | 9123 | if ($globalDBdriver == 'mysql') { |
9124 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9124 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9125 | 9125 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
9126 | 9126 | GROUP BY hour_name |
9127 | 9127 | ORDER BY hour_name ASC"; |
9128 | 9128 | } else { |
9129 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9129 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9130 | 9130 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
9131 | 9131 | GROUP BY hour_name |
9132 | 9132 | ORDER BY hour_name ASC"; |
@@ -9134,12 +9134,12 @@ discard block |
||
9134 | 9134 | |
9135 | 9135 | |
9136 | 9136 | $sth = $this->db->prepare($query); |
9137 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
9137 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
9138 | 9138 | |
9139 | 9139 | $hour_array = array(); |
9140 | 9140 | $temp_array = array(); |
9141 | 9141 | |
9142 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9142 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9143 | 9143 | { |
9144 | 9144 | $temp_array['hour_name'] = $row['hour_name']; |
9145 | 9145 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9158,12 +9158,12 @@ discard block |
||
9158 | 9158 | * @return Array the hour list |
9159 | 9159 | * |
9160 | 9160 | */ |
9161 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
9161 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
9162 | 9162 | { |
9163 | 9163 | global $globalTimezone, $globalDBdriver; |
9164 | - $filter_query = $this->getFilter($filters,true,true); |
|
9165 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
9166 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
9164 | + $filter_query = $this->getFilter($filters, true, true); |
|
9165 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
9166 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
9167 | 9167 | if ($globalTimezone != '') { |
9168 | 9168 | date_default_timezone_set($globalTimezone); |
9169 | 9169 | $datetime = new DateTime(); |
@@ -9171,24 +9171,24 @@ discard block |
||
9171 | 9171 | } else $offset = '+00:00'; |
9172 | 9172 | |
9173 | 9173 | if ($globalDBdriver == 'mysql') { |
9174 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9174 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9175 | 9175 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
9176 | 9176 | GROUP BY hour_name |
9177 | 9177 | ORDER BY hour_name ASC"; |
9178 | 9178 | } else { |
9179 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9179 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9180 | 9180 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
9181 | 9181 | GROUP BY hour_name |
9182 | 9182 | ORDER BY hour_name ASC"; |
9183 | 9183 | } |
9184 | 9184 | |
9185 | 9185 | $sth = $this->db->prepare($query); |
9186 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
9186 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
9187 | 9187 | |
9188 | 9188 | $hour_array = array(); |
9189 | 9189 | $temp_array = array(); |
9190 | 9190 | |
9191 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9191 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9192 | 9192 | { |
9193 | 9193 | $temp_array['hour_name'] = $row['hour_name']; |
9194 | 9194 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9209,8 +9209,8 @@ discard block |
||
9209 | 9209 | public function countAllHoursByCountry($country, $filters = array()) |
9210 | 9210 | { |
9211 | 9211 | global $globalTimezone, $globalDBdriver; |
9212 | - $filter_query = $this->getFilter($filters,true,true); |
|
9213 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
9212 | + $filter_query = $this->getFilter($filters, true, true); |
|
9213 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
9214 | 9214 | if ($globalTimezone != '') { |
9215 | 9215 | date_default_timezone_set($globalTimezone); |
9216 | 9216 | $datetime = new DateTime(); |
@@ -9218,24 +9218,24 @@ discard block |
||
9218 | 9218 | } else $offset = '+00:00'; |
9219 | 9219 | |
9220 | 9220 | if ($globalDBdriver == 'mysql') { |
9221 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9221 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9222 | 9222 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
9223 | 9223 | GROUP BY hour_name |
9224 | 9224 | ORDER BY hour_name ASC"; |
9225 | 9225 | } else { |
9226 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9226 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9227 | 9227 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
9228 | 9228 | GROUP BY hour_name |
9229 | 9229 | ORDER BY hour_name ASC"; |
9230 | 9230 | } |
9231 | 9231 | |
9232 | 9232 | $sth = $this->db->prepare($query); |
9233 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
9233 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
9234 | 9234 | |
9235 | 9235 | $hour_array = array(); |
9236 | 9236 | $temp_array = array(); |
9237 | 9237 | |
9238 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9238 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9239 | 9239 | { |
9240 | 9240 | $temp_array['hour_name'] = $row['hour_name']; |
9241 | 9241 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9257,8 +9257,8 @@ discard block |
||
9257 | 9257 | */ |
9258 | 9258 | public function countOverallAircrafts($filters = array()) |
9259 | 9259 | { |
9260 | - $filter_query = $this->getFilter($filters,true,true); |
|
9261 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
9260 | + $filter_query = $this->getFilter($filters, true, true); |
|
9261 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
9262 | 9262 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
9263 | 9263 | $sth = $this->db->prepare($query); |
9264 | 9264 | $sth->execute(); |
@@ -9273,8 +9273,8 @@ discard block |
||
9273 | 9273 | */ |
9274 | 9274 | public function countOverallArrival($filters = array()) |
9275 | 9275 | { |
9276 | - $filter_query = $this->getFilter($filters,true,true); |
|
9277 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
9276 | + $filter_query = $this->getFilter($filters, true, true); |
|
9277 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
9278 | 9278 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
9279 | 9279 | |
9280 | 9280 | $sth = $this->db->prepare($query); |
@@ -9290,8 +9290,8 @@ discard block |
||
9290 | 9290 | */ |
9291 | 9291 | public function countOverallPilots($filters = array()) |
9292 | 9292 | { |
9293 | - $filter_query = $this->getFilter($filters,true,true); |
|
9294 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
9293 | + $filter_query = $this->getFilter($filters, true, true); |
|
9294 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
9295 | 9295 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
9296 | 9296 | $sth = $this->db->prepare($query); |
9297 | 9297 | $sth->execute(); |
@@ -9306,8 +9306,8 @@ discard block |
||
9306 | 9306 | */ |
9307 | 9307 | public function countOverallOwners($filters = array()) |
9308 | 9308 | { |
9309 | - $filter_query = $this->getFilter($filters,true,true); |
|
9310 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
9309 | + $filter_query = $this->getFilter($filters, true, true); |
|
9310 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
9311 | 9311 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
9312 | 9312 | $sth = $this->db->prepare($query); |
9313 | 9313 | $sth->execute(); |
@@ -9340,8 +9340,8 @@ discard block |
||
9340 | 9340 | */ |
9341 | 9341 | public function countOverallMilitaryFlights($filters = array()) |
9342 | 9342 | { |
9343 | - $filter_query = $this->getFilter($filters,true,true); |
|
9344 | - $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
9343 | + $filter_query = $this->getFilter($filters, true, true); |
|
9344 | + $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
9345 | 9345 | FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'"; |
9346 | 9346 | |
9347 | 9347 | $sth = $this->db->prepare($query); |
@@ -9378,7 +9378,7 @@ discard block |
||
9378 | 9378 | public function countAllHoursFromToday($filters = array()) |
9379 | 9379 | { |
9380 | 9380 | global $globalTimezone, $globalDBdriver; |
9381 | - $filter_query = $this->getFilter($filters,true,true); |
|
9381 | + $filter_query = $this->getFilter($filters, true, true); |
|
9382 | 9382 | if ($globalTimezone != '') { |
9383 | 9383 | date_default_timezone_set($globalTimezone); |
9384 | 9384 | $datetime = new DateTime(); |
@@ -9386,12 +9386,12 @@ discard block |
||
9386 | 9386 | } else $offset = '+00:00'; |
9387 | 9387 | |
9388 | 9388 | if ($globalDBdriver == 'mysql') { |
9389 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9389 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9390 | 9390 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
9391 | 9391 | GROUP BY hour_name |
9392 | 9392 | ORDER BY hour_name ASC"; |
9393 | 9393 | } else { |
9394 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9394 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9395 | 9395 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
9396 | 9396 | GROUP BY hour_name |
9397 | 9397 | ORDER BY hour_name ASC"; |
@@ -9403,7 +9403,7 @@ discard block |
||
9403 | 9403 | $hour_array = array(); |
9404 | 9404 | $temp_array = array(); |
9405 | 9405 | |
9406 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9406 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9407 | 9407 | { |
9408 | 9408 | $temp_array['hour_name'] = $row['hour_name']; |
9409 | 9409 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9422,14 +9422,14 @@ discard block |
||
9422 | 9422 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
9423 | 9423 | { |
9424 | 9424 | global $global_query, $globalDBdriver, $globalTimezone; |
9425 | - $filter_query = $this->getFilter($filters,true,true); |
|
9425 | + $filter_query = $this->getFilter($filters, true, true); |
|
9426 | 9426 | date_default_timezone_set('UTC'); |
9427 | 9427 | $limit_query = ''; |
9428 | 9428 | if ($limit != "") |
9429 | 9429 | { |
9430 | 9430 | $limit_array = explode(",", $limit); |
9431 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
9432 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
9431 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
9432 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
9433 | 9433 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
9434 | 9434 | { |
9435 | 9435 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -9482,7 +9482,7 @@ discard block |
||
9482 | 9482 | GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH') |
9483 | 9483 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
9484 | 9484 | //echo $query; |
9485 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
9485 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
9486 | 9486 | /* |
9487 | 9487 | $sth = $this->db->prepare($query); |
9488 | 9488 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -9501,9 +9501,9 @@ discard block |
||
9501 | 9501 | */ |
9502 | 9502 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
9503 | 9503 | { |
9504 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
9504 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
9505 | 9505 | |
9506 | - $query = "SELECT spotter_output.spotter_id |
|
9506 | + $query = "SELECT spotter_output.spotter_id |
|
9507 | 9507 | FROM spotter_output |
9508 | 9508 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
9509 | 9509 | |
@@ -9511,7 +9511,7 @@ discard block |
||
9511 | 9511 | $sth = $this->db->prepare($query); |
9512 | 9512 | $sth->execute(); |
9513 | 9513 | |
9514 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9514 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9515 | 9515 | { |
9516 | 9516 | return $row['spotter_id']; |
9517 | 9517 | } |
@@ -9536,23 +9536,23 @@ discard block |
||
9536 | 9536 | } |
9537 | 9537 | |
9538 | 9538 | $current_date = date("Y-m-d H:i:s"); |
9539 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
9539 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
9540 | 9540 | |
9541 | 9541 | $diff = abs(strtotime($current_date) - strtotime($date)); |
9542 | 9542 | |
9543 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
9543 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
9544 | 9544 | $years = $time_array['years']; |
9545 | 9545 | |
9546 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
9546 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
9547 | 9547 | $months = $time_array['months']; |
9548 | 9548 | |
9549 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
9549 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
9550 | 9550 | $days = $time_array['days']; |
9551 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
9551 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
9552 | 9552 | $hours = $time_array['hours']; |
9553 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
9553 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
9554 | 9554 | $minutes = $time_array['minutes']; |
9555 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
9555 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
9556 | 9556 | |
9557 | 9557 | return $time_array; |
9558 | 9558 | } |
@@ -9578,63 +9578,63 @@ discard block |
||
9578 | 9578 | $temp_array['direction_degree'] = $direction; |
9579 | 9579 | $temp_array['direction_shortname'] = "N"; |
9580 | 9580 | $temp_array['direction_fullname'] = "North"; |
9581 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
9581 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
9582 | 9582 | $temp_array['direction_degree'] = $direction; |
9583 | 9583 | $temp_array['direction_shortname'] = "NNE"; |
9584 | 9584 | $temp_array['direction_fullname'] = "North-Northeast"; |
9585 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
9585 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
9586 | 9586 | $temp_array['direction_degree'] = $direction; |
9587 | 9587 | $temp_array['direction_shortname'] = "NE"; |
9588 | 9588 | $temp_array['direction_fullname'] = "Northeast"; |
9589 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
9589 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
9590 | 9590 | $temp_array['direction_degree'] = $direction; |
9591 | 9591 | $temp_array['direction_shortname'] = "ENE"; |
9592 | 9592 | $temp_array['direction_fullname'] = "East-Northeast"; |
9593 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
9593 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
9594 | 9594 | $temp_array['direction_degree'] = $direction; |
9595 | 9595 | $temp_array['direction_shortname'] = "E"; |
9596 | 9596 | $temp_array['direction_fullname'] = "East"; |
9597 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
9597 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
9598 | 9598 | $temp_array['direction_degree'] = $direction; |
9599 | 9599 | $temp_array['direction_shortname'] = "ESE"; |
9600 | 9600 | $temp_array['direction_fullname'] = "East-Southeast"; |
9601 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
9601 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
9602 | 9602 | $temp_array['direction_degree'] = $direction; |
9603 | 9603 | $temp_array['direction_shortname'] = "SE"; |
9604 | 9604 | $temp_array['direction_fullname'] = "Southeast"; |
9605 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
9605 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
9606 | 9606 | $temp_array['direction_degree'] = $direction; |
9607 | 9607 | $temp_array['direction_shortname'] = "SSE"; |
9608 | 9608 | $temp_array['direction_fullname'] = "South-Southeast"; |
9609 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
9609 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
9610 | 9610 | $temp_array['direction_degree'] = $direction; |
9611 | 9611 | $temp_array['direction_shortname'] = "S"; |
9612 | 9612 | $temp_array['direction_fullname'] = "South"; |
9613 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
9613 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
9614 | 9614 | $temp_array['direction_degree'] = $direction; |
9615 | 9615 | $temp_array['direction_shortname'] = "SSW"; |
9616 | 9616 | $temp_array['direction_fullname'] = "South-Southwest"; |
9617 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
9617 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
9618 | 9618 | $temp_array['direction_degree'] = $direction; |
9619 | 9619 | $temp_array['direction_shortname'] = "SW"; |
9620 | 9620 | $temp_array['direction_fullname'] = "Southwest"; |
9621 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
9621 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
9622 | 9622 | $temp_array['direction_degree'] = $direction; |
9623 | 9623 | $temp_array['direction_shortname'] = "WSW"; |
9624 | 9624 | $temp_array['direction_fullname'] = "West-Southwest"; |
9625 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
9625 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
9626 | 9626 | $temp_array['direction_degree'] = $direction; |
9627 | 9627 | $temp_array['direction_shortname'] = "W"; |
9628 | 9628 | $temp_array['direction_fullname'] = "West"; |
9629 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
9629 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
9630 | 9630 | $temp_array['direction_degree'] = $direction; |
9631 | 9631 | $temp_array['direction_shortname'] = "WNW"; |
9632 | 9632 | $temp_array['direction_fullname'] = "West-Northwest"; |
9633 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
9633 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
9634 | 9634 | $temp_array['direction_degree'] = $direction; |
9635 | 9635 | $temp_array['direction_shortname'] = "NW"; |
9636 | 9636 | $temp_array['direction_fullname'] = "Northwest"; |
9637 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
9637 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
9638 | 9638 | $temp_array['direction_degree'] = $direction; |
9639 | 9639 | $temp_array['direction_shortname'] = "NNW"; |
9640 | 9640 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -9687,9 +9687,9 @@ discard block |
||
9687 | 9687 | */ |
9688 | 9688 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
9689 | 9689 | { |
9690 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
9690 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
9691 | 9691 | |
9692 | - $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
9692 | + $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
9693 | 9693 | |
9694 | 9694 | $sth = $this->db->prepare($query); |
9695 | 9695 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9712,9 +9712,9 @@ discard block |
||
9712 | 9712 | */ |
9713 | 9713 | public function getAircraftTypeBymodeS($aircraft_modes) |
9714 | 9714 | { |
9715 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
9715 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
9716 | 9716 | |
9717 | - $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
9717 | + $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
9718 | 9718 | |
9719 | 9719 | $sth = $this->db->prepare($query); |
9720 | 9720 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9735,11 +9735,11 @@ discard block |
||
9735 | 9735 | * @param Float $longitude longitute of the flight |
9736 | 9736 | * @return String the countrie |
9737 | 9737 | */ |
9738 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
9738 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
9739 | 9739 | { |
9740 | 9740 | global $globalDBdriver, $globalDebug; |
9741 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
9742 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
9741 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
9742 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
9743 | 9743 | |
9744 | 9744 | $Connection = new Connection($this->db); |
9745 | 9745 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9779,7 +9779,7 @@ discard block |
||
9779 | 9779 | public function getCountryFromISO2($iso2) |
9780 | 9780 | { |
9781 | 9781 | global $globalDBdriver, $globalDebug; |
9782 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
9782 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
9783 | 9783 | |
9784 | 9784 | $Connection = new Connection($this->db); |
9785 | 9785 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9811,19 +9811,19 @@ discard block |
||
9811 | 9811 | */ |
9812 | 9812 | public function convertAircraftRegistration($registration) |
9813 | 9813 | { |
9814 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
9814 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
9815 | 9815 | $registration_prefix = ''; |
9816 | 9816 | $registration_1 = substr($registration, 0, 1); |
9817 | 9817 | $registration_2 = substr($registration, 0, 2); |
9818 | 9818 | |
9819 | 9819 | //first get the prefix based on two characters |
9820 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
9820 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
9821 | 9821 | |
9822 | 9822 | |
9823 | 9823 | $sth = $this->db->prepare($query); |
9824 | 9824 | $sth->execute(array(':registration_2' => $registration_2)); |
9825 | 9825 | |
9826 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9826 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9827 | 9827 | { |
9828 | 9828 | $registration_prefix = $row['registration_prefix']; |
9829 | 9829 | } |
@@ -9831,11 +9831,11 @@ discard block |
||
9831 | 9831 | //if we didn't find a two chracter prefix lets just search the one with one character |
9832 | 9832 | if ($registration_prefix == '') |
9833 | 9833 | { |
9834 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
9834 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
9835 | 9835 | $sth = $this->db->prepare($query); |
9836 | 9836 | $sth->execute(array(':registration_1' => $registration_1)); |
9837 | 9837 | |
9838 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9838 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9839 | 9839 | { |
9840 | 9840 | $registration_prefix = $row['registration_prefix']; |
9841 | 9841 | } |
@@ -9849,7 +9849,7 @@ discard block |
||
9849 | 9849 | } else { |
9850 | 9850 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
9851 | 9851 | } |
9852 | - } else if(strlen($registration_prefix) == 2){ |
|
9852 | + } else if (strlen($registration_prefix) == 2) { |
|
9853 | 9853 | if (0 === strpos($registration, 'N')) { |
9854 | 9854 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
9855 | 9855 | } else { |
@@ -9868,17 +9868,17 @@ discard block |
||
9868 | 9868 | */ |
9869 | 9869 | public function countryFromAircraftRegistration($registration) |
9870 | 9870 | { |
9871 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
9871 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
9872 | 9872 | |
9873 | 9873 | $registration_prefix = ''; |
9874 | - $registration_test = explode('-',$registration); |
|
9874 | + $registration_test = explode('-', $registration); |
|
9875 | 9875 | $country = ''; |
9876 | 9876 | if ($registration_test[0] != $registration) { |
9877 | 9877 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
9878 | 9878 | |
9879 | 9879 | $sth = $this->db->prepare($query); |
9880 | 9880 | $sth->execute(array(':registration_1' => $registration_test[0])); |
9881 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9881 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9882 | 9882 | { |
9883 | 9883 | //$registration_prefix = $row['registration_prefix']; |
9884 | 9884 | $country = $row['country']; |
@@ -9889,13 +9889,13 @@ discard block |
||
9889 | 9889 | |
9890 | 9890 | $country = ''; |
9891 | 9891 | //first get the prefix based on two characters |
9892 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
9892 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
9893 | 9893 | |
9894 | 9894 | |
9895 | 9895 | $sth = $this->db->prepare($query); |
9896 | 9896 | $sth->execute(array(':registration_2' => $registration_2)); |
9897 | 9897 | |
9898 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9898 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9899 | 9899 | { |
9900 | 9900 | $registration_prefix = $row['registration_prefix']; |
9901 | 9901 | $country = $row['country']; |
@@ -9904,12 +9904,12 @@ discard block |
||
9904 | 9904 | //if we didn't find a two chracter prefix lets just search the one with one character |
9905 | 9905 | if ($registration_prefix == "") |
9906 | 9906 | { |
9907 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
9907 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
9908 | 9908 | |
9909 | 9909 | $sth = $this->db->prepare($query); |
9910 | 9910 | $sth->execute(array(':registration_1' => $registration_1)); |
9911 | 9911 | |
9912 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9912 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9913 | 9913 | { |
9914 | 9914 | //$registration_prefix = $row['registration_prefix']; |
9915 | 9915 | $country = $row['country']; |
@@ -9929,17 +9929,17 @@ discard block |
||
9929 | 9929 | */ |
9930 | 9930 | public function registrationPrefixFromAircraftRegistration($registration) |
9931 | 9931 | { |
9932 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
9932 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
9933 | 9933 | |
9934 | 9934 | $registration_prefix = ''; |
9935 | - $registration_test = explode('-',$registration); |
|
9935 | + $registration_test = explode('-', $registration); |
|
9936 | 9936 | $country = ''; |
9937 | 9937 | if ($registration_test[0] != $registration) { |
9938 | 9938 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
9939 | 9939 | |
9940 | 9940 | $sth = $this->db->prepare($query); |
9941 | 9941 | $sth->execute(array(':registration_1' => $registration_test[0])); |
9942 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9942 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9943 | 9943 | { |
9944 | 9944 | $registration_prefix = $row['registration_prefix']; |
9945 | 9945 | $country = $row['country']; |
@@ -9950,13 +9950,13 @@ discard block |
||
9950 | 9950 | |
9951 | 9951 | $country = ''; |
9952 | 9952 | //first get the prefix based on two characters |
9953 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
9953 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
9954 | 9954 | |
9955 | 9955 | |
9956 | 9956 | $sth = $this->db->prepare($query); |
9957 | 9957 | $sth->execute(array(':registration_2' => $registration_2)); |
9958 | 9958 | |
9959 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9959 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9960 | 9960 | { |
9961 | 9961 | $registration_prefix = $row['registration_prefix']; |
9962 | 9962 | $country = $row['country']; |
@@ -9965,12 +9965,12 @@ discard block |
||
9965 | 9965 | //if we didn't find a two chracter prefix lets just search the one with one character |
9966 | 9966 | if ($registration_prefix == "") |
9967 | 9967 | { |
9968 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
9968 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
9969 | 9969 | |
9970 | 9970 | $sth = $this->db->prepare($query); |
9971 | 9971 | $sth->execute(array(':registration_1' => $registration_1)); |
9972 | 9972 | |
9973 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9973 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9974 | 9974 | { |
9975 | 9975 | $registration_prefix = $row['registration_prefix']; |
9976 | 9976 | $country = $row['country']; |
@@ -9991,13 +9991,13 @@ discard block |
||
9991 | 9991 | */ |
9992 | 9992 | public function countryFromAircraftRegistrationCode($registration) |
9993 | 9993 | { |
9994 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
9994 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
9995 | 9995 | |
9996 | 9996 | $country = ''; |
9997 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
9997 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
9998 | 9998 | $sth = $this->db->prepare($query); |
9999 | 9999 | $sth->execute(array(':registration' => $registration)); |
10000 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10000 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10001 | 10001 | { |
10002 | 10002 | $country = $row['country']; |
10003 | 10003 | } |
@@ -10010,9 +10010,9 @@ discard block |
||
10010 | 10010 | * @param String $flightaware_id flightaware_id from spotter_output table |
10011 | 10011 | * @param String $highlight New highlight value |
10012 | 10012 | */ |
10013 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
10013 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
10014 | 10014 | |
10015 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
10015 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
10016 | 10016 | $sth = $this->db->prepare($query); |
10017 | 10017 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
10018 | 10018 | } |
@@ -10041,7 +10041,7 @@ discard block |
||
10041 | 10041 | |
10042 | 10042 | $bitly_data = json_decode($bitly_data); |
10043 | 10043 | $bitly_url = ''; |
10044 | - if ($bitly_data->status_txt = "OK"){ |
|
10044 | + if ($bitly_data->status_txt = "OK") { |
|
10045 | 10045 | $bitly_url = $bitly_data->data->url; |
10046 | 10046 | } |
10047 | 10047 | |
@@ -10051,7 +10051,7 @@ discard block |
||
10051 | 10051 | |
10052 | 10052 | public function getOrderBy() |
10053 | 10053 | { |
10054 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
10054 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
10055 | 10055 | |
10056 | 10056 | return $orderby; |
10057 | 10057 | |
@@ -10185,14 +10185,14 @@ discard block |
||
10185 | 10185 | } |
10186 | 10186 | $sth = $this->db->prepare($query); |
10187 | 10187 | $sth->execute(); |
10188 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10188 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10189 | 10189 | { |
10190 | 10190 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
10191 | 10191 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
10192 | 10192 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
10193 | - $update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
10193 | + $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
10194 | 10194 | $sthu = $this->db->prepare($update_query); |
10195 | - $sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
10195 | + $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
10196 | 10196 | } |
10197 | 10197 | } |
10198 | 10198 | |
@@ -10205,7 +10205,7 @@ discard block |
||
10205 | 10205 | } |
10206 | 10206 | $sth = $this->db->prepare($query); |
10207 | 10207 | $sth->execute(); |
10208 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10208 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10209 | 10209 | { |
10210 | 10210 | if (is_numeric(substr($row['ident'], -1, 1))) |
10211 | 10211 | { |
@@ -10214,11 +10214,11 @@ discard block |
||
10214 | 10214 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
10215 | 10215 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
10216 | 10216 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
10217 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
10217 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
10218 | 10218 | if (isset($airline_array[0]['name'])) { |
10219 | - $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
10219 | + $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
10220 | 10220 | $sthu = $this->db->prepare($update_query); |
10221 | - $sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
10221 | + $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
10222 | 10222 | } |
10223 | 10223 | } |
10224 | 10224 | } |
@@ -10238,18 +10238,18 @@ discard block |
||
10238 | 10238 | } |
10239 | 10239 | $sth = $this->db->prepare($query); |
10240 | 10240 | $sth->execute(); |
10241 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10241 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10242 | 10242 | { |
10243 | 10243 | if ($row['aircraft_icao'] != '') { |
10244 | 10244 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
10245 | - if ($row['registration'] != ""){ |
|
10245 | + if ($row['registration'] != "") { |
|
10246 | 10246 | $image_array = $Image->getSpotterImage($row['registration']); |
10247 | 10247 | if (!isset($image_array[0]['registration'])) { |
10248 | 10248 | $Image->addSpotterImage($row['registration']); |
10249 | 10249 | } |
10250 | 10250 | } |
10251 | 10251 | if (count($aircraft_name) > 0) { |
10252 | - $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
10252 | + $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
10253 | 10253 | $sthu = $this->db->prepare($update_query); |
10254 | 10254 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
10255 | 10255 | } |
@@ -10264,10 +10264,10 @@ discard block |
||
10264 | 10264 | $query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output"; |
10265 | 10265 | $sth = $this->db->prepare($query); |
10266 | 10266 | $sth->execute(); |
10267 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10267 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10268 | 10268 | { |
10269 | 10269 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
10270 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
10270 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
10271 | 10271 | $airport_icao = ''; |
10272 | 10272 | if (isset($closestAirports[0])) { |
10273 | 10273 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -10281,7 +10281,7 @@ discard block |
||
10281 | 10281 | break; |
10282 | 10282 | } |
10283 | 10283 | } |
10284 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
10284 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
10285 | 10285 | $airport_icao = $closestAirports[0]['icao']; |
10286 | 10286 | if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
10287 | 10287 | } else { |
@@ -10292,28 +10292,28 @@ discard block |
||
10292 | 10292 | } |
10293 | 10293 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
10294 | 10294 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
10295 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
10295 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
10296 | 10296 | $sthu = $this->db->prepare($update_query); |
10297 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
10297 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
10298 | 10298 | } |
10299 | 10299 | } |
10300 | 10300 | } |
10301 | 10301 | } |
10302 | 10302 | |
10303 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
10303 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
10304 | 10304 | global $globalDBdriver; |
10305 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
10305 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
10306 | 10306 | /* |
10307 | 10307 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
10308 | 10308 | FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10309 | 10309 | having distance < $dist ORDER BY distance limit 100;"; |
10310 | 10310 | */ |
10311 | 10311 | if ($globalDBdriver == 'mysql') { |
10312 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
10312 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
10313 | 10313 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10314 | 10314 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
10315 | 10315 | } else { |
10316 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
10316 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
10317 | 10317 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10318 | 10318 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
10319 | 10319 | } |
@@ -5,17 +5,17 @@ discard block |
||
5 | 5 | require_once('require/class.Stats.php'); |
6 | 6 | require_once('require/class.METAR.php'); |
7 | 7 | |
8 | -if (!isset($_GET['airport'])){ |
|
8 | +if (!isset($_GET['airport'])) { |
|
9 | 9 | header('Location: '.$globalURL.'/airport'); |
10 | 10 | } else { |
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | //calculation for the pagination |
13 | - if(!isset($_GET['limit'])) |
|
13 | + if (!isset($_GET['limit'])) |
|
14 | 14 | { |
15 | 15 | $limit_start = 0; |
16 | 16 | $limit_end = 25; |
17 | 17 | $absolute_difference = 25; |
18 | - } else { |
|
18 | + } else { |
|
19 | 19 | $limit_explode = explode(",", $_GET['limit']); |
20 | 20 | $limit_start = $limit_explode[0]; |
21 | 21 | $limit_end = $limit_explode[1]; |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | $limit_next = $limit_end + $absolute_difference; |
29 | 29 | $limit_previous_1 = $limit_start - $absolute_difference; |
30 | 30 | $limit_previous_2 = $limit_end - $absolute_difference; |
31 | - $airport_icao = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
31 | + $airport_icao = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
32 | 32 | $page_url = $globalURL.'/airport/'.$airport_icao; |
33 | 33 | |
34 | 34 | if (isset($_GET['sort'])) { |
35 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
36 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, $sort); |
|
35 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
36 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao, $limit_start.",".$absolute_difference, $sort); |
|
37 | 37 | } else { |
38 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, ''); |
|
38 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao, $limit_start.",".$absolute_difference, ''); |
|
39 | 39 | } |
40 | 40 | $airport_array = $Spotter->getAllAirportInfo($airport_icao); |
41 | 41 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | //print_r($metar_parse); |
51 | 51 | } |
52 | 52 | |
53 | - $title = sprintf(_("Detailed View for %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
53 | + $title = sprintf(_("Detailed View for %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
54 | 54 | |
55 | 55 | require_once('header.php'); |
56 | 56 | |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | $airport_names = $Stats->getAllAirportNames(); |
63 | 63 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
64 | 64 | ksort($airport_names); |
65 | - foreach($airport_names as $airport_name) |
|
65 | + foreach ($airport_names as $airport_name) |
|
66 | 66 | { |
67 | - if($airport_icao == $airport_name['airport_icao']) |
|
67 | + if ($airport_icao == $airport_name['airport_icao']) |
|
68 | 68 | { |
69 | 69 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
70 | 70 | } else { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | var data = google.visualization.arrayToDataTable([ |
113 | 113 | ["'._("Date").'","'._("Departure").'","'._("Arrival").'"], '; |
114 | 114 | $airport_data = ''; |
115 | - foreach($all_data as $data) |
|
115 | + foreach ($all_data as $data) |
|
116 | 116 | { |
117 | 117 | $airport_data .= '[ "'.$data['date'].'",'.$data['departure'].','.$data['arrival'].'],'; |
118 | 118 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | print _("Dew point:").' '.$metar_parse['dew'].' °C'." - "; |
166 | 166 | } |
167 | 167 | if (isset($metar_parse['temperature']) && isset($metar_parse['dew'])) { |
168 | - $humidity = round(100 * pow((112 - (0.1 * $metar_parse['temperature']) + $metar_parse['dew']) / (112 + (0.9 * $metar_parse['temperature'])), 8),1); |
|
168 | + $humidity = round(100*pow((112 - (0.1*$metar_parse['temperature']) + $metar_parse['dew'])/(112 + (0.9*$metar_parse['temperature'])), 8), 1); |
|
169 | 169 | print _("Humidity:").' '.$humidity.'%'." - "; |
170 | 170 | } |
171 | 171 | if (isset($metar_parse['QNH'])) { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | print '<div class="table column">'; |
182 | 182 | if ($airport_array[0]['iata'] != "NA") |
183 | 183 | { |
184 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
184 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
185 | 185 | } |
186 | 186 | include('table-output.php'); |
187 | 187 | print '<div class="pagination">'; |