@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['aircraft_manufacturer'])) { |
7 | - header('Location: '.$globalURL.'/manufacturer'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/manufacturer'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
@@ -265,22 +265,22 @@ discard block |
||
265 | 265 | var entityid = entity.id; |
266 | 266 | var lastupdateentity = entity.properties.lastupdate; |
267 | 267 | <?php |
268 | - if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
269 | - // Remove flights not in latest CZML |
|
268 | + if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
269 | + // Remove flights not in latest CZML |
|
270 | 270 | ?> |
271 | 271 | if (lastupdateentity != lastupdate) { |
272 | 272 | viewer.dataSources.get(dsn).entities.remove(entity); |
273 | 273 | czmlds.entities.removeById(entityid); |
274 | 274 | } |
275 | 275 | <?php |
276 | - } else { |
|
276 | + } else { |
|
277 | 277 | ?> |
278 | 278 | if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
279 | 279 | viewer.dataSources.get(dsn).entities.remove(entity); |
280 | 280 | czmlds.entities.removeById(entityid); |
281 | 281 | } |
282 | 282 | <?php |
283 | - } |
|
283 | + } |
|
284 | 284 | ?> |
285 | 285 | } |
286 | 286 | } |
@@ -708,12 +708,12 @@ discard block |
||
708 | 708 | update_airportsLayer(); |
709 | 709 | } |
710 | 710 | <?php |
711 | - if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
|
711 | + if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
|
712 | 712 | ?> |
713 | 713 | update_atcLayer(); |
714 | 714 | setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
715 | 715 | <?php |
716 | - } |
|
716 | + } |
|
717 | 717 | ?> |
718 | 718 | |
719 | 719 | function iconColor(color) { |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | var entityid = entity.id; |
42 | 42 | var lastupdateentity = entity.properties.lastupdate; |
43 | 43 | <?php |
44 | - if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
44 | + if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
45 | 45 | ?> |
46 | 46 | if (lastupdateentity != lastupdatemarine) { |
47 | 47 | viewer.dataSources.get(dsn).entities.remove(entity); |
48 | 48 | czmldsmarine.entities.removeById(entityid); |
49 | 49 | } |
50 | 50 | <?php |
51 | - } else { |
|
51 | + } else { |
|
52 | 52 | ?> |
53 | 53 | if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
54 | 54 | viewer.dataSources.get(dsn).entities.remove(entity); |
55 | 55 | } |
56 | 56 | <?php |
57 | - } |
|
57 | + } |
|
58 | 58 | ?> |
59 | 59 | } |
60 | 60 | } |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | function updateMarineData() { |
77 | 77 | lastupdatemarine = Date.now(); |
78 | 78 | <?php |
79 | - if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
79 | + if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
80 | 80 | ?> |
81 | 81 | var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&coord='+bbox()+'&update=' + lastupdatemarine); |
82 | 82 | <?php |
83 | - } else { |
|
83 | + } else { |
|
84 | 84 | ?> |
85 | 85 | var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&update=' + lastupdatemarine); |
86 | 86 | <?php |
87 | - } |
|
87 | + } |
|
88 | 88 | ?> |
89 | 89 | livemarinedata.then(function (data) { |
90 | 90 | displayMarineData(data); |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
132 | 132 | camera.moveEnd.addEventListener(function() { |
133 | 133 | <?php |
134 | - if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
134 | + if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
135 | 135 | ?> |
136 | 136 | updateMarineData(); |
137 | 137 | <?php |
138 | - } |
|
138 | + } |
|
139 | 139 | ?> |
140 | 140 | }); |
141 | 141 |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['aircraft_manufacturer'])) { |
7 | - header('Location: '.$globalURL.'/manufacturer'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/manufacturer'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $aircraft_manufacturer = urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)); |
11 | 11 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
@@ -6,12 +6,12 @@ |
||
6 | 6 | </div> |
7 | 7 | <footer class="container"> |
8 | 8 | <?php |
9 | - if (isset($sql_time)) { |
|
9 | + if (isset($sql_time)) { |
|
10 | 10 | ?> |
11 | 11 | <i><?php echo _("Page generated in").' '.round($sql_time+$page_time,2); ?>s (<?php print round($page_time,2); ?>ms PHP - <?php print round($sql_time,2); ?>ms SQL)</i> |
12 | 12 | <br /> |
13 | 13 | <?php |
14 | - } |
|
14 | + } |
|
15 | 15 | ?> |
16 | 16 | <span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source & Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span> |
17 | 17 | </footer> |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
42 | - // Assuming the angles are in radians. |
|
43 | - $c1 = cos($heading/2); |
|
44 | - $s1 = sin($heading/2); |
|
45 | - $c2 = cos($attitude/2); |
|
46 | - $s2 = sin($attitude/2); |
|
47 | - $c3 = cos($bank/2); |
|
48 | - $s3 = sin($bank/2); |
|
49 | - $c1c2 = $c1*$c2; |
|
50 | - $s1s2 = $s1*$s2; |
|
51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
42 | + // Assuming the angles are in radians. |
|
43 | + $c1 = cos($heading/2); |
|
44 | + $s1 = sin($heading/2); |
|
45 | + $c2 = cos($attitude/2); |
|
46 | + $s2 = sin($attitude/2); |
|
47 | + $c3 = cos($bank/2); |
|
48 | + $s3 = sin($bank/2); |
|
49 | + $c1c2 = $c1*$c2; |
|
50 | + $s1s2 = $s1*$s2; |
|
51 | + $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | + $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | + $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | + $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | + return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
57 | 57 | |
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | if (isset($_GET['download'])) { |
62 | - if ($_GET['download'] == "true") |
|
63 | - { |
|
62 | + if ($_GET['download'] == "true") |
|
63 | + { |
|
64 | 64 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
65 | - } |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | header('Content-Type: text/javascript'); |
68 | 68 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
156 | 156 | $coord = explode(',',$_GET['coord']); |
157 | 157 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
158 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
158 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
159 | 159 | $coord = array(); |
160 | 160 | } |
161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
166 | 166 | $coord = explode(',',$_GET['coord']); |
167 | 167 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
168 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
168 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
169 | 169 | $coord = array(); |
170 | 170 | } |
171 | 171 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
176 | 176 | $coord = explode(',',$_GET['coord']); |
177 | 177 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
178 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
178 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
179 | 179 | $coord = array(); |
180 | 180 | } |
181 | 181 | } |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | $image = "images/placeholder_thumb.png"; |
266 | 266 | } |
267 | 267 | |
268 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
269 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
270 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
271 | - if ($prev_flightaware_id != $id) { |
|
268 | + if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
269 | + elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
270 | + elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
271 | + if ($prev_flightaware_id != $id) { |
|
272 | 272 | if ($prev_flightaware_id != '') { |
273 | 273 | /* |
274 | 274 | if ($nblatlong == 1) { |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
349 | 349 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
350 | 350 | } else $aircraft_shadow = ''; |
351 | - $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
351 | + $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
352 | 352 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
353 | 353 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
354 | 354 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
380 | 380 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
381 | 381 | } |
382 | - $output .= '},'; |
|
382 | + $output .= '},'; |
|
383 | 383 | } elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') { |
384 | 384 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : 1.0,"minimumPixelSize": 20'; |
385 | 385 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
388 | 388 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
389 | 389 | } |
390 | - $output .= '},'; |
|
390 | + $output .= '},'; |
|
391 | 391 | } elseif ($aircraft_icao != '') { |
392 | 392 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
393 | 393 | if (isset($aircraft_info[0]['engine_type'])) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return ($dec); |
58 | 58 | } |
59 | 59 | |
60 | - /* |
|
60 | + /* |
|
61 | 61 | $ais_map64 = array( |
62 | 62 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', // 48 |
63 | 63 | ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | // ' ' --- '?', // 0x20 - 0x3F |
98 | 98 | // '@' --- '_', // 0x40 - 0x5F |
99 | 99 | $ais_chars = array( |
100 | - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', |
|
101 | - 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', |
|
102 | - 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', |
|
103 | - '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'', |
|
104 | - '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', |
|
105 | - '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', |
|
106 | - '<', '=', '>', '?' |
|
100 | + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', |
|
101 | + 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', |
|
102 | + 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', |
|
103 | + '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'', |
|
104 | + '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', |
|
105 | + '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', |
|
106 | + '<', '=', '>', '?' |
|
107 | 107 | ); |
108 | 108 | // " |
109 | 109 | $rv = ''; |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | } |
422 | 422 | if ($num_seq > 1) { // for multipart messages |
423 | 423 | if ($cmsg_sid != $msg_sid // different msg_sid |
424 | - || $msg_sid == -1 // invalid initial msg_sid |
|
425 | - || ($seq - $pseq) != 1 // not insequence |
|
424 | + || $msg_sid == -1 // invalid initial msg_sid |
|
425 | + || ($seq - $pseq) != 1 // not insequence |
|
426 | 426 | ) { // invalid for multipart message |
427 | 427 | $msg_sid = -1; |
428 | 428 | $cmsg_sid = -1; |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $itu = $itu.$pcs[5]; // get itu message |
436 | 436 | $filler += (int)$pcs[6][0]; // get filler |
437 | 437 | if ($num_seq == 1 // valid single message |
438 | - || $num_seq == $pseq // valid multi-part message |
|
438 | + || $num_seq == $pseq // valid multi-part message |
|
439 | 439 | ) { |
440 | 440 | /* |
441 | 441 | if ($num_seq != 1) { // test |
@@ -520,13 +520,13 @@ discard block |
||
520 | 520 | else $pad = ''; |
521 | 521 | $rv = ''; |
522 | 522 | $ais_chars = array( |
523 | - '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9, |
|
524 | - 'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19, |
|
525 | - 'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29, |
|
526 | - '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39, |
|
527 | - '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49, |
|
528 | - '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59, |
|
529 | - '<'=>60, '='=>61, '>'=>62, '?'=>63 |
|
523 | + '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9, |
|
524 | + 'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19, |
|
525 | + 'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29, |
|
526 | + '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39, |
|
527 | + '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49, |
|
528 | + '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59, |
|
529 | + '<'=>60, '='=>61, '>'=>62, '?'=>63 |
|
530 | 530 | ); |
531 | 531 | // " |
532 | 532 | $_a = str_split($name); |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | |
14 | 14 | |
15 | 15 | /** |
16 | - * Get SQL query part for filter used |
|
17 | - * @param Array $filter the filter |
|
18 | - * @return Array the SQL part |
|
19 | - */ |
|
16 | + * Get SQL query part for filter used |
|
17 | + * @param Array $filter the filter |
|
18 | + * @return Array the SQL part |
|
19 | + */ |
|
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * Gets all the spotter information based on the latest data entry |
|
94 | - * |
|
95 | - * @return Array the spotter information |
|
96 | - * |
|
97 | - */ |
|
93 | + * Gets all the spotter information based on the latest data entry |
|
94 | + * |
|
95 | + * @return Array the spotter information |
|
96 | + * |
|
97 | + */ |
|
98 | 98 | public function getLiveMarineData($limit = '', $sort = '', $filter = array()) |
99 | 99 | { |
100 | 100 | global $globalDBdriver, $globalLiveInterval; |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
140 | - * Gets Minimal Live Spotter data |
|
141 | - * |
|
142 | - * @return Array the spotter information |
|
143 | - * |
|
144 | - */ |
|
140 | + * Gets Minimal Live Spotter data |
|
141 | + * |
|
142 | + * @return Array the spotter information |
|
143 | + * |
|
144 | + */ |
|
145 | 145 | public function getMinLiveMarineData($filter = array()) |
146 | 146 | { |
147 | 147 | global $globalDBdriver, $globalLiveInterval; |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
174 | - * Gets Minimal Live Spotter data since xx seconds |
|
175 | - * |
|
176 | - * @return Array the spotter information |
|
177 | - * |
|
178 | - */ |
|
174 | + * Gets Minimal Live Spotter data since xx seconds |
|
175 | + * |
|
176 | + * @return Array the spotter information |
|
177 | + * |
|
178 | + */ |
|
179 | 179 | public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false) |
180 | 180 | { |
181 | 181 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
249 | - * Gets number of latest data entry |
|
250 | - * |
|
251 | - * @return String number of entry |
|
252 | - * |
|
253 | - */ |
|
249 | + * Gets number of latest data entry |
|
250 | + * |
|
251 | + * @return String number of entry |
|
252 | + * |
|
253 | + */ |
|
254 | 254 | public function getLiveMarineCount($filter = array()) |
255 | 255 | { |
256 | 256 | global $globalDBdriver, $globalLiveInterval; |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
278 | - * Gets all the spotter information based on the latest data entry and coord |
|
279 | - * |
|
280 | - * @return Array the spotter information |
|
281 | - * |
|
282 | - */ |
|
278 | + * Gets all the spotter information based on the latest data entry and coord |
|
279 | + * |
|
280 | + * @return Array the spotter information |
|
281 | + * |
|
282 | + */ |
|
283 | 283 | public function getLiveMarineDatabyCoord($coord, $filter = array()) |
284 | 284 | { |
285 | 285 | global $globalDBdriver, $globalLiveInterval; |
@@ -303,11 +303,11 @@ discard block |
||
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
306 | - * Gets all the spotter information based on the latest data entry and coord |
|
307 | - * |
|
308 | - * @return Array the spotter information |
|
309 | - * |
|
310 | - */ |
|
306 | + * Gets all the spotter information based on the latest data entry and coord |
|
307 | + * |
|
308 | + * @return Array the spotter information |
|
309 | + * |
|
310 | + */ |
|
311 | 311 | public function getMinLiveMarineDatabyCoord($coord, $filter = array()) |
312 | 312 | { |
313 | 313 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
379 | - * Gets all the spotter information based on a user's latitude and longitude |
|
380 | - * |
|
381 | - * @return Array the spotter information |
|
382 | - * |
|
383 | - */ |
|
379 | + * Gets all the spotter information based on a user's latitude and longitude |
|
380 | + * |
|
381 | + * @return Array the spotter information |
|
382 | + * |
|
383 | + */ |
|
384 | 384 | public function getLatestMarineForLayar($lat, $lng, $radius, $interval) |
385 | 385 | { |
386 | 386 | $Marine = new Marine($this->db); |
@@ -393,75 +393,75 @@ discard block |
||
393 | 393 | if ($lng != '') |
394 | 394 | { |
395 | 395 | if (!is_numeric($lng)) |
396 | - { |
|
397 | - return false; |
|
398 | - } |
|
399 | - } |
|
400 | - |
|
401 | - if ($radius != '') |
|
402 | - { |
|
403 | - if (!is_numeric($radius)) |
|
404 | - { |
|
405 | - return false; |
|
406 | - } |
|
407 | - } |
|
396 | + { |
|
397 | + return false; |
|
398 | + } |
|
399 | + } |
|
400 | + |
|
401 | + if ($radius != '') |
|
402 | + { |
|
403 | + if (!is_numeric($radius)) |
|
404 | + { |
|
405 | + return false; |
|
406 | + } |
|
407 | + } |
|
408 | 408 | $additional_query = ''; |
409 | 409 | if ($interval != '') |
410 | - { |
|
411 | - if (!is_string($interval)) |
|
412 | - { |
|
413 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
414 | - return false; |
|
415 | - } else { |
|
416 | - if ($interval == '1m') |
|
417 | - { |
|
418 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
419 | - } else if ($interval == '15m'){ |
|
420 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
421 | - } |
|
422 | - } |
|
423 | - } else { |
|
424 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
425 | - } |
|
426 | - |
|
427 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
410 | + { |
|
411 | + if (!is_string($interval)) |
|
412 | + { |
|
413 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
414 | + return false; |
|
415 | + } else { |
|
416 | + if ($interval == '1m') |
|
417 | + { |
|
418 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
419 | + } else if ($interval == '15m'){ |
|
420 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
421 | + } |
|
422 | + } |
|
423 | + } else { |
|
424 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
425 | + } |
|
426 | + |
|
427 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
428 | 428 | WHERE marine_live.latitude <> '' |
429 | 429 | AND marine_live.longitude <> '' |
430 | 430 | ".$additional_query." |
431 | 431 | HAVING distance < :radius |
432 | 432 | ORDER BY distance"; |
433 | 433 | |
434 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
434 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
435 | 435 | |
436 | - return $spotter_array; |
|
437 | - } |
|
436 | + return $spotter_array; |
|
437 | + } |
|
438 | 438 | |
439 | 439 | |
440 | - /** |
|
441 | - * Gets all the spotter information based on a particular callsign |
|
442 | - * |
|
443 | - * @return Array the spotter information |
|
444 | - * |
|
445 | - */ |
|
440 | + /** |
|
441 | + * Gets all the spotter information based on a particular callsign |
|
442 | + * |
|
443 | + * @return Array the spotter information |
|
444 | + * |
|
445 | + */ |
|
446 | 446 | public function getLastLiveMarineDataByIdent($ident) |
447 | 447 | { |
448 | 448 | $Marine = new Marine($this->db); |
449 | 449 | date_default_timezone_set('UTC'); |
450 | 450 | |
451 | 451 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
452 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
452 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
453 | 453 | |
454 | 454 | $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
455 | 455 | |
456 | 456 | return $spotter_array; |
457 | 457 | } |
458 | 458 | |
459 | - /** |
|
460 | - * Gets all the spotter information based on a particular callsign |
|
461 | - * |
|
462 | - * @return Array the spotter information |
|
463 | - * |
|
464 | - */ |
|
459 | + /** |
|
460 | + * Gets all the spotter information based on a particular callsign |
|
461 | + * |
|
462 | + * @return Array the spotter information |
|
463 | + * |
|
464 | + */ |
|
465 | 465 | public function getDateLiveMarineDataByIdent($ident,$date) |
466 | 466 | { |
467 | 467 | $Marine = new Marine($this->db); |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
477 | - * Gets all the spotter information based on a particular MMSI |
|
478 | - * |
|
479 | - * @return Array the spotter information |
|
480 | - * |
|
481 | - */ |
|
477 | + * Gets all the spotter information based on a particular MMSI |
|
478 | + * |
|
479 | + * @return Array the spotter information |
|
480 | + * |
|
481 | + */ |
|
482 | 482 | public function getDateLiveMarineDataByMMSI($mmsi,$date) |
483 | 483 | { |
484 | 484 | $Marine = new Marine($this->db); |
@@ -490,51 +490,51 @@ discard block |
||
490 | 490 | return $spotter_array; |
491 | 491 | } |
492 | 492 | |
493 | - /** |
|
494 | - * Gets last spotter information based on a particular callsign |
|
495 | - * |
|
496 | - * @return Array the spotter information |
|
497 | - * |
|
498 | - */ |
|
493 | + /** |
|
494 | + * Gets last spotter information based on a particular callsign |
|
495 | + * |
|
496 | + * @return Array the spotter information |
|
497 | + * |
|
498 | + */ |
|
499 | 499 | public function getLastLiveMarineDataById($id) |
500 | 500 | { |
501 | 501 | $Marine = new Marine($this->db); |
502 | 502 | date_default_timezone_set('UTC'); |
503 | 503 | |
504 | 504 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
505 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
505 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
506 | 506 | |
507 | 507 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
508 | 508 | |
509 | 509 | return $spotter_array; |
510 | 510 | } |
511 | 511 | |
512 | - /** |
|
513 | - * Gets last spotter information based on a particular callsign |
|
514 | - * |
|
515 | - * @return Array the spotter information |
|
516 | - * |
|
517 | - */ |
|
512 | + /** |
|
513 | + * Gets last spotter information based on a particular callsign |
|
514 | + * |
|
515 | + * @return Array the spotter information |
|
516 | + * |
|
517 | + */ |
|
518 | 518 | public function getDateLiveMarineDataById($id,$date) |
519 | 519 | { |
520 | 520 | $Marine = new Marine($this->db); |
521 | 521 | date_default_timezone_set('UTC'); |
522 | 522 | |
523 | 523 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
524 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
525 | - $date = date('c',$date); |
|
524 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
525 | + $date = date('c',$date); |
|
526 | 526 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
527 | 527 | |
528 | 528 | return $spotter_array; |
529 | 529 | } |
530 | 530 | |
531 | 531 | |
532 | - /** |
|
533 | - * Gets all the spotter information based on a particular id |
|
534 | - * |
|
535 | - * @return Array the spotter information |
|
536 | - * |
|
537 | - */ |
|
532 | + /** |
|
533 | + * Gets all the spotter information based on a particular id |
|
534 | + * |
|
535 | + * @return Array the spotter information |
|
536 | + * |
|
537 | + */ |
|
538 | 538 | public function getAllLiveMarineDataById($id,$liveinterval = false) |
539 | 539 | { |
540 | 540 | global $globalDBdriver, $globalLiveInterval; |
@@ -562,18 +562,18 @@ discard block |
||
562 | 562 | return $spotter_array; |
563 | 563 | } |
564 | 564 | |
565 | - /** |
|
566 | - * Gets all the spotter information based on a particular ident |
|
567 | - * |
|
568 | - * @return Array the spotter information |
|
569 | - * |
|
570 | - */ |
|
565 | + /** |
|
566 | + * Gets all the spotter information based on a particular ident |
|
567 | + * |
|
568 | + * @return Array the spotter information |
|
569 | + * |
|
570 | + */ |
|
571 | 571 | public function getAllLiveMarineDataByIdent($ident) |
572 | 572 | { |
573 | 573 | date_default_timezone_set('UTC'); |
574 | 574 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
575 | 575 | $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
576 | - try { |
|
576 | + try { |
|
577 | 577 | |
578 | 578 | $sth = $this->db->prepare($query); |
579 | 579 | $sth->execute(array(':ident' => $ident)); |
@@ -587,23 +587,23 @@ discard block |
||
587 | 587 | |
588 | 588 | |
589 | 589 | /** |
590 | - * Deletes all info in the table |
|
591 | - * |
|
592 | - * @return String success or false |
|
593 | - * |
|
594 | - */ |
|
590 | + * Deletes all info in the table |
|
591 | + * |
|
592 | + * @return String success or false |
|
593 | + * |
|
594 | + */ |
|
595 | 595 | public function deleteLiveMarineData() |
596 | 596 | { |
597 | 597 | global $globalDBdriver; |
598 | 598 | if ($globalDBdriver == 'mysql') { |
599 | 599 | //$query = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date"; |
600 | 600 | $query = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date'; |
601 | - //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
601 | + //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
602 | 602 | } else { |
603 | 603 | $query = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date"; |
604 | 604 | } |
605 | 605 | |
606 | - try { |
|
606 | + try { |
|
607 | 607 | |
608 | 608 | $sth = $this->db->prepare($query); |
609 | 609 | $sth->execute(); |
@@ -615,18 +615,18 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | /** |
618 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
619 | - * |
|
620 | - * @return String success or false |
|
621 | - * |
|
622 | - */ |
|
618 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
619 | + * |
|
620 | + * @return String success or false |
|
621 | + * |
|
622 | + */ |
|
623 | 623 | public function deleteLiveMarineDataNotUpdated() |
624 | 624 | { |
625 | 625 | global $globalDBdriver, $globalDebug; |
626 | 626 | if ($globalDBdriver == 'mysql') { |
627 | 627 | //$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0'; |
628 | - $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
629 | - try { |
|
628 | + $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
629 | + try { |
|
630 | 630 | |
631 | 631 | $sth = $this->db->prepare($query); |
632 | 632 | $sth->execute(); |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | return "error"; |
635 | 635 | } |
636 | 636 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
637 | - $i = 0; |
|
638 | - $j =0; |
|
637 | + $i = 0; |
|
638 | + $j =0; |
|
639 | 639 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
640 | 640 | foreach($all as $row) |
641 | 641 | { |
@@ -643,20 +643,20 @@ discard block |
||
643 | 643 | $j++; |
644 | 644 | if ($j == 30) { |
645 | 645 | if ($globalDebug) echo "."; |
646 | - try { |
|
646 | + try { |
|
647 | 647 | |
648 | 648 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
649 | 649 | $sth->execute(); |
650 | 650 | } catch(PDOException $e) { |
651 | 651 | return "error"; |
652 | 652 | } |
653 | - $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
654 | - $j = 0; |
|
653 | + $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
654 | + $j = 0; |
|
655 | 655 | } |
656 | 656 | $query_delete .= "'".$row['fammarine_id']."',"; |
657 | 657 | } |
658 | 658 | if ($i > 0) { |
659 | - try { |
|
659 | + try { |
|
660 | 660 | |
661 | 661 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
662 | 662 | $sth->execute(); |
@@ -667,9 +667,9 @@ discard block |
||
667 | 667 | return "success"; |
668 | 668 | } elseif ($globalDBdriver == 'pgsql') { |
669 | 669 | //$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0"; |
670 | - //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
671 | - $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
672 | - try { |
|
670 | + //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
671 | + $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
672 | + try { |
|
673 | 673 | |
674 | 674 | $sth = $this->db->prepare($query); |
675 | 675 | $sth->execute(); |
@@ -713,17 +713,17 @@ discard block |
||
713 | 713 | } |
714 | 714 | |
715 | 715 | /** |
716 | - * Deletes all info in the table for an ident |
|
717 | - * |
|
718 | - * @return String success or false |
|
719 | - * |
|
720 | - */ |
|
716 | + * Deletes all info in the table for an ident |
|
717 | + * |
|
718 | + * @return String success or false |
|
719 | + * |
|
720 | + */ |
|
721 | 721 | public function deleteLiveMarineDataByIdent($ident) |
722 | 722 | { |
723 | 723 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
724 | 724 | $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
725 | 725 | |
726 | - try { |
|
726 | + try { |
|
727 | 727 | |
728 | 728 | $sth = $this->db->prepare($query); |
729 | 729 | $sth->execute(array(':ident' => $ident)); |
@@ -735,17 +735,17 @@ discard block |
||
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
738 | - * Deletes all info in the table for an id |
|
739 | - * |
|
740 | - * @return String success or false |
|
741 | - * |
|
742 | - */ |
|
738 | + * Deletes all info in the table for an id |
|
739 | + * |
|
740 | + * @return String success or false |
|
741 | + * |
|
742 | + */ |
|
743 | 743 | public function deleteLiveMarineDataById($id) |
744 | 744 | { |
745 | 745 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
746 | 746 | $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
747 | 747 | |
748 | - try { |
|
748 | + try { |
|
749 | 749 | |
750 | 750 | $sth = $this->db->prepare($query); |
751 | 751 | $sth->execute(array(':id' => $id)); |
@@ -758,11 +758,11 @@ discard block |
||
758 | 758 | |
759 | 759 | |
760 | 760 | /** |
761 | - * Gets the aircraft ident within the last hour |
|
762 | - * |
|
763 | - * @return String the ident |
|
764 | - * |
|
765 | - */ |
|
761 | + * Gets the aircraft ident within the last hour |
|
762 | + * |
|
763 | + * @return String the ident |
|
764 | + * |
|
765 | + */ |
|
766 | 766 | public function getIdentFromLastHour($ident) |
767 | 767 | { |
768 | 768 | global $globalDBdriver, $globalTimezone; |
@@ -788,14 +788,14 @@ discard block |
||
788 | 788 | $ident_result = $row['ident']; |
789 | 789 | } |
790 | 790 | return $ident_result; |
791 | - } |
|
791 | + } |
|
792 | 792 | |
793 | 793 | /** |
794 | - * Check recent aircraft |
|
795 | - * |
|
796 | - * @return String the ident |
|
797 | - * |
|
798 | - */ |
|
794 | + * Check recent aircraft |
|
795 | + * |
|
796 | + * @return String the ident |
|
797 | + * |
|
798 | + */ |
|
799 | 799 | public function checkIdentRecent($ident) |
800 | 800 | { |
801 | 801 | global $globalDBdriver, $globalTimezone; |
@@ -821,14 +821,14 @@ discard block |
||
821 | 821 | $ident_result = $row['fammarine_id']; |
822 | 822 | } |
823 | 823 | return $ident_result; |
824 | - } |
|
824 | + } |
|
825 | 825 | |
826 | 826 | /** |
827 | - * Check recent aircraft by id |
|
828 | - * |
|
829 | - * @return String the ident |
|
830 | - * |
|
831 | - */ |
|
827 | + * Check recent aircraft by id |
|
828 | + * |
|
829 | + * @return String the ident |
|
830 | + * |
|
831 | + */ |
|
832 | 832 | public function checkIdRecent($id) |
833 | 833 | { |
834 | 834 | global $globalDBdriver, $globalTimezone; |
@@ -854,14 +854,14 @@ discard block |
||
854 | 854 | $ident_result = $row['fammarine_id']; |
855 | 855 | } |
856 | 856 | return $ident_result; |
857 | - } |
|
857 | + } |
|
858 | 858 | |
859 | 859 | /** |
860 | - * Check recent aircraft by mmsi |
|
861 | - * |
|
862 | - * @return String the ident |
|
863 | - * |
|
864 | - */ |
|
860 | + * Check recent aircraft by mmsi |
|
861 | + * |
|
862 | + * @return String the ident |
|
863 | + * |
|
864 | + */ |
|
865 | 865 | public function checkMMSIRecent($mmsi) |
866 | 866 | { |
867 | 867 | global $globalDBdriver, $globalTimezone; |
@@ -887,19 +887,19 @@ discard block |
||
887 | 887 | $ident_result = $row['fammarine_id']; |
888 | 888 | } |
889 | 889 | return $ident_result; |
890 | - } |
|
890 | + } |
|
891 | 891 | |
892 | 892 | /** |
893 | - * Adds a new spotter data |
|
894 | - * |
|
895 | - * @param String $fammarine_id the ID from flightaware |
|
896 | - * @param String $ident the flight ident |
|
897 | - * @param String $aircraft_icao the aircraft type |
|
898 | - * @param String $departure_airport_icao the departure airport |
|
899 | - * @param String $arrival_airport_icao the arrival airport |
|
900 | - * @return String success or false |
|
901 | - * |
|
902 | - */ |
|
893 | + * Adds a new spotter data |
|
894 | + * |
|
895 | + * @param String $fammarine_id the ID from flightaware |
|
896 | + * @param String $ident the flight ident |
|
897 | + * @param String $aircraft_icao the aircraft type |
|
898 | + * @param String $departure_airport_icao the departure airport |
|
899 | + * @param String $arrival_airport_icao the arrival airport |
|
900 | + * @return String success or false |
|
901 | + * |
|
902 | + */ |
|
903 | 903 | public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
904 | 904 | { |
905 | 905 | global $globalURL, $globalArchive, $globalDebug; |
@@ -973,10 +973,10 @@ discard block |
||
973 | 973 | if ($typeid == '') $typeid = NULL; |
974 | 974 | if ($statusid == '') $statusid = NULL; |
975 | 975 | |
976 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
977 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
978 | - if ($arrival_date == '') $arrival_date = NULL; |
|
979 | - $query = ''; |
|
976 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
977 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
978 | + if ($arrival_date == '') $arrival_date = NULL; |
|
979 | + $query = ''; |
|
980 | 980 | if ($globalArchive) { |
981 | 981 | if ($globalDebug) echo '-- Delete previous data -- '; |
982 | 982 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | print '<div class="select-item">'; |
22 | 22 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
23 | 23 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
24 | - print '<option></option>'; |
|
25 | - $Stats = new Stats(); |
|
26 | - $aircraft_types = $Stats->getAllAircraftTypes(); |
|
27 | - if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
28 | - foreach($aircraft_types as $aircrafttype) |
|
29 | - { |
|
30 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
31 | - { |
|
32 | - print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
33 | - } else { |
|
34 | - print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
35 | - } |
|
24 | + print '<option></option>'; |
|
25 | + $Stats = new Stats(); |
|
26 | + $aircraft_types = $Stats->getAllAircraftTypes(); |
|
27 | + if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
28 | + foreach($aircraft_types as $aircrafttype) |
|
29 | + { |
|
30 | + if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
31 | + { |
|
32 | + print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
33 | + } else { |
|
34 | + print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | print '</select>'; |
38 | 38 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
@@ -61,18 +61,18 @@ discard block |
||
61 | 61 | print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>'; |
62 | 62 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
63 | 63 | print 'var series = ['; |
64 | - $country_data = ''; |
|
64 | + $country_data = ''; |
|
65 | 65 | foreach($airline_array as $airline_item) |
66 | 66 | { |
67 | 67 | $country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],'; |
68 | 68 | } |
69 | - $country_data = substr($country_data, 0, -1); |
|
70 | - print $country_data; |
|
71 | - print '];'; |
|
72 | - print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
73 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
74 | - print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
75 | - print 'new Datamap({ |
|
69 | + $country_data = substr($country_data, 0, -1); |
|
70 | + print $country_data; |
|
71 | + print '];'; |
|
72 | + print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
73 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
74 | + print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
75 | + print 'new Datamap({ |
|
76 | 76 | element: document.getElementById("chartCountry"), |
77 | 77 | projection: "mercator", // big world map |
78 | 78 | fills: { defaultFill: "#F5F5F5" }, |