@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
27 | 27 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
28 | 28 | curl_setopt($ch, CURLOPT_TIMEOUT, 200); |
29 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
29 | + if ($referer != '') { |
|
30 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
31 | + } |
|
30 | 32 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
31 | 33 | curl_setopt($ch, CURLOPT_FILE, $fp); |
32 | 34 | curl_exec($ch); |
@@ -37,12 +39,16 @@ discard block |
||
37 | 39 | public static function gunzip($in_file,$out_file_name = '') { |
38 | 40 | //echo $in_file.' -> '.$out_file_name."\n"; |
39 | 41 | $buffer_size = 4096; // read 4kb at a time |
40 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
42 | + if ($out_file_name == '') { |
|
43 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
44 | + } |
|
41 | 45 | if ($in_file != '' && file_exists($in_file)) { |
42 | 46 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
43 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
44 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
45 | - else { |
|
47 | + if (function_exists('gzopen')) { |
|
48 | + $file = gzopen($in_file,'rb'); |
|
49 | + } elseif (function_exists('gzopen64')) { |
|
50 | + $file = gzopen64($in_file,'rb'); |
|
51 | + } else { |
|
46 | 52 | echo 'gzopen not available'; |
47 | 53 | die; |
48 | 54 | } |
@@ -63,8 +69,12 @@ discard block |
||
63 | 69 | if ($res === TRUE) { |
64 | 70 | $zip->extractTo($path); |
65 | 71 | $zip->close(); |
66 | - } else return false; |
|
67 | - } else return false; |
|
72 | + } else { |
|
73 | + return false; |
|
74 | + } |
|
75 | + } else { |
|
76 | + return false; |
|
77 | + } |
|
68 | 78 | } |
69 | 79 | |
70 | 80 | public static function connect_sqlite($database) { |
@@ -79,7 +89,9 @@ discard block |
||
79 | 89 | public static function retrieve_route_sqlite_to_dest($database_file) { |
80 | 90 | global $globalDebug, $globalTransaction; |
81 | 91 | //$query = 'TRUNCATE TABLE routes'; |
82 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
92 | + if ($globalDebug) { |
|
93 | + echo " - Delete previous routes from DB -"; |
|
94 | + } |
|
83 | 95 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
84 | 96 | $Connection = new Connection(); |
85 | 97 | try { |
@@ -90,7 +102,9 @@ discard block |
||
90 | 102 | return "error : ".$e->getMessage(); |
91 | 103 | } |
92 | 104 | |
93 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
105 | + if ($globalDebug) { |
|
106 | + echo " - Add routes to DB -"; |
|
107 | + } |
|
94 | 108 | update_db::connect_sqlite($database_file); |
95 | 109 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
96 | 110 | $query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID"; |
@@ -105,15 +119,21 @@ discard block |
||
105 | 119 | $Connection = new Connection(); |
106 | 120 | $sth_dest = $Connection->db->prepare($query_dest); |
107 | 121 | try { |
108 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
122 | + if ($globalTransaction) { |
|
123 | + $Connection->db->beginTransaction(); |
|
124 | + } |
|
109 | 125 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
110 | 126 | //$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); |
111 | 127 | $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); |
112 | 128 | $sth_dest->execute($query_dest_values); |
113 | 129 | } |
114 | - if ($globalTransaction) $Connection->db->commit(); |
|
130 | + if ($globalTransaction) { |
|
131 | + $Connection->db->commit(); |
|
132 | + } |
|
115 | 133 | } catch(PDOException $e) { |
116 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
134 | + if ($globalTransaction) { |
|
135 | + $Connection->db->rollBack(); |
|
136 | + } |
|
117 | 137 | return "error : ".$e->getMessage(); |
118 | 138 | } |
119 | 139 | return ''; |
@@ -121,7 +141,9 @@ discard block |
||
121 | 141 | public static function retrieve_route_oneworld($database_file) { |
122 | 142 | global $globalDebug, $globalTransaction; |
123 | 143 | //$query = 'TRUNCATE TABLE routes'; |
124 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
144 | + if ($globalDebug) { |
|
145 | + echo " - Delete previous routes from DB -"; |
|
146 | + } |
|
125 | 147 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
126 | 148 | $Connection = new Connection(); |
127 | 149 | try { |
@@ -132,14 +154,18 @@ discard block |
||
132 | 154 | return "error : ".$e->getMessage(); |
133 | 155 | } |
134 | 156 | |
135 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
157 | + if ($globalDebug) { |
|
158 | + echo " - Add routes to DB -"; |
|
159 | + } |
|
136 | 160 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
137 | 161 | $Spotter = new Spotter(); |
138 | 162 | if ($fh = fopen($database_file,"r")) { |
139 | 163 | $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)'; |
140 | 164 | $Connection = new Connection(); |
141 | 165 | $sth_dest = $Connection->db->prepare($query_dest); |
142 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
166 | + if ($globalTransaction) { |
|
167 | + $Connection->db->beginTransaction(); |
|
168 | + } |
|
143 | 169 | while (!feof($fh)) { |
144 | 170 | $line = fgetcsv($fh,9999,','); |
145 | 171 | if ($line[0] != '') { |
@@ -148,13 +174,17 @@ discard block |
||
148 | 174 | $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'); |
149 | 175 | $sth_dest->execute($query_dest_values); |
150 | 176 | } catch(PDOException $e) { |
151 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
177 | + if ($globalTransaction) { |
|
178 | + $Connection->db->rollBack(); |
|
179 | + } |
|
152 | 180 | return "error : ".$e->getMessage(); |
153 | 181 | } |
154 | 182 | } |
155 | 183 | } |
156 | 184 | } |
157 | - if ($globalTransaction) $Connection->db->commit(); |
|
185 | + if ($globalTransaction) { |
|
186 | + $Connection->db->commit(); |
|
187 | + } |
|
158 | 188 | } |
159 | 189 | return ''; |
160 | 190 | } |
@@ -162,7 +192,9 @@ discard block |
||
162 | 192 | public static function retrieve_route_skyteam($database_file) { |
163 | 193 | global $globalDebug, $globalTransaction; |
164 | 194 | //$query = 'TRUNCATE TABLE routes'; |
165 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
195 | + if ($globalDebug) { |
|
196 | + echo " - Delete previous routes from DB -"; |
|
197 | + } |
|
166 | 198 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
167 | 199 | $Connection = new Connection(); |
168 | 200 | try { |
@@ -173,7 +205,9 @@ discard block |
||
173 | 205 | return "error : ".$e->getMessage(); |
174 | 206 | } |
175 | 207 | |
176 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
208 | + if ($globalDebug) { |
|
209 | + echo " - Add routes to DB -"; |
|
210 | + } |
|
177 | 211 | |
178 | 212 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
179 | 213 | $Spotter = new Spotter(); |
@@ -182,7 +216,9 @@ discard block |
||
182 | 216 | $Connection = new Connection(); |
183 | 217 | $sth_dest = $Connection->db->prepare($query_dest); |
184 | 218 | try { |
185 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
219 | + if ($globalTransaction) { |
|
220 | + $Connection->db->beginTransaction(); |
|
221 | + } |
|
186 | 222 | while (!feof($fh)) { |
187 | 223 | $line = fgetcsv($fh,9999,','); |
188 | 224 | if ($line[0] != '') { |
@@ -193,9 +229,13 @@ discard block |
||
193 | 229 | } |
194 | 230 | } |
195 | 231 | } |
196 | - if ($globalTransaction) $Connection->db->commit(); |
|
232 | + if ($globalTransaction) { |
|
233 | + $Connection->db->commit(); |
|
234 | + } |
|
197 | 235 | } catch(PDOException $e) { |
198 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
236 | + if ($globalTransaction) { |
|
237 | + $Connection->db->rollBack(); |
|
238 | + } |
|
199 | 239 | return "error : ".$e->getMessage(); |
200 | 240 | } |
201 | 241 | } |
@@ -238,11 +278,16 @@ discard block |
||
238 | 278 | $sth_dest = $Connection->db->prepare($query_dest); |
239 | 279 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
240 | 280 | try { |
241 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
281 | + if ($globalTransaction) { |
|
282 | + $Connection->db->beginTransaction(); |
|
283 | + } |
|
242 | 284 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
243 | 285 | //$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']); |
244 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
245 | - else $type = null; |
|
286 | + if ($values['UserString4'] == 'M') { |
|
287 | + $type = 'military'; |
|
288 | + } else { |
|
289 | + $type = null; |
|
290 | + } |
|
246 | 291 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
247 | 292 | $sth_dest->execute($query_dest_values); |
248 | 293 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -250,7 +295,9 @@ discard block |
||
250 | 295 | $sth_dest_owner->execute($query_dest_owner_values); |
251 | 296 | } |
252 | 297 | } |
253 | - if ($globalTransaction) $Connection->db->commit(); |
|
298 | + if ($globalTransaction) { |
|
299 | + $Connection->db->commit(); |
|
300 | + } |
|
254 | 301 | } catch(PDOException $e) { |
255 | 302 | return "error : ".$e->getMessage(); |
256 | 303 | } |
@@ -287,7 +334,9 @@ discard block |
||
287 | 334 | $Connection = new Connection(); |
288 | 335 | $sth_dest = $Connection->db->prepare($query_dest); |
289 | 336 | try { |
290 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
337 | + if ($globalTransaction) { |
|
338 | + $Connection->db->beginTransaction(); |
|
339 | + } |
|
291 | 340 | while (!feof($fh)) { |
292 | 341 | $values = array(); |
293 | 342 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -298,7 +347,9 @@ discard block |
||
298 | 347 | // Check if we can find ICAO, else set it to GLID |
299 | 348 | $aircraft_name_split = explode(' ',$aircraft_name); |
300 | 349 | $search_more = ''; |
301 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
350 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
351 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
352 | + } |
|
302 | 353 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
303 | 354 | $sth_search = $Connection->db->prepare($query_search); |
304 | 355 | try { |
@@ -311,7 +362,9 @@ discard block |
||
311 | 362 | } catch(PDOException $e) { |
312 | 363 | return "error : ".$e->getMessage(); |
313 | 364 | } |
314 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
365 | + if (!isset($values['ICAOTypeCode'])) { |
|
366 | + $values['ICAOTypeCode'] = 'GLID'; |
|
367 | + } |
|
315 | 368 | // Add data to db |
316 | 369 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
317 | 370 | //$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']); |
@@ -320,7 +373,9 @@ discard block |
||
320 | 373 | $sth_dest->execute($query_dest_values); |
321 | 374 | } |
322 | 375 | } |
323 | - if ($globalTransaction) $Connection->db->commit(); |
|
376 | + if ($globalTransaction) { |
|
377 | + $Connection->db->commit(); |
|
378 | + } |
|
324 | 379 | } catch(PDOException $e) { |
325 | 380 | return "error : ".$e->getMessage(); |
326 | 381 | } |
@@ -356,7 +411,9 @@ discard block |
||
356 | 411 | $Connection = new Connection(); |
357 | 412 | $sth_dest = $Connection->db->prepare($query_dest); |
358 | 413 | try { |
359 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
414 | + if ($globalTransaction) { |
|
415 | + $Connection->db->beginTransaction(); |
|
416 | + } |
|
360 | 417 | $tmp = fgetcsv($fh,9999,',',"'"); |
361 | 418 | while (!feof($fh)) { |
362 | 419 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -370,13 +427,17 @@ discard block |
||
370 | 427 | // Check if we can find ICAO, else set it to GLID |
371 | 428 | $aircraft_name_split = explode(' ',$aircraft_name); |
372 | 429 | $search_more = ''; |
373 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
430 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
431 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
432 | + } |
|
374 | 433 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
375 | 434 | $sth_search = $Connection->db->prepare($query_search); |
376 | 435 | try { |
377 | 436 | $sth_search->execute(); |
378 | 437 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
379 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
438 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
439 | + $values['ICAOTypeCode'] = $result['icao']; |
|
440 | + } |
|
380 | 441 | } catch(PDOException $e) { |
381 | 442 | return "error : ".$e->getMessage(); |
382 | 443 | } |
@@ -389,7 +450,9 @@ discard block |
||
389 | 450 | $sth_dest->execute($query_dest_values); |
390 | 451 | } |
391 | 452 | } |
392 | - if ($globalTransaction) $Connection->db->commit(); |
|
453 | + if ($globalTransaction) { |
|
454 | + $Connection->db->commit(); |
|
455 | + } |
|
393 | 456 | } catch(PDOException $e) { |
394 | 457 | return "error : ".$e->getMessage(); |
395 | 458 | } |
@@ -428,7 +491,9 @@ discard block |
||
428 | 491 | $sth_dest = $Connection->db->prepare($query_dest); |
429 | 492 | $sth_modes = $Connection->db->prepare($query_modes); |
430 | 493 | try { |
431 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
494 | + if ($globalTransaction) { |
|
495 | + $Connection->db->beginTransaction(); |
|
496 | + } |
|
432 | 497 | $tmp = fgetcsv($fh,9999,',','"'); |
433 | 498 | while (!feof($fh)) { |
434 | 499 | $line = fgetcsv($fh,9999,',','"'); |
@@ -438,16 +503,22 @@ discard block |
||
438 | 503 | $values['registration'] = $line[0]; |
439 | 504 | $values['base'] = $line[4]; |
440 | 505 | $values['owner'] = $line[5]; |
441 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
442 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
506 | + if ($line[6] == '') { |
|
507 | + $values['date_first_reg'] = null; |
|
508 | + } else { |
|
509 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
510 | + } |
|
443 | 511 | $values['cancel'] = $line[7]; |
444 | 512 | } elseif ($country == 'EI') { |
445 | 513 | // TODO : add modeS & reg to aircraft_modes |
446 | 514 | $values['registration'] = $line[0]; |
447 | 515 | $values['base'] = $line[3]; |
448 | 516 | $values['owner'] = $line[2]; |
449 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
517 | + if ($line[1] == '') { |
|
518 | + $values['date_first_reg'] = null; |
|
519 | + } else { |
|
520 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
521 | + } |
|
451 | 522 | $values['cancel'] = ''; |
452 | 523 | $values['modes'] = $line[7]; |
453 | 524 | $values['icao'] = $line[8]; |
@@ -466,16 +537,22 @@ discard block |
||
466 | 537 | $values['registration'] = $line[3]; |
467 | 538 | $values['base'] = null; |
468 | 539 | $values['owner'] = $line[5]; |
469 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
470 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
540 | + if ($line[18] == '') { |
|
541 | + $values['date_first_reg'] = null; |
|
542 | + } else { |
|
543 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
544 | + } |
|
471 | 545 | $values['cancel'] = ''; |
472 | 546 | } elseif ($country == 'VH') { |
473 | 547 | // TODO : add modeS & reg to aircraft_modes |
474 | 548 | $values['registration'] = $line[0]; |
475 | 549 | $values['base'] = null; |
476 | 550 | $values['owner'] = $line[12]; |
477 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
551 | + if ($line[28] == '') { |
|
552 | + $values['date_first_reg'] = null; |
|
553 | + } else { |
|
554 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
555 | + } |
|
479 | 556 | |
480 | 557 | $values['cancel'] = $line[39]; |
481 | 558 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -494,29 +571,41 @@ discard block |
||
494 | 571 | $values['registration'] = $line[0]; |
495 | 572 | $values['base'] = null; |
496 | 573 | $values['owner'] = $line[8]; |
497 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
498 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
574 | + if ($line[7] == '') { |
|
575 | + $values['date_first_reg'] = null; |
|
576 | + } else { |
|
577 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
578 | + } |
|
499 | 579 | $values['cancel'] = ''; |
500 | 580 | } elseif ($country == 'PP') { |
501 | 581 | $values['registration'] = $line[0]; |
502 | 582 | $values['base'] = null; |
503 | 583 | $values['owner'] = $line[4]; |
504 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
505 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
584 | + if ($line[6] == '') { |
|
585 | + $values['date_first_reg'] = null; |
|
586 | + } else { |
|
587 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
588 | + } |
|
506 | 589 | $values['cancel'] = $line[7]; |
507 | 590 | } elseif ($country == 'E7') { |
508 | 591 | $values['registration'] = $line[0]; |
509 | 592 | $values['base'] = null; |
510 | 593 | $values['owner'] = $line[4]; |
511 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
512 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
594 | + if ($line[5] == '') { |
|
595 | + $values['date_first_reg'] = null; |
|
596 | + } else { |
|
597 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
598 | + } |
|
513 | 599 | $values['cancel'] = ''; |
514 | 600 | } elseif ($country == '8Q') { |
515 | 601 | $values['registration'] = $line[0]; |
516 | 602 | $values['base'] = null; |
517 | 603 | $values['owner'] = $line[3]; |
518 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
519 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
604 | + if ($line[7] == '') { |
|
605 | + $values['date_first_reg'] = null; |
|
606 | + } else { |
|
607 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
608 | + } |
|
520 | 609 | $values['cancel'] = ''; |
521 | 610 | } elseif ($country == 'ZK') { |
522 | 611 | $values['registration'] = $line[0]; |
@@ -561,7 +650,9 @@ discard block |
||
561 | 650 | $sth_modes->execute($query_modes_values); |
562 | 651 | } |
563 | 652 | } |
564 | - if ($globalTransaction) $Connection->db->commit(); |
|
653 | + if ($globalTransaction) { |
|
654 | + $Connection->db->commit(); |
|
655 | + } |
|
565 | 656 | } catch(PDOException $e) { |
566 | 657 | return "error : ".$e->getMessage(); |
567 | 658 | } |
@@ -697,25 +788,45 @@ discard block |
||
697 | 788 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
698 | 789 | $Connection = new Connection(); |
699 | 790 | $sth_dest = $Connection->db->prepare($query_dest); |
700 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
791 | + if ($globalTransaction) { |
|
792 | + $Connection->db->beginTransaction(); |
|
793 | + } |
|
701 | 794 | |
702 | 795 | $i = 0; |
703 | 796 | while($row = sparql_fetch_array($result)) |
704 | 797 | { |
705 | 798 | if ($i >= 1) { |
706 | 799 | //print_r($row); |
707 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
708 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
709 | - if (!isset($row['type'])) $row['type'] = ''; |
|
710 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
800 | + if (!isset($row['iata'])) { |
|
801 | + $row['iata'] = ''; |
|
802 | + } |
|
803 | + if (!isset($row['icao'])) { |
|
804 | + $row['icao'] = ''; |
|
805 | + } |
|
806 | + if (!isset($row['type'])) { |
|
807 | + $row['type'] = ''; |
|
808 | + } |
|
809 | + if (!isset($row['altitude'])) { |
|
810 | + $row['altitude'] = ''; |
|
811 | + } |
|
711 | 812 | if (isset($row['city_bis'])) { |
712 | 813 | $row['city'] = $row['city_bis']; |
713 | 814 | } |
714 | - if (!isset($row['city'])) $row['city'] = ''; |
|
715 | - if (!isset($row['country'])) $row['country'] = ''; |
|
716 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
717 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
718 | - if (!isset($row['name'])) continue; |
|
815 | + if (!isset($row['city'])) { |
|
816 | + $row['city'] = ''; |
|
817 | + } |
|
818 | + if (!isset($row['country'])) { |
|
819 | + $row['country'] = ''; |
|
820 | + } |
|
821 | + if (!isset($row['homepage'])) { |
|
822 | + $row['homepage'] = ''; |
|
823 | + } |
|
824 | + if (!isset($row['wikipedia_page'])) { |
|
825 | + $row['wikipedia_page'] = ''; |
|
826 | + } |
|
827 | + if (!isset($row['name'])) { |
|
828 | + continue; |
|
829 | + } |
|
719 | 830 | if (!isset($row['image'])) { |
720 | 831 | $row['image'] = ''; |
721 | 832 | $row['image_thumb'] = ''; |
@@ -771,7 +882,9 @@ discard block |
||
771 | 882 | |
772 | 883 | $i++; |
773 | 884 | } |
774 | - if ($globalTransaction) $Connection->db->commit(); |
|
885 | + if ($globalTransaction) { |
|
886 | + $Connection->db->commit(); |
|
887 | + } |
|
775 | 888 | /* |
776 | 889 | echo "Delete duplicate rows...\n"; |
777 | 890 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
@@ -814,7 +927,9 @@ discard block |
||
814 | 927 | $delimiter = ','; |
815 | 928 | $out_file = $tmp_dir.'airports.csv'; |
816 | 929 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
817 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
930 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
931 | + return FALSE; |
|
932 | + } |
|
818 | 933 | echo "Add data from ourairports.com...\n"; |
819 | 934 | |
820 | 935 | $header = NULL; |
@@ -824,8 +939,9 @@ discard block |
||
824 | 939 | //$Connection->db->beginTransaction(); |
825 | 940 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
826 | 941 | { |
827 | - if(!$header) $header = $row; |
|
828 | - else { |
|
942 | + if(!$header) { |
|
943 | + $header = $row; |
|
944 | + } else { |
|
829 | 945 | $data = array(); |
830 | 946 | $data = array_combine($header, $row); |
831 | 947 | try { |
@@ -866,7 +982,9 @@ discard block |
||
866 | 982 | echo "Download data from another free database...\n"; |
867 | 983 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
868 | 984 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
869 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
985 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
986 | + return FALSE; |
|
987 | + } |
|
870 | 988 | update_db::unzip($out_file); |
871 | 989 | $header = NULL; |
872 | 990 | echo "Add data from another free database...\n"; |
@@ -877,8 +995,9 @@ discard block |
||
877 | 995 | //$Connection->db->beginTransaction(); |
878 | 996 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
879 | 997 | { |
880 | - if(!$header) $header = $row; |
|
881 | - else { |
|
998 | + if(!$header) { |
|
999 | + $header = $row; |
|
1000 | + } else { |
|
882 | 1001 | $data = $row; |
883 | 1002 | |
884 | 1003 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
@@ -1047,7 +1166,9 @@ discard block |
||
1047 | 1166 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
1048 | 1167 | { |
1049 | 1168 | $i = 0; |
1050 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1169 | + if ($globalTransaction) { |
|
1170 | + $Connection->db->beginTransaction(); |
|
1171 | + } |
|
1051 | 1172 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1052 | 1173 | { |
1053 | 1174 | if ($i > 0) { |
@@ -1060,7 +1181,9 @@ discard block |
||
1060 | 1181 | } |
1061 | 1182 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
1062 | 1183 | if (!empty($result_search)) { |
1063 | - if ($globalDebug) echo '.'; |
|
1184 | + if ($globalDebug) { |
|
1185 | + echo '.'; |
|
1186 | + } |
|
1064 | 1187 | //if ($globalDBdriver == 'mysql') { |
1065 | 1188 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
1066 | 1189 | //} else { |
@@ -1082,8 +1205,12 @@ discard block |
||
1082 | 1205 | } |
1083 | 1206 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
1084 | 1207 | if (!empty($result_search_mfr)) { |
1085 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
1086 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
1208 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
1209 | + $data[16] = $data[23]; |
|
1210 | + } |
|
1211 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
1212 | + $data[16] = $data[15]; |
|
1213 | + } |
|
1087 | 1214 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1088 | 1215 | try { |
1089 | 1216 | $sthf = $Connection->db->prepare($queryf); |
@@ -1094,7 +1221,9 @@ discard block |
||
1094 | 1221 | } |
1095 | 1222 | } |
1096 | 1223 | if (strtotime($data[29]) > time()) { |
1097 | - if ($globalDebug) echo 'i'; |
|
1224 | + if ($globalDebug) { |
|
1225 | + echo 'i'; |
|
1226 | + } |
|
1098 | 1227 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1099 | 1228 | try { |
1100 | 1229 | $sth = $Connection->db->prepare($query); |
@@ -1105,13 +1234,19 @@ discard block |
||
1105 | 1234 | } |
1106 | 1235 | } |
1107 | 1236 | if ($i % 90 == 0) { |
1108 | - if ($globalTransaction) $Connection->db->commit(); |
|
1109 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1237 | + if ($globalTransaction) { |
|
1238 | + $Connection->db->commit(); |
|
1239 | + } |
|
1240 | + if ($globalTransaction) { |
|
1241 | + $Connection->db->beginTransaction(); |
|
1242 | + } |
|
1110 | 1243 | } |
1111 | 1244 | $i++; |
1112 | 1245 | } |
1113 | 1246 | fclose($handle); |
1114 | - if ($globalTransaction) $Connection->db->commit(); |
|
1247 | + if ($globalTransaction) { |
|
1248 | + $Connection->db->commit(); |
|
1249 | + } |
|
1115 | 1250 | } |
1116 | 1251 | return ''; |
1117 | 1252 | } |
@@ -1131,11 +1266,15 @@ discard block |
||
1131 | 1266 | if (($handle = fopen($tmp_dir.'modes.tsv', 'r')) !== FALSE) |
1132 | 1267 | { |
1133 | 1268 | $i = 0; |
1134 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1269 | + if ($globalTransaction) { |
|
1270 | + $Connection->db->beginTransaction(); |
|
1271 | + } |
|
1135 | 1272 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1136 | 1273 | { |
1137 | 1274 | if ($i > 0) { |
1138 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
1275 | + if ($data[1] == 'NULL') { |
|
1276 | + $data[1] = $data[0]; |
|
1277 | + } |
|
1139 | 1278 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1140 | 1279 | try { |
1141 | 1280 | $sth = $Connection->db->prepare($query); |
@@ -1147,7 +1286,9 @@ discard block |
||
1147 | 1286 | $i++; |
1148 | 1287 | } |
1149 | 1288 | fclose($handle); |
1150 | - if ($globalTransaction) $Connection->db->commit(); |
|
1289 | + if ($globalTransaction) { |
|
1290 | + $Connection->db->commit(); |
|
1291 | + } |
|
1151 | 1292 | } |
1152 | 1293 | return ''; |
1153 | 1294 | } |
@@ -1179,11 +1320,15 @@ discard block |
||
1179 | 1320 | if (($handle = fopen($tmp_dir.'airlines.tsv', 'r')) !== FALSE) |
1180 | 1321 | { |
1181 | 1322 | $i = 0; |
1182 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1323 | + if ($globalTransaction) { |
|
1324 | + $Connection->db->beginTransaction(); |
|
1325 | + } |
|
1183 | 1326 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1184 | 1327 | { |
1185 | 1328 | if ($i > 0) { |
1186 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
1329 | + if ($data[1] == 'NULL') { |
|
1330 | + $data[1] = $data[0]; |
|
1331 | + } |
|
1187 | 1332 | $query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)'; |
1188 | 1333 | try { |
1189 | 1334 | $sth = $Connection->db->prepare($query); |
@@ -1195,7 +1340,9 @@ discard block |
||
1195 | 1340 | $i++; |
1196 | 1341 | } |
1197 | 1342 | fclose($handle); |
1198 | - if ($globalTransaction) $Connection->db->commit(); |
|
1343 | + if ($globalTransaction) { |
|
1344 | + $Connection->db->commit(); |
|
1345 | + } |
|
1199 | 1346 | } |
1200 | 1347 | /* |
1201 | 1348 | $query = "UNLOCK TABLES"; |
@@ -1225,7 +1372,9 @@ discard block |
||
1225 | 1372 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
1226 | 1373 | { |
1227 | 1374 | $i = 0; |
1228 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1375 | + if ($globalTransaction) { |
|
1376 | + $Connection->db->beginTransaction(); |
|
1377 | + } |
|
1229 | 1378 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1230 | 1379 | { |
1231 | 1380 | if ($i > 0) { |
@@ -1241,7 +1390,9 @@ discard block |
||
1241 | 1390 | $i++; |
1242 | 1391 | } |
1243 | 1392 | fclose($handle); |
1244 | - if ($globalTransaction) $Connection->db->commit(); |
|
1393 | + if ($globalTransaction) { |
|
1394 | + $Connection->db->commit(); |
|
1395 | + } |
|
1245 | 1396 | } |
1246 | 1397 | return ''; |
1247 | 1398 | } |
@@ -1261,7 +1412,9 @@ discard block |
||
1261 | 1412 | if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE) |
1262 | 1413 | { |
1263 | 1414 | $i = 0; |
1264 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1415 | + if ($globalTransaction) { |
|
1416 | + $Connection->db->beginTransaction(); |
|
1417 | + } |
|
1265 | 1418 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1266 | 1419 | { |
1267 | 1420 | if ($i > 0) { |
@@ -1271,19 +1424,25 @@ discard block |
||
1271 | 1424 | $sth = $Connection->db->prepare($query); |
1272 | 1425 | $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')); |
1273 | 1426 | } catch(PDOException $e) { |
1274 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1427 | + if ($globalDebug) { |
|
1428 | + echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1429 | + } |
|
1275 | 1430 | die(); |
1276 | 1431 | } |
1277 | 1432 | } |
1278 | 1433 | if ($globalTransaction && $i % 2000 == 0) { |
1279 | 1434 | $Connection->db->commit(); |
1280 | - if ($globalDebug) echo '.'; |
|
1435 | + if ($globalDebug) { |
|
1436 | + echo '.'; |
|
1437 | + } |
|
1281 | 1438 | $Connection->db->beginTransaction(); |
1282 | 1439 | } |
1283 | 1440 | $i++; |
1284 | 1441 | } |
1285 | 1442 | fclose($handle); |
1286 | - if ($globalTransaction) $Connection->db->commit(); |
|
1443 | + if ($globalTransaction) { |
|
1444 | + $Connection->db->commit(); |
|
1445 | + } |
|
1287 | 1446 | } |
1288 | 1447 | return ''; |
1289 | 1448 | } |
@@ -1308,7 +1467,9 @@ discard block |
||
1308 | 1467 | $i = 0; |
1309 | 1468 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1310 | 1469 | //$Connection->db->beginTransaction(); |
1311 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1470 | + if ($globalTransaction) { |
|
1471 | + $Connection->db->beginTransaction(); |
|
1472 | + } |
|
1312 | 1473 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1313 | 1474 | { |
1314 | 1475 | if ($i > 0) { |
@@ -1324,7 +1485,9 @@ discard block |
||
1324 | 1485 | $i++; |
1325 | 1486 | } |
1326 | 1487 | fclose($handle); |
1327 | - if ($globalTransaction) $Connection->db->commit(); |
|
1488 | + if ($globalTransaction) { |
|
1489 | + $Connection->db->commit(); |
|
1490 | + } |
|
1328 | 1491 | } |
1329 | 1492 | return ''; |
1330 | 1493 | } |
@@ -1344,7 +1507,9 @@ discard block |
||
1344 | 1507 | if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE) |
1345 | 1508 | { |
1346 | 1509 | $i = 0; |
1347 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1510 | + if ($globalTransaction) { |
|
1511 | + $Connection->db->beginTransaction(); |
|
1512 | + } |
|
1348 | 1513 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1349 | 1514 | { |
1350 | 1515 | if ($i > 0) { |
@@ -1361,7 +1526,9 @@ discard block |
||
1361 | 1526 | $i++; |
1362 | 1527 | } |
1363 | 1528 | fclose($handle); |
1364 | - if ($globalTransaction) $Connection->db->commit(); |
|
1529 | + if ($globalTransaction) { |
|
1530 | + $Connection->db->commit(); |
|
1531 | + } |
|
1365 | 1532 | } |
1366 | 1533 | return ''; |
1367 | 1534 | } |
@@ -1380,7 +1547,9 @@ discard block |
||
1380 | 1547 | $Connection = new Connection(); |
1381 | 1548 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
1382 | 1549 | { |
1383 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1550 | + if ($globalTransaction) { |
|
1551 | + $Connection->db->beginTransaction(); |
|
1552 | + } |
|
1384 | 1553 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
1385 | 1554 | { |
1386 | 1555 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1395,7 +1564,9 @@ discard block |
||
1395 | 1564 | } |
1396 | 1565 | } |
1397 | 1566 | fclose($handle); |
1398 | - if ($globalTransaction) $Connection->db->commit(); |
|
1567 | + if ($globalTransaction) { |
|
1568 | + $Connection->db->commit(); |
|
1569 | + } |
|
1399 | 1570 | } |
1400 | 1571 | return ''; |
1401 | 1572 | } |
@@ -1471,9 +1642,14 @@ discard block |
||
1471 | 1642 | if ($i > 0 && $data[0] != '') { |
1472 | 1643 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1473 | 1644 | $period = str_replace(',','',$data[14]); |
1474 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1475 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1476 | - else $launch_date = NULL; |
|
1645 | + if (!empty($period) && strpos($period,'days')) { |
|
1646 | + $period = str_replace(' days','',$period)*24*60; |
|
1647 | + } |
|
1648 | + if ($data[18] != '') { |
|
1649 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1650 | + } else { |
|
1651 | + $launch_date = NULL; |
|
1652 | + } |
|
1477 | 1653 | $data = array_map(function($value) { |
1478 | 1654 | return trim($value) === '' ? null : $value; |
1479 | 1655 | }, $data); |
@@ -1836,7 +2012,9 @@ discard block |
||
1836 | 2012 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1837 | 2013 | { |
1838 | 2014 | $i = 0; |
1839 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
2015 | + if ($globalTransaction) { |
|
2016 | + $Connection->db->beginTransaction(); |
|
2017 | + } |
|
1840 | 2018 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1841 | 2019 | { |
1842 | 2020 | $i++; |
@@ -1864,7 +2042,9 @@ discard block |
||
1864 | 2042 | } |
1865 | 2043 | } |
1866 | 2044 | fclose($handle); |
1867 | - if ($globalTransaction) $Connection->db->commit(); |
|
2045 | + if ($globalTransaction) { |
|
2046 | + $Connection->db->commit(); |
|
2047 | + } |
|
1868 | 2048 | } |
1869 | 2049 | return ''; |
1870 | 2050 | } |
@@ -1907,7 +2087,9 @@ discard block |
||
1907 | 2087 | $Connection = new Connection(); |
1908 | 2088 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1909 | 2089 | { |
1910 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
2090 | + if ($globalTransaction) { |
|
2091 | + $Connection->db->beginTransaction(); |
|
2092 | + } |
|
1911 | 2093 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1912 | 2094 | { |
1913 | 2095 | if(count($row) > 1) { |
@@ -1921,7 +2103,9 @@ discard block |
||
1921 | 2103 | } |
1922 | 2104 | } |
1923 | 2105 | fclose($handle); |
1924 | - if ($globalTransaction) $Connection->db->commit(); |
|
2106 | + if ($globalTransaction) { |
|
2107 | + $Connection->db->commit(); |
|
2108 | + } |
|
1925 | 2109 | } |
1926 | 2110 | return ''; |
1927 | 2111 | } |
@@ -1941,8 +2125,9 @@ discard block |
||
1941 | 2125 | } |
1942 | 2126 | |
1943 | 2127 | |
1944 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1945 | - else { |
|
2128 | + if ($globalDBdriver == 'mysql') { |
|
2129 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
2130 | + } else { |
|
1946 | 2131 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
1947 | 2132 | $query = "CREATE EXTENSION postgis"; |
1948 | 2133 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -1961,7 +2146,9 @@ discard block |
||
1961 | 2146 | global $tmp_dir, $globalDebug; |
1962 | 2147 | include_once('class.create_db.php'); |
1963 | 2148 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1964 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
2149 | + if ($globalDebug) { |
|
2150 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
2151 | + } |
|
1965 | 2152 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
1966 | 2153 | $error = ''; |
1967 | 2154 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
@@ -1971,20 +2158,34 @@ discard block |
||
1971 | 2158 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
1972 | 2159 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1973 | 2160 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
1974 | - if ($globalDebug) echo "Gunzip..."; |
|
2161 | + if ($globalDebug) { |
|
2162 | + echo "Gunzip..."; |
|
2163 | + } |
|
1975 | 2164 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
1976 | - if ($globalDebug) echo "Add to DB..."; |
|
2165 | + if ($globalDebug) { |
|
2166 | + echo "Add to DB..."; |
|
2167 | + } |
|
1977 | 2168 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
1978 | 2169 | $NOTAM = new NOTAM(); |
1979 | 2170 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
1980 | 2171 | update_db::insert_notam_version($notam_md5); |
1981 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
1982 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
1983 | - } elseif ($globalDebug) echo "No new version."; |
|
1984 | - } else $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
2172 | + } else { |
|
2173 | + $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
2174 | + } |
|
2175 | + } else { |
|
2176 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2177 | + } |
|
2178 | + } elseif ($globalDebug) { |
|
2179 | + echo "No new version."; |
|
2180 | + } |
|
2181 | + } else { |
|
2182 | + $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
2183 | + } |
|
1985 | 2184 | if ($error != '') { |
1986 | 2185 | return $error; |
1987 | - } elseif ($globalDebug) echo "Done\n"; |
|
2186 | + } elseif ($globalDebug) { |
|
2187 | + echo "Done\n"; |
|
2188 | + } |
|
1988 | 2189 | return ''; |
1989 | 2190 | } |
1990 | 2191 | |
@@ -2039,68 +2240,114 @@ discard block |
||
2039 | 2240 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
2040 | 2241 | if (extension_loaded('zip')) { |
2041 | 2242 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
2042 | - if ($globalDebug) echo "Unzip..."; |
|
2243 | + if ($globalDebug) { |
|
2244 | + echo "Unzip..."; |
|
2245 | + } |
|
2043 | 2246 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
2044 | - if ($globalDebug) echo "Add to DB..."; |
|
2247 | + if ($globalDebug) { |
|
2248 | + echo "Add to DB..."; |
|
2249 | + } |
|
2045 | 2250 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
2046 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
2251 | + if ($globalDebug) { |
|
2252 | + echo "Copy airlines logos to airlines images directory..."; |
|
2253 | + } |
|
2047 | 2254 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
2048 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2049 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
2050 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2051 | - } else $error = "ZIP module not loaded but required for IVAO."; |
|
2255 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
2256 | + $error = "Failed to copy airlines logo."; |
|
2257 | + } |
|
2258 | + } else { |
|
2259 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
2260 | + } |
|
2261 | + } else { |
|
2262 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2263 | + } |
|
2264 | + } else { |
|
2265 | + $error = "ZIP module not loaded but required for IVAO."; |
|
2266 | + } |
|
2052 | 2267 | if ($error != '') { |
2053 | 2268 | return $error; |
2054 | - } elseif ($globalDebug) echo "Done\n"; |
|
2269 | + } elseif ($globalDebug) { |
|
2270 | + echo "Done\n"; |
|
2271 | + } |
|
2055 | 2272 | return ''; |
2056 | 2273 | } |
2057 | 2274 | |
2058 | 2275 | public static function update_routes() { |
2059 | 2276 | global $tmp_dir, $globalDebug; |
2060 | 2277 | $error = ''; |
2061 | - if ($globalDebug) echo "Routes : Download..."; |
|
2278 | + if ($globalDebug) { |
|
2279 | + echo "Routes : Download..."; |
|
2280 | + } |
|
2062 | 2281 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
2063 | 2282 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
2064 | - if ($globalDebug) echo "Gunzip..."; |
|
2283 | + if ($globalDebug) { |
|
2284 | + echo "Gunzip..."; |
|
2285 | + } |
|
2065 | 2286 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
2066 | - if ($globalDebug) echo "Add to DB..."; |
|
2287 | + if ($globalDebug) { |
|
2288 | + echo "Add to DB..."; |
|
2289 | + } |
|
2067 | 2290 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
2068 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2291 | + } else { |
|
2292 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2293 | + } |
|
2069 | 2294 | if ($error != '') { |
2070 | 2295 | return $error; |
2071 | - } elseif ($globalDebug) echo "Done\n"; |
|
2296 | + } elseif ($globalDebug) { |
|
2297 | + echo "Done\n"; |
|
2298 | + } |
|
2072 | 2299 | return ''; |
2073 | 2300 | } |
2074 | 2301 | public static function update_oneworld() { |
2075 | 2302 | global $tmp_dir, $globalDebug; |
2076 | 2303 | $error = ''; |
2077 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
2304 | + if ($globalDebug) { |
|
2305 | + echo "Schedules Oneworld : Download..."; |
|
2306 | + } |
|
2078 | 2307 | update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
2079 | 2308 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
2080 | - if ($globalDebug) echo "Gunzip..."; |
|
2309 | + if ($globalDebug) { |
|
2310 | + echo "Gunzip..."; |
|
2311 | + } |
|
2081 | 2312 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
2082 | - if ($globalDebug) echo "Add to DB..."; |
|
2313 | + if ($globalDebug) { |
|
2314 | + echo "Add to DB..."; |
|
2315 | + } |
|
2083 | 2316 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
2084 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2317 | + } else { |
|
2318 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2319 | + } |
|
2085 | 2320 | if ($error != '') { |
2086 | 2321 | return $error; |
2087 | - } elseif ($globalDebug) echo "Done\n"; |
|
2322 | + } elseif ($globalDebug) { |
|
2323 | + echo "Done\n"; |
|
2324 | + } |
|
2088 | 2325 | return ''; |
2089 | 2326 | } |
2090 | 2327 | public static function update_skyteam() { |
2091 | 2328 | global $tmp_dir, $globalDebug; |
2092 | 2329 | $error = ''; |
2093 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
2330 | + if ($globalDebug) { |
|
2331 | + echo "Schedules Skyteam : Download..."; |
|
2332 | + } |
|
2094 | 2333 | update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
2095 | 2334 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
2096 | - if ($globalDebug) echo "Gunzip..."; |
|
2335 | + if ($globalDebug) { |
|
2336 | + echo "Gunzip..."; |
|
2337 | + } |
|
2097 | 2338 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
2098 | - if ($globalDebug) echo "Add to DB..."; |
|
2339 | + if ($globalDebug) { |
|
2340 | + echo "Add to DB..."; |
|
2341 | + } |
|
2099 | 2342 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
2100 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2343 | + } else { |
|
2344 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2345 | + } |
|
2101 | 2346 | if ($error != '') { |
2102 | 2347 | return $error; |
2103 | - } elseif ($globalDebug) echo "Done\n"; |
|
2348 | + } elseif ($globalDebug) { |
|
2349 | + echo "Done\n"; |
|
2350 | + } |
|
2104 | 2351 | return ''; |
2105 | 2352 | } |
2106 | 2353 | public static function update_ModeS() { |
@@ -2117,340 +2364,590 @@ discard block |
||
2117 | 2364 | exit; |
2118 | 2365 | } elseif ($globalDebug) echo "Done\n"; |
2119 | 2366 | */ |
2120 | - if ($globalDebug) echo "Modes : Download..."; |
|
2121 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2367 | + if ($globalDebug) { |
|
2368 | + echo "Modes : Download..."; |
|
2369 | + } |
|
2370 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2122 | 2371 | update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
2123 | 2372 | |
2124 | 2373 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2125 | 2374 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
2126 | - if ($globalDebug) echo "Unzip..."; |
|
2127 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2375 | + if ($globalDebug) { |
|
2376 | + echo "Unzip..."; |
|
2377 | + } |
|
2378 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2128 | 2379 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
2129 | - if ($globalDebug) echo "Add to DB..."; |
|
2380 | + if ($globalDebug) { |
|
2381 | + echo "Add to DB..."; |
|
2382 | + } |
|
2130 | 2383 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
2131 | 2384 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
2132 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2385 | + } else { |
|
2386 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2387 | + } |
|
2133 | 2388 | if ($error != '') { |
2134 | 2389 | return $error; |
2135 | - } elseif ($globalDebug) echo "Done\n"; |
|
2390 | + } elseif ($globalDebug) { |
|
2391 | + echo "Done\n"; |
|
2392 | + } |
|
2136 | 2393 | return ''; |
2137 | 2394 | } |
2138 | 2395 | |
2139 | 2396 | public static function update_ModeS_faa() { |
2140 | 2397 | global $tmp_dir, $globalDebug; |
2141 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
2398 | + if ($globalDebug) { |
|
2399 | + echo "Modes FAA: Download..."; |
|
2400 | + } |
|
2142 | 2401 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
2143 | 2402 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2144 | - if ($globalDebug) echo "Unzip..."; |
|
2403 | + if ($globalDebug) { |
|
2404 | + echo "Unzip..."; |
|
2405 | + } |
|
2145 | 2406 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
2146 | - if ($globalDebug) echo "Add to DB..."; |
|
2407 | + if ($globalDebug) { |
|
2408 | + echo "Add to DB..."; |
|
2409 | + } |
|
2147 | 2410 | $error = update_db::modes_faa(); |
2148 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2411 | + } else { |
|
2412 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2413 | + } |
|
2149 | 2414 | if ($error != '') { |
2150 | 2415 | return $error; |
2151 | - } elseif ($globalDebug) echo "Done\n"; |
|
2416 | + } elseif ($globalDebug) { |
|
2417 | + echo "Done\n"; |
|
2418 | + } |
|
2152 | 2419 | return ''; |
2153 | 2420 | } |
2154 | 2421 | |
2155 | 2422 | public static function update_ModeS_flarm() { |
2156 | 2423 | global $tmp_dir, $globalDebug; |
2157 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
2424 | + if ($globalDebug) { |
|
2425 | + echo "Modes Flarmnet: Download..."; |
|
2426 | + } |
|
2158 | 2427 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
2159 | 2428 | if (file_exists($tmp_dir.'data.fln')) { |
2160 | - if ($globalDebug) echo "Add to DB..."; |
|
2429 | + if ($globalDebug) { |
|
2430 | + echo "Add to DB..."; |
|
2431 | + } |
|
2161 | 2432 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
2162 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2433 | + } else { |
|
2434 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2435 | + } |
|
2163 | 2436 | if ($error != '') { |
2164 | 2437 | return $error; |
2165 | - } elseif ($globalDebug) echo "Done\n"; |
|
2438 | + } elseif ($globalDebug) { |
|
2439 | + echo "Done\n"; |
|
2440 | + } |
|
2166 | 2441 | return ''; |
2167 | 2442 | } |
2168 | 2443 | |
2169 | 2444 | public static function update_ModeS_ogn() { |
2170 | 2445 | global $tmp_dir, $globalDebug; |
2171 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
2446 | + if ($globalDebug) { |
|
2447 | + echo "Modes OGN: Download..."; |
|
2448 | + } |
|
2172 | 2449 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
2173 | 2450 | if (file_exists($tmp_dir.'ogn.csv')) { |
2174 | - if ($globalDebug) echo "Add to DB..."; |
|
2451 | + if ($globalDebug) { |
|
2452 | + echo "Add to DB..."; |
|
2453 | + } |
|
2175 | 2454 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
2176 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2455 | + } else { |
|
2456 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2457 | + } |
|
2177 | 2458 | if ($error != '') { |
2178 | 2459 | return $error; |
2179 | - } elseif ($globalDebug) echo "Done\n"; |
|
2460 | + } elseif ($globalDebug) { |
|
2461 | + echo "Done\n"; |
|
2462 | + } |
|
2180 | 2463 | return ''; |
2181 | 2464 | } |
2182 | 2465 | |
2183 | 2466 | public static function update_owner() { |
2184 | 2467 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2185 | 2468 | |
2186 | - if ($globalDebug) echo "Owner France: Download..."; |
|
2469 | + if ($globalDebug) { |
|
2470 | + echo "Owner France: Download..."; |
|
2471 | + } |
|
2187 | 2472 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
2188 | 2473 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2189 | - if ($globalDebug) echo "Add to DB..."; |
|
2474 | + if ($globalDebug) { |
|
2475 | + echo "Add to DB..."; |
|
2476 | + } |
|
2190 | 2477 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
2191 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2478 | + } else { |
|
2479 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2480 | + } |
|
2192 | 2481 | if ($error != '') { |
2193 | 2482 | return $error; |
2194 | - } elseif ($globalDebug) echo "Done\n"; |
|
2483 | + } elseif ($globalDebug) { |
|
2484 | + echo "Done\n"; |
|
2485 | + } |
|
2195 | 2486 | |
2196 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
2487 | + if ($globalDebug) { |
|
2488 | + echo "Owner Ireland: Download..."; |
|
2489 | + } |
|
2197 | 2490 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
2198 | 2491 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2199 | - if ($globalDebug) echo "Add to DB..."; |
|
2492 | + if ($globalDebug) { |
|
2493 | + echo "Add to DB..."; |
|
2494 | + } |
|
2200 | 2495 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
2201 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2496 | + } else { |
|
2497 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2498 | + } |
|
2202 | 2499 | if ($error != '') { |
2203 | 2500 | return $error; |
2204 | - } elseif ($globalDebug) echo "Done\n"; |
|
2205 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
2501 | + } elseif ($globalDebug) { |
|
2502 | + echo "Done\n"; |
|
2503 | + } |
|
2504 | + if ($globalDebug) { |
|
2505 | + echo "Owner Switzerland: Download..."; |
|
2506 | + } |
|
2206 | 2507 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
2207 | 2508 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2208 | - if ($globalDebug) echo "Add to DB..."; |
|
2509 | + if ($globalDebug) { |
|
2510 | + echo "Add to DB..."; |
|
2511 | + } |
|
2209 | 2512 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
2210 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2513 | + } else { |
|
2514 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2515 | + } |
|
2211 | 2516 | if ($error != '') { |
2212 | 2517 | return $error; |
2213 | - } elseif ($globalDebug) echo "Done\n"; |
|
2214 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
2518 | + } elseif ($globalDebug) { |
|
2519 | + echo "Done\n"; |
|
2520 | + } |
|
2521 | + if ($globalDebug) { |
|
2522 | + echo "Owner Czech Republic: Download..."; |
|
2523 | + } |
|
2215 | 2524 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
2216 | 2525 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2217 | - if ($globalDebug) echo "Add to DB..."; |
|
2526 | + if ($globalDebug) { |
|
2527 | + echo "Add to DB..."; |
|
2528 | + } |
|
2218 | 2529 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
2219 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2530 | + } else { |
|
2531 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2532 | + } |
|
2220 | 2533 | if ($error != '') { |
2221 | 2534 | return $error; |
2222 | - } elseif ($globalDebug) echo "Done\n"; |
|
2223 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
2535 | + } elseif ($globalDebug) { |
|
2536 | + echo "Done\n"; |
|
2537 | + } |
|
2538 | + if ($globalDebug) { |
|
2539 | + echo "Owner Australia: Download..."; |
|
2540 | + } |
|
2224 | 2541 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
2225 | 2542 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2226 | - if ($globalDebug) echo "Add to DB..."; |
|
2543 | + if ($globalDebug) { |
|
2544 | + echo "Add to DB..."; |
|
2545 | + } |
|
2227 | 2546 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
2228 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2547 | + } else { |
|
2548 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2549 | + } |
|
2229 | 2550 | if ($error != '') { |
2230 | 2551 | return $error; |
2231 | - } elseif ($globalDebug) echo "Done\n"; |
|
2232 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
2552 | + } elseif ($globalDebug) { |
|
2553 | + echo "Done\n"; |
|
2554 | + } |
|
2555 | + if ($globalDebug) { |
|
2556 | + echo "Owner Austria: Download..."; |
|
2557 | + } |
|
2233 | 2558 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
2234 | 2559 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2235 | - if ($globalDebug) echo "Add to DB..."; |
|
2560 | + if ($globalDebug) { |
|
2561 | + echo "Add to DB..."; |
|
2562 | + } |
|
2236 | 2563 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
2237 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2564 | + } else { |
|
2565 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2566 | + } |
|
2238 | 2567 | if ($error != '') { |
2239 | 2568 | return $error; |
2240 | - } elseif ($globalDebug) echo "Done\n"; |
|
2241 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
2569 | + } elseif ($globalDebug) { |
|
2570 | + echo "Done\n"; |
|
2571 | + } |
|
2572 | + if ($globalDebug) { |
|
2573 | + echo "Owner Chile: Download..."; |
|
2574 | + } |
|
2242 | 2575 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
2243 | 2576 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2244 | - if ($globalDebug) echo "Add to DB..."; |
|
2577 | + if ($globalDebug) { |
|
2578 | + echo "Add to DB..."; |
|
2579 | + } |
|
2245 | 2580 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
2246 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2581 | + } else { |
|
2582 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2583 | + } |
|
2247 | 2584 | if ($error != '') { |
2248 | 2585 | return $error; |
2249 | - } elseif ($globalDebug) echo "Done\n"; |
|
2250 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
2586 | + } elseif ($globalDebug) { |
|
2587 | + echo "Done\n"; |
|
2588 | + } |
|
2589 | + if ($globalDebug) { |
|
2590 | + echo "Owner Colombia: Download..."; |
|
2591 | + } |
|
2251 | 2592 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
2252 | 2593 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2253 | - if ($globalDebug) echo "Add to DB..."; |
|
2594 | + if ($globalDebug) { |
|
2595 | + echo "Add to DB..."; |
|
2596 | + } |
|
2254 | 2597 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
2255 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2598 | + } else { |
|
2599 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2600 | + } |
|
2256 | 2601 | if ($error != '') { |
2257 | 2602 | return $error; |
2258 | - } elseif ($globalDebug) echo "Done\n"; |
|
2259 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
2603 | + } elseif ($globalDebug) { |
|
2604 | + echo "Done\n"; |
|
2605 | + } |
|
2606 | + if ($globalDebug) { |
|
2607 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
2608 | + } |
|
2260 | 2609 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
2261 | 2610 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2262 | - if ($globalDebug) echo "Add to DB..."; |
|
2611 | + if ($globalDebug) { |
|
2612 | + echo "Add to DB..."; |
|
2613 | + } |
|
2263 | 2614 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
2264 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2615 | + } else { |
|
2616 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2617 | + } |
|
2265 | 2618 | if ($error != '') { |
2266 | 2619 | return $error; |
2267 | - } elseif ($globalDebug) echo "Done\n"; |
|
2268 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
2620 | + } elseif ($globalDebug) { |
|
2621 | + echo "Done\n"; |
|
2622 | + } |
|
2623 | + if ($globalDebug) { |
|
2624 | + echo "Owner Brazil: Download..."; |
|
2625 | + } |
|
2269 | 2626 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
2270 | 2627 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2271 | - if ($globalDebug) echo "Add to DB..."; |
|
2628 | + if ($globalDebug) { |
|
2629 | + echo "Add to DB..."; |
|
2630 | + } |
|
2272 | 2631 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
2273 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2632 | + } else { |
|
2633 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2634 | + } |
|
2274 | 2635 | if ($error != '') { |
2275 | 2636 | return $error; |
2276 | - } elseif ($globalDebug) echo "Done\n"; |
|
2277 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
2637 | + } elseif ($globalDebug) { |
|
2638 | + echo "Done\n"; |
|
2639 | + } |
|
2640 | + if ($globalDebug) { |
|
2641 | + echo "Owner Cayman Islands: Download..."; |
|
2642 | + } |
|
2278 | 2643 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
2279 | 2644 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2280 | - if ($globalDebug) echo "Add to DB..."; |
|
2645 | + if ($globalDebug) { |
|
2646 | + echo "Add to DB..."; |
|
2647 | + } |
|
2281 | 2648 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
2282 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2649 | + } else { |
|
2650 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2651 | + } |
|
2283 | 2652 | if ($error != '') { |
2284 | 2653 | return $error; |
2285 | - } elseif ($globalDebug) echo "Done\n"; |
|
2286 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
2654 | + } elseif ($globalDebug) { |
|
2655 | + echo "Done\n"; |
|
2656 | + } |
|
2657 | + if ($globalDebug) { |
|
2658 | + echo "Owner Croatia: Download..."; |
|
2659 | + } |
|
2287 | 2660 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
2288 | 2661 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2289 | - if ($globalDebug) echo "Add to DB..."; |
|
2662 | + if ($globalDebug) { |
|
2663 | + echo "Add to DB..."; |
|
2664 | + } |
|
2290 | 2665 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
2291 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2666 | + } else { |
|
2667 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2668 | + } |
|
2292 | 2669 | if ($error != '') { |
2293 | 2670 | return $error; |
2294 | - } elseif ($globalDebug) echo "Done\n"; |
|
2295 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
2671 | + } elseif ($globalDebug) { |
|
2672 | + echo "Done\n"; |
|
2673 | + } |
|
2674 | + if ($globalDebug) { |
|
2675 | + echo "Owner Luxembourg: Download..."; |
|
2676 | + } |
|
2296 | 2677 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
2297 | 2678 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2298 | - if ($globalDebug) echo "Add to DB..."; |
|
2679 | + if ($globalDebug) { |
|
2680 | + echo "Add to DB..."; |
|
2681 | + } |
|
2299 | 2682 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
2300 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2683 | + } else { |
|
2684 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2685 | + } |
|
2301 | 2686 | if ($error != '') { |
2302 | 2687 | return $error; |
2303 | - } elseif ($globalDebug) echo "Done\n"; |
|
2304 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
2688 | + } elseif ($globalDebug) { |
|
2689 | + echo "Done\n"; |
|
2690 | + } |
|
2691 | + if ($globalDebug) { |
|
2692 | + echo "Owner Maldives: Download..."; |
|
2693 | + } |
|
2305 | 2694 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
2306 | 2695 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2307 | - if ($globalDebug) echo "Add to DB..."; |
|
2696 | + if ($globalDebug) { |
|
2697 | + echo "Add to DB..."; |
|
2698 | + } |
|
2308 | 2699 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
2309 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2700 | + } else { |
|
2701 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2702 | + } |
|
2310 | 2703 | if ($error != '') { |
2311 | 2704 | return $error; |
2312 | - } elseif ($globalDebug) echo "Done\n"; |
|
2313 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
2705 | + } elseif ($globalDebug) { |
|
2706 | + echo "Done\n"; |
|
2707 | + } |
|
2708 | + if ($globalDebug) { |
|
2709 | + echo "Owner New Zealand: Download..."; |
|
2710 | + } |
|
2314 | 2711 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
2315 | 2712 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2316 | - if ($globalDebug) echo "Add to DB..."; |
|
2713 | + if ($globalDebug) { |
|
2714 | + echo "Add to DB..."; |
|
2715 | + } |
|
2317 | 2716 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
2318 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2717 | + } else { |
|
2718 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2719 | + } |
|
2319 | 2720 | if ($error != '') { |
2320 | 2721 | return $error; |
2321 | - } elseif ($globalDebug) echo "Done\n"; |
|
2322 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
2722 | + } elseif ($globalDebug) { |
|
2723 | + echo "Done\n"; |
|
2724 | + } |
|
2725 | + if ($globalDebug) { |
|
2726 | + echo "Owner Papua New Guinea: Download..."; |
|
2727 | + } |
|
2323 | 2728 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
2324 | 2729 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2325 | - if ($globalDebug) echo "Add to DB..."; |
|
2730 | + if ($globalDebug) { |
|
2731 | + echo "Add to DB..."; |
|
2732 | + } |
|
2326 | 2733 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
2327 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2734 | + } else { |
|
2735 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2736 | + } |
|
2328 | 2737 | if ($error != '') { |
2329 | 2738 | return $error; |
2330 | - } elseif ($globalDebug) echo "Done\n"; |
|
2331 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
2739 | + } elseif ($globalDebug) { |
|
2740 | + echo "Done\n"; |
|
2741 | + } |
|
2742 | + if ($globalDebug) { |
|
2743 | + echo "Owner Slovakia: Download..."; |
|
2744 | + } |
|
2332 | 2745 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
2333 | 2746 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2334 | - if ($globalDebug) echo "Add to DB..."; |
|
2747 | + if ($globalDebug) { |
|
2748 | + echo "Add to DB..."; |
|
2749 | + } |
|
2335 | 2750 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
2336 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2751 | + } else { |
|
2752 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2753 | + } |
|
2337 | 2754 | if ($error != '') { |
2338 | 2755 | return $error; |
2339 | - } elseif ($globalDebug) echo "Done\n"; |
|
2340 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
2756 | + } elseif ($globalDebug) { |
|
2757 | + echo "Done\n"; |
|
2758 | + } |
|
2759 | + if ($globalDebug) { |
|
2760 | + echo "Owner Ecuador: Download..."; |
|
2761 | + } |
|
2341 | 2762 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
2342 | 2763 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2343 | - if ($globalDebug) echo "Add to DB..."; |
|
2764 | + if ($globalDebug) { |
|
2765 | + echo "Add to DB..."; |
|
2766 | + } |
|
2344 | 2767 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
2345 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2768 | + } else { |
|
2769 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2770 | + } |
|
2346 | 2771 | if ($error != '') { |
2347 | 2772 | return $error; |
2348 | - } elseif ($globalDebug) echo "Done\n"; |
|
2349 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
2773 | + } elseif ($globalDebug) { |
|
2774 | + echo "Done\n"; |
|
2775 | + } |
|
2776 | + if ($globalDebug) { |
|
2777 | + echo "Owner Iceland: Download..."; |
|
2778 | + } |
|
2350 | 2779 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
2351 | 2780 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2352 | - if ($globalDebug) echo "Add to DB..."; |
|
2781 | + if ($globalDebug) { |
|
2782 | + echo "Add to DB..."; |
|
2783 | + } |
|
2353 | 2784 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
2354 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2785 | + } else { |
|
2786 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2787 | + } |
|
2355 | 2788 | if ($error != '') { |
2356 | 2789 | return $error; |
2357 | - } elseif ($globalDebug) echo "Done\n"; |
|
2358 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
2790 | + } elseif ($globalDebug) { |
|
2791 | + echo "Done\n"; |
|
2792 | + } |
|
2793 | + if ($globalDebug) { |
|
2794 | + echo "Owner Isle of Man: Download..."; |
|
2795 | + } |
|
2359 | 2796 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
2360 | 2797 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2361 | - if ($globalDebug) echo "Add to DB..."; |
|
2798 | + if ($globalDebug) { |
|
2799 | + echo "Add to DB..."; |
|
2800 | + } |
|
2362 | 2801 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
2363 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2802 | + } else { |
|
2803 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2804 | + } |
|
2364 | 2805 | if ($error != '') { |
2365 | 2806 | return $error; |
2366 | - } elseif ($globalDebug) echo "Done\n"; |
|
2807 | + } elseif ($globalDebug) { |
|
2808 | + echo "Done\n"; |
|
2809 | + } |
|
2367 | 2810 | if ($globalMasterSource) { |
2368 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
2811 | + if ($globalDebug) { |
|
2812 | + echo "ModeS Netherlands: Download..."; |
|
2813 | + } |
|
2369 | 2814 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
2370 | 2815 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2371 | - if ($globalDebug) echo "Add to DB..."; |
|
2816 | + if ($globalDebug) { |
|
2817 | + echo "Add to DB..."; |
|
2818 | + } |
|
2372 | 2819 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
2373 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2820 | + } else { |
|
2821 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2822 | + } |
|
2374 | 2823 | if ($error != '') { |
2375 | 2824 | return $error; |
2376 | - } elseif ($globalDebug) echo "Done\n"; |
|
2377 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
2825 | + } elseif ($globalDebug) { |
|
2826 | + echo "Done\n"; |
|
2827 | + } |
|
2828 | + if ($globalDebug) { |
|
2829 | + echo "ModeS Denmark: Download..."; |
|
2830 | + } |
|
2378 | 2831 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
2379 | 2832 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2380 | - if ($globalDebug) echo "Add to DB..."; |
|
2833 | + if ($globalDebug) { |
|
2834 | + echo "Add to DB..."; |
|
2835 | + } |
|
2381 | 2836 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
2382 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2837 | + } else { |
|
2838 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2839 | + } |
|
2383 | 2840 | if ($error != '') { |
2384 | 2841 | return $error; |
2385 | - } elseif ($globalDebug) echo "Done\n"; |
|
2386 | - } elseif ($globalDebug) echo "Done\n"; |
|
2842 | + } elseif ($globalDebug) { |
|
2843 | + echo "Done\n"; |
|
2844 | + } |
|
2845 | + } elseif ($globalDebug) { |
|
2846 | + echo "Done\n"; |
|
2847 | + } |
|
2387 | 2848 | return ''; |
2388 | 2849 | } |
2389 | 2850 | |
2390 | 2851 | public static function update_translation() { |
2391 | 2852 | global $tmp_dir, $globalDebug; |
2392 | 2853 | $error = ''; |
2393 | - if ($globalDebug) echo "Translation : Download..."; |
|
2854 | + if ($globalDebug) { |
|
2855 | + echo "Translation : Download..."; |
|
2856 | + } |
|
2394 | 2857 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
2395 | 2858 | if (file_exists($tmp_dir.'translation.zip')) { |
2396 | - if ($globalDebug) echo "Unzip..."; |
|
2859 | + if ($globalDebug) { |
|
2860 | + echo "Unzip..."; |
|
2861 | + } |
|
2397 | 2862 | update_db::unzip($tmp_dir.'translation.zip'); |
2398 | - if ($globalDebug) echo "Add to DB..."; |
|
2863 | + if ($globalDebug) { |
|
2864 | + echo "Add to DB..."; |
|
2865 | + } |
|
2399 | 2866 | $error = update_db::translation(); |
2400 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2867 | + } else { |
|
2868 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2869 | + } |
|
2401 | 2870 | if ($error != '') { |
2402 | 2871 | return $error; |
2403 | - } elseif ($globalDebug) echo "Done\n"; |
|
2872 | + } elseif ($globalDebug) { |
|
2873 | + echo "Done\n"; |
|
2874 | + } |
|
2404 | 2875 | return ''; |
2405 | 2876 | } |
2406 | 2877 | |
2407 | 2878 | public static function update_translation_fam() { |
2408 | 2879 | global $tmp_dir, $globalDebug; |
2409 | 2880 | $error = ''; |
2410 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
2881 | + if ($globalDebug) { |
|
2882 | + echo "Translation from FlightAirMap website : Download..."; |
|
2883 | + } |
|
2411 | 2884 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
2412 | 2885 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
2413 | 2886 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
2414 | 2887 | $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
2415 | 2888 | $translation_md5 = $translation_md5_file[0]; |
2416 | 2889 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
2417 | - if ($globalDebug) echo "Gunzip..."; |
|
2890 | + if ($globalDebug) { |
|
2891 | + echo "Gunzip..."; |
|
2892 | + } |
|
2418 | 2893 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
2419 | - if ($globalDebug) echo "Add to DB..."; |
|
2894 | + if ($globalDebug) { |
|
2895 | + echo "Add to DB..."; |
|
2896 | + } |
|
2420 | 2897 | $error = update_db::translation_fam(); |
2421 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
2422 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2898 | + } else { |
|
2899 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
2900 | + } |
|
2901 | + } else { |
|
2902 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2903 | + } |
|
2423 | 2904 | if ($error != '') { |
2424 | 2905 | return $error; |
2425 | - } elseif ($globalDebug) echo "Done\n"; |
|
2906 | + } elseif ($globalDebug) { |
|
2907 | + echo "Done\n"; |
|
2908 | + } |
|
2426 | 2909 | return ''; |
2427 | 2910 | } |
2428 | 2911 | public static function update_ModeS_fam() { |
2429 | 2912 | global $tmp_dir, $globalDebug; |
2430 | 2913 | $error = ''; |
2431 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
2914 | + if ($globalDebug) { |
|
2915 | + echo "ModeS from FlightAirMap website : Download..."; |
|
2916 | + } |
|
2432 | 2917 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
2433 | 2918 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
2434 | 2919 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
2435 | 2920 | $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
2436 | 2921 | $modes_md5 = $modes_md5_file[0]; |
2437 | 2922 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
2438 | - if ($globalDebug) echo "Gunzip..."; |
|
2923 | + if ($globalDebug) { |
|
2924 | + echo "Gunzip..."; |
|
2925 | + } |
|
2439 | 2926 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
2440 | - if ($globalDebug) echo "Add to DB..."; |
|
2927 | + if ($globalDebug) { |
|
2928 | + echo "Add to DB..."; |
|
2929 | + } |
|
2441 | 2930 | $error = update_db::modes_fam(); |
2442 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
2443 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2931 | + } else { |
|
2932 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
2933 | + } |
|
2934 | + } else { |
|
2935 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2936 | + } |
|
2444 | 2937 | if ($error != '') { |
2445 | 2938 | return $error; |
2446 | - } elseif ($globalDebug) echo "Done\n"; |
|
2939 | + } elseif ($globalDebug) { |
|
2940 | + echo "Done\n"; |
|
2941 | + } |
|
2447 | 2942 | return ''; |
2448 | 2943 | } |
2449 | 2944 | |
2450 | 2945 | public static function update_airlines_fam() { |
2451 | 2946 | global $tmp_dir, $globalDebug; |
2452 | 2947 | $error = ''; |
2453 | - if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
|
2948 | + if ($globalDebug) { |
|
2949 | + echo "Airlines from FlightAirMap website : Download..."; |
|
2950 | + } |
|
2454 | 2951 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
2455 | 2952 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
2456 | 2953 | $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
@@ -2459,26 +2956,42 @@ discard block |
||
2459 | 2956 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
2460 | 2957 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
2461 | 2958 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
2462 | - if ($globalDebug) echo "Gunzip..."; |
|
2959 | + if ($globalDebug) { |
|
2960 | + echo "Gunzip..."; |
|
2961 | + } |
|
2463 | 2962 | update_db::gunzip($tmp_dir.'airlines.tsv.gz'); |
2464 | - if ($globalDebug) echo "Add to DB..."; |
|
2963 | + if ($globalDebug) { |
|
2964 | + echo "Add to DB..."; |
|
2965 | + } |
|
2465 | 2966 | $error = update_db::airlines_fam(); |
2466 | 2967 | update_db::insert_airlines_version($airlines_md5); |
2467 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
2468 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
2469 | - } elseif ($globalDebug) echo "No update."; |
|
2470 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
2968 | + } else { |
|
2969 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
2970 | + } |
|
2971 | + } else { |
|
2972 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
2973 | + } |
|
2974 | + } elseif ($globalDebug) { |
|
2975 | + echo "No update."; |
|
2976 | + } |
|
2977 | + } else { |
|
2978 | + $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
2979 | + } |
|
2471 | 2980 | if ($error != '') { |
2472 | 2981 | return $error; |
2473 | 2982 | } else { |
2474 | - if ($globalDebug) echo "Done\n"; |
|
2983 | + if ($globalDebug) { |
|
2984 | + echo "Done\n"; |
|
2985 | + } |
|
2475 | 2986 | } |
2476 | 2987 | return ''; |
2477 | 2988 | } |
2478 | 2989 | |
2479 | 2990 | public static function update_owner_fam() { |
2480 | 2991 | global $tmp_dir, $globalDebug, $globalOwner; |
2481 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
2992 | + if ($globalDebug) { |
|
2993 | + echo "owner from FlightAirMap website : Download..."; |
|
2994 | + } |
|
2482 | 2995 | $error = ''; |
2483 | 2996 | if ($globalOwner === TRUE) { |
2484 | 2997 | update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
@@ -2491,35 +3004,57 @@ discard block |
||
2491 | 3004 | $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
2492 | 3005 | $owners_md5 = $owners_md5_file[0]; |
2493 | 3006 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
2494 | - if ($globalDebug) echo "Gunzip..."; |
|
3007 | + if ($globalDebug) { |
|
3008 | + echo "Gunzip..."; |
|
3009 | + } |
|
2495 | 3010 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
2496 | - if ($globalDebug) echo "Add to DB..."; |
|
3011 | + if ($globalDebug) { |
|
3012 | + echo "Add to DB..."; |
|
3013 | + } |
|
2497 | 3014 | $error = update_db::owner_fam(); |
2498 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
2499 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
3015 | + } else { |
|
3016 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
3017 | + } |
|
3018 | + } else { |
|
3019 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
3020 | + } |
|
2500 | 3021 | if ($error != '') { |
2501 | 3022 | return $error; |
2502 | - } elseif ($globalDebug) echo "Done\n"; |
|
3023 | + } elseif ($globalDebug) { |
|
3024 | + echo "Done\n"; |
|
3025 | + } |
|
2503 | 3026 | return ''; |
2504 | 3027 | } |
2505 | 3028 | public static function update_routes_fam() { |
2506 | 3029 | global $tmp_dir, $globalDebug; |
2507 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
3030 | + if ($globalDebug) { |
|
3031 | + echo "Routes from FlightAirMap website : Download..."; |
|
3032 | + } |
|
2508 | 3033 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
2509 | 3034 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
2510 | 3035 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
2511 | 3036 | $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
2512 | 3037 | $routes_md5 = $routes_md5_file[0]; |
2513 | 3038 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
2514 | - if ($globalDebug) echo "Gunzip..."; |
|
3039 | + if ($globalDebug) { |
|
3040 | + echo "Gunzip..."; |
|
3041 | + } |
|
2515 | 3042 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
2516 | - if ($globalDebug) echo "Add to DB..."; |
|
3043 | + if ($globalDebug) { |
|
3044 | + echo "Add to DB..."; |
|
3045 | + } |
|
2517 | 3046 | $error = update_db::routes_fam(); |
2518 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
2519 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
3047 | + } else { |
|
3048 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
3049 | + } |
|
3050 | + } else { |
|
3051 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
3052 | + } |
|
2520 | 3053 | if ($error != '') { |
2521 | 3054 | return $error; |
2522 | - } elseif ($globalDebug) echo "Done\n"; |
|
3055 | + } elseif ($globalDebug) { |
|
3056 | + echo "Done\n"; |
|
3057 | + } |
|
2523 | 3058 | return ''; |
2524 | 3059 | } |
2525 | 3060 | public static function update_marine_identity_fam() { |
@@ -2529,21 +3064,33 @@ discard block |
||
2529 | 3064 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
2530 | 3065 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2531 | 3066 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2532 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
3067 | + if ($globalDebug) { |
|
3068 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
3069 | + } |
|
2533 | 3070 | update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
2534 | 3071 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2535 | 3072 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
2536 | - if ($globalDebug) echo "Gunzip..."; |
|
3073 | + if ($globalDebug) { |
|
3074 | + echo "Gunzip..."; |
|
3075 | + } |
|
2537 | 3076 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
2538 | - if ($globalDebug) echo "Add to DB..."; |
|
3077 | + if ($globalDebug) { |
|
3078 | + echo "Add to DB..."; |
|
3079 | + } |
|
2539 | 3080 | $error = update_db::marine_identity_fam(); |
2540 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
2541 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
3081 | + } else { |
|
3082 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
3083 | + } |
|
3084 | + } else { |
|
3085 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
3086 | + } |
|
2542 | 3087 | if ($error != '') { |
2543 | 3088 | return $error; |
2544 | 3089 | } else { |
2545 | 3090 | update_db::insert_marine_identity_version($marine_identity_md5); |
2546 | - if ($globalDebug) echo "Done\n"; |
|
3091 | + if ($globalDebug) { |
|
3092 | + echo "Done\n"; |
|
3093 | + } |
|
2547 | 3094 | } |
2548 | 3095 | } |
2549 | 3096 | } |
@@ -2557,21 +3104,33 @@ discard block |
||
2557 | 3104 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
2558 | 3105 | $satellite_md5 = $satellite_md5_file[0]; |
2559 | 3106 | if (!update_db::check_satellite_version($satellite_md5)) { |
2560 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
3107 | + if ($globalDebug) { |
|
3108 | + echo "Satellite from FlightAirMap website : Download..."; |
|
3109 | + } |
|
2561 | 3110 | update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
2562 | 3111 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2563 | 3112 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
2564 | - if ($globalDebug) echo "Gunzip..."; |
|
3113 | + if ($globalDebug) { |
|
3114 | + echo "Gunzip..."; |
|
3115 | + } |
|
2565 | 3116 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
2566 | - if ($globalDebug) echo "Add to DB..."; |
|
3117 | + if ($globalDebug) { |
|
3118 | + echo "Add to DB..."; |
|
3119 | + } |
|
2567 | 3120 | $error = update_db::satellite_fam(); |
2568 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
2569 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
3121 | + } else { |
|
3122 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
3123 | + } |
|
3124 | + } else { |
|
3125 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
3126 | + } |
|
2570 | 3127 | if ($error != '') { |
2571 | 3128 | return $error; |
2572 | 3129 | } else { |
2573 | 3130 | update_db::insert_satellite_version($satellite_md5); |
2574 | - if ($globalDebug) echo "Done\n"; |
|
3131 | + if ($globalDebug) { |
|
3132 | + echo "Done\n"; |
|
3133 | + } |
|
2575 | 3134 | } |
2576 | 3135 | } |
2577 | 3136 | } |
@@ -2579,17 +3138,25 @@ discard block |
||
2579 | 3138 | } |
2580 | 3139 | public static function update_banned_fam() { |
2581 | 3140 | global $tmp_dir, $globalDebug; |
2582 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
3141 | + if ($globalDebug) { |
|
3142 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
3143 | + } |
|
2583 | 3144 | update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
2584 | 3145 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2585 | 3146 | //if ($globalDebug) echo "Gunzip..."; |
2586 | 3147 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
2587 | - if ($globalDebug) echo "Add to DB..."; |
|
3148 | + if ($globalDebug) { |
|
3149 | + echo "Add to DB..."; |
|
3150 | + } |
|
2588 | 3151 | $error = update_db::banned_fam(); |
2589 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
3152 | + } else { |
|
3153 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
3154 | + } |
|
2590 | 3155 | if ($error != '') { |
2591 | 3156 | return $error; |
2592 | - } elseif ($globalDebug) echo "Done\n"; |
|
3157 | + } elseif ($globalDebug) { |
|
3158 | + echo "Done\n"; |
|
3159 | + } |
|
2593 | 3160 | return ''; |
2594 | 3161 | } |
2595 | 3162 | |
@@ -2597,7 +3164,9 @@ discard block |
||
2597 | 3164 | global $tmp_dir, $globalDebug, $globalDBdriver; |
2598 | 3165 | include_once('class.create_db.php'); |
2599 | 3166 | $error = ''; |
2600 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
3167 | + if ($globalDebug) { |
|
3168 | + echo "Airspace from FlightAirMap website : Download..."; |
|
3169 | + } |
|
2601 | 3170 | if ($globalDBdriver == 'mysql') { |
2602 | 3171 | update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
2603 | 3172 | } else { |
@@ -2614,9 +3183,13 @@ discard block |
||
2614 | 3183 | } |
2615 | 3184 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2616 | 3185 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
2617 | - if ($globalDebug) echo "Gunzip..."; |
|
3186 | + if ($globalDebug) { |
|
3187 | + echo "Gunzip..."; |
|
3188 | + } |
|
2618 | 3189 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
2619 | - if ($globalDebug) echo "Add to DB..."; |
|
3190 | + if ($globalDebug) { |
|
3191 | + echo "Add to DB..."; |
|
3192 | + } |
|
2620 | 3193 | $Connection = new Connection(); |
2621 | 3194 | if ($Connection->tableExists('airspace')) { |
2622 | 3195 | $query = 'DROP TABLE airspace'; |
@@ -2629,20 +3202,30 @@ discard block |
||
2629 | 3202 | } |
2630 | 3203 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2631 | 3204 | update_db::insert_airspace_version($airspace_md5); |
2632 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
2633 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
3205 | + } else { |
|
3206 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
3207 | + } |
|
3208 | + } else { |
|
3209 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
3210 | + } |
|
2634 | 3211 | } |
2635 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
3212 | + } else { |
|
3213 | + $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
3214 | + } |
|
2636 | 3215 | if ($error != '') { |
2637 | 3216 | return $error; |
2638 | - } elseif ($globalDebug) echo "Done\n"; |
|
3217 | + } elseif ($globalDebug) { |
|
3218 | + echo "Done\n"; |
|
3219 | + } |
|
2639 | 3220 | return ''; |
2640 | 3221 | } |
2641 | 3222 | |
2642 | 3223 | public static function update_geoid_fam() { |
2643 | 3224 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2644 | 3225 | $error = ''; |
2645 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
3226 | + if ($globalDebug) { |
|
3227 | + echo "Geoid from FlightAirMap website : Download..."; |
|
3228 | + } |
|
2646 | 3229 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
2647 | 3230 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2648 | 3231 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2651,76 +3234,120 @@ discard block |
||
2651 | 3234 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
2652 | 3235 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2653 | 3236 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
2654 | - if ($globalDebug) echo "Gunzip..."; |
|
3237 | + if ($globalDebug) { |
|
3238 | + echo "Gunzip..."; |
|
3239 | + } |
|
2655 | 3240 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
2656 | 3241 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2657 | 3242 | update_db::insert_geoid_version($geoid_md5); |
2658 | - } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
2659 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
2660 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
2661 | - } elseif ($globalDebug) echo 'No new version'."\n"; |
|
2662 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3243 | + } else { |
|
3244 | + $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
3245 | + } |
|
3246 | + } else { |
|
3247 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
3248 | + } |
|
3249 | + } else { |
|
3250 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
3251 | + } |
|
3252 | + } elseif ($globalDebug) { |
|
3253 | + echo 'No new version'."\n"; |
|
3254 | + } |
|
3255 | + } else { |
|
3256 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3257 | + } |
|
2663 | 3258 | if ($error != '') { |
2664 | 3259 | return $error; |
2665 | - } elseif ($globalDebug) echo "Done\n"; |
|
3260 | + } elseif ($globalDebug) { |
|
3261 | + echo "Done\n"; |
|
3262 | + } |
|
2666 | 3263 | return ''; |
2667 | 3264 | } |
2668 | 3265 | |
2669 | 3266 | public static function update_tle() { |
2670 | 3267 | global $tmp_dir, $globalDebug; |
2671 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
3268 | + if ($globalDebug) { |
|
3269 | + echo "Download TLE : Download..."; |
|
3270 | + } |
|
2672 | 3271 | $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', |
2673 | 3272 | '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', |
2674 | 3273 | 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
2675 | 3274 | foreach ($alltle as $filename) { |
2676 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
3275 | + if ($globalDebug) { |
|
3276 | + echo "downloading ".$filename.'...'; |
|
3277 | + } |
|
2677 | 3278 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
2678 | 3279 | if (file_exists($tmp_dir.$filename)) { |
2679 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
3280 | + if ($globalDebug) { |
|
3281 | + echo "Add to DB ".$filename."..."; |
|
3282 | + } |
|
2680 | 3283 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
2681 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3284 | + } else { |
|
3285 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3286 | + } |
|
2682 | 3287 | if ($error != '') { |
2683 | 3288 | echo $error."\n"; |
2684 | - } elseif ($globalDebug) echo "Done\n"; |
|
3289 | + } elseif ($globalDebug) { |
|
3290 | + echo "Done\n"; |
|
3291 | + } |
|
2685 | 3292 | } |
2686 | 3293 | return ''; |
2687 | 3294 | } |
2688 | 3295 | |
2689 | 3296 | public static function update_ucsdb() { |
2690 | 3297 | global $tmp_dir, $globalDebug; |
2691 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
3298 | + if ($globalDebug) { |
|
3299 | + echo "Download UCS DB : Download..."; |
|
3300 | + } |
|
2692 | 3301 | update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2693 | 3302 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2694 | - if ($globalDebug) echo "Add to DB..."; |
|
3303 | + if ($globalDebug) { |
|
3304 | + echo "Add to DB..."; |
|
3305 | + } |
|
2695 | 3306 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2696 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3307 | + } else { |
|
3308 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3309 | + } |
|
2697 | 3310 | if ($error != '') { |
2698 | 3311 | echo $error."\n"; |
2699 | - } elseif ($globalDebug) echo "Done\n"; |
|
3312 | + } elseif ($globalDebug) { |
|
3313 | + echo "Done\n"; |
|
3314 | + } |
|
2700 | 3315 | return ''; |
2701 | 3316 | } |
2702 | 3317 | |
2703 | 3318 | public static function update_celestrak() { |
2704 | 3319 | global $tmp_dir, $globalDebug; |
2705 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
3320 | + if ($globalDebug) { |
|
3321 | + echo "Download Celestrak DB : Download..."; |
|
3322 | + } |
|
2706 | 3323 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
2707 | 3324 | if (file_exists($tmp_dir.'satcat.txt')) { |
2708 | - if ($globalDebug) echo "Add to DB..."; |
|
3325 | + if ($globalDebug) { |
|
3326 | + echo "Add to DB..."; |
|
3327 | + } |
|
2709 | 3328 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
2710 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3329 | + } else { |
|
3330 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3331 | + } |
|
2711 | 3332 | if ($error != '') { |
2712 | 3333 | echo $error."\n"; |
2713 | - } elseif ($globalDebug) echo "Done\n"; |
|
3334 | + } elseif ($globalDebug) { |
|
3335 | + echo "Done\n"; |
|
3336 | + } |
|
2714 | 3337 | return ''; |
2715 | 3338 | } |
2716 | 3339 | |
2717 | 3340 | public static function update_models() { |
2718 | 3341 | global $tmp_dir, $globalDebug; |
2719 | 3342 | $error = ''; |
2720 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
3343 | + if ($globalDebug) { |
|
3344 | + echo "Models from FlightAirMap website : Download..."; |
|
3345 | + } |
|
2721 | 3346 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
2722 | 3347 | if (file_exists($tmp_dir.'models.md5sum')) { |
2723 | - if ($globalDebug) echo "Check files...\n"; |
|
3348 | + if ($globalDebug) { |
|
3349 | + echo "Check files...\n"; |
|
3350 | + } |
|
2724 | 3351 | $newmodelsdb = array(); |
2725 | 3352 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
2726 | 3353 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2739,19 +3366,29 @@ discard block |
||
2739 | 3366 | } |
2740 | 3367 | $diff = array_diff($newmodelsdb,$modelsdb); |
2741 | 3368 | foreach ($diff as $key => $value) { |
2742 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3369 | + if ($globalDebug) { |
|
3370 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3371 | + } |
|
2743 | 3372 | update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
2744 | 3373 | |
2745 | 3374 | } |
2746 | 3375 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
2747 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3376 | + } else { |
|
3377 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3378 | + } |
|
2748 | 3379 | if ($error != '') { |
2749 | 3380 | return $error; |
2750 | - } elseif ($globalDebug) echo "Done\n"; |
|
2751 | - if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
3381 | + } elseif ($globalDebug) { |
|
3382 | + echo "Done\n"; |
|
3383 | + } |
|
3384 | + if ($globalDebug) { |
|
3385 | + echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
3386 | + } |
|
2752 | 3387 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
2753 | 3388 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
2754 | - if ($globalDebug) echo "Check files...\n"; |
|
3389 | + if ($globalDebug) { |
|
3390 | + echo "Check files...\n"; |
|
3391 | + } |
|
2755 | 3392 | $newmodelsdb = array(); |
2756 | 3393 | if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
2757 | 3394 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2770,25 +3407,35 @@ discard block |
||
2770 | 3407 | } |
2771 | 3408 | $diff = array_diff($newmodelsdb,$modelsdb); |
2772 | 3409 | foreach ($diff as $key => $value) { |
2773 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3410 | + if ($globalDebug) { |
|
3411 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3412 | + } |
|
2774 | 3413 | update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
2775 | 3414 | |
2776 | 3415 | } |
2777 | 3416 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
2778 | - } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
3417 | + } else { |
|
3418 | + $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
3419 | + } |
|
2779 | 3420 | if ($error != '') { |
2780 | 3421 | return $error; |
2781 | - } elseif ($globalDebug) echo "Done\n"; |
|
3422 | + } elseif ($globalDebug) { |
|
3423 | + echo "Done\n"; |
|
3424 | + } |
|
2782 | 3425 | return ''; |
2783 | 3426 | } |
2784 | 3427 | |
2785 | 3428 | public static function update_liveries() { |
2786 | 3429 | global $tmp_dir, $globalDebug; |
2787 | 3430 | $error = ''; |
2788 | - if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
|
3431 | + if ($globalDebug) { |
|
3432 | + echo "Liveries from FlightAirMap website : Download..."; |
|
3433 | + } |
|
2789 | 3434 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
2790 | 3435 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
2791 | - if ($globalDebug) echo "Check files...\n"; |
|
3436 | + if ($globalDebug) { |
|
3437 | + echo "Check files...\n"; |
|
3438 | + } |
|
2792 | 3439 | $newmodelsdb = array(); |
2793 | 3440 | if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
2794 | 3441 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2807,25 +3454,35 @@ discard block |
||
2807 | 3454 | } |
2808 | 3455 | $diff = array_diff($newmodelsdb,$modelsdb); |
2809 | 3456 | foreach ($diff as $key => $value) { |
2810 | - if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
|
3457 | + if ($globalDebug) { |
|
3458 | + echo 'Downloading liveries '.$key.' ...'."\n"; |
|
3459 | + } |
|
2811 | 3460 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
2812 | 3461 | |
2813 | 3462 | } |
2814 | 3463 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
2815 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3464 | + } else { |
|
3465 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3466 | + } |
|
2816 | 3467 | if ($error != '') { |
2817 | 3468 | return $error; |
2818 | - } elseif ($globalDebug) echo "Done\n"; |
|
3469 | + } elseif ($globalDebug) { |
|
3470 | + echo "Done\n"; |
|
3471 | + } |
|
2819 | 3472 | return ''; |
2820 | 3473 | } |
2821 | 3474 | |
2822 | 3475 | public static function update_space_models() { |
2823 | 3476 | global $tmp_dir, $globalDebug; |
2824 | 3477 | $error = ''; |
2825 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
3478 | + if ($globalDebug) { |
|
3479 | + echo "Space models from FlightAirMap website : Download..."; |
|
3480 | + } |
|
2826 | 3481 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
2827 | 3482 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2828 | - if ($globalDebug) echo "Check files...\n"; |
|
3483 | + if ($globalDebug) { |
|
3484 | + echo "Check files...\n"; |
|
3485 | + } |
|
2829 | 3486 | $newmodelsdb = array(); |
2830 | 3487 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
2831 | 3488 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2844,25 +3501,35 @@ discard block |
||
2844 | 3501 | } |
2845 | 3502 | $diff = array_diff($newmodelsdb,$modelsdb); |
2846 | 3503 | foreach ($diff as $key => $value) { |
2847 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
3504 | + if ($globalDebug) { |
|
3505 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
3506 | + } |
|
2848 | 3507 | update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
2849 | 3508 | |
2850 | 3509 | } |
2851 | 3510 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
2852 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3511 | + } else { |
|
3512 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3513 | + } |
|
2853 | 3514 | if ($error != '') { |
2854 | 3515 | return $error; |
2855 | - } elseif ($globalDebug) echo "Done\n"; |
|
3516 | + } elseif ($globalDebug) { |
|
3517 | + echo "Done\n"; |
|
3518 | + } |
|
2856 | 3519 | return ''; |
2857 | 3520 | } |
2858 | 3521 | |
2859 | 3522 | public static function update_vehicules_models() { |
2860 | 3523 | global $tmp_dir, $globalDebug; |
2861 | 3524 | $error = ''; |
2862 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
3525 | + if ($globalDebug) { |
|
3526 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
3527 | + } |
|
2863 | 3528 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
2864 | 3529 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2865 | - if ($globalDebug) echo "Check files...\n"; |
|
3530 | + if ($globalDebug) { |
|
3531 | + echo "Check files...\n"; |
|
3532 | + } |
|
2866 | 3533 | $newmodelsdb = array(); |
2867 | 3534 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
2868 | 3535 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2881,15 +3548,21 @@ discard block |
||
2881 | 3548 | } |
2882 | 3549 | $diff = array_diff($newmodelsdb,$modelsdb); |
2883 | 3550 | foreach ($diff as $key => $value) { |
2884 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3551 | + if ($globalDebug) { |
|
3552 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3553 | + } |
|
2885 | 3554 | update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
2886 | 3555 | |
2887 | 3556 | } |
2888 | 3557 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
2889 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3558 | + } else { |
|
3559 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3560 | + } |
|
2890 | 3561 | if ($error != '') { |
2891 | 3562 | return $error; |
2892 | - } elseif ($globalDebug) echo "Done\n"; |
|
3563 | + } elseif ($globalDebug) { |
|
3564 | + echo "Done\n"; |
|
3565 | + } |
|
2893 | 3566 | return ''; |
2894 | 3567 | } |
2895 | 3568 | |
@@ -2962,7 +3635,9 @@ discard block |
||
2962 | 3635 | } |
2963 | 3636 | |
2964 | 3637 | $error = ''; |
2965 | - if ($globalDebug) echo "Notam : Download..."; |
|
3638 | + if ($globalDebug) { |
|
3639 | + echo "Notam : Download..."; |
|
3640 | + } |
|
2966 | 3641 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
2967 | 3642 | if (file_exists($tmp_dir.'notam.rss')) { |
2968 | 3643 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -2977,14 +3652,30 @@ discard block |
||
2977 | 3652 | $data['fir'] = $q[0]; |
2978 | 3653 | $data['code'] = $q[1]; |
2979 | 3654 | $ifrvfr = $q[2]; |
2980 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
2981 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
2982 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
2983 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
2984 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
2985 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
2986 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
2987 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
3655 | + if ($ifrvfr == 'IV') { |
|
3656 | + $data['rules'] = 'IFR/VFR'; |
|
3657 | + } |
|
3658 | + if ($ifrvfr == 'I') { |
|
3659 | + $data['rules'] = 'IFR'; |
|
3660 | + } |
|
3661 | + if ($ifrvfr == 'V') { |
|
3662 | + $data['rules'] = 'VFR'; |
|
3663 | + } |
|
3664 | + if ($q[4] == 'A') { |
|
3665 | + $data['scope'] = 'Airport warning'; |
|
3666 | + } |
|
3667 | + if ($q[4] == 'E') { |
|
3668 | + $data['scope'] = 'Enroute warning'; |
|
3669 | + } |
|
3670 | + if ($q[4] == 'W') { |
|
3671 | + $data['scope'] = 'Navigation warning'; |
|
3672 | + } |
|
3673 | + if ($q[4] == 'AE') { |
|
3674 | + $data['scope'] = 'Airport/Enroute warning'; |
|
3675 | + } |
|
3676 | + if ($q[4] == 'AW') { |
|
3677 | + $data['scope'] = 'Airport/Navigation warning'; |
|
3678 | + } |
|
2988 | 3679 | //$data['scope'] = $q[4]; |
2989 | 3680 | $data['lower_limit'] = $q[5]; |
2990 | 3681 | $data['upper_limit'] = $q[6]; |
@@ -2992,8 +3683,12 @@ discard block |
||
2992 | 3683 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
2993 | 3684 | $latitude = $Common->convertDec($las,'latitude'); |
2994 | 3685 | $longitude = $Common->convertDec($lns,'longitude'); |
2995 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
2996 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
3686 | + if ($lac == 'S') { |
|
3687 | + $latitude = '-'.$latitude; |
|
3688 | + } |
|
3689 | + if ($lnc == 'W') { |
|
3690 | + $longitude = '-'.$longitude; |
|
3691 | + } |
|
2997 | 3692 | $data['center_latitude'] = $latitude; |
2998 | 3693 | $data['center_longitude'] = $longitude; |
2999 | 3694 | $data['radius'] = intval($radius); |
@@ -3023,10 +3718,14 @@ discard block |
||
3023 | 3718 | $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']); |
3024 | 3719 | unset($data); |
3025 | 3720 | } |
3026 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3721 | + } else { |
|
3722 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3723 | + } |
|
3027 | 3724 | if ($error != '') { |
3028 | 3725 | return $error; |
3029 | - } elseif ($globalDebug) echo "Done\n"; |
|
3726 | + } elseif ($globalDebug) { |
|
3727 | + echo "Done\n"; |
|
3728 | + } |
|
3030 | 3729 | return ''; |
3031 | 3730 | } |
3032 | 3731 | |
@@ -3051,7 +3750,9 @@ discard block |
||
3051 | 3750 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
3052 | 3751 | $airspace_json = json_decode($airspace_lst,true); |
3053 | 3752 | foreach ($airspace_json['records'] as $airspace) { |
3054 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
3753 | + if ($globalDebug) { |
|
3754 | + echo $airspace['name']."...\n"; |
|
3755 | + } |
|
3055 | 3756 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
3056 | 3757 | if (file_exists($tmp_dir.$airspace['name'])) { |
3057 | 3758 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -3095,8 +3796,11 @@ discard block |
||
3095 | 3796 | return "error : ".$e->getMessage(); |
3096 | 3797 | } |
3097 | 3798 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3098 | - if ($row['nb'] > 0) return false; |
|
3099 | - else return true; |
|
3799 | + if ($row['nb'] > 0) { |
|
3800 | + return false; |
|
3801 | + } else { |
|
3802 | + return true; |
|
3803 | + } |
|
3100 | 3804 | } |
3101 | 3805 | |
3102 | 3806 | public static function insert_last_update() { |
@@ -3121,8 +3825,11 @@ discard block |
||
3121 | 3825 | return "error : ".$e->getMessage(); |
3122 | 3826 | } |
3123 | 3827 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3124 | - if ($row['nb'] > 0) return true; |
|
3125 | - else return false; |
|
3828 | + if ($row['nb'] > 0) { |
|
3829 | + return true; |
|
3830 | + } else { |
|
3831 | + return false; |
|
3832 | + } |
|
3126 | 3833 | } |
3127 | 3834 | |
3128 | 3835 | public static function check_geoid_version($version) { |
@@ -3135,8 +3842,11 @@ discard block |
||
3135 | 3842 | return "error : ".$e->getMessage(); |
3136 | 3843 | } |
3137 | 3844 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3138 | - if ($row['nb'] > 0) return true; |
|
3139 | - else return false; |
|
3845 | + if ($row['nb'] > 0) { |
|
3846 | + return true; |
|
3847 | + } else { |
|
3848 | + return false; |
|
3849 | + } |
|
3140 | 3850 | } |
3141 | 3851 | |
3142 | 3852 | public static function check_marine_identity_version($version) { |
@@ -3149,8 +3859,11 @@ discard block |
||
3149 | 3859 | return "error : ".$e->getMessage(); |
3150 | 3860 | } |
3151 | 3861 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3152 | - if ($row['nb'] > 0) return true; |
|
3153 | - else return false; |
|
3862 | + if ($row['nb'] > 0) { |
|
3863 | + return true; |
|
3864 | + } else { |
|
3865 | + return false; |
|
3866 | + } |
|
3154 | 3867 | } |
3155 | 3868 | |
3156 | 3869 | public static function check_satellite_version($version) { |
@@ -3163,8 +3876,11 @@ discard block |
||
3163 | 3876 | return "error : ".$e->getMessage(); |
3164 | 3877 | } |
3165 | 3878 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3166 | - if ($row['nb'] > 0) return true; |
|
3167 | - else return false; |
|
3879 | + if ($row['nb'] > 0) { |
|
3880 | + return true; |
|
3881 | + } else { |
|
3882 | + return false; |
|
3883 | + } |
|
3168 | 3884 | } |
3169 | 3885 | |
3170 | 3886 | public static function check_airlines_version($version) { |
@@ -3177,8 +3893,11 @@ discard block |
||
3177 | 3893 | return "error : ".$e->getMessage(); |
3178 | 3894 | } |
3179 | 3895 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3180 | - if ($row['nb'] > 0) return true; |
|
3181 | - else return false; |
|
3896 | + if ($row['nb'] > 0) { |
|
3897 | + return true; |
|
3898 | + } else { |
|
3899 | + return false; |
|
3900 | + } |
|
3182 | 3901 | } |
3183 | 3902 | |
3184 | 3903 | public static function check_notam_version($version) { |
@@ -3191,8 +3910,11 @@ discard block |
||
3191 | 3910 | return "error : ".$e->getMessage(); |
3192 | 3911 | } |
3193 | 3912 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3194 | - if ($row['nb'] > 0) return true; |
|
3195 | - else return false; |
|
3913 | + if ($row['nb'] > 0) { |
|
3914 | + return true; |
|
3915 | + } else { |
|
3916 | + return false; |
|
3917 | + } |
|
3196 | 3918 | } |
3197 | 3919 | |
3198 | 3920 | public static function insert_airlines_version($version) { |
@@ -3282,8 +4004,11 @@ discard block |
||
3282 | 4004 | return "error : ".$e->getMessage(); |
3283 | 4005 | } |
3284 | 4006 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3285 | - if ($row['nb'] > 0) return false; |
|
3286 | - else return true; |
|
4007 | + if ($row['nb'] > 0) { |
|
4008 | + return false; |
|
4009 | + } else { |
|
4010 | + return true; |
|
4011 | + } |
|
3287 | 4012 | } |
3288 | 4013 | |
3289 | 4014 | public static function insert_last_notam_update() { |
@@ -3313,8 +4038,11 @@ discard block |
||
3313 | 4038 | return "error : ".$e->getMessage(); |
3314 | 4039 | } |
3315 | 4040 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3316 | - if ($row['nb'] > 0) return false; |
|
3317 | - else return true; |
|
4041 | + if ($row['nb'] > 0) { |
|
4042 | + return false; |
|
4043 | + } else { |
|
4044 | + return true; |
|
4045 | + } |
|
3318 | 4046 | } |
3319 | 4047 | |
3320 | 4048 | public static function insert_last_airspace_update() { |
@@ -3344,8 +4072,11 @@ discard block |
||
3344 | 4072 | return "error : ".$e->getMessage(); |
3345 | 4073 | } |
3346 | 4074 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3347 | - if ($row['nb'] > 0) return false; |
|
3348 | - else return true; |
|
4075 | + if ($row['nb'] > 0) { |
|
4076 | + return false; |
|
4077 | + } else { |
|
4078 | + return true; |
|
4079 | + } |
|
3349 | 4080 | } |
3350 | 4081 | |
3351 | 4082 | public static function insert_last_geoid_update() { |
@@ -3375,8 +4106,11 @@ discard block |
||
3375 | 4106 | return "error : ".$e->getMessage(); |
3376 | 4107 | } |
3377 | 4108 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3378 | - if ($row['nb'] > 0) return false; |
|
3379 | - else return true; |
|
4109 | + if ($row['nb'] > 0) { |
|
4110 | + return false; |
|
4111 | + } else { |
|
4112 | + return true; |
|
4113 | + } |
|
3380 | 4114 | } |
3381 | 4115 | |
3382 | 4116 | public static function insert_last_owner_update() { |
@@ -3406,8 +4140,11 @@ discard block |
||
3406 | 4140 | return "error : ".$e->getMessage(); |
3407 | 4141 | } |
3408 | 4142 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3409 | - if ($row['nb'] > 0) return false; |
|
3410 | - else return true; |
|
4143 | + if ($row['nb'] > 0) { |
|
4144 | + return false; |
|
4145 | + } else { |
|
4146 | + return true; |
|
4147 | + } |
|
3411 | 4148 | } |
3412 | 4149 | |
3413 | 4150 | public static function insert_last_fires_update() { |
@@ -3437,8 +4174,11 @@ discard block |
||
3437 | 4174 | return "error : ".$e->getMessage(); |
3438 | 4175 | } |
3439 | 4176 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3440 | - if ($row['nb'] > 0) return false; |
|
3441 | - else return true; |
|
4177 | + if ($row['nb'] > 0) { |
|
4178 | + return false; |
|
4179 | + } else { |
|
4180 | + return true; |
|
4181 | + } |
|
3442 | 4182 | } |
3443 | 4183 | |
3444 | 4184 | public static function insert_last_airlines_update() { |
@@ -3468,8 +4208,11 @@ discard block |
||
3468 | 4208 | return "error : ".$e->getMessage(); |
3469 | 4209 | } |
3470 | 4210 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3471 | - if ($row['nb'] > 0) return false; |
|
3472 | - else return true; |
|
4211 | + if ($row['nb'] > 0) { |
|
4212 | + return false; |
|
4213 | + } else { |
|
4214 | + return true; |
|
4215 | + } |
|
3473 | 4216 | } |
3474 | 4217 | |
3475 | 4218 | public static function insert_last_schedules_update() { |
@@ -3499,8 +4242,11 @@ discard block |
||
3499 | 4242 | return "error : ".$e->getMessage(); |
3500 | 4243 | } |
3501 | 4244 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3502 | - if ($row['nb'] > 0) return false; |
|
3503 | - else return true; |
|
4245 | + if ($row['nb'] > 0) { |
|
4246 | + return false; |
|
4247 | + } else { |
|
4248 | + return true; |
|
4249 | + } |
|
3504 | 4250 | } |
3505 | 4251 | |
3506 | 4252 | public static function insert_last_tle_update() { |
@@ -3530,8 +4276,11 @@ discard block |
||
3530 | 4276 | return "error : ".$e->getMessage(); |
3531 | 4277 | } |
3532 | 4278 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3533 | - if ($row['nb'] > 0) return false; |
|
3534 | - else return true; |
|
4279 | + if ($row['nb'] > 0) { |
|
4280 | + return false; |
|
4281 | + } else { |
|
4282 | + return true; |
|
4283 | + } |
|
3535 | 4284 | } |
3536 | 4285 | |
3537 | 4286 | public static function insert_last_ucsdb_update() { |
@@ -3561,8 +4310,11 @@ discard block |
||
3561 | 4310 | return "error : ".$e->getMessage(); |
3562 | 4311 | } |
3563 | 4312 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3564 | - if ($row['nb'] > 0) return false; |
|
3565 | - else return true; |
|
4313 | + if ($row['nb'] > 0) { |
|
4314 | + return false; |
|
4315 | + } else { |
|
4316 | + return true; |
|
4317 | + } |
|
3566 | 4318 | } |
3567 | 4319 | |
3568 | 4320 | public static function insert_last_celestrak_update() { |
@@ -3592,8 +4344,11 @@ discard block |
||
3592 | 4344 | return "error : ".$e->getMessage(); |
3593 | 4345 | } |
3594 | 4346 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3595 | - if ($row['nb'] > 0) return false; |
|
3596 | - else return true; |
|
4347 | + if ($row['nb'] > 0) { |
|
4348 | + return false; |
|
4349 | + } else { |
|
4350 | + return true; |
|
4351 | + } |
|
3597 | 4352 | } |
3598 | 4353 | |
3599 | 4354 | public static function check_last_satellite_update() { |
@@ -3611,8 +4366,11 @@ discard block |
||
3611 | 4366 | return "error : ".$e->getMessage(); |
3612 | 4367 | } |
3613 | 4368 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3614 | - if ($row['nb'] > 0) return false; |
|
3615 | - else return true; |
|
4369 | + if ($row['nb'] > 0) { |
|
4370 | + return false; |
|
4371 | + } else { |
|
4372 | + return true; |
|
4373 | + } |
|
3616 | 4374 | } |
3617 | 4375 | |
3618 | 4376 | public static function insert_last_marine_identity_update() { |
@@ -38,8 +38,11 @@ discard block |
||
38 | 38 | global $globalGeoidSource; |
39 | 39 | //if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm'; |
40 | 40 | if ($name == '') { |
41 | - if (isset($globalGeoidSource) && $globalGeoidSource != '') $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'; |
|
42 | - else $name = dirname(__FILE__).'/../data/egm96-15.pgm'; |
|
41 | + if (isset($globalGeoidSource) && $globalGeoidSource != '') { |
|
42 | + $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'; |
|
43 | + } else { |
|
44 | + $name = dirname(__FILE__).'/../data/egm96-15.pgm'; |
|
45 | + } |
|
43 | 46 | } |
44 | 47 | |
45 | 48 | if (file_exists($name) === FALSE) { |
@@ -159,7 +162,9 @@ discard block |
||
159 | 162 | } |
160 | 163 | } |
161 | 164 | $this->t = $t; |
162 | - } else $t = $this->t; |
|
165 | + } else { |
|
166 | + $t = $this->t; |
|
167 | + } |
|
163 | 168 | if (!($cubic)) { |
164 | 169 | $a = (((1 - $fx) * $this->v00) + ($fx * $this->v01)); |
165 | 170 | $b = (((1 - $fx) * $this->v10) + ($fx * $this->v11)); |
@@ -4,11 +4,19 @@ discard block |
||
4 | 4 | if (isset($_SESSION['error'])) { |
5 | 5 | header('Content-Encoding: none;'); |
6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
11 | -} |
|
7 | + if (isset($_SESSION['error'])) { |
|
8 | + unset($_SESSION['error']); |
|
9 | + } |
|
10 | + if (isset($_SESSION['errorlst'])) { |
|
11 | + unset($_SESSION['errorlst']); |
|
12 | + } |
|
13 | + if (isset($_SESSION['next'])) { |
|
14 | + unset($_SESSION['next']); |
|
15 | + } |
|
16 | + if (isset($_SESSION['install'])) { |
|
17 | + unset($_SESSION['install']); |
|
18 | + } |
|
19 | + } |
|
12 | 20 | /* |
13 | 21 | if (isset($_SESSION['errorlst'])) { |
14 | 22 | header('Content-Encoding: none;'); |
@@ -168,31 +176,49 @@ discard block |
||
168 | 176 | </div> |
169 | 177 | <p> |
170 | 178 | <label for="dbhost">Database hostname</label> |
171 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
179 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
180 | + print $globalDBhost; |
|
181 | +} |
|
182 | +?>" /> |
|
172 | 183 | </p> |
173 | 184 | <p> |
174 | 185 | <label for="dbport">Database port</label> |
175 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
186 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
187 | + print $globalDBport; |
|
188 | +} |
|
189 | +?>" /> |
|
176 | 190 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
177 | 191 | </p> |
178 | 192 | <p> |
179 | 193 | <label for="dbname">Database name</label> |
180 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
194 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
195 | + print $globalDBname; |
|
196 | +} |
|
197 | +?>" /> |
|
181 | 198 | </p> |
182 | 199 | <p> |
183 | 200 | <label for="dbuser">Database user</label> |
184 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
201 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
202 | + print $globalDBuser; |
|
203 | +} |
|
204 | +?>" /> |
|
185 | 205 | </p> |
186 | 206 | <p> |
187 | 207 | <label for="dbuserpass">Database user password</label> |
188 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
208 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
209 | + print $globalDBpass; |
|
210 | +} |
|
211 | +?>" /> |
|
189 | 212 | </p> |
190 | 213 | </fieldset> |
191 | 214 | <fieldset id="site"> |
192 | 215 | <legend>Site configuration</legend> |
193 | 216 | <p> |
194 | 217 | <label for="sitename">Site name</label> |
195 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
218 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
219 | + print $globalName; |
|
220 | +} |
|
221 | +?>" /> |
|
196 | 222 | </p> |
197 | 223 | <p> |
198 | 224 | <label for="siteurl">Site directory</label> |
@@ -205,18 +231,27 @@ discard block |
||
205 | 231 | } |
206 | 232 | } |
207 | 233 | ?> |
208 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
234 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
235 | + print $globalURL; |
|
236 | +} |
|
237 | +?>" /> |
|
209 | 238 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
210 | 239 | <p class="help-block">Can be empty</p> |
211 | 240 | </p> |
212 | 241 | <p> |
213 | 242 | <label for="timezone">Timezone</label> |
214 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
243 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
244 | + print $globalTimezone; |
|
245 | +} |
|
246 | +?>" /> |
|
215 | 247 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
216 | 248 | </p> |
217 | 249 | <p> |
218 | 250 | <label for="language">Language</label> |
219 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
251 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
252 | + print $globalLanguage; |
|
253 | +} |
|
254 | +?>" /> |
|
220 | 255 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
221 | 256 | </p> |
222 | 257 | </fieldset> |
@@ -236,11 +271,17 @@ discard block |
||
236 | 271 | <div id="mapbox_data"> |
237 | 272 | <p> |
238 | 273 | <label for="mapboxid">Mapbox id</label> |
239 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
274 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
275 | + print $globalMapboxId; |
|
276 | +} |
|
277 | +?>" /> |
|
240 | 278 | </p> |
241 | 279 | <p> |
242 | 280 | <label for="mapboxtoken">Mapbox token</label> |
243 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
281 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
282 | + print $globalMapboxToken; |
|
283 | +} |
|
284 | +?>" /> |
|
244 | 285 | </p> |
245 | 286 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
246 | 287 | </div> |
@@ -248,7 +289,10 @@ discard block |
||
248 | 289 | <div id="google_data"> |
249 | 290 | <p> |
250 | 291 | <label for="googlekey">Google API key</label> |
251 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
292 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
293 | + print $globalGoogleAPIKey; |
|
294 | +} |
|
295 | +?>" /> |
|
252 | 296 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
253 | 297 | </p> |
254 | 298 | </div> |
@@ -256,7 +300,10 @@ discard block |
||
256 | 300 | <div id="bing_data"> |
257 | 301 | <p> |
258 | 302 | <label for="bingkey">Bing Map key</label> |
259 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
303 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
304 | + print $globalBingMapKey; |
|
305 | +} |
|
306 | +?>" /> |
|
260 | 307 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
261 | 308 | </p> |
262 | 309 | </div> |
@@ -264,7 +311,10 @@ discard block |
||
264 | 311 | <div id="mapquest_data"> |
265 | 312 | <p> |
266 | 313 | <label for="mapquestkey">MapQuest key</label> |
267 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
314 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
315 | + print $globalMapQuestKey; |
|
316 | +} |
|
317 | +?>" /> |
|
268 | 318 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
269 | 319 | </p> |
270 | 320 | </div> |
@@ -272,11 +322,17 @@ discard block |
||
272 | 322 | <div id="here_data"> |
273 | 323 | <p> |
274 | 324 | <label for="hereappid">Here App_Id</label> |
275 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
325 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
326 | + print $globalHereappId; |
|
327 | +} |
|
328 | +?>" /> |
|
276 | 329 | </p> |
277 | 330 | <p> |
278 | 331 | <label for="hereappcode">Here App_Code</label> |
279 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
332 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
333 | + print $globalHereappCode; |
|
334 | +} |
|
335 | +?>" /> |
|
280 | 336 | </p> |
281 | 337 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
282 | 338 | </div> |
@@ -284,7 +340,10 @@ discard block |
||
284 | 340 | <div id="openweathermap_data"> |
285 | 341 | <p> |
286 | 342 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
287 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
343 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
344 | + print $globalOpenWeatherMapKey; |
|
345 | +} |
|
346 | +?>" /> |
|
288 | 347 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
289 | 348 | </p> |
290 | 349 | </div> |
@@ -313,42 +372,86 @@ discard block |
||
313 | 372 | <legend>Coverage area</legend> |
314 | 373 | <p> |
315 | 374 | <label for="latitudemax">The maximum latitude (north)</label> |
316 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
375 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
376 | + print $globalLatitudeMax; |
|
377 | +} |
|
378 | +?>" /> |
|
317 | 379 | </p> |
318 | 380 | <p> |
319 | 381 | <label for="latitudemin">The minimum latitude (south)</label> |
320 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
382 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
383 | + print $globalLatitudeMin; |
|
384 | +} |
|
385 | +?>" /> |
|
321 | 386 | </p> |
322 | 387 | <p> |
323 | 388 | <label for="longitudemax">The maximum longitude (west)</label> |
324 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
389 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
390 | + print $globalLongitudeMax; |
|
391 | +} |
|
392 | +?>" /> |
|
325 | 393 | </p> |
326 | 394 | <p> |
327 | 395 | <label for="longitudemin">The minimum longitude (east)</label> |
328 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
396 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
397 | + print $globalLongitudeMin; |
|
398 | +} |
|
399 | +?>" /> |
|
329 | 400 | </p> |
330 | 401 | <p> |
331 | 402 | <label for="latitudecenter">The latitude center</label> |
332 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
403 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
404 | + print $globalCenterLatitude; |
|
405 | +} |
|
406 | +?>" /> |
|
333 | 407 | </p> |
334 | 408 | <p> |
335 | 409 | <label for="longitudecenter">The longitude center</label> |
336 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
410 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
411 | + print $globalCenterLongitude; |
|
412 | +} |
|
413 | +?>" /> |
|
337 | 414 | </p> |
338 | 415 | <p> |
339 | 416 | <label for="livezoom">Default Zoom on live map</label> |
340 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
417 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
418 | + print $globalLiveZoom; |
|
419 | +} else { |
|
420 | + print '9'; |
|
421 | +} |
|
422 | +?>" /> |
|
341 | 423 | </p> |
342 | 424 | <p> |
343 | 425 | <label for="squawk_country">Country for squawk usage</label> |
344 | 426 | <select name="squawk_country" id="squawk_country"> |
345 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
346 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
347 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
348 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
349 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
350 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
351 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
427 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
428 | + print ' selected '; |
|
429 | +} |
|
430 | +?>>UK</option> |
|
431 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
432 | + print ' selected '; |
|
433 | +} |
|
434 | +?>>NZ</option> |
|
435 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
436 | + print ' selected '; |
|
437 | +} |
|
438 | +?>>US</option> |
|
439 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
440 | + print ' selected '; |
|
441 | +} |
|
442 | +?>>AU</option> |
|
443 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
444 | + print ' selected '; |
|
445 | +} |
|
446 | +?>>NL</option> |
|
447 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
448 | + print ' selected '; |
|
449 | +} |
|
450 | +?>>FR</option> |
|
451 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
452 | + print ' selected '; |
|
453 | +} |
|
454 | +?>>TR</option> |
|
352 | 455 | </select> |
353 | 456 | </p> |
354 | 457 | </fieldset> |
@@ -357,15 +460,24 @@ discard block |
||
357 | 460 | <p><i>Only put in DB flights that are inside a circle</i></p> |
358 | 461 | <p> |
359 | 462 | <label for="latitude">Center latitude</label> |
360 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
463 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
464 | + echo $globalDistanceIgnore['latitude']; |
|
465 | +} |
|
466 | +?>" /> |
|
361 | 467 | </p> |
362 | 468 | <p> |
363 | 469 | <label for="longitude">Center longitude</label> |
364 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
470 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
471 | + echo $globalDistanceIgnore['longitude']; |
|
472 | +} |
|
473 | +?>" /> |
|
365 | 474 | </p> |
366 | 475 | <p> |
367 | 476 | <label for="Distance">Distance (in km)</label> |
368 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
477 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
478 | + echo $globalDistanceIgnore['distance']; |
|
479 | +} |
|
480 | +?>" /> |
|
369 | 481 | </p> |
370 | 482 | </fieldset> |
371 | 483 | <fieldset id="sourceloc"> |
@@ -481,11 +593,17 @@ discard block |
||
481 | 593 | <div id="flightaware_data"> |
482 | 594 | <p> |
483 | 595 | <label for="flightawareusername">FlightAware username</label> |
484 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
596 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
597 | + print $globalFlightAwareUsername; |
|
598 | +} |
|
599 | +?>" /> |
|
485 | 600 | </p> |
486 | 601 | <p> |
487 | 602 | <label for="flightawarepassword">FlightAware password/API key</label> |
488 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
603 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
604 | + print $globalFlightAwarePassword; |
|
605 | +} |
|
606 | +?>" /> |
|
489 | 607 | </p> |
490 | 608 | </div> |
491 | 609 | --> |
@@ -527,7 +645,10 @@ discard block |
||
527 | 645 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
528 | 646 | ?> |
529 | 647 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
530 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
648 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
649 | + print $source['port']; |
|
650 | +} |
|
651 | +?>" /></td> |
|
531 | 652 | <?php |
532 | 653 | } else { |
533 | 654 | $hostport = explode(':',$source['host']); |
@@ -546,36 +667,114 @@ discard block |
||
546 | 667 | ?> |
547 | 668 | <td> |
548 | 669 | <select name="format[]" id="format"> |
549 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
550 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
551 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
552 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
553 | - <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option> |
|
554 | - <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option> |
|
555 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
556 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
557 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
558 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
559 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
560 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
561 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
562 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
563 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
564 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
565 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
566 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
567 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
568 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
569 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
570 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
571 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
670 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
671 | + print 'selected'; |
|
672 | +} |
|
673 | +?>>Auto</option> |
|
674 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
675 | + print 'selected'; |
|
676 | +} |
|
677 | +?>>SBS</option> |
|
678 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
679 | + print 'selected'; |
|
680 | +} |
|
681 | +?>>TSV</option> |
|
682 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
683 | + print 'selected'; |
|
684 | +} |
|
685 | +?>>Raw</option> |
|
686 | + <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') { |
|
687 | + print 'selected'; |
|
688 | +} |
|
689 | +?>>Dump1090 aircraft.json</option> |
|
690 | + <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') { |
|
691 | + print 'selected'; |
|
692 | +} |
|
693 | +?>>Planefinder client</option> |
|
694 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
695 | + print 'selected'; |
|
696 | +} |
|
697 | +?>>APRS</option> |
|
698 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
699 | + print 'selected'; |
|
700 | +} |
|
701 | +?>>Radarcape deltadb.txt</option> |
|
702 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
703 | + print 'selected'; |
|
704 | +} |
|
705 | +?>>Vatsim</option> |
|
706 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
707 | + print 'selected'; |
|
708 | +} |
|
709 | +?>>Virtual Radar Server AircraftList.json</option> |
|
710 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
711 | + print 'selected'; |
|
712 | +} |
|
713 | +?>>Virtual Radar Server TCP</option> |
|
714 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
715 | + print 'selected'; |
|
716 | +} |
|
717 | +?>>phpVMS</option> |
|
718 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
719 | + print 'selected'; |
|
720 | +} |
|
721 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
722 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
723 | + print 'selected'; |
|
724 | +} |
|
725 | +?>>Virtual Airlines Manager</option> |
|
726 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
727 | + print 'selected'; |
|
728 | +} |
|
729 | +?>>IVAO</option> |
|
730 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
731 | + print 'selected'; |
|
732 | +} |
|
733 | +?>>FlightGear Multiplayer</option> |
|
734 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
735 | + print 'selected'; |
|
736 | +} |
|
737 | +?>>FlightGear Singleplayer</option> |
|
738 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
739 | + print 'selected'; |
|
740 | +} |
|
741 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
742 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
743 | + print 'selected'; |
|
744 | +} |
|
745 | +?>>ACARS SBS-3 over TCP</option> |
|
746 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
747 | + print 'selected'; |
|
748 | +} |
|
749 | +?>>NMEA AIS over TCP</option> |
|
750 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
751 | + print 'selected'; |
|
752 | +} |
|
753 | +?>>AirWhere website</option> |
|
754 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
755 | + print 'selected'; |
|
756 | +} |
|
757 | +?>>HidnSeek Callback</option> |
|
758 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
759 | + print 'selected'; |
|
760 | +} |
|
761 | +?>>Blitzortung</option> |
|
572 | 762 | </select> |
573 | 763 | </td> |
574 | 764 | <td> |
575 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
765 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
766 | + print $source['name']; |
|
767 | +} |
|
768 | +?>" /> |
|
576 | 769 | </td> |
577 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
578 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
770 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
771 | + print 'checked'; |
|
772 | +} |
|
773 | +?> /></td> |
|
774 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
775 | + print 'checked'; |
|
776 | +} |
|
777 | +?> /></td> |
|
579 | 778 | <td> |
580 | 779 | <select name="timezones[]" id="timezones"> |
581 | 780 | <?php |
@@ -585,7 +784,9 @@ discard block |
||
585 | 784 | print '<option selected>'.$timezones.'</option>'; |
586 | 785 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
587 | 786 | print '<option selected>'.$timezones.'</option>'; |
588 | - } else print '<option>'.$timezones.'</option>'; |
|
787 | + } else { |
|
788 | + print '<option>'.$timezones.'</option>'; |
|
789 | + } |
|
589 | 790 | } |
590 | 791 | ?> |
591 | 792 | </select> |
@@ -638,7 +839,9 @@ discard block |
||
638 | 839 | foreach($timezonelist as $timezones){ |
639 | 840 | if ($timezones == 'UTC') { |
640 | 841 | print '<option selected>'.$timezones.'</option>'; |
641 | - } else print '<option>'.$timezones.'</option>'; |
|
842 | + } else { |
|
843 | + print '<option>'.$timezones.'</option>'; |
|
844 | + } |
|
642 | 845 | } |
643 | 846 | ?> |
644 | 847 | </select> |
@@ -663,11 +866,17 @@ discard block |
||
663 | 866 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
664 | 867 | <p> |
665 | 868 | <label for="acarshost">ACARS UDP host</label> |
666 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
869 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
870 | + print $globalACARSHost; |
|
871 | +} |
|
872 | +?>" /> |
|
667 | 873 | </p> |
668 | 874 | <p> |
669 | 875 | <label for="acarsport">ACARS UDP port</label> |
670 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
876 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
877 | + print $globalACARSPort; |
|
878 | +} |
|
879 | +?>" /> |
|
671 | 880 | </p> |
672 | 881 | </fieldset> |
673 | 882 | </div> |
@@ -693,17 +902,38 @@ discard block |
||
693 | 902 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
694 | 903 | <td> |
695 | 904 | <select name="newslang[]"> |
696 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
697 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
905 | + <option value="en"<?php if ($lng == 'en') { |
|
906 | + print ' selected'; |
|
907 | +} |
|
908 | +?>>English</option> |
|
909 | + <option value="fr"<?php if ($lng == 'fr') { |
|
910 | + print ' selected'; |
|
911 | +} |
|
912 | +?>>French</option> |
|
698 | 913 | </select> |
699 | 914 | </td> |
700 | 915 | <td> |
701 | 916 | <select name="newstype[]"> |
702 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
703 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
704 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
705 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
706 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
917 | + <option value="global"<?php if ($type == 'global') { |
|
918 | + print ' selected'; |
|
919 | +} |
|
920 | +?>>Global</option> |
|
921 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
922 | + print ' selected'; |
|
923 | +} |
|
924 | +?>>Aircraft</option> |
|
925 | + <option value="marine"<?php if ($type == 'marine') { |
|
926 | + print ' selected'; |
|
927 | +} |
|
928 | +?>>Marine</option> |
|
929 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
930 | + print ' selected'; |
|
931 | +} |
|
932 | +?>>Tracker</option> |
|
933 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
934 | + print ' selected'; |
|
935 | +} |
|
936 | +?>>Satellite</option> |
|
707 | 937 | </select> |
708 | 938 | </td> |
709 | 939 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -836,13 +1066,19 @@ discard block |
||
836 | 1066 | <div id="schedules_options"> |
837 | 1067 | <p> |
838 | 1068 | <label for="britishairways">British Airways API Key</label> |
839 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
1069 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
1070 | + print $globalBritishAirwaysKey; |
|
1071 | +} |
|
1072 | +?>" /> |
|
840 | 1073 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
841 | 1074 | </p> |
842 | 1075 | <!-- |
843 | 1076 | <p> |
844 | 1077 | <label for="transavia">Transavia Test API Consumer Key</label> |
845 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
1078 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
1079 | + print $globalTransaviaKey; |
|
1080 | +} |
|
1081 | +?>" /> |
|
846 | 1082 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
847 | 1083 | </p> |
848 | 1084 | --> |
@@ -851,10 +1087,16 @@ discard block |
||
851 | 1087 | <b>Lufthansa API Key</b> |
852 | 1088 | <p> |
853 | 1089 | <label for="lufthansakey">Key</label> |
854 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
1090 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
1091 | + print $globalLufthansaKey['key']; |
|
1092 | +} |
|
1093 | +?>" /> |
|
855 | 1094 | </p><p> |
856 | 1095 | <label for="lufthansasecret">Secret</label> |
857 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
1096 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
1097 | + print $globalLufthansaKey['secret']; |
|
1098 | +} |
|
1099 | +?>" /> |
|
858 | 1100 | </p> |
859 | 1101 | </div> |
860 | 1102 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -864,11 +1106,17 @@ discard block |
||
864 | 1106 | <b>FlightAware API Key</b> |
865 | 1107 | <p> |
866 | 1108 | <label for="flightawareusername">Username</label> |
867 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
1109 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
1110 | + print $globalFlightAwareUsername; |
|
1111 | +} |
|
1112 | +?>" /> |
|
868 | 1113 | </p> |
869 | 1114 | <p> |
870 | 1115 | <label for="flightawarepassword">API key</label> |
871 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
1116 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
1117 | + print $globalFlightAwarePassword; |
|
1118 | +} |
|
1119 | +?>" /> |
|
872 | 1120 | </p> |
873 | 1121 | </div> |
874 | 1122 | <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p> |
@@ -885,10 +1133,22 @@ discard block |
||
885 | 1133 | <p> |
886 | 1134 | <label for="mapmatchingsource">Map Matching source</label> |
887 | 1135 | <select name="mapmatchingsource" id="mapmatchingsource"> |
888 | - <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option> |
|
889 | - <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option> |
|
890 | - <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option> |
|
891 | - <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option> |
|
1136 | + <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) { |
|
1137 | + print 'selected="selected" '; |
|
1138 | +} |
|
1139 | +?>>FlightAirMap Map Matching</option> |
|
1140 | + <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') { |
|
1141 | + print 'selected="selected" '; |
|
1142 | +} |
|
1143 | +?>>GraphHopper</option> |
|
1144 | + <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') { |
|
1145 | + print 'selected="selected" '; |
|
1146 | +} |
|
1147 | +?>>OSMR</option> |
|
1148 | + <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') { |
|
1149 | + print 'selected="selected" '; |
|
1150 | +} |
|
1151 | +?>>Mapbox</option> |
|
892 | 1152 | </select> |
893 | 1153 | <p class="help-block">Mapbox need the API Key defined in map section.</p> |
894 | 1154 | <p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p> |
@@ -896,7 +1156,10 @@ discard block |
||
896 | 1156 | <br /> |
897 | 1157 | <p> |
898 | 1158 | <label for="graphhopper">GraphHopper API Key</label> |
899 | - <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" /> |
|
1159 | + <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) { |
|
1160 | + print $globalGraphHopperKey; |
|
1161 | +} |
|
1162 | +?>" /> |
|
900 | 1163 | <p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p> |
901 | 1164 | </p> |
902 | 1165 | </div> |
@@ -914,7 +1177,10 @@ discard block |
||
914 | 1177 | </p> |
915 | 1178 | <p> |
916 | 1179 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
917 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
1180 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
1181 | + print $globalNOTAMSource; |
|
1182 | +} |
|
1183 | +?>" /> |
|
918 | 1184 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
919 | 1185 | </p> |
920 | 1186 | <br /> |
@@ -930,14 +1196,20 @@ discard block |
||
930 | 1196 | <div id="metarsrc"> |
931 | 1197 | <p> |
932 | 1198 | <label for="metarsource">URL of your METAR source</label> |
933 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
1199 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
1200 | + print $globalMETARurl; |
|
1201 | +} |
|
1202 | +?>" /> |
|
934 | 1203 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
935 | 1204 | </p> |
936 | 1205 | </div> |
937 | 1206 | <br /> |
938 | 1207 | <p> |
939 | 1208 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
940 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
1209 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
1210 | + print $globalBitlyAccessToken; |
|
1211 | +} |
|
1212 | +?>" /> |
|
941 | 1213 | </p> |
942 | 1214 | <br /> |
943 | 1215 | <p> |
@@ -953,11 +1225,26 @@ discard block |
||
953 | 1225 | <p> |
954 | 1226 | <label for="geoid_source">Geoid Source</label> |
955 | 1227 | <select name="geoid_source" id="geoid_source"> |
956 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
957 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
958 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
959 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
960 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
1228 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
1229 | + print ' selected="selected"'; |
|
1230 | +} |
|
1231 | +?>>EGM96 15' (2.1MB)</option> |
|
1232 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
1233 | + print ' selected="selected"'; |
|
1234 | +} |
|
1235 | +?>>EGM96 5' (19MB)</option> |
|
1236 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
1237 | + print ' selected="selected"'; |
|
1238 | +} |
|
1239 | +?>>EGM2008 5' (19MB)</option> |
|
1240 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
1241 | + print ' selected="selected"'; |
|
1242 | +} |
|
1243 | +?>>EGM2008 2.5' (75MB)</option> |
|
1244 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
1245 | + print ' selected="selected"'; |
|
1246 | +} |
|
1247 | +?>>EGM2008 1' (470MB)</option> |
|
961 | 1248 | </select> |
962 | 1249 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
963 | 1250 | </p> |
@@ -979,7 +1266,12 @@ discard block |
||
979 | 1266 | </p> |
980 | 1267 | <p> |
981 | 1268 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
982 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
1269 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
1270 | + print $globalArchiveMonths; |
|
1271 | +} else { |
|
1272 | + echo '1'; |
|
1273 | +} |
|
1274 | +?>" /> |
|
983 | 1275 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
984 | 1276 | </p> |
985 | 1277 | <p> |
@@ -989,12 +1281,22 @@ discard block |
||
989 | 1281 | </p> |
990 | 1282 | <p> |
991 | 1283 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
992 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
1284 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
1285 | + print $globalArchiveKeepMonths; |
|
1286 | +} else { |
|
1287 | + echo '1'; |
|
1288 | +} |
|
1289 | +?>" /> |
|
993 | 1290 | <p class="help-block">0 to disable</p> |
994 | 1291 | </p> |
995 | 1292 | <p> |
996 | 1293 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
997 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
1294 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
1295 | + print $globalArchiveKeepTrackMonths; |
|
1296 | +} else { |
|
1297 | + echo '1'; |
|
1298 | +} |
|
1299 | +?>" /> |
|
998 | 1300 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
999 | 1301 | </p> |
1000 | 1302 | <br /> |
@@ -1004,7 +1306,12 @@ discard block |
||
1004 | 1306 | <p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p> |
1005 | 1307 | <div id="cronends"> |
1006 | 1308 | <label for="cronend">Run script for xx seconds</label> |
1007 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
1309 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
1310 | + print $globalCronEnd; |
|
1311 | +} else { |
|
1312 | + print '0'; |
|
1313 | +} |
|
1314 | +?>" /> |
|
1008 | 1315 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
1009 | 1316 | </div> |
1010 | 1317 | </p> |
@@ -1057,20 +1364,40 @@ discard block |
||
1057 | 1364 | <br /> |
1058 | 1365 | <p> |
1059 | 1366 | <label for="refresh">Show flights detected since xxx seconds</label> |
1060 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
1367 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
1368 | + echo $globalLiveInterval; |
|
1369 | +} else { |
|
1370 | + echo '200'; |
|
1371 | +} |
|
1372 | +?>" /> |
|
1061 | 1373 | </p> |
1062 | 1374 | <p> |
1063 | 1375 | <label for="maprefresh">Live map refresh (in seconds)</label> |
1064 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
1376 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
1377 | + echo $globalMapRefresh; |
|
1378 | +} else { |
|
1379 | + echo '30'; |
|
1380 | +} |
|
1381 | +?>" /> |
|
1065 | 1382 | </p> |
1066 | 1383 | <p> |
1067 | 1384 | <label for="mapidle">Map idle timeout (in minutes)</label> |
1068 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
1385 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
1386 | + echo $globalMapIdleTimeout; |
|
1387 | +} else { |
|
1388 | + echo '30'; |
|
1389 | +} |
|
1390 | +?>" /> |
|
1069 | 1391 | <p class="help-block">0 to disable</p> |
1070 | 1392 | </p> |
1071 | 1393 | <p> |
1072 | 1394 | <label for="minfetch">HTTP/file source fetch every xxx seconds</label> |
1073 | - <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" /> |
|
1395 | + <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) { |
|
1396 | + echo $globalMinFetch; |
|
1397 | +} else { |
|
1398 | + echo '20'; |
|
1399 | +} |
|
1400 | +?>" /> |
|
1074 | 1401 | </p> |
1075 | 1402 | <p> |
1076 | 1403 | <label for="bbox">Only display flights that we can see on screen (bounding box)</label> |
@@ -1084,12 +1411,20 @@ discard block |
||
1084 | 1411 | <br /> |
1085 | 1412 | <p> |
1086 | 1413 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
1087 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
1414 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
1415 | + echo $globalClosestMinDist; |
|
1416 | +} else { |
|
1417 | + echo '50'; |
|
1418 | +} |
|
1419 | +?>" /> |
|
1088 | 1420 | </p> |
1089 | 1421 | <br /> |
1090 | 1422 | <p> |
1091 | 1423 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1092 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1424 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
1425 | + echo $globalAircraftSize; |
|
1426 | +} |
|
1427 | +?>" /> |
|
1093 | 1428 | </p> |
1094 | 1429 | <br /> |
1095 | 1430 | <p> |
@@ -1108,7 +1443,12 @@ discard block |
||
1108 | 1443 | if (extension_loaded('gd') && function_exists('gd_info')) { |
1109 | 1444 | ?> |
1110 | 1445 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
1111 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
1446 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
1447 | + echo $globalAircraftIconColor; |
|
1448 | +} else { |
|
1449 | + echo '1a3151'; |
|
1450 | +} |
|
1451 | +?>" /> |
|
1112 | 1452 | <?php |
1113 | 1453 | if (!is_writable('../cache')) { |
1114 | 1454 | ?> |
@@ -1126,14 +1466,27 @@ discard block |
||
1126 | 1466 | <p> |
1127 | 1467 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
1128 | 1468 | <div class="range"> |
1129 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
1130 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
1469 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
1470 | + echo $globalAirportZoom; |
|
1471 | +} else { |
|
1472 | + echo '7'; |
|
1473 | +} |
|
1474 | +?>" /> |
|
1475 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
1476 | + echo $globalAirportZoom; |
|
1477 | +} else { |
|
1478 | + echo '7'; |
|
1479 | +} |
|
1480 | +?></output> |
|
1131 | 1481 | </div> |
1132 | 1482 | </p> |
1133 | 1483 | <br /> |
1134 | 1484 | <p> |
1135 | 1485 | <label for="customcss">Custom CSS web path</label> |
1136 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
1486 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
1487 | + echo $globalCustomCSS; |
|
1488 | +} |
|
1489 | +?>" /> |
|
1137 | 1490 | </p> |
1138 | 1491 | </fieldset> |
1139 | 1492 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1160,8 +1513,12 @@ discard block |
||
1160 | 1513 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
1161 | 1514 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
1162 | 1515 | |
1163 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
1164 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1516 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
1517 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
1518 | + } |
|
1519 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
1520 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1521 | + } |
|
1165 | 1522 | |
1166 | 1523 | $_SESSION['database_root'] = $dbroot; |
1167 | 1524 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1229,15 +1586,23 @@ discard block |
||
1229 | 1586 | $source_city = $_POST['source_city']; |
1230 | 1587 | $source_country = $_POST['source_country']; |
1231 | 1588 | $source_ref = $_POST['source_ref']; |
1232 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
1233 | - else $source_id = array(); |
|
1589 | + if (isset($source_id)) { |
|
1590 | + $source_id = $_POST['source_id']; |
|
1591 | + } else { |
|
1592 | + $source_id = array(); |
|
1593 | + } |
|
1234 | 1594 | |
1235 | 1595 | $sources = array(); |
1236 | 1596 | foreach ($source_name as $keys => $name) { |
1237 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1238 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1597 | + if (isset($source_id[$keys])) { |
|
1598 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1599 | + } else { |
|
1600 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1601 | + } |
|
1602 | + } |
|
1603 | + if (count($sources) > 0) { |
|
1604 | + $_SESSION['sources'] = $sources; |
|
1239 | 1605 | } |
1240 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
1241 | 1606 | |
1242 | 1607 | $newsurl = $_POST['newsurl']; |
1243 | 1608 | $newslng = $_POST['newslang']; |
@@ -1250,7 +1615,9 @@ discard block |
||
1250 | 1615 | $lng = $newslng[$newskey]; |
1251 | 1616 | if (isset($newsfeeds[$type][$lng])) { |
1252 | 1617 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
1253 | - } else $newsfeeds[$type][$lng] = array($url); |
|
1618 | + } else { |
|
1619 | + $newsfeeds[$type][$lng] = array($url); |
|
1620 | + } |
|
1254 | 1621 | } |
1255 | 1622 | } |
1256 | 1623 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1274,17 +1641,29 @@ discard block |
||
1274 | 1641 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
1275 | 1642 | |
1276 | 1643 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
1277 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1278 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1644 | + if ($globalaircraft == 'aircraft') { |
|
1645 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1646 | + } else { |
|
1647 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1648 | + } |
|
1279 | 1649 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
1280 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1281 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1650 | + if ($globaltracker == 'tracker') { |
|
1651 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1652 | + } else { |
|
1653 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1654 | + } |
|
1282 | 1655 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
1283 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1284 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1656 | + if ($globalmarine == 'marine') { |
|
1657 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1658 | + } else { |
|
1659 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1660 | + } |
|
1285 | 1661 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
1286 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1287 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1662 | + if ($globalsatellite == 'satellite') { |
|
1663 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1664 | + } else { |
|
1665 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1666 | + } |
|
1288 | 1667 | |
1289 | 1668 | /* |
1290 | 1669 | $globalSBS1Hosts = array(); |
@@ -1306,23 +1685,37 @@ discard block |
||
1306 | 1685 | $name = $_POST['name']; |
1307 | 1686 | $format = $_POST['format']; |
1308 | 1687 | $timezones = $_POST['timezones']; |
1309 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
1310 | - else $sourcestats = array(); |
|
1311 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
1312 | - else $noarchive = array(); |
|
1688 | + if (isset($_POST['sourcestats'])) { |
|
1689 | + $sourcestats = $_POST['sourcestats']; |
|
1690 | + } else { |
|
1691 | + $sourcestats = array(); |
|
1692 | + } |
|
1693 | + if (isset($_POST['noarchive'])) { |
|
1694 | + $noarchive = $_POST['noarchive']; |
|
1695 | + } else { |
|
1696 | + $noarchive = array(); |
|
1697 | + } |
|
1313 | 1698 | $gSources = array(); |
1314 | 1699 | $forcepilots = false; |
1315 | 1700 | foreach ($host as $key => $h) { |
1316 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
1317 | - else $cov = 'FALSE'; |
|
1318 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
1319 | - else $arch = 'FALSE'; |
|
1701 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
1702 | + $cov = 'TRUE'; |
|
1703 | + } else { |
|
1704 | + $cov = 'FALSE'; |
|
1705 | + } |
|
1706 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
1707 | + $arch = 'TRUE'; |
|
1708 | + } else { |
|
1709 | + $arch = 'FALSE'; |
|
1710 | + } |
|
1320 | 1711 | if (strpos($format[$key],'_callback')) { |
1321 | 1712 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
1322 | 1713 | } elseif ($h != '' || $name[$key] != '') { |
1323 | 1714 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
1324 | 1715 | } |
1325 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
1716 | + if ($format[$key] == 'airwhere') { |
|
1717 | + $forcepilots = true; |
|
1718 | + } |
|
1326 | 1719 | } |
1327 | 1720 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
1328 | 1721 | |
@@ -1353,7 +1746,9 @@ discard block |
||
1353 | 1746 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
1354 | 1747 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1355 | 1748 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
1356 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1749 | + } else { |
|
1750 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1751 | + } |
|
1357 | 1752 | |
1358 | 1753 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
1359 | 1754 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1394,7 +1789,9 @@ discard block |
||
1394 | 1789 | |
1395 | 1790 | // Create in settings.php keys not yet configurable if not already here |
1396 | 1791 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1397 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1792 | + if (!isset($globalDebug)) { |
|
1793 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1794 | + } |
|
1398 | 1795 | |
1399 | 1796 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
1400 | 1797 | if ($resetyearstats == 'resetyearstats') { |
@@ -1437,37 +1834,56 @@ discard block |
||
1437 | 1834 | } |
1438 | 1835 | */ |
1439 | 1836 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
1440 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1441 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1442 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1443 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1837 | + if ($globalsbs == 'sbs') { |
|
1838 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1839 | + } else { |
|
1840 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1841 | + } |
|
1842 | + if ($globalaprs == 'aprs') { |
|
1843 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1844 | + } else { |
|
1845 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1846 | + } |
|
1444 | 1847 | $va = false; |
1445 | 1848 | if ($globalivao == 'ivao') { |
1446 | 1849 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
1447 | 1850 | $va = true; |
1448 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1851 | + } else { |
|
1852 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1853 | + } |
|
1449 | 1854 | if ($globalvatsim == 'vatsim') { |
1450 | 1855 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
1451 | 1856 | $va = true; |
1452 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1857 | + } else { |
|
1858 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1859 | + } |
|
1453 | 1860 | if ($globalphpvms == 'phpvms') { |
1454 | 1861 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
1455 | 1862 | $va = true; |
1456 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1863 | + } else { |
|
1864 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1865 | + } |
|
1457 | 1866 | if ($globalvam == 'vam') { |
1458 | 1867 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
1459 | 1868 | $va = true; |
1460 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1869 | + } else { |
|
1870 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1871 | + } |
|
1461 | 1872 | if ($va) { |
1462 | 1873 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
1463 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1874 | + } else { |
|
1875 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1876 | + } |
|
1464 | 1877 | if ($globalva == 'va' || $va) { |
1465 | 1878 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
1466 | 1879 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
1467 | 1880 | } else { |
1468 | 1881 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
1469 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1470 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1882 | + if ($forcepilots) { |
|
1883 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1884 | + } else { |
|
1885 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1886 | + } |
|
1471 | 1887 | } |
1472 | 1888 | |
1473 | 1889 | |
@@ -1690,7 +2106,9 @@ discard block |
||
1690 | 2106 | $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
1691 | 2107 | $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
1692 | 2108 | |
1693 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2109 | + if (!isset($globalTransaction)) { |
|
2110 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2111 | + } |
|
1694 | 2112 | |
1695 | 2113 | // Set some defaults values... |
1696 | 2114 | if (!isset($globalAircraftImageSources)) { |
@@ -1705,15 +2123,23 @@ discard block |
||
1705 | 2123 | |
1706 | 2124 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1707 | 2125 | |
1708 | - if ($error == '') settings::modify_settings($settings); |
|
1709 | - if ($error == '') settings::comment_settings($settings_comment); |
|
2126 | + if ($error == '') { |
|
2127 | + settings::modify_settings($settings); |
|
2128 | + } |
|
2129 | + if ($error == '') { |
|
2130 | + settings::comment_settings($settings_comment); |
|
2131 | + } |
|
1710 | 2132 | if ($error != '') { |
1711 | 2133 | print '<div class="info column">'.$error.'</div>'; |
1712 | 2134 | require('../footer.php'); |
1713 | 2135 | exit; |
1714 | 2136 | } else { |
1715 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
1716 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
2137 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
2138 | + $_SESSION['waypoints'] = 1; |
|
2139 | + } |
|
2140 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
2141 | + $_SESSION['owner'] = 1; |
|
2142 | + } |
|
1717 | 2143 | if (isset($_POST['createdb'])) { |
1718 | 2144 | $_SESSION['install'] = 'database_create'; |
1719 | 2145 | } else { |
@@ -1750,10 +2176,18 @@ discard block |
||
1750 | 2176 | $popw = false; |
1751 | 2177 | foreach ($_SESSION['done'] as $done) { |
1752 | 2178 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
1753 | - if ($done == 'Create database') $pop = true; |
|
1754 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1755 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1756 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
2179 | + if ($done == 'Create database') { |
|
2180 | + $pop = true; |
|
2181 | + } |
|
2182 | + if ($_SESSION['install'] == 'database_create') { |
|
2183 | + $pop = true; |
|
2184 | + } |
|
2185 | + if ($_SESSION['install'] == 'database_import') { |
|
2186 | + $popi = true; |
|
2187 | + } |
|
2188 | + if ($_SESSION['install'] == 'waypoints') { |
|
2189 | + $popw = true; |
|
2190 | + } |
|
1757 | 2191 | } |
1758 | 2192 | if ($pop) { |
1759 | 2193 | sleep(5); |
@@ -1764,7 +2198,9 @@ discard block |
||
1764 | 2198 | } else if ($popw) { |
1765 | 2199 | sleep(5); |
1766 | 2200 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
1767 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2201 | + } else { |
|
2202 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2203 | + } |
|
1768 | 2204 | print '</div></ul>'; |
1769 | 2205 | print '<div id="error"></div>'; |
1770 | 2206 | /* foreach ($_SESSION['done'] as $done) { |
@@ -11,7 +11,9 @@ discard block |
||
11 | 11 | print '<h1>'._("Geoid Height Calculator").'</h1>'; |
12 | 12 | print '</div>'; |
13 | 13 | print '<p>Not available</p>'; |
14 | - if (isset($globalDebug) && $globalDebug) echo '<p>'.$e.'</p>'; |
|
14 | + if (isset($globalDebug) && $globalDebug) { |
|
15 | + echo '<p>'.$e.'</p>'; |
|
16 | + } |
|
15 | 17 | require_once('footer.php'); |
16 | 18 | exit(); |
17 | 19 | } |
@@ -69,8 +71,11 @@ discard block |
||
69 | 71 | print '<div class="col-sm-6">'.round($altitude-$geoid,3).'</div>'; |
70 | 72 | } |
71 | 73 | print '<div class="col-sm-6"><b>Earth Gravity Model</b></div>'; |
72 | - if (isset($globalGeoidSource) && $globalGeoidSource != '') $geoidsource = $globalGeoidSource; |
|
73 | - else $geoidsource = 'EGM96-15'; |
|
74 | + if (isset($globalGeoidSource) && $globalGeoidSource != '') { |
|
75 | + $geoidsource = $globalGeoidSource; |
|
76 | + } else { |
|
77 | + $geoidsource = 'EGM96-15'; |
|
78 | + } |
|
74 | 79 | print '<div class="col-sm-6">'.$geoidsource.'</div>'; |
75 | 80 | print '</div>'; |
76 | 81 | } |
@@ -22,10 +22,14 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct($dbc = null) { |
24 | 24 | global $globalFilterName; |
25 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
25 | + if (isset($globalFilterName)) { |
|
26 | + $this->filter_name = $globalFilterName; |
|
27 | + } |
|
26 | 28 | $Connection = new Connection($dbc); |
27 | 29 | $this->db = $Connection->db(); |
28 | - if ($this->db === null) die('Error: No DB connection. (Stats)'); |
|
30 | + if ($this->db === null) { |
|
31 | + die('Error: No DB connection. (Stats)'); |
|
32 | + } |
|
29 | 33 | } |
30 | 34 | |
31 | 35 | public function addLastStatsUpdate($type,$stats_date) { |
@@ -93,7 +97,9 @@ discard block |
||
93 | 97 | |
94 | 98 | public function getAllAirlineNames($filter_name = '') { |
95 | 99 | global $globalStatsFilters; |
96 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
100 | + if ($filter_name == '') { |
|
101 | + $filter_name = $this->filter_name; |
|
102 | + } |
|
97 | 103 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
98 | 104 | try { |
99 | 105 | $sth = $this->db->prepare($query); |
@@ -113,7 +119,9 @@ discard block |
||
113 | 119 | return $all; |
114 | 120 | } |
115 | 121 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
116 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
122 | + if ($filter_name == '') { |
|
123 | + $filter_name = $this->filter_name; |
|
124 | + } |
|
117 | 125 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
118 | 126 | try { |
119 | 127 | $sth = $this->db->prepare($query); |
@@ -125,7 +133,9 @@ discard block |
||
125 | 133 | return $all; |
126 | 134 | } |
127 | 135 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
128 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
136 | + if ($filter_name == '') { |
|
137 | + $filter_name = $this->filter_name; |
|
138 | + } |
|
129 | 139 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
130 | 140 | try { |
131 | 141 | $sth = $this->db->prepare($query); |
@@ -137,7 +147,9 @@ discard block |
||
137 | 147 | return $all; |
138 | 148 | } |
139 | 149 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
140 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
150 | + if ($filter_name == '') { |
|
151 | + $filter_name = $this->filter_name; |
|
152 | + } |
|
141 | 153 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
142 | 154 | try { |
143 | 155 | $sth = $this->db->prepare($query); |
@@ -150,7 +162,9 @@ discard block |
||
150 | 162 | } |
151 | 163 | |
152 | 164 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
153 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
165 | + if ($filter_name == '') { |
|
166 | + $filter_name = $this->filter_name; |
|
167 | + } |
|
154 | 168 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
155 | 169 | try { |
156 | 170 | $sth = $this->db->prepare($query); |
@@ -163,7 +177,9 @@ discard block |
||
163 | 177 | } |
164 | 178 | |
165 | 179 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
166 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
180 | + if ($filter_name == '') { |
|
181 | + $filter_name = $this->filter_name; |
|
182 | + } |
|
167 | 183 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
168 | 184 | try { |
169 | 185 | $sth = $this->db->prepare($query); |
@@ -178,7 +194,9 @@ discard block |
||
178 | 194 | |
179 | 195 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
180 | 196 | global $globalStatsFilters; |
181 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
197 | + if ($filter_name == '') { |
|
198 | + $filter_name = $this->filter_name; |
|
199 | + } |
|
182 | 200 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
183 | 201 | $Spotter = new Spotter($this->db); |
184 | 202 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -187,8 +205,11 @@ discard block |
||
187 | 205 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
188 | 206 | } |
189 | 207 | if ($year == '' && $month == '') { |
190 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
191 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
208 | + if ($limit) { |
|
209 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
210 | + } else { |
|
211 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
212 | + } |
|
192 | 213 | try { |
193 | 214 | $sth = $this->db->prepare($query); |
194 | 215 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -196,11 +217,16 @@ discard block |
||
196 | 217 | echo "error : ".$e->getMessage(); |
197 | 218 | } |
198 | 219 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
199 | - } else $all = array(); |
|
220 | + } else { |
|
221 | + $all = array(); |
|
222 | + } |
|
200 | 223 | } else { |
201 | 224 | if ($year == '' && $month == '') { |
202 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
203 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
225 | + if ($limit) { |
|
226 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
227 | + } else { |
|
228 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
229 | + } |
|
204 | 230 | try { |
205 | 231 | $sth = $this->db->prepare($query); |
206 | 232 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -208,7 +234,9 @@ discard block |
||
208 | 234 | echo "error : ".$e->getMessage(); |
209 | 235 | } |
210 | 236 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
211 | - } else $all = array(); |
|
237 | + } else { |
|
238 | + $all = array(); |
|
239 | + } |
|
212 | 240 | } |
213 | 241 | if (empty($all)) { |
214 | 242 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -227,10 +255,15 @@ discard block |
||
227 | 255 | } |
228 | 256 | public function countAllMarineTypes($limit = true, $filter_name = '',$year = '', $month = '') { |
229 | 257 | global $globalStatsFilters; |
230 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
258 | + if ($filter_name == '') { |
|
259 | + $filter_name = $this->filter_name; |
|
260 | + } |
|
231 | 261 | if ($year == '' && $month == '') { |
232 | - if ($limit) $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY marine_type_count DESC LIMIT 10 OFFSET 0"; |
|
233 | - else $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
262 | + if ($limit) { |
|
263 | + $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY marine_type_count DESC LIMIT 10 OFFSET 0"; |
|
264 | + } else { |
|
265 | + $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
266 | + } |
|
234 | 267 | try { |
235 | 268 | $sth = $this->db->prepare($query); |
236 | 269 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -238,7 +271,9 @@ discard block |
||
238 | 271 | echo "error : ".$e->getMessage(); |
239 | 272 | } |
240 | 273 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
241 | - } else $all = array(); |
|
274 | + } else { |
|
275 | + $all = array(); |
|
276 | + } |
|
242 | 277 | if (empty($all)) { |
243 | 278 | $filters = array('year' => $year,'month' => $month); |
244 | 279 | if ($filter_name != '') { |
@@ -252,10 +287,15 @@ discard block |
||
252 | 287 | } |
253 | 288 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
254 | 289 | global $globalStatsFilters; |
255 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
290 | + if ($filter_name == '') { |
|
291 | + $filter_name = $this->filter_name; |
|
292 | + } |
|
256 | 293 | if ($year == '' && $month == '') { |
257 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
258 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
294 | + if ($limit) { |
|
295 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
296 | + } else { |
|
297 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
298 | + } |
|
259 | 299 | try { |
260 | 300 | $sth = $this->db->prepare($query); |
261 | 301 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -263,7 +303,9 @@ discard block |
||
263 | 303 | echo "error : ".$e->getMessage(); |
264 | 304 | } |
265 | 305 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
266 | - } else $all = array(); |
|
306 | + } else { |
|
307 | + $all = array(); |
|
308 | + } |
|
267 | 309 | if (empty($all)) { |
268 | 310 | $Spotter = new Spotter($this->db); |
269 | 311 | $filters = array(); |
@@ -278,7 +320,9 @@ discard block |
||
278 | 320 | } |
279 | 321 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
280 | 322 | global $globalStatsFilters; |
281 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
323 | + if ($filter_name == '') { |
|
324 | + $filter_name = $this->filter_name; |
|
325 | + } |
|
282 | 326 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
283 | 327 | $Spotter = new Spotter($this->db); |
284 | 328 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -287,8 +331,11 @@ discard block |
||
287 | 331 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
288 | 332 | } |
289 | 333 | if ($year == '' && $month == '') { |
290 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
291 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
334 | + if ($limit) { |
|
335 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
336 | + } else { |
|
337 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
338 | + } |
|
292 | 339 | try { |
293 | 340 | $sth = $this->db->prepare($query); |
294 | 341 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -296,11 +343,16 @@ discard block |
||
296 | 343 | echo "error : ".$e->getMessage(); |
297 | 344 | } |
298 | 345 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
299 | - } else $all = array(); |
|
346 | + } else { |
|
347 | + $all = array(); |
|
348 | + } |
|
300 | 349 | } else { |
301 | 350 | if ($year == '' && $month == '') { |
302 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
303 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
351 | + if ($limit) { |
|
352 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
353 | + } else { |
|
354 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
355 | + } |
|
304 | 356 | try { |
305 | 357 | $sth = $this->db->prepare($query); |
306 | 358 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -308,7 +360,9 @@ discard block |
||
308 | 360 | echo "error : ".$e->getMessage(); |
309 | 361 | } |
310 | 362 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
311 | - } else $all = array(); |
|
363 | + } else { |
|
364 | + $all = array(); |
|
365 | + } |
|
312 | 366 | } |
313 | 367 | if (empty($all)) { |
314 | 368 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -328,7 +382,9 @@ discard block |
||
328 | 382 | |
329 | 383 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
330 | 384 | global $globalStatsFilters; |
331 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
385 | + if ($filter_name == '') { |
|
386 | + $filter_name = $this->filter_name; |
|
387 | + } |
|
332 | 388 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
333 | 389 | $Spotter = new Spotter($this->db); |
334 | 390 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -337,8 +393,11 @@ discard block |
||
337 | 393 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
338 | 394 | } |
339 | 395 | if ($year == '' && $month == '') { |
340 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
341 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
396 | + if ($limit) { |
|
397 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
398 | + } else { |
|
399 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
400 | + } |
|
342 | 401 | try { |
343 | 402 | $sth = $this->db->prepare($query); |
344 | 403 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -346,11 +405,16 @@ discard block |
||
346 | 405 | echo "error : ".$e->getMessage(); |
347 | 406 | } |
348 | 407 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
349 | - } else $all = array(); |
|
408 | + } else { |
|
409 | + $all = array(); |
|
410 | + } |
|
350 | 411 | } else { |
351 | 412 | if ($year == '' && $month == '') { |
352 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
353 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
413 | + if ($limit) { |
|
414 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
415 | + } else { |
|
416 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
417 | + } |
|
354 | 418 | try { |
355 | 419 | $sth = $this->db->prepare($query); |
356 | 420 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -358,7 +422,9 @@ discard block |
||
358 | 422 | echo "error : ".$e->getMessage(); |
359 | 423 | } |
360 | 424 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
361 | - } else $all = array(); |
|
425 | + } else { |
|
426 | + $all = array(); |
|
427 | + } |
|
362 | 428 | } |
363 | 429 | if (empty($all)) { |
364 | 430 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -377,7 +443,9 @@ discard block |
||
377 | 443 | } |
378 | 444 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
379 | 445 | global $globalStatsFilters; |
380 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
446 | + if ($filter_name == '') { |
|
447 | + $filter_name = $this->filter_name; |
|
448 | + } |
|
381 | 449 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
382 | 450 | $Spotter = new Spotter($this->db); |
383 | 451 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -385,12 +453,18 @@ discard block |
||
385 | 453 | foreach ($airlines as $airline) { |
386 | 454 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
387 | 455 | } |
388 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
389 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
456 | + if ($limit) { |
|
457 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
458 | + } else { |
|
459 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
460 | + } |
|
390 | 461 | $query_values = array(':filter_name' => $filter_name); |
391 | 462 | } else { |
392 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
393 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
463 | + if ($limit) { |
|
464 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
465 | + } else { |
|
466 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
467 | + } |
|
394 | 468 | $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
395 | 469 | } |
396 | 470 | try { |
@@ -418,17 +492,29 @@ discard block |
||
418 | 492 | |
419 | 493 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
420 | 494 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
421 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
495 | + if ($filter_name == '') { |
|
496 | + $filter_name = $this->filter_name; |
|
497 | + } |
|
422 | 498 | if ($year == '' && $month == '') { |
423 | - if ($globalVATSIM) $forsource = 'vatsim'; |
|
424 | - if ($globalIVAO) $forsource = 'ivao'; |
|
499 | + if ($globalVATSIM) { |
|
500 | + $forsource = 'vatsim'; |
|
501 | + } |
|
502 | + if ($globalIVAO) { |
|
503 | + $forsource = 'ivao'; |
|
504 | + } |
|
425 | 505 | if (isset($forsource)) { |
426 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
427 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
506 | + if ($limit) { |
|
507 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
508 | + } else { |
|
509 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
510 | + } |
|
428 | 511 | $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
429 | 512 | } else { |
430 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
431 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
513 | + if ($limit) { |
|
514 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
515 | + } else { |
|
516 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
517 | + } |
|
432 | 518 | $query_values = array(':filter_name' => $filter_name); |
433 | 519 | } |
434 | 520 | try { |
@@ -438,7 +524,9 @@ discard block |
||
438 | 524 | echo "error : ".$e->getMessage(); |
439 | 525 | } |
440 | 526 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
441 | - } else $all = array(); |
|
527 | + } else { |
|
528 | + $all = array(); |
|
529 | + } |
|
442 | 530 | if (empty($all)) { |
443 | 531 | $Spotter = new Spotter($this->db); |
444 | 532 | $filters = array(); |
@@ -453,7 +541,9 @@ discard block |
||
453 | 541 | } |
454 | 542 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
455 | 543 | global $globalStatsFilters; |
456 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
544 | + if ($filter_name == '') { |
|
545 | + $filter_name = $this->filter_name; |
|
546 | + } |
|
457 | 547 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
458 | 548 | $Spotter = new Spotter($this->db); |
459 | 549 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -462,8 +552,11 @@ discard block |
||
462 | 552 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
463 | 553 | } |
464 | 554 | if ($year == '' && $month == '') { |
465 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
466 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
555 | + if ($limit) { |
|
556 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
557 | + } else { |
|
558 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
559 | + } |
|
467 | 560 | try { |
468 | 561 | $sth = $this->db->prepare($query); |
469 | 562 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -471,11 +564,16 @@ discard block |
||
471 | 564 | echo "error : ".$e->getMessage(); |
472 | 565 | } |
473 | 566 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
474 | - } else $all = array(); |
|
567 | + } else { |
|
568 | + $all = array(); |
|
569 | + } |
|
475 | 570 | } else { |
476 | 571 | if ($year == '' && $month == '') { |
477 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
478 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
572 | + if ($limit) { |
|
573 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
574 | + } else { |
|
575 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
576 | + } |
|
479 | 577 | try { |
480 | 578 | $sth = $this->db->prepare($query); |
481 | 579 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -483,7 +581,9 @@ discard block |
||
483 | 581 | echo "error : ".$e->getMessage(); |
484 | 582 | } |
485 | 583 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
486 | - } else $all = array(); |
|
584 | + } else { |
|
585 | + $all = array(); |
|
586 | + } |
|
487 | 587 | } |
488 | 588 | if (empty($all)) { |
489 | 589 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -502,7 +602,9 @@ discard block |
||
502 | 602 | } |
503 | 603 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
504 | 604 | global $globalStatsFilters; |
505 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
605 | + if ($filter_name == '') { |
|
606 | + $filter_name = $this->filter_name; |
|
607 | + } |
|
506 | 608 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
507 | 609 | $Spotter = new Spotter($this->db); |
508 | 610 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -511,8 +613,11 @@ discard block |
||
511 | 613 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
512 | 614 | } |
513 | 615 | if ($year == '' && $month == '') { |
514 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
515 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
616 | + if ($limit) { |
|
617 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
618 | + } else { |
|
619 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
620 | + } |
|
516 | 621 | try { |
517 | 622 | $sth = $this->db->prepare($query); |
518 | 623 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -520,11 +625,16 @@ discard block |
||
520 | 625 | echo "error : ".$e->getMessage(); |
521 | 626 | } |
522 | 627 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
523 | - } else $all = array(); |
|
628 | + } else { |
|
629 | + $all = array(); |
|
630 | + } |
|
524 | 631 | } else { |
525 | 632 | if ($year == '' && $month == '') { |
526 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
527 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
633 | + if ($limit) { |
|
634 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
635 | + } else { |
|
636 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
637 | + } |
|
528 | 638 | try { |
529 | 639 | $sth = $this->db->prepare($query); |
530 | 640 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -532,7 +642,9 @@ discard block |
||
532 | 642 | echo "error : ".$e->getMessage(); |
533 | 643 | } |
534 | 644 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
535 | - } else $all = array(); |
|
645 | + } else { |
|
646 | + $all = array(); |
|
647 | + } |
|
536 | 648 | } |
537 | 649 | if (empty($all)) { |
538 | 650 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -551,7 +663,9 @@ discard block |
||
551 | 663 | } |
552 | 664 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
553 | 665 | $Connection = new Connection($this->db); |
554 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
666 | + if ($filter_name == '') { |
|
667 | + $filter_name = $this->filter_name; |
|
668 | + } |
|
555 | 669 | if ($Connection->tableExists('countries')) { |
556 | 670 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
557 | 671 | $Spotter = new Spotter($this->db); |
@@ -561,8 +675,11 @@ discard block |
||
561 | 675 | foreach ($airlines as $airline) { |
562 | 676 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
563 | 677 | } |
564 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
565 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
678 | + if ($limit) { |
|
679 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
680 | + } else { |
|
681 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
682 | + } |
|
566 | 683 | try { |
567 | 684 | $sth = $this->db->prepare($query); |
568 | 685 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -571,11 +688,16 @@ discard block |
||
571 | 688 | } |
572 | 689 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
573 | 690 | return $all; |
574 | - } else return array(); |
|
691 | + } else { |
|
692 | + return array(); |
|
693 | + } |
|
575 | 694 | } else { |
576 | 695 | if ($year == '' && $month == '') { |
577 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
578 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
696 | + if ($limit) { |
|
697 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
698 | + } else { |
|
699 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
700 | + } |
|
579 | 701 | try { |
580 | 702 | $sth = $this->db->prepare($query); |
581 | 703 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -584,20 +706,29 @@ discard block |
||
584 | 706 | } |
585 | 707 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
586 | 708 | return $all; |
587 | - } else return array(); |
|
709 | + } else { |
|
710 | + return array(); |
|
711 | + } |
|
588 | 712 | } |
589 | 713 | $Spotter = new Spotter($this->db); |
590 | 714 | return $Spotter->countAllFlightOverCountries($limit); |
591 | - } else return array(); |
|
715 | + } else { |
|
716 | + return array(); |
|
717 | + } |
|
592 | 718 | } |
593 | 719 | public function countAllMarineOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
594 | 720 | $Connection = new Connection($this->db); |
595 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
721 | + if ($filter_name == '') { |
|
722 | + $filter_name = $this->filter_name; |
|
723 | + } |
|
596 | 724 | if ($Connection->tableExists('countries')) { |
597 | 725 | $all = array(); |
598 | 726 | if ($year == '' && $month == '') { |
599 | - if ($limit) $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC LIMIT 20 OFFSET 0"; |
|
600 | - else $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC"; |
|
727 | + if ($limit) { |
|
728 | + $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC LIMIT 20 OFFSET 0"; |
|
729 | + } else { |
|
730 | + $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC"; |
|
731 | + } |
|
601 | 732 | try { |
602 | 733 | $sth = $this->db->prepare($query); |
603 | 734 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -615,17 +746,24 @@ discard block |
||
615 | 746 | $all = $Marine->countAllMarineOverCountries($limit,0,'',$filters); |
616 | 747 | } |
617 | 748 | return $all; |
618 | - } else return array(); |
|
749 | + } else { |
|
750 | + return array(); |
|
751 | + } |
|
619 | 752 | } |
620 | 753 | public function countAllTrackerOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
621 | 754 | global $globalStatsFilters; |
622 | 755 | $Connection = new Connection($this->db); |
623 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
756 | + if ($filter_name == '') { |
|
757 | + $filter_name = $this->filter_name; |
|
758 | + } |
|
624 | 759 | if ($Connection->tableExists('countries')) { |
625 | 760 | $all = array(); |
626 | 761 | if ($year == '' && $month == '') { |
627 | - if ($limit) $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC LIMIT 20 OFFSET 0"; |
|
628 | - else $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC"; |
|
762 | + if ($limit) { |
|
763 | + $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC LIMIT 20 OFFSET 0"; |
|
764 | + } else { |
|
765 | + $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC"; |
|
766 | + } |
|
629 | 767 | try { |
630 | 768 | $sth = $this->db->prepare($query); |
631 | 769 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -644,14 +782,21 @@ discard block |
||
644 | 782 | $all = $Tracker->countAllTrackerOverCountries($limit,0,'',$filters); |
645 | 783 | } |
646 | 784 | return $all; |
647 | - } else return array(); |
|
785 | + } else { |
|
786 | + return array(); |
|
787 | + } |
|
648 | 788 | } |
649 | 789 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
650 | 790 | global $globalStatsFilters; |
651 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
791 | + if ($filter_name == '') { |
|
792 | + $filter_name = $this->filter_name; |
|
793 | + } |
|
652 | 794 | if ($year == '' && $month == '') { |
653 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
654 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
795 | + if ($limit) { |
|
796 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
797 | + } else { |
|
798 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
799 | + } |
|
655 | 800 | try { |
656 | 801 | $sth = $this->db->prepare($query); |
657 | 802 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -659,7 +804,9 @@ discard block |
||
659 | 804 | echo "error : ".$e->getMessage(); |
660 | 805 | } |
661 | 806 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
662 | - } else $all = array(); |
|
807 | + } else { |
|
808 | + $all = array(); |
|
809 | + } |
|
663 | 810 | if (empty($all)) { |
664 | 811 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
665 | 812 | if ($filter_name != '') { |
@@ -674,7 +821,9 @@ discard block |
||
674 | 821 | |
675 | 822 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
676 | 823 | global $globalStatsFilters; |
677 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
824 | + if ($filter_name == '') { |
|
825 | + $filter_name = $this->filter_name; |
|
826 | + } |
|
678 | 827 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
679 | 828 | $Spotter = new Spotter($this->db); |
680 | 829 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -683,8 +832,11 @@ discard block |
||
683 | 832 | foreach ($airlines as $airline) { |
684 | 833 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
685 | 834 | } |
686 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
687 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
835 | + if ($limit) { |
|
836 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
837 | + } else { |
|
838 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
839 | + } |
|
688 | 840 | try { |
689 | 841 | $sth = $this->db->prepare($query); |
690 | 842 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -692,11 +844,16 @@ discard block |
||
692 | 844 | echo "error : ".$e->getMessage(); |
693 | 845 | } |
694 | 846 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
695 | - } else $all = array(); |
|
847 | + } else { |
|
848 | + $all = array(); |
|
849 | + } |
|
696 | 850 | } else { |
697 | 851 | if ($year == '' && $month == '') { |
698 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
699 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
852 | + if ($limit) { |
|
853 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
854 | + } else { |
|
855 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
856 | + } |
|
700 | 857 | try { |
701 | 858 | $sth = $this->db->prepare($query); |
702 | 859 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -704,7 +861,9 @@ discard block |
||
704 | 861 | echo "error : ".$e->getMessage(); |
705 | 862 | } |
706 | 863 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
707 | - } else $all = array(); |
|
864 | + } else { |
|
865 | + $all = array(); |
|
866 | + } |
|
708 | 867 | } |
709 | 868 | if (empty($all)) { |
710 | 869 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -723,7 +882,9 @@ discard block |
||
723 | 882 | } |
724 | 883 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
725 | 884 | global $globalStatsFilters; |
726 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
885 | + if ($filter_name == '') { |
|
886 | + $filter_name = $this->filter_name; |
|
887 | + } |
|
727 | 888 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
728 | 889 | $Spotter = new Spotter($this->db); |
729 | 890 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -732,8 +893,11 @@ discard block |
||
732 | 893 | foreach ($airlines as $airline) { |
733 | 894 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
734 | 895 | } |
735 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
736 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
896 | + if ($limit) { |
|
897 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
898 | + } else { |
|
899 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
900 | + } |
|
737 | 901 | try { |
738 | 902 | $sth = $this->db->prepare($query); |
739 | 903 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -741,11 +905,16 @@ discard block |
||
741 | 905 | echo "error : ".$e->getMessage(); |
742 | 906 | } |
743 | 907 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
744 | - } else $all = array(); |
|
908 | + } else { |
|
909 | + $all = array(); |
|
910 | + } |
|
745 | 911 | } else { |
746 | 912 | if ($year == '' && $month == '') { |
747 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
748 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
913 | + if ($limit) { |
|
914 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
915 | + } else { |
|
916 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
917 | + } |
|
749 | 918 | try { |
750 | 919 | $sth = $this->db->prepare($query); |
751 | 920 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -753,7 +922,9 @@ discard block |
||
753 | 922 | echo "error : ".$e->getMessage(); |
754 | 923 | } |
755 | 924 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
756 | - } else $all = array(); |
|
925 | + } else { |
|
926 | + $all = array(); |
|
927 | + } |
|
757 | 928 | } |
758 | 929 | if (empty($all)) { |
759 | 930 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -778,7 +949,9 @@ discard block |
||
778 | 949 | $icao = $value['airport_departure_icao']; |
779 | 950 | if (isset($all[$icao])) { |
780 | 951 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
781 | - } else $all[$icao] = $value; |
|
952 | + } else { |
|
953 | + $all[$icao] = $value; |
|
954 | + } |
|
782 | 955 | } |
783 | 956 | $count = array(); |
784 | 957 | foreach ($all as $key => $row) { |
@@ -790,7 +963,9 @@ discard block |
||
790 | 963 | } |
791 | 964 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
792 | 965 | global $globalStatsFilters; |
793 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
966 | + if ($filter_name == '') { |
|
967 | + $filter_name = $this->filter_name; |
|
968 | + } |
|
794 | 969 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
795 | 970 | $Spotter = new Spotter($this->db); |
796 | 971 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -799,8 +974,11 @@ discard block |
||
799 | 974 | foreach ($airlines as $airline) { |
800 | 975 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
801 | 976 | } |
802 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
803 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
977 | + if ($limit) { |
|
978 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
979 | + } else { |
|
980 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
981 | + } |
|
804 | 982 | try { |
805 | 983 | $sth = $this->db->prepare($query); |
806 | 984 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -808,11 +986,16 @@ discard block |
||
808 | 986 | echo "error : ".$e->getMessage(); |
809 | 987 | } |
810 | 988 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
811 | - } else $all = array(); |
|
989 | + } else { |
|
990 | + $all = array(); |
|
991 | + } |
|
812 | 992 | } else { |
813 | 993 | if ($year == '' && $month == '') { |
814 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
815 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
994 | + if ($limit) { |
|
995 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
996 | + } else { |
|
997 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
998 | + } |
|
816 | 999 | try { |
817 | 1000 | $sth = $this->db->prepare($query); |
818 | 1001 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -820,7 +1003,9 @@ discard block |
||
820 | 1003 | echo "error : ".$e->getMessage(); |
821 | 1004 | } |
822 | 1005 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
823 | - } else $all = array(); |
|
1006 | + } else { |
|
1007 | + $all = array(); |
|
1008 | + } |
|
824 | 1009 | } |
825 | 1010 | if (empty($all)) { |
826 | 1011 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -845,7 +1030,9 @@ discard block |
||
845 | 1030 | $icao = $value['airport_arrival_icao']; |
846 | 1031 | if (isset($all[$icao])) { |
847 | 1032 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
848 | - } else $all[$icao] = $value; |
|
1033 | + } else { |
|
1034 | + $all[$icao] = $value; |
|
1035 | + } |
|
849 | 1036 | } |
850 | 1037 | $count = array(); |
851 | 1038 | foreach ($all as $key => $row) { |
@@ -857,7 +1044,9 @@ discard block |
||
857 | 1044 | } |
858 | 1045 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
859 | 1046 | global $globalDBdriver, $globalStatsFilters; |
860 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1047 | + if ($filter_name == '') { |
|
1048 | + $filter_name = $this->filter_name; |
|
1049 | + } |
|
861 | 1050 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
862 | 1051 | $Spotter = new Spotter($this->db); |
863 | 1052 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -866,20 +1055,32 @@ discard block |
||
866 | 1055 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
867 | 1056 | } |
868 | 1057 | if ($globalDBdriver == 'mysql') { |
869 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
870 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
1058 | + if ($limit) { |
|
1059 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
1060 | + } else { |
|
1061 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
1062 | + } |
|
871 | 1063 | } else { |
872 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
873 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
1064 | + if ($limit) { |
|
1065 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
1066 | + } else { |
|
1067 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
1068 | + } |
|
874 | 1069 | } |
875 | 1070 | $query_data = array(':filter_name' => $filter_name); |
876 | 1071 | } else { |
877 | 1072 | if ($globalDBdriver == 'mysql') { |
878 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
879 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1073 | + if ($limit) { |
|
1074 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1075 | + } else { |
|
1076 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1077 | + } |
|
880 | 1078 | } else { |
881 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
882 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1079 | + if ($limit) { |
|
1080 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1081 | + } else { |
|
1082 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1083 | + } |
|
883 | 1084 | } |
884 | 1085 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
885 | 1086 | } |
@@ -907,13 +1108,21 @@ discard block |
||
907 | 1108 | |
908 | 1109 | public function countAllMarineMonthsLastYear($limit = true,$filter_name = '') { |
909 | 1110 | global $globalDBdriver, $globalStatsFilters; |
910 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1111 | + if ($filter_name == '') { |
|
1112 | + $filter_name = $this->filter_name; |
|
1113 | + } |
|
911 | 1114 | if ($globalDBdriver == 'mysql') { |
912 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
913 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
1115 | + if ($limit) { |
|
1116 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
1117 | + } else { |
|
1118 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
1119 | + } |
|
914 | 1120 | } else { |
915 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
916 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
1121 | + if ($limit) { |
|
1122 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
1123 | + } else { |
|
1124 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
1125 | + } |
|
917 | 1126 | } |
918 | 1127 | $query_data = array(':filter_name' => $filter_name); |
919 | 1128 | try { |
@@ -936,13 +1145,21 @@ discard block |
||
936 | 1145 | |
937 | 1146 | public function countAllTrackerMonthsLastYear($limit = true,$filter_name = '') { |
938 | 1147 | global $globalDBdriver, $globalStatsFilters; |
939 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1148 | + if ($filter_name == '') { |
|
1149 | + $filter_name = $this->filter_name; |
|
1150 | + } |
|
940 | 1151 | if ($globalDBdriver == 'mysql') { |
941 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
942 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
1152 | + if ($limit) { |
|
1153 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
1154 | + } else { |
|
1155 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
1156 | + } |
|
943 | 1157 | } else { |
944 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
945 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
1158 | + if ($limit) { |
|
1159 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
1160 | + } else { |
|
1161 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
1162 | + } |
|
946 | 1163 | } |
947 | 1164 | $query_data = array(':filter_name' => $filter_name); |
948 | 1165 | try { |
@@ -965,7 +1182,9 @@ discard block |
||
965 | 1182 | |
966 | 1183 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
967 | 1184 | global $globalStatsFilters; |
968 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1185 | + if ($filter_name == '') { |
|
1186 | + $filter_name = $this->filter_name; |
|
1187 | + } |
|
969 | 1188 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
970 | 1189 | $Spotter = new Spotter($this->db); |
971 | 1190 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1002,7 +1221,9 @@ discard block |
||
1002 | 1221 | } |
1003 | 1222 | public function countAllMarineDatesLastMonth($filter_name = '') { |
1004 | 1223 | global $globalStatsFilters; |
1005 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1224 | + if ($filter_name == '') { |
|
1225 | + $filter_name = $this->filter_name; |
|
1226 | + } |
|
1006 | 1227 | $query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'month' AND filter_name = :filter_name"; |
1007 | 1228 | $query_data = array(':filter_name' => $filter_name); |
1008 | 1229 | try { |
@@ -1024,7 +1245,9 @@ discard block |
||
1024 | 1245 | } |
1025 | 1246 | public function countAllTrackerDatesLastMonth($filter_name = '') { |
1026 | 1247 | global $globalStatsFilters; |
1027 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1248 | + if ($filter_name == '') { |
|
1249 | + $filter_name = $this->filter_name; |
|
1250 | + } |
|
1028 | 1251 | $query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'month' AND filter_name = :filter_name"; |
1029 | 1252 | $query_data = array(':filter_name' => $filter_name); |
1030 | 1253 | try { |
@@ -1046,7 +1269,9 @@ discard block |
||
1046 | 1269 | } |
1047 | 1270 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
1048 | 1271 | global $globalDBdriver, $globalStatsFilters; |
1049 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1272 | + if ($filter_name == '') { |
|
1273 | + $filter_name = $this->filter_name; |
|
1274 | + } |
|
1050 | 1275 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1051 | 1276 | $Spotter = new Spotter($this->db); |
1052 | 1277 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1091,7 +1316,9 @@ discard block |
||
1091 | 1316 | } |
1092 | 1317 | public function countAllMarineDatesLast7Days($filter_name = '') { |
1093 | 1318 | global $globalDBdriver, $globalStatsFilters; |
1094 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1319 | + if ($filter_name == '') { |
|
1320 | + $filter_name = $this->filter_name; |
|
1321 | + } |
|
1095 | 1322 | if ($globalDBdriver == 'mysql') { |
1096 | 1323 | $query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'month' AND marine_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND filter_name = :filter_name"; |
1097 | 1324 | } else { |
@@ -1117,7 +1344,9 @@ discard block |
||
1117 | 1344 | } |
1118 | 1345 | public function countAllTrackerDatesLast7Days($filter_name = '') { |
1119 | 1346 | global $globalDBdriver, $globalStatsFilters; |
1120 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1347 | + if ($filter_name == '') { |
|
1348 | + $filter_name = $this->filter_name; |
|
1349 | + } |
|
1121 | 1350 | if ($globalDBdriver == 'mysql') { |
1122 | 1351 | $query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'month' AND tracker_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND filter_name = :filter_name"; |
1123 | 1352 | } else { |
@@ -1143,7 +1372,9 @@ discard block |
||
1143 | 1372 | } |
1144 | 1373 | public function countAllDates($stats_airline = '',$filter_name = '') { |
1145 | 1374 | global $globalStatsFilters; |
1146 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1375 | + if ($filter_name == '') { |
|
1376 | + $filter_name = $this->filter_name; |
|
1377 | + } |
|
1147 | 1378 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1148 | 1379 | $Spotter = new Spotter($this->db); |
1149 | 1380 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1180,7 +1411,9 @@ discard block |
||
1180 | 1411 | } |
1181 | 1412 | public function countAllDatesMarine($filter_name = '') { |
1182 | 1413 | global $globalStatsFilters; |
1183 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1414 | + if ($filter_name == '') { |
|
1415 | + $filter_name = $this->filter_name; |
|
1416 | + } |
|
1184 | 1417 | $query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'date' AND filter_name = :filter_name ORDER BY date_count DESC"; |
1185 | 1418 | $query_data = array(':filter_name' => $filter_name); |
1186 | 1419 | try { |
@@ -1202,7 +1435,9 @@ discard block |
||
1202 | 1435 | } |
1203 | 1436 | public function countAllDatesTracker($filter_name = '') { |
1204 | 1437 | global $globalStatsFilters; |
1205 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1438 | + if ($filter_name == '') { |
|
1439 | + $filter_name = $this->filter_name; |
|
1440 | + } |
|
1206 | 1441 | $query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'date' AND filter_name = :filter_name ORDER BY date_count DESC"; |
1207 | 1442 | $query_data = array(':filter_name' => $filter_name); |
1208 | 1443 | try { |
@@ -1224,7 +1459,9 @@ discard block |
||
1224 | 1459 | } |
1225 | 1460 | public function countAllDatesByAirlines($filter_name = '') { |
1226 | 1461 | global $globalStatsFilters; |
1227 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1462 | + if ($filter_name == '') { |
|
1463 | + $filter_name = $this->filter_name; |
|
1464 | + } |
|
1228 | 1465 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
1229 | 1466 | $query_data = array('filter_name' => $filter_name); |
1230 | 1467 | try { |
@@ -1246,7 +1483,9 @@ discard block |
||
1246 | 1483 | } |
1247 | 1484 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
1248 | 1485 | global $globalStatsFilters, $globalDBdriver; |
1249 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1486 | + if ($filter_name == '') { |
|
1487 | + $filter_name = $this->filter_name; |
|
1488 | + } |
|
1250 | 1489 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1251 | 1490 | $Spotter = new Spotter($this->db); |
1252 | 1491 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1331,7 +1570,9 @@ discard block |
||
1331 | 1570 | } |
1332 | 1571 | public function countAllMilitaryMonths($filter_name = '') { |
1333 | 1572 | global $globalStatsFilters; |
1334 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1573 | + if ($filter_name == '') { |
|
1574 | + $filter_name = $this->filter_name; |
|
1575 | + } |
|
1335 | 1576 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
1336 | 1577 | try { |
1337 | 1578 | $sth = $this->db->prepare($query); |
@@ -1352,7 +1593,9 @@ discard block |
||
1352 | 1593 | } |
1353 | 1594 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
1354 | 1595 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1355 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1596 | + if ($filter_name == '') { |
|
1597 | + $filter_name = $this->filter_name; |
|
1598 | + } |
|
1356 | 1599 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1357 | 1600 | $Spotter = new Spotter($this->db); |
1358 | 1601 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1360,12 +1603,18 @@ discard block |
||
1360 | 1603 | foreach ($airlines as $airline) { |
1361 | 1604 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
1362 | 1605 | } |
1363 | - if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1364 | - else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1606 | + if ($limit) { |
|
1607 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1608 | + } else { |
|
1609 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1610 | + } |
|
1365 | 1611 | $query_data = array(':filter_name' => $filter_name); |
1366 | 1612 | } else { |
1367 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1368 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1613 | + if ($limit) { |
|
1614 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1615 | + } else { |
|
1616 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1617 | + } |
|
1369 | 1618 | $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1370 | 1619 | } |
1371 | 1620 | if ($orderby == 'hour') { |
@@ -1375,7 +1624,9 @@ discard block |
||
1375 | 1624 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
1376 | 1625 | } |
1377 | 1626 | } |
1378 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
1627 | + if ($orderby == 'count') { |
|
1628 | + $query .= " ORDER BY hour_count DESC"; |
|
1629 | + } |
|
1379 | 1630 | try { |
1380 | 1631 | $sth = $this->db->prepare($query); |
1381 | 1632 | $sth->execute($query_data); |
@@ -1399,9 +1650,14 @@ discard block |
||
1399 | 1650 | } |
1400 | 1651 | public function countAllMarineHours($orderby = 'hour',$limit = true,$filter_name = '') { |
1401 | 1652 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1402 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1403 | - if ($limit) $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
1404 | - else $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
1653 | + if ($filter_name == '') { |
|
1654 | + $filter_name = $this->filter_name; |
|
1655 | + } |
|
1656 | + if ($limit) { |
|
1657 | + $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
1658 | + } else { |
|
1659 | + $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
1660 | + } |
|
1405 | 1661 | $query_data = array(':filter_name' => $filter_name); |
1406 | 1662 | if ($orderby == 'hour') { |
1407 | 1663 | if ($globalDBdriver == 'mysql') { |
@@ -1410,7 +1666,9 @@ discard block |
||
1410 | 1666 | $query .= " ORDER BY CAST(marine_date AS integer) ASC"; |
1411 | 1667 | } |
1412 | 1668 | } |
1413 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
1669 | + if ($orderby == 'count') { |
|
1670 | + $query .= " ORDER BY hour_count DESC"; |
|
1671 | + } |
|
1414 | 1672 | try { |
1415 | 1673 | $sth = $this->db->prepare($query); |
1416 | 1674 | $sth->execute($query_data); |
@@ -1430,9 +1688,14 @@ discard block |
||
1430 | 1688 | } |
1431 | 1689 | public function countAllTrackerHours($orderby = 'hour',$limit = true,$filter_name = '') { |
1432 | 1690 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1433 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1434 | - if ($limit) $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
1435 | - else $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
1691 | + if ($filter_name == '') { |
|
1692 | + $filter_name = $this->filter_name; |
|
1693 | + } |
|
1694 | + if ($limit) { |
|
1695 | + $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
1696 | + } else { |
|
1697 | + $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
1698 | + } |
|
1436 | 1699 | $query_data = array(':filter_name' => $filter_name); |
1437 | 1700 | if ($orderby == 'hour') { |
1438 | 1701 | if ($globalDBdriver == 'mysql') { |
@@ -1441,7 +1704,9 @@ discard block |
||
1441 | 1704 | $query .= " ORDER BY CAST(tracker_date AS integer) ASC"; |
1442 | 1705 | } |
1443 | 1706 | } |
1444 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
1707 | + if ($orderby == 'count') { |
|
1708 | + $query .= " ORDER BY hour_count DESC"; |
|
1709 | + } |
|
1445 | 1710 | try { |
1446 | 1711 | $sth = $this->db->prepare($query); |
1447 | 1712 | $sth->execute($query_data); |
@@ -1461,8 +1726,12 @@ discard block |
||
1461 | 1726 | } |
1462 | 1727 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
1463 | 1728 | global $globalStatsFilters; |
1464 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1465 | - if ($year == '') $year = date('Y'); |
|
1729 | + if ($filter_name == '') { |
|
1730 | + $filter_name = $this->filter_name; |
|
1731 | + } |
|
1732 | + if ($year == '') { |
|
1733 | + $year = date('Y'); |
|
1734 | + } |
|
1466 | 1735 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
1467 | 1736 | if (empty($all)) { |
1468 | 1737 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1481,8 +1750,12 @@ discard block |
||
1481 | 1750 | } |
1482 | 1751 | public function countOverallMarine($filter_name = '',$year = '',$month = '') { |
1483 | 1752 | global $globalStatsFilters; |
1484 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1485 | - if ($year == '') $year = date('Y'); |
|
1753 | + if ($filter_name == '') { |
|
1754 | + $filter_name = $this->filter_name; |
|
1755 | + } |
|
1756 | + if ($year == '') { |
|
1757 | + $year = date('Y'); |
|
1758 | + } |
|
1486 | 1759 | $all = $this->getSumStats('marine_bymonth',$year,'',$filter_name,$month); |
1487 | 1760 | if (empty($all)) { |
1488 | 1761 | $filters = array('year' => $year,'month' => $month); |
@@ -1497,8 +1770,12 @@ discard block |
||
1497 | 1770 | } |
1498 | 1771 | public function countOverallTracker($filter_name = '',$year = '',$month = '') { |
1499 | 1772 | global $globalStatsFilters; |
1500 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1501 | - if ($year == '') $year = date('Y'); |
|
1773 | + if ($filter_name == '') { |
|
1774 | + $filter_name = $this->filter_name; |
|
1775 | + } |
|
1776 | + if ($year == '') { |
|
1777 | + $year = date('Y'); |
|
1778 | + } |
|
1502 | 1779 | $all = $this->getSumStats('tracker_bymonth',$year,'',$filter_name,$month); |
1503 | 1780 | if (empty($all)) { |
1504 | 1781 | $filters = array('year' => $year,'month' => $month); |
@@ -1513,8 +1790,12 @@ discard block |
||
1513 | 1790 | } |
1514 | 1791 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
1515 | 1792 | global $globalStatsFilters; |
1516 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1517 | - if ($year == '') $year = date('Y'); |
|
1793 | + if ($filter_name == '') { |
|
1794 | + $filter_name = $this->filter_name; |
|
1795 | + } |
|
1796 | + if ($year == '') { |
|
1797 | + $year = date('Y'); |
|
1798 | + } |
|
1518 | 1799 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
1519 | 1800 | if (empty($all)) { |
1520 | 1801 | $filters = array(); |
@@ -1530,8 +1811,12 @@ discard block |
||
1530 | 1811 | } |
1531 | 1812 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
1532 | 1813 | global $globalStatsFilters; |
1533 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1534 | - if ($year == '') $year = date('Y'); |
|
1814 | + if ($filter_name == '') { |
|
1815 | + $filter_name = $this->filter_name; |
|
1816 | + } |
|
1817 | + if ($year == '') { |
|
1818 | + $year = date('Y'); |
|
1819 | + } |
|
1535 | 1820 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
1536 | 1821 | if (empty($all)) { |
1537 | 1822 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1550,7 +1835,9 @@ discard block |
||
1550 | 1835 | } |
1551 | 1836 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
1552 | 1837 | global $globalStatsFilters; |
1553 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1838 | + if ($filter_name == '') { |
|
1839 | + $filter_name = $this->filter_name; |
|
1840 | + } |
|
1554 | 1841 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1555 | 1842 | $Spotter = new Spotter($this->db); |
1556 | 1843 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1568,7 +1855,9 @@ discard block |
||
1568 | 1855 | } |
1569 | 1856 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1570 | 1857 | $all = $result[0]['nb']; |
1571 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1858 | + } else { |
|
1859 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1860 | + } |
|
1572 | 1861 | } else { |
1573 | 1862 | if ($year == '' && $month == '') { |
1574 | 1863 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1580,7 +1869,9 @@ discard block |
||
1580 | 1869 | } |
1581 | 1870 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1582 | 1871 | $all = $result[0]['nb']; |
1583 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1872 | + } else { |
|
1873 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1874 | + } |
|
1584 | 1875 | } |
1585 | 1876 | if (empty($all)) { |
1586 | 1877 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1599,7 +1890,9 @@ discard block |
||
1599 | 1890 | } |
1600 | 1891 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
1601 | 1892 | global $globalStatsFilters; |
1602 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1893 | + if ($filter_name == '') { |
|
1894 | + $filter_name = $this->filter_name; |
|
1895 | + } |
|
1603 | 1896 | if ($year == '' && $month == '') { |
1604 | 1897 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
1605 | 1898 | try { |
@@ -1610,7 +1903,9 @@ discard block |
||
1610 | 1903 | } |
1611 | 1904 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1612 | 1905 | $all = $result[0]['nb_airline']; |
1613 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1906 | + } else { |
|
1907 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1908 | + } |
|
1614 | 1909 | if (empty($all)) { |
1615 | 1910 | $filters = array(); |
1616 | 1911 | $filters = array('year' => $year,'month' => $month); |
@@ -1625,7 +1920,9 @@ discard block |
||
1625 | 1920 | } |
1626 | 1921 | public function countOverallMarineTypes($filter_name = '',$year = '',$month = '') { |
1627 | 1922 | global $globalStatsFilters; |
1628 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1923 | + if ($filter_name == '') { |
|
1924 | + $filter_name = $this->filter_name; |
|
1925 | + } |
|
1629 | 1926 | $all = array(); |
1630 | 1927 | if ($year == '' && $month == '') { |
1631 | 1928 | $query = "SELECT COUNT(*) AS nb_type FROM stats_marine_type WHERE filter_name = :filter_name"; |
@@ -1652,7 +1949,9 @@ discard block |
||
1652 | 1949 | } |
1653 | 1950 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
1654 | 1951 | global $globalStatsFilters; |
1655 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1952 | + if ($filter_name == '') { |
|
1953 | + $filter_name = $this->filter_name; |
|
1954 | + } |
|
1656 | 1955 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1657 | 1956 | $Spotter = new Spotter($this->db); |
1658 | 1957 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1707,7 +2006,9 @@ discard block |
||
1707 | 2006 | } |
1708 | 2007 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
1709 | 2008 | global $globalStatsFilters; |
1710 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2009 | + if ($filter_name == '') { |
|
2010 | + $filter_name = $this->filter_name; |
|
2011 | + } |
|
1711 | 2012 | //if ($year == '') $year = date('Y'); |
1712 | 2013 | if ($year == '' && $month == '') { |
1713 | 2014 | $query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1736,7 +2037,9 @@ discard block |
||
1736 | 2037 | } |
1737 | 2038 | |
1738 | 2039 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
1739 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2040 | + if ($filter_name == '') { |
|
2041 | + $filter_name = $this->filter_name; |
|
2042 | + } |
|
1740 | 2043 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1741 | 2044 | $Spotter = new Spotter($this->db); |
1742 | 2045 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1760,7 +2063,9 @@ discard block |
||
1760 | 2063 | return $all; |
1761 | 2064 | } |
1762 | 2065 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
1763 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2066 | + if ($filter_name == '') { |
|
2067 | + $filter_name = $this->filter_name; |
|
2068 | + } |
|
1764 | 2069 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
1765 | 2070 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
1766 | 2071 | try { |
@@ -1773,7 +2078,9 @@ discard block |
||
1773 | 2078 | return $all; |
1774 | 2079 | } |
1775 | 2080 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
1776 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2081 | + if ($filter_name == '') { |
|
2082 | + $filter_name = $this->filter_name; |
|
2083 | + } |
|
1777 | 2084 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1778 | 2085 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
1779 | 2086 | try { |
@@ -1784,7 +2091,9 @@ discard block |
||
1784 | 2091 | } |
1785 | 2092 | } |
1786 | 2093 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
1787 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2094 | + if ($filter_name == '') { |
|
2095 | + $filter_name = $this->filter_name; |
|
2096 | + } |
|
1788 | 2097 | global $globalArchiveMonths, $globalDBdriver; |
1789 | 2098 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1790 | 2099 | $Spotter = new Spotter($this->db); |
@@ -1840,7 +2149,9 @@ discard block |
||
1840 | 2149 | } |
1841 | 2150 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
1842 | 2151 | global $globalArchiveMonths, $globalDBdriver; |
1843 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2152 | + if ($filter_name == '') { |
|
2153 | + $filter_name = $this->filter_name; |
|
2154 | + } |
|
1844 | 2155 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1845 | 2156 | $Spotter = new Spotter($this->db); |
1846 | 2157 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1873,7 +2184,9 @@ discard block |
||
1873 | 2184 | } |
1874 | 2185 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
1875 | 2186 | global $globalArchiveMonths, $globalDBdriver; |
1876 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2187 | + if ($filter_name == '') { |
|
2188 | + $filter_name = $this->filter_name; |
|
2189 | + } |
|
1877 | 2190 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1878 | 2191 | $Spotter = new Spotter($this->db); |
1879 | 2192 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1904,7 +2217,9 @@ discard block |
||
1904 | 2217 | } |
1905 | 2218 | public function getStatsAirlineTotal($filter_name = '') { |
1906 | 2219 | global $globalArchiveMonths, $globalDBdriver; |
1907 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2220 | + if ($filter_name == '') { |
|
2221 | + $filter_name = $this->filter_name; |
|
2222 | + } |
|
1908 | 2223 | if ($globalDBdriver == 'mysql') { |
1909 | 2224 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
1910 | 2225 | } else { |
@@ -1921,7 +2236,9 @@ discard block |
||
1921 | 2236 | } |
1922 | 2237 | public function getStatsOwnerTotal($filter_name = '') { |
1923 | 2238 | global $globalArchiveMonths, $globalDBdriver; |
1924 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2239 | + if ($filter_name == '') { |
|
2240 | + $filter_name = $this->filter_name; |
|
2241 | + } |
|
1925 | 2242 | if ($globalDBdriver == 'mysql') { |
1926 | 2243 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
1927 | 2244 | } else { |
@@ -1938,7 +2255,9 @@ discard block |
||
1938 | 2255 | } |
1939 | 2256 | public function getStatsOwner($owner_name,$filter_name = '') { |
1940 | 2257 | global $globalArchiveMonths, $globalDBdriver; |
1941 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2258 | + if ($filter_name == '') { |
|
2259 | + $filter_name = $this->filter_name; |
|
2260 | + } |
|
1942 | 2261 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
1943 | 2262 | try { |
1944 | 2263 | $sth = $this->db->prepare($query); |
@@ -1947,12 +2266,17 @@ discard block |
||
1947 | 2266 | echo "error : ".$e->getMessage(); |
1948 | 2267 | } |
1949 | 2268 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1950 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1951 | - else return 0; |
|
2269 | + if (isset($all[0]['cnt'])) { |
|
2270 | + return $all[0]['cnt']; |
|
2271 | + } else { |
|
2272 | + return 0; |
|
2273 | + } |
|
1952 | 2274 | } |
1953 | 2275 | public function getStatsPilotTotal($filter_name = '') { |
1954 | 2276 | global $globalArchiveMonths, $globalDBdriver; |
1955 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2277 | + if ($filter_name == '') { |
|
2278 | + $filter_name = $this->filter_name; |
|
2279 | + } |
|
1956 | 2280 | if ($globalDBdriver == 'mysql') { |
1957 | 2281 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
1958 | 2282 | } else { |
@@ -1969,7 +2293,9 @@ discard block |
||
1969 | 2293 | } |
1970 | 2294 | public function getStatsPilot($pilot,$filter_name = '') { |
1971 | 2295 | global $globalArchiveMonths, $globalDBdriver; |
1972 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2296 | + if ($filter_name == '') { |
|
2297 | + $filter_name = $this->filter_name; |
|
2298 | + } |
|
1973 | 2299 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1974 | 2300 | try { |
1975 | 2301 | $sth = $this->db->prepare($query); |
@@ -1978,13 +2304,18 @@ discard block |
||
1978 | 2304 | echo "error : ".$e->getMessage(); |
1979 | 2305 | } |
1980 | 2306 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1981 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1982 | - else return 0; |
|
2307 | + if (isset($all[0]['cnt'])) { |
|
2308 | + return $all[0]['cnt']; |
|
2309 | + } else { |
|
2310 | + return 0; |
|
2311 | + } |
|
1983 | 2312 | } |
1984 | 2313 | |
1985 | 2314 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1986 | 2315 | global $globalDBdriver; |
1987 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2316 | + if ($filter_name == '') { |
|
2317 | + $filter_name = $this->filter_name; |
|
2318 | + } |
|
1988 | 2319 | if ($globalDBdriver == 'mysql') { |
1989 | 2320 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
1990 | 2321 | } else { |
@@ -2000,7 +2331,9 @@ discard block |
||
2000 | 2331 | } |
2001 | 2332 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
2002 | 2333 | global $globalDBdriver; |
2003 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
2334 | + if ($filter_name == '') { |
|
2335 | + $filter_name = $this->filter_name; |
|
2336 | + } |
|
2004 | 2337 | if ($globalDBdriver == 'mysql') { |
2005 | 2338 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
2006 | 2339 | } else { |
@@ -2519,27 +2852,37 @@ discard block |
||
2519 | 2852 | date_default_timezone_set('UTC'); |
2520 | 2853 | if ((isset($globalMarine) && $globalMarine) || (isset($globalMasterServer) && $globalMasterServer)) { |
2521 | 2854 | $last_update = $this->getLastStatsUpdate('last_update_stats_marine'); |
2522 | - if ($globalDebug) echo '!!! Update Marine stats !!!'."\n"; |
|
2855 | + if ($globalDebug) { |
|
2856 | + echo '!!! Update Marine stats !!!'."\n"; |
|
2857 | + } |
|
2523 | 2858 | if (isset($last_update[0]['value'])) { |
2524 | 2859 | $last_update_day = $last_update[0]['value']; |
2525 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
2860 | + } else { |
|
2861 | + $last_update_day = '2012-12-12 12:12:12'; |
|
2862 | + } |
|
2526 | 2863 | $reset = false; |
2527 | 2864 | $Marine = new Marine($this->db); |
2528 | 2865 | $filtername = 'marine'; |
2529 | 2866 | if ($Connection->tableExists('countries')) { |
2530 | - if ($globalDebug) echo 'Count all vessels by countries...'."\n"; |
|
2867 | + if ($globalDebug) { |
|
2868 | + echo 'Count all vessels by countries...'."\n"; |
|
2869 | + } |
|
2531 | 2870 | $alldata = $Marine->countAllMarineOverCountries(false,0,$last_update_day); |
2532 | 2871 | foreach ($alldata as $number) { |
2533 | 2872 | echo $this->addStatCountryMarine($number['marine_country_iso2'],$number['marine_country_iso3'],$number['marine_country'],$number['marine_count'],'','',$reset); |
2534 | 2873 | } |
2535 | 2874 | } |
2536 | - if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
|
2875 | + if ($globalDebug) { |
|
2876 | + echo 'Count all vessels by months...'."\n"; |
|
2877 | + } |
|
2537 | 2878 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
2538 | 2879 | $filter_last_month = array('since_date' => $last_month); |
2539 | 2880 | $alldata = $Marine->countAllMonths($filter_last_month); |
2540 | 2881 | $lastyear = false; |
2541 | 2882 | foreach ($alldata as $number) { |
2542 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2883 | + if ($number['year_name'] != date('Y')) { |
|
2884 | + $lastyear = true; |
|
2885 | + } |
|
2543 | 2886 | $this->addStat('marine_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2544 | 2887 | } |
2545 | 2888 | echo 'Marine data...'."\n"; |
@@ -2569,7 +2912,9 @@ discard block |
||
2569 | 2912 | foreach ($alldata as $number) { |
2570 | 2913 | $this->addStatMarine('hour',$number['hour_name'],$number['hour_count']); |
2571 | 2914 | } |
2572 | - if ($globalDebug) echo 'Count all types...'."\n"; |
|
2915 | + if ($globalDebug) { |
|
2916 | + echo 'Count all types...'."\n"; |
|
2917 | + } |
|
2573 | 2918 | $alldata = $Marine->countAllMarineTypes(false,0,$last_update_day); |
2574 | 2919 | foreach ($alldata as $number) { |
2575 | 2920 | $this->addStatMarineType($number['marine_type'],$number['marine_type_id'],$number['marine_type_count'],'',$reset); |
@@ -2581,26 +2926,36 @@ discard block |
||
2581 | 2926 | } |
2582 | 2927 | if ((isset($globalTracker) && $globalTracker) || (isset($globalMasterServer) && $globalMasterServer)) { |
2583 | 2928 | $last_update = $this->getLastStatsUpdate('last_update_stats_tracker'); |
2584 | - if ($globalDebug) echo '!!! Update tracker stats !!!'."\n"; |
|
2929 | + if ($globalDebug) { |
|
2930 | + echo '!!! Update tracker stats !!!'."\n"; |
|
2931 | + } |
|
2585 | 2932 | if (isset($last_update[0]['value'])) { |
2586 | 2933 | $last_update_day = $last_update[0]['value']; |
2587 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
2934 | + } else { |
|
2935 | + $last_update_day = '2012-12-12 12:12:12'; |
|
2936 | + } |
|
2588 | 2937 | $reset = false; |
2589 | 2938 | $Tracker = new Tracker($this->db); |
2590 | 2939 | if ($Connection->tableExists('countries')) { |
2591 | - if ($globalDebug) echo 'Count all trackers by countries...'."\n"; |
|
2940 | + if ($globalDebug) { |
|
2941 | + echo 'Count all trackers by countries...'."\n"; |
|
2942 | + } |
|
2592 | 2943 | $alldata = $Tracker->countAllTrackerOverCountries(false,0,$last_update_day); |
2593 | 2944 | foreach ($alldata as $number) { |
2594 | 2945 | $this->addStatCountryTracker($number['tracker_country_iso2'],$number['tracker_country_iso3'],$number['tracker_country'],$number['tracker_count'],'','',$reset); |
2595 | 2946 | } |
2596 | 2947 | } |
2597 | - if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
|
2948 | + if ($globalDebug) { |
|
2949 | + echo 'Count all vessels by months...'."\n"; |
|
2950 | + } |
|
2598 | 2951 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
2599 | 2952 | $filter_last_month = array('since_date' => $last_month); |
2600 | 2953 | $alldata = $Tracker->countAllMonths($filter_last_month); |
2601 | 2954 | $lastyear = false; |
2602 | 2955 | foreach ($alldata as $number) { |
2603 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2956 | + if ($number['year_name'] != date('Y')) { |
|
2957 | + $lastyear = true; |
|
2958 | + } |
|
2604 | 2959 | $this->addStat('tracker_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2605 | 2960 | } |
2606 | 2961 | echo 'Tracker data...'."\n"; |
@@ -2630,7 +2985,9 @@ discard block |
||
2630 | 2985 | foreach ($alldata as $number) { |
2631 | 2986 | $this->addStatTracker('hour',$number['hour_name'],$number['hour_count']); |
2632 | 2987 | } |
2633 | - if ($globalDebug) echo 'Count all types...'."\n"; |
|
2988 | + if ($globalDebug) { |
|
2989 | + echo 'Count all types...'."\n"; |
|
2990 | + } |
|
2634 | 2991 | $alldata = $Tracker->countAllTrackerTypes(false,0,$last_update_day); |
2635 | 2992 | foreach ($alldata as $number) { |
2636 | 2993 | $this->addStatTrackerType($number['tracker_type'],$number['tracker_type_count'],'',$reset); |
@@ -2642,10 +2999,14 @@ discard block |
||
2642 | 2999 | |
2643 | 3000 | if (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft) || (isset($globalMasterServer) && $globalMasterServer)) { |
2644 | 3001 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
2645 | - if ($globalDebug) echo '!!! Update aicraft stats !!!'."\n"; |
|
3002 | + if ($globalDebug) { |
|
3003 | + echo '!!! Update aicraft stats !!!'."\n"; |
|
3004 | + } |
|
2646 | 3005 | if (isset($last_update[0]['value'])) { |
2647 | 3006 | $last_update_day = $last_update[0]['value']; |
2648 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
3007 | + } else { |
|
3008 | + $last_update_day = '2012-12-12 12:12:12'; |
|
3009 | + } |
|
2649 | 3010 | $reset = false; |
2650 | 3011 | //if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) { |
2651 | 3012 | if ($globalStatsResetYear) { |
@@ -2654,43 +3015,63 @@ discard block |
||
2654 | 3015 | } |
2655 | 3016 | $Spotter = new Spotter($this->db); |
2656 | 3017 | |
2657 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
3018 | + if ($globalDebug) { |
|
3019 | + echo 'Count all aircraft types...'."\n"; |
|
3020 | + } |
|
2658 | 3021 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
2659 | 3022 | foreach ($alldata as $number) { |
2660 | 3023 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
2661 | 3024 | } |
2662 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
3025 | + if ($globalDebug) { |
|
3026 | + echo 'Count all airlines...'."\n"; |
|
3027 | + } |
|
2663 | 3028 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
2664 | 3029 | foreach ($alldata as $number) { |
2665 | 3030 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
2666 | 3031 | } |
2667 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
3032 | + if ($globalDebug) { |
|
3033 | + echo 'Count all registrations...'."\n"; |
|
3034 | + } |
|
2668 | 3035 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
2669 | 3036 | foreach ($alldata as $number) { |
2670 | 3037 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
2671 | 3038 | } |
2672 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
3039 | + if ($globalDebug) { |
|
3040 | + echo 'Count all callsigns...'."\n"; |
|
3041 | + } |
|
2673 | 3042 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
2674 | 3043 | foreach ($alldata as $number) { |
2675 | 3044 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
2676 | 3045 | } |
2677 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
3046 | + if ($globalDebug) { |
|
3047 | + echo 'Count all owners...'."\n"; |
|
3048 | + } |
|
2678 | 3049 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
2679 | 3050 | foreach ($alldata as $number) { |
2680 | 3051 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
2681 | 3052 | } |
2682 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
3053 | + if ($globalDebug) { |
|
3054 | + echo 'Count all pilots...'."\n"; |
|
3055 | + } |
|
2683 | 3056 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
2684 | 3057 | foreach ($alldata as $number) { |
2685 | - if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
|
3058 | + if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') { |
|
3059 | + $number['pilot_id'] = $number['pilot_name']; |
|
3060 | + } |
|
2686 | 3061 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
2687 | 3062 | } |
2688 | 3063 | |
2689 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
3064 | + if ($globalDebug) { |
|
3065 | + echo 'Count all departure airports...'."\n"; |
|
3066 | + } |
|
2690 | 3067 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
2691 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
3068 | + if ($globalDebug) { |
|
3069 | + echo 'Count all detected departure airports...'."\n"; |
|
3070 | + } |
|
2692 | 3071 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
2693 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
3072 | + if ($globalDebug) { |
|
3073 | + echo 'Order departure airports...'."\n"; |
|
3074 | + } |
|
2694 | 3075 | $alldata = array(); |
2695 | 3076 | foreach ($pall as $value) { |
2696 | 3077 | $icao = $value['airport_departure_icao']; |
@@ -2700,7 +3081,9 @@ discard block |
||
2700 | 3081 | $icao = $value['airport_departure_icao']; |
2701 | 3082 | if (isset($alldata[$icao])) { |
2702 | 3083 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
2703 | - } else $alldata[$icao] = $value; |
|
3084 | + } else { |
|
3085 | + $alldata[$icao] = $value; |
|
3086 | + } |
|
2704 | 3087 | } |
2705 | 3088 | $count = array(); |
2706 | 3089 | foreach ($alldata as $key => $row) { |
@@ -2710,11 +3093,17 @@ discard block |
||
2710 | 3093 | foreach ($alldata as $number) { |
2711 | 3094 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
2712 | 3095 | } |
2713 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
3096 | + if ($globalDebug) { |
|
3097 | + echo 'Count all arrival airports...'."\n"; |
|
3098 | + } |
|
2714 | 3099 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
2715 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
3100 | + if ($globalDebug) { |
|
3101 | + echo 'Count all detected arrival airports...'."\n"; |
|
3102 | + } |
|
2716 | 3103 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
2717 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
3104 | + if ($globalDebug) { |
|
3105 | + echo 'Order arrival airports...'."\n"; |
|
3106 | + } |
|
2718 | 3107 | $alldata = array(); |
2719 | 3108 | foreach ($pall as $value) { |
2720 | 3109 | $icao = $value['airport_arrival_icao']; |
@@ -2724,7 +3113,9 @@ discard block |
||
2724 | 3113 | $icao = $value['airport_arrival_icao']; |
2725 | 3114 | if (isset($alldata[$icao])) { |
2726 | 3115 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
2727 | - } else $alldata[$icao] = $value; |
|
3116 | + } else { |
|
3117 | + $alldata[$icao] = $value; |
|
3118 | + } |
|
2728 | 3119 | } |
2729 | 3120 | $count = array(); |
2730 | 3121 | foreach ($alldata as $key => $row) { |
@@ -2735,7 +3126,9 @@ discard block |
||
2735 | 3126 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
2736 | 3127 | } |
2737 | 3128 | if ($Connection->tableExists('countries')) { |
2738 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
3129 | + if ($globalDebug) { |
|
3130 | + echo 'Count all flights by countries...'."\n"; |
|
3131 | + } |
|
2739 | 3132 | //$SpotterArchive = new SpotterArchive(); |
2740 | 3133 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
2741 | 3134 | $Spotter = new Spotter($this->db); |
@@ -2746,7 +3139,9 @@ discard block |
||
2746 | 3139 | } |
2747 | 3140 | |
2748 | 3141 | if (isset($globalAccidents) && $globalAccidents) { |
2749 | - if ($globalDebug) echo 'Count fatalities stats...'."\n"; |
|
3142 | + if ($globalDebug) { |
|
3143 | + echo 'Count fatalities stats...'."\n"; |
|
3144 | + } |
|
2750 | 3145 | $Accident = new Accident($this->db); |
2751 | 3146 | $this->deleteStatsByType('fatalities_byyear'); |
2752 | 3147 | $alldata = $Accident->countFatalitiesByYear(); |
@@ -2762,48 +3157,68 @@ discard block |
||
2762 | 3157 | |
2763 | 3158 | // Add by month using getstat if month finish... |
2764 | 3159 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
2765 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
3160 | + if ($globalDebug) { |
|
3161 | + echo 'Count all flights by months...'."\n"; |
|
3162 | + } |
|
2766 | 3163 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
2767 | 3164 | $filter_last_month = array('since_date' => $last_month); |
2768 | 3165 | $Spotter = new Spotter($this->db); |
2769 | 3166 | $alldata = $Spotter->countAllMonths($filter_last_month); |
2770 | 3167 | $lastyear = false; |
2771 | 3168 | foreach ($alldata as $number) { |
2772 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
3169 | + if ($number['year_name'] != date('Y')) { |
|
3170 | + $lastyear = true; |
|
3171 | + } |
|
2773 | 3172 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2774 | 3173 | } |
2775 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
3174 | + if ($globalDebug) { |
|
3175 | + echo 'Count all military flights by months...'."\n"; |
|
3176 | + } |
|
2776 | 3177 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
2777 | 3178 | foreach ($alldata as $number) { |
2778 | 3179 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2779 | 3180 | } |
2780 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
3181 | + if ($globalDebug) { |
|
3182 | + echo 'Count all owners by months...'."\n"; |
|
3183 | + } |
|
2781 | 3184 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
2782 | 3185 | foreach ($alldata as $number) { |
2783 | 3186 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2784 | 3187 | } |
2785 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
3188 | + if ($globalDebug) { |
|
3189 | + echo 'Count all pilots by months...'."\n"; |
|
3190 | + } |
|
2786 | 3191 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
2787 | 3192 | foreach ($alldata as $number) { |
2788 | 3193 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2789 | 3194 | } |
2790 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
3195 | + if ($globalDebug) { |
|
3196 | + echo 'Count all airlines by months...'."\n"; |
|
3197 | + } |
|
2791 | 3198 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
2792 | 3199 | foreach ($alldata as $number) { |
2793 | 3200 | $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2794 | 3201 | } |
2795 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
3202 | + if ($globalDebug) { |
|
3203 | + echo 'Count all aircrafts by months...'."\n"; |
|
3204 | + } |
|
2796 | 3205 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
2797 | 3206 | foreach ($alldata as $number) { |
2798 | 3207 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2799 | 3208 | } |
2800 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
3209 | + if ($globalDebug) { |
|
3210 | + echo 'Count all real arrivals by months...'."\n"; |
|
3211 | + } |
|
2801 | 3212 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
2802 | 3213 | foreach ($alldata as $number) { |
2803 | 3214 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2804 | 3215 | } |
2805 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
2806 | - if ($globalDebug) echo '...Departure'."\n"; |
|
3216 | + if ($globalDebug) { |
|
3217 | + echo 'Airports data...'."\n"; |
|
3218 | + } |
|
3219 | + if ($globalDebug) { |
|
3220 | + echo '...Departure'."\n"; |
|
3221 | + } |
|
2807 | 3222 | $this->deleteStatAirport('daily'); |
2808 | 3223 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
2809 | 3224 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -2921,7 +3336,9 @@ discard block |
||
2921 | 3336 | // Count by airlines |
2922 | 3337 | echo '--- Stats by airlines ---'."\n"; |
2923 | 3338 | if ($Connection->tableExists('countries')) { |
2924 | - if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
3339 | + if ($globalDebug) { |
|
3340 | + echo 'Count all flights by countries by airlines...'."\n"; |
|
3341 | + } |
|
2925 | 3342 | $SpotterArchive = new SpotterArchive($this->db); |
2926 | 3343 | //$Spotter = new Spotter($this->db); |
2927 | 3344 | $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
@@ -2930,37 +3347,53 @@ discard block |
||
2930 | 3347 | $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
2931 | 3348 | } |
2932 | 3349 | } |
2933 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
3350 | + if ($globalDebug) { |
|
3351 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
3352 | + } |
|
2934 | 3353 | $Spotter = new Spotter($this->db); |
2935 | 3354 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
2936 | 3355 | foreach ($alldata as $number) { |
2937 | 3356 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
2938 | 3357 | } |
2939 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
3358 | + if ($globalDebug) { |
|
3359 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
3360 | + } |
|
2940 | 3361 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
2941 | 3362 | foreach ($alldata as $number) { |
2942 | 3363 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
2943 | 3364 | } |
2944 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
3365 | + if ($globalDebug) { |
|
3366 | + echo 'Count all callsigns by airlines...'."\n"; |
|
3367 | + } |
|
2945 | 3368 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
2946 | 3369 | foreach ($alldata as $number) { |
2947 | 3370 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
2948 | 3371 | } |
2949 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
3372 | + if ($globalDebug) { |
|
3373 | + echo 'Count all owners by airlines...'."\n"; |
|
3374 | + } |
|
2950 | 3375 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
2951 | 3376 | foreach ($alldata as $number) { |
2952 | 3377 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
2953 | 3378 | } |
2954 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
3379 | + if ($globalDebug) { |
|
3380 | + echo 'Count all pilots by airlines...'."\n"; |
|
3381 | + } |
|
2955 | 3382 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
2956 | 3383 | foreach ($alldata as $number) { |
2957 | 3384 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
2958 | 3385 | } |
2959 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
3386 | + if ($globalDebug) { |
|
3387 | + echo 'Count all departure airports by airlines...'."\n"; |
|
3388 | + } |
|
2960 | 3389 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
2961 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
3390 | + if ($globalDebug) { |
|
3391 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
3392 | + } |
|
2962 | 3393 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
2963 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
3394 | + if ($globalDebug) { |
|
3395 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
3396 | + } |
|
2964 | 3397 | //$alldata = array(); |
2965 | 3398 | foreach ($dall as $value) { |
2966 | 3399 | $icao = $value['airport_departure_icao']; |
@@ -2981,11 +3414,17 @@ discard block |
||
2981 | 3414 | foreach ($alldata as $number) { |
2982 | 3415 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
2983 | 3416 | } |
2984 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
3417 | + if ($globalDebug) { |
|
3418 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
3419 | + } |
|
2985 | 3420 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
2986 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
3421 | + if ($globalDebug) { |
|
3422 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
3423 | + } |
|
2987 | 3424 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
2988 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
3425 | + if ($globalDebug) { |
|
3426 | + echo 'Order arrival airports by airlines...'."\n"; |
|
3427 | + } |
|
2989 | 3428 | //$alldata = array(); |
2990 | 3429 | foreach ($dall as $value) { |
2991 | 3430 | $icao = $value['airport_arrival_icao']; |
@@ -3004,37 +3443,53 @@ discard block |
||
3004 | 3443 | } |
3005 | 3444 | $alldata = $pall; |
3006 | 3445 | foreach ($alldata as $number) { |
3007 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
3446 | + if ($number['airline_icao'] != '') { |
|
3447 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
3448 | + } |
|
3449 | + } |
|
3450 | + if ($globalDebug) { |
|
3451 | + echo 'Count all flights by months by airlines...'."\n"; |
|
3008 | 3452 | } |
3009 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
3010 | 3453 | $Spotter = new Spotter($this->db); |
3011 | 3454 | $alldata = $Spotter->countAllMonthsByAirlines($filter_last_month); |
3012 | 3455 | $lastyear = false; |
3013 | 3456 | foreach ($alldata as $number) { |
3014 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
3457 | + if ($number['year_name'] != date('Y')) { |
|
3458 | + $lastyear = true; |
|
3459 | + } |
|
3015 | 3460 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
3016 | 3461 | } |
3017 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
3462 | + if ($globalDebug) { |
|
3463 | + echo 'Count all owners by months by airlines...'."\n"; |
|
3464 | + } |
|
3018 | 3465 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
3019 | 3466 | foreach ($alldata as $number) { |
3020 | 3467 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
3021 | 3468 | } |
3022 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
3469 | + if ($globalDebug) { |
|
3470 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
3471 | + } |
|
3023 | 3472 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
3024 | 3473 | foreach ($alldata as $number) { |
3025 | 3474 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
3026 | 3475 | } |
3027 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
3476 | + if ($globalDebug) { |
|
3477 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
3478 | + } |
|
3028 | 3479 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
3029 | 3480 | foreach ($alldata as $number) { |
3030 | 3481 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
3031 | 3482 | } |
3032 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
3483 | + if ($globalDebug) { |
|
3484 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
3485 | + } |
|
3033 | 3486 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
3034 | 3487 | foreach ($alldata as $number) { |
3035 | 3488 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
3036 | 3489 | } |
3037 | - if ($globalDebug) echo '...Departure'."\n"; |
|
3490 | + if ($globalDebug) { |
|
3491 | + echo '...Departure'."\n"; |
|
3492 | + } |
|
3038 | 3493 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
3039 | 3494 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
3040 | 3495 | foreach ($dall as $value) { |
@@ -3057,7 +3512,9 @@ discard block |
||
3057 | 3512 | foreach ($alldata as $number) { |
3058 | 3513 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
3059 | 3514 | } |
3060 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
3515 | + if ($globalDebug) { |
|
3516 | + echo '...Arrival'."\n"; |
|
3517 | + } |
|
3061 | 3518 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
3062 | 3519 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
3063 | 3520 | foreach ($dall as $value) { |
@@ -3081,13 +3538,19 @@ discard block |
||
3081 | 3538 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
3082 | 3539 | } |
3083 | 3540 | |
3084 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
3085 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
3541 | + if ($globalDebug) { |
|
3542 | + echo 'Flights data...'."\n"; |
|
3543 | + } |
|
3544 | + if ($globalDebug) { |
|
3545 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
3546 | + } |
|
3086 | 3547 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
3087 | 3548 | foreach ($alldata as $number) { |
3088 | 3549 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
3089 | 3550 | } |
3090 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
3551 | + if ($globalDebug) { |
|
3552 | + echo '-> countAllDates...'."\n"; |
|
3553 | + } |
|
3091 | 3554 | //$previousdata = $this->countAllDatesByAirlines(); |
3092 | 3555 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
3093 | 3556 | $values = array(); |
@@ -3100,14 +3563,18 @@ discard block |
||
3100 | 3563 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
3101 | 3564 | } |
3102 | 3565 | |
3103 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
3566 | + if ($globalDebug) { |
|
3567 | + echo '-> countAllHours...'."\n"; |
|
3568 | + } |
|
3104 | 3569 | $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
3105 | 3570 | foreach ($alldata as $number) { |
3106 | 3571 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
3107 | 3572 | } |
3108 | 3573 | |
3109 | 3574 | // Stats by filters |
3110 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
3575 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
3576 | + $globalStatsFilters = array(); |
|
3577 | + } |
|
3111 | 3578 | foreach ($globalStatsFilters as $name => $filter) { |
3112 | 3579 | if (!empty($filter)) { |
3113 | 3580 | //$filter_name = $filter['name']; |
@@ -3115,7 +3582,9 @@ discard block |
||
3115 | 3582 | $reset = false; |
3116 | 3583 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
3117 | 3584 | if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) { |
3118 | - if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
3585 | + if ($globalDebug) { |
|
3586 | + echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
3587 | + } |
|
3119 | 3588 | $this->deleteOldStats($filter_name); |
3120 | 3589 | unset($last_update); |
3121 | 3590 | } |
@@ -3132,39 +3601,55 @@ discard block |
||
3132 | 3601 | $reset = true; |
3133 | 3602 | } |
3134 | 3603 | // Count by filter |
3135 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
3604 | + if ($globalDebug) { |
|
3605 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
3606 | + } |
|
3136 | 3607 | $Spotter = new Spotter($this->db); |
3137 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
3608 | + if ($globalDebug) { |
|
3609 | + echo 'Count all aircraft types...'."\n"; |
|
3610 | + } |
|
3138 | 3611 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
3139 | 3612 | foreach ($alldata as $number) { |
3140 | 3613 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
3141 | 3614 | } |
3142 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
3615 | + if ($globalDebug) { |
|
3616 | + echo 'Count all airlines...'."\n"; |
|
3617 | + } |
|
3143 | 3618 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
3144 | 3619 | foreach ($alldata as $number) { |
3145 | 3620 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
3146 | 3621 | } |
3147 | - if ($globalDebug) echo 'Count all aircraft registrations...'."\n"; |
|
3622 | + if ($globalDebug) { |
|
3623 | + echo 'Count all aircraft registrations...'."\n"; |
|
3624 | + } |
|
3148 | 3625 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
3149 | 3626 | foreach ($alldata as $number) { |
3150 | 3627 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
3151 | 3628 | } |
3152 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
3629 | + if ($globalDebug) { |
|
3630 | + echo 'Count all callsigns...'."\n"; |
|
3631 | + } |
|
3153 | 3632 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
3154 | 3633 | foreach ($alldata as $number) { |
3155 | 3634 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
3156 | 3635 | } |
3157 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
3636 | + if ($globalDebug) { |
|
3637 | + echo 'Count all owners...'."\n"; |
|
3638 | + } |
|
3158 | 3639 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
3159 | 3640 | foreach ($alldata as $number) { |
3160 | 3641 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
3161 | 3642 | } |
3162 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
3643 | + if ($globalDebug) { |
|
3644 | + echo 'Count all pilots...'."\n"; |
|
3645 | + } |
|
3163 | 3646 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
3164 | 3647 | foreach ($alldata as $number) { |
3165 | 3648 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
3166 | 3649 | } |
3167 | - if ($globalDebug) echo 'Count departure airports...'."\n"; |
|
3650 | + if ($globalDebug) { |
|
3651 | + echo 'Count departure airports...'."\n"; |
|
3652 | + } |
|
3168 | 3653 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
3169 | 3654 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
3170 | 3655 | $alldata = array(); |
@@ -3176,7 +3661,9 @@ discard block |
||
3176 | 3661 | $icao = $value['airport_departure_icao']; |
3177 | 3662 | if (isset($alldata[$icao])) { |
3178 | 3663 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
3179 | - } else $alldata[$icao] = $value; |
|
3664 | + } else { |
|
3665 | + $alldata[$icao] = $value; |
|
3666 | + } |
|
3180 | 3667 | } |
3181 | 3668 | $count = array(); |
3182 | 3669 | foreach ($alldata as $key => $row) { |
@@ -3186,7 +3673,9 @@ discard block |
||
3186 | 3673 | foreach ($alldata as $number) { |
3187 | 3674 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
3188 | 3675 | } |
3189 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
3676 | + if ($globalDebug) { |
|
3677 | + echo 'Count all arrival airports...'."\n"; |
|
3678 | + } |
|
3190 | 3679 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
3191 | 3680 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
3192 | 3681 | $alldata = array(); |
@@ -3198,7 +3687,9 @@ discard block |
||
3198 | 3687 | $icao = $value['airport_arrival_icao']; |
3199 | 3688 | if (isset($alldata[$icao])) { |
3200 | 3689 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
3201 | - } else $alldata[$icao] = $value; |
|
3690 | + } else { |
|
3691 | + $alldata[$icao] = $value; |
|
3692 | + } |
|
3202 | 3693 | } |
3203 | 3694 | $count = array(); |
3204 | 3695 | foreach ($alldata as $key => $row) { |
@@ -3208,35 +3699,49 @@ discard block |
||
3208 | 3699 | foreach ($alldata as $number) { |
3209 | 3700 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
3210 | 3701 | } |
3211 | - if ($globalDebug) echo 'Count all months...'."\n"; |
|
3702 | + if ($globalDebug) { |
|
3703 | + echo 'Count all months...'."\n"; |
|
3704 | + } |
|
3212 | 3705 | $Spotter = new Spotter($this->db); |
3213 | 3706 | $alldata = $Spotter->countAllMonths($filter); |
3214 | 3707 | $lastyear = false; |
3215 | 3708 | foreach ($alldata as $number) { |
3216 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
3709 | + if ($number['year_name'] != date('Y')) { |
|
3710 | + $lastyear = true; |
|
3711 | + } |
|
3217 | 3712 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
3218 | 3713 | } |
3219 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
3714 | + if ($globalDebug) { |
|
3715 | + echo 'Count all owners by months...'."\n"; |
|
3716 | + } |
|
3220 | 3717 | $alldata = $Spotter->countAllMonthsOwners($filter); |
3221 | 3718 | foreach ($alldata as $number) { |
3222 | 3719 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
3223 | 3720 | } |
3224 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
3721 | + if ($globalDebug) { |
|
3722 | + echo 'Count all pilots by months...'."\n"; |
|
3723 | + } |
|
3225 | 3724 | $alldata = $Spotter->countAllMonthsPilots($filter); |
3226 | 3725 | foreach ($alldata as $number) { |
3227 | 3726 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
3228 | 3727 | } |
3229 | - if ($globalDebug) echo 'Count all military by months...'."\n"; |
|
3728 | + if ($globalDebug) { |
|
3729 | + echo 'Count all military by months...'."\n"; |
|
3730 | + } |
|
3230 | 3731 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
3231 | 3732 | foreach ($alldata as $number) { |
3232 | 3733 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
3233 | 3734 | } |
3234 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
3735 | + if ($globalDebug) { |
|
3736 | + echo 'Count all aircrafts by months...'."\n"; |
|
3737 | + } |
|
3235 | 3738 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
3236 | 3739 | foreach ($alldata as $number) { |
3237 | 3740 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
3238 | 3741 | } |
3239 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
3742 | + if ($globalDebug) { |
|
3743 | + echo 'Count all real arrivals by months...'."\n"; |
|
3744 | + } |
|
3240 | 3745 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
3241 | 3746 | foreach ($alldata as $number) { |
3242 | 3747 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
@@ -58,7 +58,9 @@ discard block |
||
58 | 58 | { |
59 | 59 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
60 | 60 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
61 | - } else $image = $spotter_item['image_thumbnail']; |
|
61 | + } else { |
|
62 | + $image = $spotter_item['image_thumbnail']; |
|
63 | + } |
|
62 | 64 | } |
63 | 65 | /* else { |
64 | 66 | $image = "images/placeholder_thumb.png"; |
@@ -73,8 +75,12 @@ discard block |
||
73 | 75 | } |
74 | 76 | print '<div class="right">'; |
75 | 77 | print '<div class="callsign-details">'; |
76 | - if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
77 | - if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
78 | + if ($spotter_item['ident'] != 'Not Available') { |
|
79 | + print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
80 | + } |
|
81 | + if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') { |
|
82 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
83 | + } |
|
78 | 84 | print '</div>'; |
79 | 85 | if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') { |
80 | 86 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
@@ -106,13 +112,21 @@ discard block |
||
106 | 112 | print '</div>'; |
107 | 113 | print '<div id="aircraft">'; |
108 | 114 | print '<span>'._("Aircraft").'</span>'; |
109 | - if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
115 | + if (isset($spotter_item['aircraft_wiki'])) { |
|
116 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
117 | + } |
|
110 | 118 | if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
111 | 119 | $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
112 | - if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
113 | - else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
114 | - } elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
115 | - else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
120 | + if (count($aircraft_names) == 1) { |
|
121 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
122 | + } else { |
|
123 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
124 | + } |
|
125 | + } elseif (isset($spotter_item['aircraft_type'])) { |
|
126 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
127 | + } else { |
|
128 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
129 | + } |
|
116 | 130 | |
117 | 131 | print '</div>'; |
118 | 132 | print '<div id ="altitude"><span>'._("Altitude").'</span>'; |
@@ -125,11 +139,17 @@ discard block |
||
125 | 139 | } |
126 | 140 | |
127 | 141 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
128 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
129 | - else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
142 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
143 | + print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
144 | + } else { |
|
145 | + print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
146 | + } |
|
130 | 147 | } else { |
131 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
132 | - else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
148 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
149 | + print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
150 | + } else { |
|
151 | + print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
152 | + } |
|
133 | 153 | } |
134 | 154 | |
135 | 155 | if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) { |
@@ -143,7 +163,9 @@ discard block |
||
143 | 163 | print '</i>'; |
144 | 164 | } |
145 | 165 | print '</div>'; |
146 | - if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
166 | + if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
167 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
168 | + } |
|
147 | 169 | print '<div id="speed"><span>'._("Speed").'</span>'; |
148 | 170 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
149 | 171 | print round($spotter_item['ground_speed']*1.15078).' mph'; |
@@ -185,8 +207,11 @@ discard block |
||
185 | 207 | } |
186 | 208 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
187 | 209 | print '<div id="pilot"><span>'._("Pilot").'</span>'; |
188 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
189 | - else print $spotter_item['pilot_name']; |
|
210 | + if (isset($spotter_item['pilot_id'])) { |
|
211 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
212 | + } else { |
|
213 | + print $spotter_item['pilot_name']; |
|
214 | + } |
|
190 | 215 | print '</div>'; |
191 | 216 | } |
192 | 217 | if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') { |
@@ -212,10 +237,18 @@ discard block |
||
212 | 237 | } |
213 | 238 | print '</div>'; |
214 | 239 | print '</div>'; |
215 | - if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
216 | - if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
217 | - if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
218 | - if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
240 | + if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
241 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
242 | + } |
|
243 | + if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
244 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
245 | + } |
|
246 | + if (isset($spotter_item['acars']['message'])) { |
|
247 | + print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
248 | + } |
|
249 | + if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
250 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
251 | + } |
|
219 | 252 | print '</div>'; |
220 | 253 | } |
221 | 254 | ?> |
@@ -37,8 +37,11 @@ discard block |
||
37 | 37 | } else { |
38 | 38 | curl_setopt($ch, CURLOPT_USERAGENT, $useragent); |
39 | 39 | } |
40 | - if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
41 | - else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
40 | + if ($timeout == '') { |
|
41 | + curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
42 | + } else { |
|
43 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
44 | + } |
|
42 | 45 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
43 | 46 | if ($type == 'post') { |
44 | 47 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
@@ -51,7 +54,9 @@ discard block |
||
51 | 54 | } else { |
52 | 55 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
53 | 56 | } |
54 | - } elseif ($type != 'get' && $type != '') curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type); |
|
57 | + } elseif ($type != 'get' && $type != '') { |
|
58 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type); |
|
59 | + } |
|
55 | 60 | if ($headers != '') { |
56 | 61 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); |
57 | 62 | } |
@@ -95,8 +100,9 @@ discard block |
||
95 | 100 | private function curlResponseHeaderCallback($ch, $headerLine) { |
96 | 101 | //global $cookies; |
97 | 102 | $cookies = array(); |
98 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
99 | - $cookies[] = $cookie; |
|
103 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
104 | + $cookies[] = $cookie; |
|
105 | + } |
|
100 | 106 | return strlen($headerLine); // Needed by curl |
101 | 107 | } |
102 | 108 | |
@@ -107,7 +113,9 @@ discard block |
||
107 | 113 | curl_setopt($ch, CURLOPT_URL, $url); |
108 | 114 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
109 | 115 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
110 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
116 | + if ($referer != '') { |
|
117 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
118 | + } |
|
111 | 119 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
112 | 120 | if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
113 | 121 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
@@ -119,7 +127,9 @@ discard block |
||
119 | 127 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
120 | 128 | curl_setopt($ch, CURLOPT_FILE, $fp); |
121 | 129 | curl_exec($ch); |
122 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
130 | + if (curl_errno($ch) && $globalDebug) { |
|
131 | + echo 'Download error: '.curl_error($ch); |
|
132 | + } |
|
123 | 133 | curl_close($ch); |
124 | 134 | fclose($fp); |
125 | 135 | } |
@@ -127,12 +137,16 @@ discard block |
||
127 | 137 | public static function gunzip($in_file,$out_file_name = '') { |
128 | 138 | //echo $in_file.' -> '.$out_file_name."\n"; |
129 | 139 | $buffer_size = 4096; // read 4kb at a time |
130 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
140 | + if ($out_file_name == '') { |
|
141 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
142 | + } |
|
131 | 143 | if ($in_file != '' && file_exists($in_file)) { |
132 | 144 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
133 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
134 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
135 | - else { |
|
145 | + if (function_exists('gzopen')) { |
|
146 | + $file = gzopen($in_file,'rb'); |
|
147 | + } elseif (function_exists('gzopen64')) { |
|
148 | + $file = gzopen64($in_file,'rb'); |
|
149 | + } else { |
|
136 | 150 | echo 'gzopen not available'; |
137 | 151 | die; |
138 | 152 | } |
@@ -148,11 +162,14 @@ discard block |
||
148 | 162 | public static function bunzip2($in_file,$out_file_name = '') { |
149 | 163 | //echo $in_file.' -> '.$out_file_name."\n"; |
150 | 164 | $buffer_size = 4096; // read 4kb at a time |
151 | - if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
|
165 | + if ($out_file_name == '') { |
|
166 | + $out_file_name = str_replace('.bz2', '', $in_file); |
|
167 | + } |
|
152 | 168 | if ($in_file != '' && file_exists($in_file)) { |
153 | 169 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
154 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
155 | - else { |
|
170 | + if (function_exists('bzopen')) { |
|
171 | + $file = bzopen($in_file,'rb'); |
|
172 | + } else { |
|
156 | 173 | echo 'bzopen not available'; |
157 | 174 | die; |
158 | 175 | } |
@@ -171,10 +188,16 @@ discard block |
||
171 | 188 | * @return Array array of the tables in HTML page |
172 | 189 | */ |
173 | 190 | public function table2array($data) { |
174 | - if (!is_string($data)) return array(); |
|
175 | - if ($data == '') return array(); |
|
191 | + if (!is_string($data)) { |
|
192 | + return array(); |
|
193 | + } |
|
194 | + if ($data == '') { |
|
195 | + return array(); |
|
196 | + } |
|
176 | 197 | $html = str_get_html($data); |
177 | - if ($html === false) return array(); |
|
198 | + if ($html === false) { |
|
199 | + return array(); |
|
200 | + } |
|
178 | 201 | $tabledata=array(); |
179 | 202 | foreach($html->find('tr') as $element) |
180 | 203 | { |
@@ -209,7 +232,9 @@ discard block |
||
209 | 232 | */ |
210 | 233 | public function text2array($data) { |
211 | 234 | $html = str_get_html($data); |
212 | - if ($html === false) return array(); |
|
235 | + if ($html === false) { |
|
236 | + return array(); |
|
237 | + } |
|
213 | 238 | $tabledata=array(); |
214 | 239 | foreach($html->find('p') as $element) |
215 | 240 | { |
@@ -230,7 +255,9 @@ discard block |
||
230 | 255 | * @return Float Distance in $unit |
231 | 256 | */ |
232 | 257 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
233 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
258 | + if ($lat == $latc && $lon == $lonc) { |
|
259 | + return 0; |
|
260 | + } |
|
234 | 261 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
235 | 262 | if ($unit == "km") { |
236 | 263 | return round($dist * 1.609344); |
@@ -276,7 +303,9 @@ discard block |
||
276 | 303 | $dX = $latc - $lat; |
277 | 304 | $dY = $lonc - $lon; |
278 | 305 | $azimuth = rad2deg(atan2($dY,$dX)); |
279 | - if ($azimuth < 0) return $azimuth+360; |
|
306 | + if ($azimuth < 0) { |
|
307 | + return $azimuth+360; |
|
308 | + } |
|
280 | 309 | return $azimuth; |
281 | 310 | } |
282 | 311 | |
@@ -290,10 +319,16 @@ discard block |
||
290 | 319 | public function withinThreshold ($timeDifference, $distance) { |
291 | 320 | $x = abs($timeDifference); |
292 | 321 | $d = abs($distance); |
293 | - if ($x == 0 || $d == 0) return true; |
|
322 | + if ($x == 0 || $d == 0) { |
|
323 | + return true; |
|
324 | + } |
|
294 | 325 | // may be due to Internet jitter; distance is realistic |
295 | - if ($x < 0.7 && $d < 2000) return true; |
|
296 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
326 | + if ($x < 0.7 && $d < 2000) { |
|
327 | + return true; |
|
328 | + } else { |
|
329 | + return $d/$x < 1500*0.27778; |
|
330 | + } |
|
331 | + // 1500 km/h max |
|
297 | 332 | } |
298 | 333 | |
299 | 334 | |
@@ -322,11 +357,17 @@ discard block |
||
322 | 357 | |
323 | 358 | public function convertDM($coord,$latlong) { |
324 | 359 | if ($latlong == 'latitude') { |
325 | - if ($coord < 0) $NSEW = 'S'; |
|
326 | - else $NSEW = 'N'; |
|
360 | + if ($coord < 0) { |
|
361 | + $NSEW = 'S'; |
|
362 | + } else { |
|
363 | + $NSEW = 'N'; |
|
364 | + } |
|
327 | 365 | } else { |
328 | - if ($coord < 0) $NSEW = 'W'; |
|
329 | - else $NSEW = 'E'; |
|
366 | + if ($coord < 0) { |
|
367 | + $NSEW = 'W'; |
|
368 | + } else { |
|
369 | + $NSEW = 'E'; |
|
370 | + } |
|
330 | 371 | } |
331 | 372 | $coord = abs($coord); |
332 | 373 | $deg = floor($coord); |
@@ -369,7 +410,9 @@ discard block |
||
369 | 410 | public function hex2str($hex) { |
370 | 411 | $str = ''; |
371 | 412 | $hexln = strlen($hex); |
372 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
413 | + for($i=0;$i<$hexln;$i+=2) { |
|
414 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
415 | + } |
|
373 | 416 | return $str; |
374 | 417 | } |
375 | 418 | |
@@ -406,8 +449,11 @@ discard block |
||
406 | 449 | $b = $lat2 - $lat1; |
407 | 450 | $c = -($a*$lat1+$b*$lon1); |
408 | 451 | $d = $a*$lat3+$b*$lon3+$c; |
409 | - if ($d > -$approx && $d < $approx) return true; |
|
410 | - else return false; |
|
452 | + if ($d > -$approx && $d < $approx) { |
|
453 | + return true; |
|
454 | + } else { |
|
455 | + return false; |
|
456 | + } |
|
411 | 457 | } |
412 | 458 | |
413 | 459 | public function array_merge_noappend() { |
@@ -466,7 +512,9 @@ discard block |
||
466 | 512 | return $result; |
467 | 513 | } |
468 | 514 | $handle = @opendir('./locale'); |
469 | - if ($handle === false) return $result; |
|
515 | + if ($handle === false) { |
|
516 | + return $result; |
|
517 | + } |
|
470 | 518 | while (false !== ($file = readdir($handle))) { |
471 | 519 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
472 | 520 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -537,8 +585,9 @@ discard block |
||
537 | 585 | $error = false; |
538 | 586 | if ($fp_out = gzopen($dest, $mode)) { |
539 | 587 | if ($fp_in = fopen($source,'rb')) { |
540 | - while (!feof($fp_in)) |
|
541 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
588 | + while (!feof($fp_in)) { |
|
589 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
590 | + } |
|
542 | 591 | fclose($fp_in); |
543 | 592 | } else { |
544 | 593 | $error = true; |
@@ -547,14 +596,17 @@ discard block |
||
547 | 596 | } else { |
548 | 597 | $error = true; |
549 | 598 | } |
550 | - if ($error) |
|
551 | - return false; |
|
552 | - else |
|
553 | - return $dest; |
|
599 | + if ($error) { |
|
600 | + return false; |
|
601 | + } else { |
|
602 | + return $dest; |
|
603 | + } |
|
554 | 604 | } |
555 | 605 | |
556 | 606 | public function remove_accents($string) { |
557 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
607 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
608 | + return $string; |
|
609 | + } |
|
558 | 610 | $chars = array( |
559 | 611 | // Decompositions for Latin-1 Supplement |
560 | 612 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -678,7 +730,9 @@ discard block |
||
678 | 730 | $ip = gethostbyname($host); |
679 | 731 | $s = socket_create(AF_INET, SOCK_STREAM, 0); |
680 | 732 | $r = @socket_connect($s, $ip, $port); |
681 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
733 | + if (!socket_set_nonblock($s)) { |
|
734 | + echo "Unable to set nonblock on socket\n"; |
|
735 | + } |
|
682 | 736 | if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
683 | 737 | return $s; |
684 | 738 | } |
@@ -723,18 +777,22 @@ discard block |
||
723 | 777 | //NOTE: use a trailing slash for folders!!! |
724 | 778 | //see http://bugs.php.net/bug.php?id=27609 |
725 | 779 | //see http://bugs.php.net/bug.php?id=30931 |
726 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
780 | + if ($path{strlen($path)-1}=='/') { |
|
781 | + // recursively return a temporary file path |
|
727 | 782 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
728 | - else if (is_dir($path)) |
|
729 | - return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
783 | + } else if (is_dir($path)) { |
|
784 | + return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
785 | + } |
|
730 | 786 | // check tmp file for read/write capabilities |
731 | 787 | $rm = file_exists($path); |
732 | 788 | $f = @fopen($path, 'a'); |
733 | - if ($f===false) |
|
734 | - return false; |
|
789 | + if ($f===false) { |
|
790 | + return false; |
|
791 | + } |
|
735 | 792 | fclose($f); |
736 | - if (!$rm) |
|
737 | - unlink($path); |
|
793 | + if (!$rm) { |
|
794 | + unlink($path); |
|
795 | + } |
|
738 | 796 | return true; |
739 | 797 | } |
740 | 798 | |
@@ -750,7 +808,9 @@ discard block |
||
750 | 808 | * @return Array Coordinate of the route |
751 | 809 | */ |
752 | 810 | public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) { |
753 | - if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
811 | + if ($nbpts <= 2) { |
|
812 | + return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
813 | + } |
|
754 | 814 | $sx = deg2rad($begin_lon); |
755 | 815 | $sy = deg2rad($begin_lat); |
756 | 816 | $ex = deg2rad($end_lon); |
@@ -759,7 +819,9 @@ discard block |
||
759 | 819 | $h = $sy - $ey; |
760 | 820 | $z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2); |
761 | 821 | $g = 2.0*asin(sqrt($z)); |
762 | - if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
822 | + if ($g == M_PI || is_nan($g)) { |
|
823 | + return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
824 | + } |
|
763 | 825 | $first_pass = array(); |
764 | 826 | $delta = 1.0/($nbpts-1); |
765 | 827 | for ($i =0; $i < $nbpts; ++$i) { |
@@ -49,7 +49,10 @@ discard block |
||
49 | 49 | <?php |
50 | 50 | if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
51 | 51 | ?> |
52 | -<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
|
52 | +<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) { |
|
53 | + print '?tsk='.$tsk; |
|
54 | +} |
|
55 | +?>"></script> |
|
53 | 56 | <?php |
54 | 57 | if (!isset($globalAircraft) || $globalAircraft) { |
55 | 58 | ?> |
@@ -163,11 +166,26 @@ discard block |
||
163 | 166 | <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li> |
164 | 167 | <li><?php echo _("NOTAM scope:"); ?> |
165 | 168 | <select class="selectpicker" onchange="notamscope(this);"> |
166 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
167 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
168 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
169 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
170 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
169 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
170 | + print ' selected'; |
|
171 | +} |
|
172 | +?>>All</option> |
|
173 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
174 | + print ' selected'; |
|
175 | +} |
|
176 | +?>>Airport/Enroute warning</option> |
|
177 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
178 | + print ' selected'; |
|
179 | +} |
|
180 | +?>>Airport warning</option> |
|
181 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
182 | + print ' selected'; |
|
183 | +} |
|
184 | +?>>Navigation warning</option> |
|
185 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
186 | + print ' selected'; |
|
187 | +} |
|
188 | +?>>Enroute warning</option> |
|
171 | 189 | </select |
172 | 190 | </li> |
173 | 191 | </ul> |
@@ -195,7 +213,12 @@ discard block |
||
195 | 213 | <div class="form-group"> |
196 | 214 | <label>From (UTC):</label> |
197 | 215 | <div class='input-group date' id='datetimepicker1'> |
198 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
216 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) { |
|
217 | + print $_POST['start_date']; |
|
218 | +} elseif (isset($_COOKIE['archive_begin'])) { |
|
219 | + print date("m/d/Y h:i a",$_COOKIE['archive_begin']); |
|
220 | +} |
|
221 | +?>" required /> |
|
199 | 222 | <span class="input-group-addon"> |
200 | 223 | <span class="glyphicon glyphicon-calendar"></span> |
201 | 224 | </span> |
@@ -204,7 +227,12 @@ discard block |
||
204 | 227 | <div class="form-group"> |
205 | 228 | <label>To (UTC):</label> |
206 | 229 | <div class='input-group date' id='datetimepicker2'> |
207 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
230 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) { |
|
231 | + print $_POST['end_date']; |
|
232 | +} elseif (isset($_COOKIE['archive_end'])) { |
|
233 | + print date("m/d/Y h:i a",$_COOKIE['archive_end']); |
|
234 | +} |
|
235 | +?>" /> |
|
208 | 236 | <span class="input-group-addon"> |
209 | 237 | <span class="glyphicon glyphicon-calendar"></span> |
210 | 238 | </span> |
@@ -229,8 +257,20 @@ discard block |
||
229 | 257 | </script> |
230 | 258 | <li><?php echo _("Playback speed:"); ?> |
231 | 259 | <div class="range"> |
232 | - <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
233 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
260 | + <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
261 | + print $_POST['archivespeed']; |
|
262 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
263 | + print $_COOKIE['archive_speed']; |
|
264 | +} else { |
|
265 | + print '1'; |
|
266 | +} |
|
267 | +?>"> |
|
268 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
269 | + print $_COOKIE['archive_speed']; |
|
270 | +} else { |
|
271 | + print '1'; |
|
272 | +} |
|
273 | +?></output> |
|
234 | 274 | </div> |
235 | 275 | </li> |
236 | 276 | <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li> |
@@ -252,29 +292,53 @@ discard block |
||
252 | 292 | <li><?php echo _("Type of Map:"); ?> |
253 | 293 | <select class="selectpicker" onchange="mapType(this);"> |
254 | 294 | <?php |
255 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
256 | - else $MapType = $_COOKIE['MapType']; |
|
295 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
296 | + $MapType = $globalMapProvider; |
|
297 | + } else { |
|
298 | + $MapType = $_COOKIE['MapType']; |
|
299 | + } |
|
257 | 300 | ?> |
258 | 301 | <?php |
259 | 302 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
260 | 303 | ?> |
261 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
304 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
305 | + print ' selected'; |
|
306 | +} |
|
307 | +?>>Natural Earth (local)</option> |
|
262 | 308 | <?php |
263 | 309 | } else { |
264 | 310 | if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
265 | 311 | ?> |
266 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
312 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
313 | + print ' selected'; |
|
314 | +} |
|
315 | +?>>Natural Earth (local)</option> |
|
267 | 316 | <?php |
268 | 317 | } |
269 | 318 | ?> |
270 | - <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
|
271 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
|
319 | + <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') { |
|
320 | + print ' selected'; |
|
321 | +} |
|
322 | +?>>ArcGIS Streetmap</option> |
|
323 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') { |
|
324 | + print ' selected'; |
|
325 | +} |
|
326 | +?>>ArcGIS Satellite</option> |
|
272 | 327 | <?php |
273 | 328 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
274 | 329 | ?> |
275 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
276 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
277 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
330 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
331 | + print ' selected'; |
|
332 | +} |
|
333 | +?>>Bing-Aerial</option> |
|
334 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
335 | + print ' selected'; |
|
336 | +} |
|
337 | +?>>Bing-Hybrid</option> |
|
338 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
339 | + print ' selected'; |
|
340 | +} |
|
341 | +?>>Bing-Road</option> |
|
278 | 342 | <?php |
279 | 343 | } |
280 | 344 | ?> |
@@ -284,59 +348,143 @@ discard block |
||
284 | 348 | <?php |
285 | 349 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
286 | 350 | ?> |
287 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
288 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
289 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
351 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
352 | + print ' selected'; |
|
353 | +} |
|
354 | +?>>Here-Aerial</option> |
|
355 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
356 | + print ' selected'; |
|
357 | +} |
|
358 | +?>>Here-Hybrid</option> |
|
359 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
360 | + print ' selected'; |
|
361 | +} |
|
362 | +?>>Here-Road</option> |
|
290 | 363 | <?php |
291 | 364 | } |
292 | 365 | ?> |
293 | 366 | <?php |
294 | 367 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
295 | 368 | ?> |
296 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
297 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
298 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
299 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
369 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
370 | + print ' selected'; |
|
371 | +} |
|
372 | +?>>Google Roadmap</option> |
|
373 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
374 | + print ' selected'; |
|
375 | +} |
|
376 | +?>>Google Satellite</option> |
|
377 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
378 | + print ' selected'; |
|
379 | +} |
|
380 | +?>>Google Hybrid</option> |
|
381 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
382 | + print ' selected'; |
|
383 | +} |
|
384 | +?>>Google Terrain</option> |
|
300 | 385 | <?php |
301 | 386 | } |
302 | 387 | ?> |
303 | 388 | <?php |
304 | 389 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
305 | 390 | ?> |
306 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
307 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
308 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
391 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
392 | + print ' selected'; |
|
393 | +} |
|
394 | +?>>MapQuest-OSM</option> |
|
395 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
396 | + print ' selected'; |
|
397 | +} |
|
398 | +?>>MapQuest-Aerial</option> |
|
399 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
400 | + print ' selected'; |
|
401 | +} |
|
402 | +?>>MapQuest-Hybrid</option> |
|
309 | 403 | <?php |
310 | 404 | } |
311 | 405 | ?> |
312 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
313 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
|
406 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
407 | + print ' selected'; |
|
408 | +} |
|
409 | +?>>Yandex</option> |
|
410 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
411 | + print ' selected'; |
|
412 | +} |
|
413 | +?>>Natural Earth</option> |
|
314 | 414 | <?php |
315 | 415 | } |
316 | 416 | ?> |
317 | - <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
|
417 | + <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') { |
|
418 | + print ' selected'; |
|
419 | +} |
|
420 | +?>>National Geographic Street</option> |
|
318 | 421 | <?php |
319 | 422 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
320 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
321 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
423 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
424 | + $MapBoxId = 'default'; |
|
425 | + } else { |
|
426 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
427 | + } |
|
322 | 428 | ?> |
323 | - <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
|
324 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
325 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
326 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
327 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
328 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
329 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
330 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
331 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
332 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
333 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
334 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
335 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
429 | + <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') { |
|
430 | + print ' selected'; |
|
431 | +} |
|
432 | +?>>Mapbox GL</option> |
|
433 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
434 | + print ' selected'; |
|
435 | +} |
|
436 | +?>>Mapbox default</option> |
|
437 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
438 | + print ' selected'; |
|
439 | +} |
|
440 | +?>>Mapbox streets</option> |
|
441 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
442 | + print ' selected'; |
|
443 | +} |
|
444 | +?>>Mapbox light</option> |
|
445 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
446 | + print ' selected'; |
|
447 | +} |
|
448 | +?>>Mapbox dark</option> |
|
449 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
450 | + print ' selected'; |
|
451 | +} |
|
452 | +?>>Mapbox satellite</option> |
|
453 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
454 | + print ' selected'; |
|
455 | +} |
|
456 | +?>>Mapbox streets-satellite</option> |
|
457 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
458 | + print ' selected'; |
|
459 | +} |
|
460 | +?>>Mapbox streets-basic</option> |
|
461 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
462 | + print ' selected'; |
|
463 | +} |
|
464 | +?>>Mapbox comic</option> |
|
465 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
466 | + print ' selected'; |
|
467 | +} |
|
468 | +?>>Mapbox outdoors</option> |
|
469 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
470 | + print ' selected'; |
|
471 | +} |
|
472 | +?>>Mapbox pencil</option> |
|
473 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
474 | + print ' selected'; |
|
475 | +} |
|
476 | +?>>Mapbox pirates</option> |
|
477 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
478 | + print ' selected'; |
|
479 | +} |
|
480 | +?>>Mapbox emerald</option> |
|
336 | 481 | <?php |
337 | 482 | } |
338 | 483 | ?> |
339 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
484 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
485 | + print ' selected'; |
|
486 | +} |
|
487 | +?>>OpenStreetMap</option> |
|
340 | 488 | <?php |
341 | 489 | } |
342 | 490 | ?> |
@@ -347,10 +495,22 @@ discard block |
||
347 | 495 | ?> |
348 | 496 | <li><?php echo _("Type of Terrain:"); ?> |
349 | 497 | <select class="selectpicker" onchange="terrainType(this);"> |
350 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
351 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
352 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
353 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
498 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
499 | + print ' selected'; |
|
500 | +} |
|
501 | +?>>stk terrain</option> |
|
502 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
503 | + print ' selected'; |
|
504 | +} |
|
505 | +?>>ellipsoid</option> |
|
506 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
507 | + print ' selected'; |
|
508 | +} |
|
509 | +?>>vr terrain</option> |
|
510 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
511 | + print ' selected'; |
|
512 | +} |
|
513 | +?>>ArticDEM</option> |
|
354 | 514 | </select> |
355 | 515 | </li> |
356 | 516 | <?php |
@@ -359,43 +519,88 @@ discard block |
||
359 | 519 | <?php |
360 | 520 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
361 | 521 | ?> |
362 | - <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
522 | + <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') { |
|
523 | + print 'checked'; |
|
524 | +} |
|
525 | +?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
363 | 526 | |
364 | 527 | <?php |
365 | 528 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
366 | 529 | ?> |
367 | - <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
368 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
369 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
370 | - <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
371 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
530 | + <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
531 | + print 'checked'; |
|
532 | +} |
|
533 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
534 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
535 | + print 'checked'; |
|
536 | +} |
|
537 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
538 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) { |
|
539 | + print 'checked'; |
|
540 | +} |
|
541 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
542 | + <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) { |
|
543 | + print 'checked'; |
|
544 | +} |
|
545 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
546 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
547 | + print 'checked'; |
|
548 | +} |
|
549 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
372 | 550 | <?php |
373 | 551 | } elseif (!isset($globalTracker) || $globalTracker === TRUE) { |
374 | 552 | ?> |
375 | - <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
553 | + <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) { |
|
554 | + print 'checked'; |
|
555 | +} |
|
556 | +?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
376 | 557 | <?php |
377 | 558 | } |
378 | 559 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
379 | 560 | ?> |
380 | - <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
561 | + <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
562 | + print 'checked'; |
|
563 | +} |
|
564 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
381 | 565 | <?php |
382 | 566 | } |
383 | 567 | } |
384 | 568 | ?> |
385 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
386 | - <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
387 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
388 | - <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
569 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) { |
|
570 | + print 'checked'; |
|
571 | +} |
|
572 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
573 | + <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
574 | + print 'checked'; |
|
575 | +} |
|
576 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
577 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
578 | + print 'checked'; |
|
579 | +} |
|
580 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
581 | + <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
582 | + print 'checked'; |
|
583 | +} |
|
584 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
389 | 585 | <?php |
390 | 586 | if (isset($globalFires)) { |
391 | 587 | ?> |
392 | - <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
588 | + <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
589 | + print 'checked'; |
|
590 | +} |
|
591 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
393 | 592 | <?php |
394 | 593 | } |
395 | 594 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
396 | 595 | ?> |
397 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
398 | - <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
596 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
597 | + print 'checked'; |
|
598 | +} |
|
599 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
600 | + <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) { |
|
601 | + print 'checked'; |
|
602 | +} |
|
603 | +?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
399 | 604 | <?php |
400 | 605 | } |
401 | 606 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -408,17 +613,25 @@ discard block |
||
408 | 613 | if (function_exists('array_column')) { |
409 | 614 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
410 | 615 | ?> |
411 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
616 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
617 | + print 'checked'; |
|
618 | +} |
|
619 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
412 | 620 | <?php |
413 | 621 | } |
414 | 622 | } elseif (isset($globalSources)) { |
415 | 623 | $dispolar = false; |
416 | 624 | foreach ($globalSources as $testsource) { |
417 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
625 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
626 | + $dispolar = true; |
|
627 | + } |
|
418 | 628 | } |
419 | 629 | if ($dispolar) { |
420 | 630 | ?> |
421 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
631 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
632 | + print 'checked'; |
|
633 | +} |
|
634 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
422 | 635 | <?php |
423 | 636 | } |
424 | 637 | } |
@@ -431,12 +644,22 @@ discard block |
||
431 | 644 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
432 | 645 | if (extension_loaded('gd') && function_exists('gd_info')) { |
433 | 646 | ?> |
434 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
647 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
648 | + print 'checked'; |
|
649 | +} |
|
650 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
435 | 651 | <?php |
436 | 652 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
437 | 653 | ?> |
438 | 654 | <li><?php echo _("Aircraft icon color:"); ?> |
439 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> |
|
655 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
656 | + print $_COOKIE['IconColor']; |
|
657 | +} elseif (isset($globalAircraftIconColor)) { |
|
658 | + print $globalAircraftIconColor; |
|
659 | +} else { |
|
660 | + print '1a3151'; |
|
661 | +} |
|
662 | +?>"> |
|
440 | 663 | </li> |
441 | 664 | <?php |
442 | 665 | } |
@@ -448,7 +671,14 @@ discard block |
||
448 | 671 | if (extension_loaded('gd') && function_exists('gd_info')) { |
449 | 672 | ?> |
450 | 673 | <li><?php echo _("Marine icon color:"); ?> |
451 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
|
674 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
675 | + print $_COOKIE['MarineIconColor']; |
|
676 | +} elseif (isset($globalMarineIconColor)) { |
|
677 | + print $globalMarineIconColor; |
|
678 | +} else { |
|
679 | + print '1a3151'; |
|
680 | +} |
|
681 | +?>"> |
|
452 | 682 | </li> |
453 | 683 | <?php |
454 | 684 | } |
@@ -459,7 +689,14 @@ discard block |
||
459 | 689 | if (extension_loaded('gd') && function_exists('gd_info')) { |
460 | 690 | ?> |
461 | 691 | <li><?php echo _("Tracker icon color:"); ?> |
462 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
|
692 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
693 | + print $_COOKIE['TrackerIconColor']; |
|
694 | +} elseif (isset($globalTrackerIconColor)) { |
|
695 | + print $globalTrackerIconColor; |
|
696 | +} else { |
|
697 | + print '1a3151'; |
|
698 | +} |
|
699 | +?>"> |
|
463 | 700 | </li> |
464 | 701 | <?php |
465 | 702 | } |
@@ -470,8 +707,22 @@ discard block |
||
470 | 707 | ?> |
471 | 708 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
472 | 709 | <div class="range"> |
473 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
474 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
710 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
711 | + print $_COOKIE['AirportZoom']; |
|
712 | +} elseif (isset($globalAirportZoom)) { |
|
713 | + print $globalAirportZoom; |
|
714 | +} else { |
|
715 | + print '7'; |
|
716 | +} |
|
717 | +?>"> |
|
718 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
719 | + print $_COOKIE['AirportZoom']; |
|
720 | +} elseif (isset($globalAirportZoom)) { |
|
721 | + print $globalAirportZoom; |
|
722 | +} else { |
|
723 | + print '7'; |
|
724 | +} |
|
725 | +?></output> |
|
475 | 726 | </div> |
476 | 727 | </li> |
477 | 728 | <?php |
@@ -483,10 +734,23 @@ discard block |
||
483 | 734 | <?php |
484 | 735 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
485 | 736 | ?> |
486 | - <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> ><?php echo _("Use airlines liveries"); ?></li> |
|
487 | - <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li> |
|
737 | + <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') { |
|
738 | + print 'checked'; |
|
739 | +} |
|
740 | +?> ><?php echo _("Use airlines liveries"); ?></li> |
|
741 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
742 | + print 'checked'; |
|
743 | +} |
|
744 | +?> ><?php echo _("Force Aircraft color"); ?></li> |
|
488 | 745 | <li><?php echo _("Aircraft icon color:"); ?> |
489 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>"> |
|
746 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
747 | + print $_COOKIE['IconColor']; |
|
748 | +} elseif (isset($globalAircraftIconColor)) { |
|
749 | + print $globalAircraftIconColor; |
|
750 | +} else { |
|
751 | + print 'ff0000'; |
|
752 | +} |
|
753 | +?>"> |
|
490 | 754 | </li> |
491 | 755 | <?php |
492 | 756 | } |
@@ -494,9 +758,19 @@ discard block |
||
494 | 758 | <?php |
495 | 759 | if (isset($globalMarine) && $globalMarine === TRUE) { |
496 | 760 | ?> |
497 | - <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li> |
|
761 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
762 | + print 'checked'; |
|
763 | +} |
|
764 | +?> ><?php echo _("Force Marine color"); ?></li> |
|
498 | 765 | <li><?php echo _("Marine icon color:"); ?> |
499 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>"> |
|
766 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
767 | + print $_COOKIE['MarineIconColor']; |
|
768 | +} elseif (isset($globalMarineIconColor)) { |
|
769 | + print $globalMarineIconColor; |
|
770 | +} else { |
|
771 | + print 'ff0000'; |
|
772 | +} |
|
773 | +?>"> |
|
500 | 774 | </li> |
501 | 775 | <?php |
502 | 776 | } |
@@ -504,9 +778,19 @@ discard block |
||
504 | 778 | <?php |
505 | 779 | if (isset($globalTracker) && $globalTracker === TRUE) { |
506 | 780 | ?> |
507 | - <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?></li> |
|
781 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
782 | + print 'checked'; |
|
783 | +} |
|
784 | +?> ><?php echo _("Force Tracker color"); ?></li> |
|
508 | 785 | <li><?php echo _("Tracker icon color:"); ?> |
509 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>"> |
|
786 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
787 | + print $_COOKIE['TrackerIconColor']; |
|
788 | +} elseif (isset($globalTrackerIconColor)) { |
|
789 | + print $globalTrackerIconColor; |
|
790 | +} else { |
|
791 | + print 'ff0000'; |
|
792 | +} |
|
793 | +?>"> |
|
510 | 794 | </li> |
511 | 795 | <?php |
512 | 796 | } |
@@ -514,22 +798,46 @@ discard block |
||
514 | 798 | ?> |
515 | 799 | <li><?php echo _("Distance unit:"); ?> |
516 | 800 | <select class="selectpicker" onchange="unitdistance(this);"> |
517 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
518 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
519 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
801 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
802 | + echo ' selected'; |
|
803 | +} |
|
804 | +?>>km</option> |
|
805 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
806 | + echo ' selected'; |
|
807 | +} |
|
808 | +?>>nm</option> |
|
809 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
810 | + echo ' selected'; |
|
811 | +} |
|
812 | +?>>mi</option> |
|
520 | 813 | </select> |
521 | 814 | </li> |
522 | 815 | <li><?php echo _("Altitude unit:"); ?> |
523 | 816 | <select class="selectpicker" onchange="unitaltitude(this);"> |
524 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
525 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
817 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
818 | + echo ' selected'; |
|
819 | +} |
|
820 | +?>>m</option> |
|
821 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
822 | + echo ' selected'; |
|
823 | +} |
|
824 | +?>>feet</option> |
|
526 | 825 | </select> |
527 | 826 | </li> |
528 | 827 | <li><?php echo _("Speed unit:"); ?> |
529 | 828 | <select class="selectpicker" onchange="unitspeed(this);"> |
530 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
531 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
532 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
829 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
830 | + echo ' selected'; |
|
831 | +} |
|
832 | +?>>km/h</option> |
|
833 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
834 | + echo ' selected'; |
|
835 | +} |
|
836 | +?>>mph</option> |
|
837 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
838 | + echo ' selected'; |
|
839 | +} |
|
840 | +?>>knots</option> |
|
533 | 841 | </select> |
534 | 842 | </li> |
535 | 843 | |
@@ -547,9 +855,18 @@ discard block |
||
547 | 855 | <?php |
548 | 856 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
549 | 857 | ?> |
550 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
551 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
552 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
858 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { |
|
859 | + print 'checked'; |
|
860 | +} |
|
861 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
862 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { |
|
863 | + print 'checked'; |
|
864 | +} |
|
865 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
866 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { |
|
867 | + print 'checked'; |
|
868 | +} |
|
869 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
553 | 870 | <?php |
554 | 871 | } |
555 | 872 | ?> |
@@ -557,10 +874,16 @@ discard block |
||
557 | 874 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
558 | 875 | ?> |
559 | 876 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
560 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
877 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { |
|
878 | + print 'checked'; |
|
879 | +} |
|
880 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
561 | 881 | <?php } ?> |
562 | 882 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
563 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
883 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
884 | + print 'checked'; |
|
885 | +} |
|
886 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
564 | 887 | <?php } ?> |
565 | 888 | <?php |
566 | 889 | } |
@@ -577,7 +900,9 @@ discard block |
||
577 | 900 | } |
578 | 901 | foreach($allairlinenames as $airline) { |
579 | 902 | $airline_name = $airline['airline_name']; |
580 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
903 | + if (strlen($airline_name) > 30) { |
|
904 | + $airline_name = substr($airline_name,0,30).'...'; |
|
905 | + } |
|
581 | 906 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
582 | 907 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
583 | 908 | } else { |
@@ -595,7 +920,10 @@ discard block |
||
595 | 920 | <li><?php echo _("Display alliance:"); ?> |
596 | 921 | <br/> |
597 | 922 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
598 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
923 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
924 | + echo ' selected'; |
|
925 | +} |
|
926 | +?>><?php echo _("All"); ?></option> |
|
599 | 927 | <?php |
600 | 928 | foreach($allalliancenames as $alliance) { |
601 | 929 | $alliance_name = $alliance['alliance']; |
@@ -654,10 +982,22 @@ discard block |
||
654 | 982 | ?> |
655 | 983 | <li><?php echo _("Display airlines of type:"); ?><br/> |
656 | 984 | <select class="selectpicker" onchange="airlinestype(this);"> |
657 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
658 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
659 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
660 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
985 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
986 | + echo ' selected'; |
|
987 | +} |
|
988 | +?>><?php echo _("All"); ?></option> |
|
989 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
990 | + echo ' selected'; |
|
991 | +} |
|
992 | +?>><?php echo _("Passenger"); ?></option> |
|
993 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
994 | + echo ' selected'; |
|
995 | +} |
|
996 | +?>><?php echo _("Cargo"); ?></option> |
|
997 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
998 | + echo ' selected'; |
|
999 | +} |
|
1000 | +?>><?php echo _("Military"); ?></option> |
|
661 | 1001 | </select> |
662 | 1002 | </li> |
663 | 1003 | <?php |
@@ -671,14 +1011,20 @@ discard block |
||
671 | 1011 | ?> |
672 | 1012 | <li> |
673 | 1013 | <?php echo _("Display vessels with MMSI:"); ?> |
674 | - <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
|
1014 | + <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) { |
|
1015 | + print $_COOKIE['filter_mmsi']; |
|
1016 | +} |
|
1017 | +?>" /> |
|
675 | 1018 | </li> |
676 | 1019 | <?php |
677 | 1020 | } |
678 | 1021 | ?> |
679 | 1022 | <li> |
680 | 1023 | <?php echo _("Display with ident:"); ?> |
681 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
1024 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
1025 | + print $_COOKIE['filter_ident']; |
|
1026 | +} |
|
1027 | +?>" /> |
|
682 | 1028 | </li> |
683 | 1029 | </ul> |
684 | 1030 | </form> |
@@ -694,7 +1040,10 @@ discard block |
||
694 | 1040 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
695 | 1041 | <form> |
696 | 1042 | <ul> |
697 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
1043 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) { |
|
1044 | + print 'checked'; |
|
1045 | +} |
|
1046 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
698 | 1047 | <li><?php echo _("Type:"); ?> |
699 | 1048 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
700 | 1049 | <?php |
@@ -702,25 +1051,45 @@ discard block |
||
702 | 1051 | $types = $Satellite->get_tle_types(); |
703 | 1052 | foreach ($types as $type) { |
704 | 1053 | $type_name = $type['tle_type']; |
705 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
706 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
707 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
708 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
709 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
710 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
711 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
712 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
713 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
714 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
715 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
716 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
717 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
718 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
719 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
720 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
721 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
722 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
723 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
1054 | + if ($type_name == 'musson') { |
|
1055 | + $type_name = 'Russian LEO Navigation'; |
|
1056 | + } else if ($type_name == 'nnss') { |
|
1057 | + $type_name = 'Navi Navigation Satellite System'; |
|
1058 | + } else if ($type_name == 'sbas') { |
|
1059 | + $type_name = 'Satellite-Based Augmentation System'; |
|
1060 | + } else if ($type_name == 'glo-ops') { |
|
1061 | + $type_name = 'Glonass Operational'; |
|
1062 | + } else if ($type_name == 'gps-ops') { |
|
1063 | + $type_name = 'GPS Operational'; |
|
1064 | + } else if ($type_name == 'argos') { |
|
1065 | + $type_name = 'ARGOS Data Collection System'; |
|
1066 | + } else if ($type_name == 'tdrss') { |
|
1067 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
1068 | + } else if ($type_name == 'sarsat') { |
|
1069 | + $type_name = 'Search & Rescue'; |
|
1070 | + } else if ($type_name == 'dmc') { |
|
1071 | + $type_name = 'Disaster Monitoring'; |
|
1072 | + } else if ($type_name == 'resource') { |
|
1073 | + $type_name = 'Earth Resources'; |
|
1074 | + } else if ($type_name == 'stations') { |
|
1075 | + $type_name = 'Space Stations'; |
|
1076 | + } else if ($type_name == 'geo') { |
|
1077 | + $type_name = 'Geostationary'; |
|
1078 | + } else if ($type_name == 'amateur') { |
|
1079 | + $type_name = 'Amateur Radio'; |
|
1080 | + } else if ($type_name == 'x-comm') { |
|
1081 | + $type_name = 'Experimental'; |
|
1082 | + } else if ($type_name == 'other-comm') { |
|
1083 | + $type_name = 'Other Comm'; |
|
1084 | + } else if ($type_name == 'science') { |
|
1085 | + $type_name = 'Space & Earth Science'; |
|
1086 | + } else if ($type_name == 'military') { |
|
1087 | + $type_name = 'Miscellaneous Military'; |
|
1088 | + } else if ($type_name == 'radar') { |
|
1089 | + $type_name = 'Radar Calibration'; |
|
1090 | + } else if ($type_name == 'tle-new') { |
|
1091 | + $type_name = 'Last 30 days launches'; |
|
1092 | + } |
|
724 | 1093 | |
725 | 1094 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
726 | 1095 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -4,10 +4,15 @@ discard block |
||
4 | 4 | |
5 | 5 | setcookie("MapFormat",'2d'); |
6 | 6 | |
7 | -if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = ''; |
|
7 | +if (!isset($globalOpenWeatherMapKey)) { |
|
8 | + $globalOpenWeatherMapKey = ''; |
|
9 | +} |
|
8 | 10 | // Compressed GeoJson is used if true |
9 | -if (!isset($globalJsonCompress)) $compress = true; |
|
10 | -else $compress = $globalJsonCompress; |
|
11 | +if (!isset($globalJsonCompress)) { |
|
12 | + $compress = true; |
|
13 | +} else { |
|
14 | + $compress = $globalJsonCompress; |
|
15 | +} |
|
11 | 16 | if (isset($_GET['archive'])) { |
12 | 17 | $archive = true; |
13 | 18 | //$archiveupdatetime = 50; |
@@ -18,8 +23,11 @@ discard block |
||
18 | 23 | //$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10)); |
19 | 24 | //$lastupd = 20; |
20 | 25 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
21 | - if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
|
22 | - else $enddate = time(); |
|
26 | + if (isset($_GET['enddate']) && $_GET['enddate'] != '') { |
|
27 | + $enddate = $_GET['enddate']; |
|
28 | + } else { |
|
29 | + $enddate = time(); |
|
30 | + } |
|
23 | 31 | setcookie("archive_begin",$begindate); |
24 | 32 | setcookie("archive_end",$enddate); |
25 | 33 | setcookie("archive_update",$lastupd); |
@@ -107,7 +115,17 @@ discard block |
||
107 | 115 | } |
108 | 116 | |
109 | 117 | //create the map |
110 | - map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom); |
|
118 | + map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) { |
|
119 | + print $latitude; |
|
120 | +} else { |
|
121 | + print $globalCenterLatitude; |
|
122 | +} |
|
123 | +?>,<?php if (isset($longitude)) { |
|
124 | + print $longitude; |
|
125 | +} else { |
|
126 | + print $globalCenterLongitude; |
|
127 | +} |
|
128 | +?>], zoom); |
|
111 | 129 | <?php |
112 | 130 | } else { |
113 | 131 | if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) { |
@@ -133,9 +151,21 @@ discard block |
||
133 | 151 | || navigator.userAgent.match(/BlackBerry/i) |
134 | 152 | || navigator.userAgent.match(/Windows Phone/i)) |
135 | 153 | { |
136 | - var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>; |
|
154 | + var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) { |
|
155 | + print $viewzoom-1; |
|
156 | +} elseif (isset($viewzoom)) { |
|
157 | + print $viewzoom; |
|
158 | +} else { |
|
159 | + print '8'; |
|
160 | +} |
|
161 | +?>; |
|
137 | 162 | } else { |
138 | - var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>; |
|
163 | + var zoom = <?php if (isset($viewzoom)) { |
|
164 | + print $viewzoom; |
|
165 | +} else { |
|
166 | + print '9'; |
|
167 | +} |
|
168 | +?>; |
|
139 | 169 | } |
140 | 170 | |
141 | 171 | //create the map |
@@ -161,16 +191,27 @@ discard block |
||
161 | 191 | bounds = L.latLngBounds(southWest,northEast); |
162 | 192 | //a few title layers |
163 | 193 | <?php |
164 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
165 | - else $MapType = $globalMapProvider; |
|
194 | + if (isset($_COOKIE['MapType'])) { |
|
195 | + $MapType = $_COOKIE['MapType']; |
|
196 | + } else { |
|
197 | + $MapType = $globalMapProvider; |
|
198 | + } |
|
166 | 199 | |
167 | 200 | if ($MapType == 'Mapbox') { |
168 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
169 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
170 | -?> |
|
201 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
202 | + $MapBoxId = $globalMapboxId; |
|
203 | + } else { |
|
204 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
205 | + } |
|
206 | + ?> |
|
171 | 207 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
172 | 208 | maxZoom: 18, |
173 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
209 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
210 | + print 'false'; |
|
211 | +} else { |
|
212 | + print 'true'; |
|
213 | +} |
|
214 | +?>, |
|
174 | 215 | attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>', |
175 | 216 | id: '<?php print $MapBoxId; ?>', |
176 | 217 | token: '<?php print $globalMapboxToken; ?>' |
@@ -189,7 +230,12 @@ discard block |
||
189 | 230 | ?> |
190 | 231 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
191 | 232 | maxZoom: 18, |
192 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
233 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
234 | + print 'false'; |
|
235 | +} else { |
|
236 | + print 'true'; |
|
237 | +} |
|
238 | +?>, |
|
193 | 239 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
194 | 240 | '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>' |
195 | 241 | }).addTo(map); |
@@ -198,7 +244,12 @@ discard block |
||
198 | 244 | ?> |
199 | 245 | L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', { |
200 | 246 | maxZoom: 18, |
201 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
247 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
248 | + print 'false'; |
|
249 | +} else { |
|
250 | + print 'true'; |
|
251 | +} |
|
252 | +?>, |
|
202 | 253 | attribution: 'Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012' |
203 | 254 | }).addTo(map); |
204 | 255 | <?php |
@@ -206,7 +257,12 @@ discard block |
||
206 | 257 | ?> |
207 | 258 | L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { |
208 | 259 | maxZoom: 18, |
209 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
260 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
261 | + print 'false'; |
|
262 | +} else { |
|
263 | + print 'true'; |
|
264 | +} |
|
265 | +?>, |
|
210 | 266 | attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' |
211 | 267 | }).addTo(map); |
212 | 268 | <?php |
@@ -214,7 +270,12 @@ discard block |
||
214 | 270 | ?> |
215 | 271 | L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', { |
216 | 272 | maxZoom: 18, |
217 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
273 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
274 | + print 'false'; |
|
275 | +} else { |
|
276 | + print 'true'; |
|
277 | +} |
|
278 | +?>, |
|
218 | 279 | attribution: 'Tiles © Esri — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC' |
219 | 280 | }).addTo(map); |
220 | 281 | <?php |
@@ -259,20 +320,26 @@ discard block |
||
259 | 320 | map.addLayer(yandexLayer); |
260 | 321 | <?php |
261 | 322 | } elseif ($MapType == 'Bing-Aerial') { |
262 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
263 | -?> |
|
323 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
324 | + setcookie('MapType','OpenStreetMap'); |
|
325 | + } |
|
326 | + ?> |
|
264 | 327 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
265 | 328 | map.addLayer(bingLayer); |
266 | 329 | <?php |
267 | 330 | } elseif ($MapType == 'Bing-Hybrid') { |
268 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
269 | -?> |
|
331 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
332 | + setcookie('MapType','OpenStreetMap'); |
|
333 | + } |
|
334 | + ?> |
|
270 | 335 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
271 | 336 | map.addLayer(bingLayer); |
272 | 337 | <?php |
273 | 338 | } elseif ($MapType == 'Bing-Road') { |
274 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
275 | -?> |
|
339 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
340 | + setcookie('MapType','OpenStreetMap'); |
|
341 | + } |
|
342 | + ?> |
|
276 | 343 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
277 | 344 | map.addLayer(bingLayer); |
278 | 345 | <?php |
@@ -301,7 +368,12 @@ discard block |
||
301 | 368 | maxZoom: 5, |
302 | 369 | tms : true, |
303 | 370 | zindex : 3, |
304 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
371 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
372 | + print 'false'; |
|
373 | +} else { |
|
374 | + print 'true'; |
|
375 | +} |
|
376 | +?>, |
|
305 | 377 | attribution: 'Natural Earth' |
306 | 378 | }).addTo(map); |
307 | 379 | <?php |
@@ -309,9 +381,24 @@ discard block |
||
309 | 381 | $customid = $MapType; |
310 | 382 | ?> |
311 | 383 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
312 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
313 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
314 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
384 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
385 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
386 | +} else { |
|
387 | + print '18'; |
|
388 | +} |
|
389 | +?>, |
|
390 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
391 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
392 | +} else { |
|
393 | + print '0'; |
|
394 | +} |
|
395 | +?>, |
|
396 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
397 | + print 'false'; |
|
398 | +} else { |
|
399 | + print 'true'; |
|
400 | +} |
|
401 | +?>, |
|
315 | 402 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
316 | 403 | }).addTo(map); |
317 | 404 | |
@@ -351,7 +438,12 @@ discard block |
||
351 | 438 | } |
352 | 439 | } elseif ($globalBounding == 'circle') { |
353 | 440 | ?> |
354 | - var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{ |
|
441 | + var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) { |
|
442 | + print $globalBoundingCircleSize; |
|
443 | +} else { |
|
444 | + print '70000'; |
|
445 | +} |
|
446 | +?>,{ |
|
355 | 447 | color: '#92C7D1', |
356 | 448 | fillColor: '#92C7D1', |
357 | 449 | fillOpacity: 0.3, |
@@ -443,7 +535,12 @@ discard block |
||
443 | 535 | createCookie('lastcentercoord',map.getCenter().lat+','+map.getCenter().lng+','+map.getZoom(),2); |
444 | 536 | }); |
445 | 537 | update_locationsLayer(); |
446 | -setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
538 | +setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) { |
|
539 | + print $globalMapRefresh*1000*2; |
|
540 | +} else { |
|
541 | + print '60000'; |
|
542 | +} |
|
543 | +?>); |
|
447 | 544 | |
448 | 545 | <?php |
449 | 546 | // Add support for custom json via $globalMapJson |