@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // This script can be slow... |
3 | 3 | set_time_limit(0); |
4 | -ini_set('max_execution_time',6000); |
|
4 | +ini_set('max_execution_time', 6000); |
|
5 | 5 | require_once('require/class.Connection.php'); |
6 | 6 | require_once('require/class.Common.php'); |
7 | 7 | |
@@ -63,24 +63,24 @@ discard block |
||
63 | 63 | $min = false; |
64 | 64 | $allhistory = false; |
65 | 65 | $filter['source'] = array(); |
66 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
71 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
66 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
69 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
71 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
72 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
73 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
74 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
75 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
76 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
77 | 77 | |
78 | 78 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
79 | 79 | $min = true; |
80 | 80 | } else $min = false; |
81 | 81 | |
82 | 82 | if (isset($_GET['ident'])) { |
83 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
83 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
84 | 84 | $from_archive = true; |
85 | 85 | if ($tracker) { |
86 | 86 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $allhistory = true; |
95 | 95 | } |
96 | 96 | elseif (isset($_GET['flightaware_id'])) { |
97 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
97 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
98 | 98 | $from_archive = true; |
99 | 99 | if ($tracker) { |
100 | 100 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
@@ -109,26 +109,26 @@ discard block |
||
109 | 109 | } |
110 | 110 | elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
111 | 111 | $from_archive = true; |
112 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
112 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
113 | 113 | if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
114 | 114 | else $begindate = $begindate - 3000; |
115 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
116 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
117 | - $part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT); |
|
115 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
116 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
117 | + $part = filter_input(INPUT_GET, 'part', FILTER_SANITIZE_NUMBER_INT); |
|
118 | 118 | if ($part == '') $part = 0; |
119 | 119 | |
120 | 120 | if ($begindate != '' && $enddate != '') { |
121 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
122 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
121 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
122 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
123 | 123 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
124 | 124 | if ($tracker) { |
125 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
125 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
126 | 126 | } |
127 | 127 | elseif ($marine) { |
128 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
128 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
129 | 129 | } |
130 | 130 | else { |
131 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part); |
|
131 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter, $part); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if ($flightcnt == '') $flightcnt = 0; |
140 | 140 | } else $flightcnt = 0; |
141 | 141 | |
142 | -$sqltime = round(microtime(true)-$begintime,2); |
|
142 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
143 | 143 | |
144 | 144 | $pfi = ''; |
145 | 145 | //var_dump($spotter_array); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $begin = true; |
155 | 155 | if (!empty($spotter_array) && is_array($spotter_array)) { |
156 | 156 | $output .= '"features": ['; |
157 | - foreach($spotter_array as $spotter_item) { |
|
157 | + foreach ($spotter_array as $spotter_item) { |
|
158 | 158 | $j++; |
159 | 159 | date_default_timezone_set('UTC'); |
160 | 160 | if ($tracker) { |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if ($begin) { |
179 | 179 | if ($j > 1) { |
180 | 180 | if (isset($output_time)) { |
181 | - $output_time = substr($output_time, 0, -1); |
|
181 | + $output_time = substr($output_time, 0, -1); |
|
182 | 182 | $output .= '"time": ['.$output_time.']'; |
183 | 183 | } |
184 | 184 | $output .= '},'; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $output .= '"type": "LineString",'; |
188 | 188 | $output .= '"coordinates": ['; |
189 | 189 | if (isset($output_history)) { |
190 | - $output_history = substr($output_history, 0, -1); |
|
190 | + $output_history = substr($output_history, 0, -1); |
|
191 | 191 | $output .= $output_history; |
192 | 192 | } |
193 | 193 | $output .= ']}},'; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $output .= '"fi": "'.$pfi.'",'; |
219 | 219 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
220 | 220 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
221 | - $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
221 | + $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
222 | 222 | //" |
223 | 223 | } else { |
224 | 224 | $output .= '"c": "NA",'; |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | if ($j > 1) { |
354 | 354 | if (isset($output_time)) { |
355 | - $output_time = substr($output_time, 0, -1); |
|
355 | + $output_time = substr($output_time, 0, -1); |
|
356 | 356 | $output .= '"time": ['.$output_time.']'; |
357 | 357 | } |
358 | 358 | $output .= '},'; |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $output .= '"type": "LineString",'; |
362 | 362 | $output .= '"coordinates": ['; |
363 | 363 | if (isset($output_history)) { |
364 | - $output_history = substr($output_history, 0, -1); |
|
364 | + $output_history = substr($output_history, 0, -1); |
|
365 | 365 | $output .= $output_history; |
366 | 366 | } |
367 | 367 | $output .= ']'; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $output = substr($output, 0, -1); |
373 | 373 | $output .= ']'; |
374 | 374 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
375 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
375 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
376 | 376 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
377 | 377 | $output .= '"fc": "'.$flightcnt.'"'; |
378 | 378 | } else { |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | if (!isset($globalJsonCompress)) $compress = true; |
7 | 7 | else $compress = $globalJsonCompress; |
8 | 8 | |
9 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
10 | -if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
9 | +if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
10 | +if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
11 | 11 | ?> |
12 | 12 | <?php |
13 | 13 | if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if (typeof props != 'undefined') { |
227 | 227 | var thedate = new Date(props); |
228 | 228 | $("#thedate").html(thedate.toUTCString()); |
229 | - // $("#archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'); |
|
229 | + // $("#archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | <?php |
374 | 374 | } else { |
375 | 375 | ?> |
376 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
376 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
377 | 377 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
378 | 378 | <?php |
379 | 379 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | /* |
391 | 391 | shadowUrl: iconURLShadowpath, |
392 | 392 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
393 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
393 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
394 | 394 | */ |
395 | 395 | }) |
396 | 396 | }) |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | <?php |
425 | 425 | } else { |
426 | 426 | ?> |
427 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
427 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
428 | 428 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
429 | 429 | <?php |
430 | 430 | } |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | <?php |
473 | 473 | } else { |
474 | 474 | ?> |
475 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
475 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
476 | 476 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
477 | 477 | <?php |
478 | 478 | } |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | $s3 = sin($bank/2); |
60 | 60 | $c1c2 = $c1*$c2; |
61 | 61 | $s1s2 = $s1*$s2; |
62 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
63 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
64 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
62 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
63 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
64 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
67 | 67 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
68 | 68 | |
69 | 69 | } |
@@ -84,17 +84,17 @@ discard block |
||
84 | 84 | $min = false; |
85 | 85 | $allhistory = false; |
86 | 86 | $filter['source'] = array(); |
87 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
88 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
89 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
90 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
91 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
92 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
93 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
94 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
96 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
97 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
87 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
88 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
89 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
90 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
91 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
92 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
93 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
94 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
95 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
96 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
97 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
98 | 98 | /* |
99 | 99 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
100 | 100 | $min = true; |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | $from_archive = true; |
142 | 142 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
143 | 143 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
144 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
145 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
146 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
147 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
148 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
144 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
145 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
146 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
147 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
148 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
149 | 149 | if ($tracker) { |
150 | - $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter); |
|
150 | + $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter); |
|
151 | 151 | } elseif ($marine) { |
152 | - $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter); |
|
152 | + $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter); |
|
153 | 153 | } else { |
154 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
154 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
155 | 155 | } |
156 | 156 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
157 | 157 | $from_archive = true; |
@@ -168,36 +168,36 @@ discard block |
||
168 | 168 | } |
169 | 169 | $enddate = $_COOKIE['archive_end']; |
170 | 170 | $enddateinitial = $_COOKIE['archive_end']; |
171 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
172 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
173 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
171 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
172 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
173 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
174 | 174 | //echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
175 | 175 | if ($tracker) { |
176 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
176 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
177 | 177 | } elseif ($marine) { |
178 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
178 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
179 | 179 | } else { |
180 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
180 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
181 | 181 | } |
182 | 182 | } elseif ($tracker) { |
183 | 183 | $coord = array(); |
184 | 184 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
185 | - $coord = explode(',',$_GET['coord']); |
|
186 | - 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) |
|
185 | + $coord = explode(',', $_GET['coord']); |
|
186 | + 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) |
|
187 | 187 | && $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)) { |
188 | 188 | $coord = array(); |
189 | 189 | } |
190 | 190 | } |
191 | 191 | $previous_filter = $filter; |
192 | 192 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) { |
193 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker'])); |
|
194 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
193 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker'])); |
|
194 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
195 | 195 | /* |
196 | 196 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
197 | 197 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']); |
198 | 198 | */ |
199 | 199 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
200 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
200 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
201 | 201 | } else { |
202 | 202 | $spotter_array = array(); |
203 | 203 | } |
@@ -205,22 +205,22 @@ discard block |
||
205 | 205 | } elseif ($marine) { |
206 | 206 | $coord = array(); |
207 | 207 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
208 | - $coord = explode(',',$_GET['coord']); |
|
209 | - 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) |
|
208 | + $coord = explode(',', $_GET['coord']); |
|
209 | + 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) |
|
210 | 210 | && $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)) { |
211 | 211 | $coord = array(); |
212 | 212 | } |
213 | 213 | } |
214 | 214 | $previous_filter = $filter; |
215 | 215 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) { |
216 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine'])); |
|
217 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
216 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackMarine'])); |
|
217 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
218 | 218 | /* |
219 | 219 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
220 | 220 | $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true,$_COOKIE['MapTrack']); |
221 | 221 | */ |
222 | 222 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
223 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
223 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
224 | 224 | } else { |
225 | 225 | $spotter_array = array(); |
226 | 226 | } |
@@ -228,20 +228,20 @@ discard block |
||
228 | 228 | } else { |
229 | 229 | $coord = array(); |
230 | 230 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
231 | - $coord = explode(',',$_GET['coord']); |
|
232 | - 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) |
|
231 | + $coord = explode(',', $_GET['coord']); |
|
232 | + 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) |
|
233 | 233 | && $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)) { |
234 | 234 | $coord = array(); |
235 | 235 | } |
236 | 236 | } |
237 | 237 | $previous_filter = $filter; |
238 | 238 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
239 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
|
240 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
239 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrack'])); |
|
240 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
241 | 241 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
242 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true,$_COOKIE['MapTrack']); |
|
242 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true, $_COOKIE['MapTrack']); |
|
243 | 243 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
244 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
244 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
245 | 245 | } else { |
246 | 246 | $spotter_array = array(); |
247 | 247 | } |
@@ -251,19 +251,19 @@ discard block |
||
251 | 251 | if (!empty($spotter_array) && isset($coord)) { |
252 | 252 | if ($tracker) { |
253 | 253 | if (isset($_GET['archive'])) { |
254 | - $flightcnt = $TrackerLive->getLiveTrackerCount($begindate,$enddate,$filter); |
|
254 | + $flightcnt = $TrackerLive->getLiveTrackerCount($begindate, $enddate, $filter); |
|
255 | 255 | } else { |
256 | 256 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
257 | 257 | } |
258 | 258 | } elseif ($marine) { |
259 | 259 | if (isset($_GET['archive'])) { |
260 | - $flightcnt = $MarineLive->getLiveMarineCount($begindate,$enddate,$filter); |
|
260 | + $flightcnt = $MarineLive->getLiveMarineCount($begindate, $enddate, $filter); |
|
261 | 261 | } else { |
262 | 262 | $flightcnt = $MarineLive->getLiveMarineCount($filter); |
263 | 263 | } |
264 | 264 | } else { |
265 | 265 | if (isset($_GET['archive'])) { |
266 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
266 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
267 | 267 | } else { |
268 | 268 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
269 | 269 | } |
@@ -271,17 +271,17 @@ discard block |
||
271 | 271 | if ($flightcnt == '') $flightcnt = 0; |
272 | 272 | } else $flightcnt = 0; |
273 | 273 | |
274 | -$sqltime = round(microtime(true)-$begintime,2); |
|
274 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
275 | 275 | $minitime = time(); |
276 | 276 | $minitracktime_begin = time(); |
277 | 277 | $minitracktime = $minitracktime_begin; |
278 | 278 | $maxitime = 0; |
279 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
279 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
280 | 280 | $modelsdb = array(); |
281 | 281 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
282 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
283 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
284 | - if (isset($row[1]) ){ |
|
282 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
283 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
284 | + if (isset($row[1])) { |
|
285 | 285 | $model = $row[0]; |
286 | 286 | $modelsdb[$model] = $row[1]; |
287 | 287 | } |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | } |
292 | 292 | $modelsdb2 = array(); |
293 | 293 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
294 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
295 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
296 | - if (isset($row[1]) ){ |
|
294 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
295 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
296 | + if (isset($row[1])) { |
|
297 | 297 | $model = $row[0]; |
298 | 298 | $glb = $row[1]; |
299 | 299 | if (isset($row[2])) { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | if (!empty($spotter_array) && is_array($spotter_array)) |
340 | 340 | { |
341 | 341 | $nblatlong = 0; |
342 | - foreach($spotter_array as $spotter_item) |
|
342 | + foreach ($spotter_array as $spotter_item) |
|
343 | 343 | { |
344 | 344 | $j++; |
345 | 345 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -393,13 +393,13 @@ discard block |
||
393 | 393 | } |
394 | 394 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
395 | 395 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
396 | - if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",'; |
|
396 | + if (isset($spotter_item['ident'])) $output .= '"ident": "'.$spotter_item['ident'].'",'; |
|
397 | 397 | if ($tracker) { |
398 | 398 | if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
399 | - $output.= '"type": "tracker"'; |
|
399 | + $output .= '"type": "tracker"'; |
|
400 | 400 | } elseif ($marine) { |
401 | 401 | if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
402 | - $output.= '"type": "marine"'; |
|
402 | + $output .= '"type": "marine"'; |
|
403 | 403 | } else { |
404 | 404 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
405 | 405 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -413,14 +413,14 @@ discard block |
||
413 | 413 | if (isset($airline_icao)) { |
414 | 414 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
415 | 415 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
416 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
416 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
417 | 417 | } |
418 | 418 | } |
419 | 419 | } |
420 | 420 | //if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
421 | 421 | } |
422 | - $output.= '"gltf2": %gltf2%,'; |
|
423 | - $output.= '"type": "flight"'; |
|
422 | + $output .= '"gltf2": %gltf2%,'; |
|
423 | + $output .= '"type": "flight"'; |
|
424 | 424 | } |
425 | 425 | $output .= '},'; |
426 | 426 | |
@@ -791,8 +791,8 @@ discard block |
||
791 | 791 | $output .= '},'; |
792 | 792 | } |
793 | 793 | } |
794 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
795 | - else $output = str_replace('%onground%','false',$output); |
|
794 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
795 | + else $output = str_replace('%onground%', 'false', $output); |
|
796 | 796 | |
797 | 797 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
798 | 798 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
809 | 809 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
810 | 810 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
811 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
811 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
812 | 812 | $output .= $spotter_item['longitude'].', '; |
813 | 813 | $output .= $spotter_item['latitude']; |
814 | 814 | $prevlong = $spotter_item['longitude']; |
@@ -836,8 +836,8 @@ discard block |
||
836 | 836 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
837 | 837 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
838 | 838 | } else { |
839 | - $nblatlong = $nblatlong+1; |
|
840 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
839 | + $nblatlong = $nblatlong + 1; |
|
840 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
841 | 841 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
842 | 842 | if ($spotter_item['ground_speed'] == 0) { |
843 | 843 | $output .= $prevlong.', '; |
@@ -878,26 +878,26 @@ discard block |
||
878 | 878 | $output .= ']'; |
879 | 879 | if (isset($globalArchive) && $globalArchive === TRUE) { |
880 | 880 | if (isset($begindateinitial)) { |
881 | - $output = str_replace('%minitime%',date("c",$begindateinitial),$output); |
|
882 | - } elseif ((time()-$globalLiveInterval) > $minitime) { |
|
883 | - if (time()-$globalLiveInterval > $maxitime) { |
|
884 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
881 | + $output = str_replace('%minitime%', date("c", $begindateinitial), $output); |
|
882 | + } elseif ((time() - $globalLiveInterval) > $minitime) { |
|
883 | + if (time() - $globalLiveInterval > $maxitime) { |
|
884 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
885 | 885 | } else { |
886 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
886 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
887 | 887 | } |
888 | 888 | } |
889 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
889 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
890 | 890 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
891 | - $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
|
891 | + $output = str_replace('%minitime%', date("c", $minitracktime), $output); |
|
892 | 892 | } else { |
893 | - $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
893 | + $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
894 | 894 | } |
895 | 895 | if (isset($enddateinitial)) { |
896 | - $output = str_replace('%maxitime%',date("c",$enddateinitial),$output); |
|
896 | + $output = str_replace('%maxitime%', date("c", $enddateinitial), $output); |
|
897 | 897 | } else { |
898 | - $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
898 | + $output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
899 | 899 | } |
900 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
901 | -else $output = str_replace('%gltf2%','false',$output); |
|
900 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
901 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
902 | 902 | print $output; |
903 | 903 | ?> |
@@ -17,62 +17,62 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
38 | 38 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
39 | 39 | if (isset($flt['source'])) { |
40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
41 | 41 | } else { |
42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
47 | 47 | if (isset($flt['source'])) { |
48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
49 | 49 | } else { |
50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
54 | 54 | if (isset($flt['source'])) { |
55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
56 | 56 | } else { |
57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
61 | 61 | if (isset($flt['source'])) { |
62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
63 | 63 | } else { |
64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
68 | 68 | if (isset($flt['source'])) { |
69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
74 | 74 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
83 | 83 | } |
84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
86 | 86 | } |
87 | 87 | if (isset($filter['source']) && !empty($filter['source'])) { |
88 | 88 | if (count($filter['source']) == 1) { |
89 | 89 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
90 | 90 | } else { |
91 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
91 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
122 | 122 | } |
123 | 123 | } |
124 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
124 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
125 | 125 | } |
126 | 126 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
127 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
127 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
128 | 128 | } |
129 | 129 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
130 | 130 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
131 | 131 | if ($filter_query_where != '') { |
132 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
132 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
133 | 133 | } |
134 | 134 | $filter_query = $filter_query_join.$filter_query_where; |
135 | 135 | return $filter_query; |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | if ($limit != '') |
153 | 153 | { |
154 | 154 | $limit_array = explode(',', $limit); |
155 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
156 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
155 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
156 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
157 | 157 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
158 | 158 | { |
159 | 159 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } else { |
178 | 178 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
179 | 179 | } |
180 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
180 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
181 | 181 | |
182 | 182 | return $spotter_array; |
183 | 183 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | { |
193 | 193 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
194 | 194 | date_default_timezone_set('UTC'); |
195 | - $filter_query = $this->getFilter($filter,true,true); |
|
195 | + $filter_query = $this->getFilter($filter, true, true); |
|
196 | 196 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
197 | 197 | if ($globalDBdriver == 'mysql') { |
198 | 198 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | try { |
216 | 216 | $sth = $this->db->prepare($query); |
217 | 217 | $sth->execute(); |
218 | - } catch(PDOException $e) { |
|
218 | + } catch (PDOException $e) { |
|
219 | 219 | echo $e->getMessage(); |
220 | 220 | die; |
221 | 221 | } |
@@ -229,20 +229,20 @@ discard block |
||
229 | 229 | * @return Array the spotter information |
230 | 230 | * |
231 | 231 | */ |
232 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '') |
|
232 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '') |
|
233 | 233 | { |
234 | 234 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
235 | 235 | date_default_timezone_set('UTC'); |
236 | 236 | $usecoord = false; |
237 | 237 | if (is_array($coord) && !empty($coord)) { |
238 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
239 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
240 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
241 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
238 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
239 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
240 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
241 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
242 | 242 | $usecoord = true; |
243 | 243 | } |
244 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
245 | - $filter_query = $this->getFilter($filter,true,true); |
|
244 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
245 | + $filter_query = $this->getFilter($filter, true, true); |
|
246 | 246 | |
247 | 247 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
248 | 248 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
255 | 255 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
256 | 256 | */ |
257 | - $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
|
257 | + $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
|
258 | 258 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
259 | 259 | if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
260 | 260 | if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | ORDER BY flightaware_id, date"; |
269 | 269 | if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
270 | 270 | } else { |
271 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
271 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
272 | 272 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
273 | 273 | if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
274 | 274 | if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
285 | 285 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
286 | 286 | */ |
287 | - $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
|
287 | + $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
|
288 | 288 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
289 | 289 | if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
290 | 290 | if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | try { |
312 | 312 | $sth = $this->db->prepare($query); |
313 | 313 | $sth->execute($query_values); |
314 | - } catch(PDOException $e) { |
|
314 | + } catch (PDOException $e) { |
|
315 | 315 | echo $e->getMessage(); |
316 | 316 | die; |
317 | 317 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | public function getLiveSpotterCount($filter = array()) |
329 | 329 | { |
330 | 330 | global $globalDBdriver, $globalLiveInterval; |
331 | - $filter_query = $this->getFilter($filter,true,true); |
|
331 | + $filter_query = $this->getFilter($filter, true, true); |
|
332 | 332 | |
333 | 333 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
334 | 334 | if ($globalDBdriver == 'mysql') { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | try { |
342 | 342 | $sth = $this->db->prepare($query); |
343 | 343 | $sth->execute(); |
344 | - } catch(PDOException $e) { |
|
344 | + } catch (PDOException $e) { |
|
345 | 345 | echo $e->getMessage(); |
346 | 346 | die; |
347 | 347 | } |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | $filter_query = $this->getFilter($filter); |
365 | 365 | |
366 | 366 | if (is_array($coord)) { |
367 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
368 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
369 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
370 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
367 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
368 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
369 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
370 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
371 | 371 | } else return array(); |
372 | 372 | if ($globalDBdriver == 'mysql') { |
373 | 373 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -390,23 +390,23 @@ discard block |
||
390 | 390 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
391 | 391 | $Spotter = new Spotter($this->db); |
392 | 392 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
393 | - $filter_query = $this->getFilter($filter,true,true); |
|
393 | + $filter_query = $this->getFilter($filter, true, true); |
|
394 | 394 | |
395 | 395 | if (is_array($coord)) { |
396 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
397 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
398 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
399 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
396 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
397 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
398 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
399 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
400 | 400 | } else return array(); |
401 | 401 | if ($globalDBdriver == 'mysql') { |
402 | 402 | if (isset($globalArchive) && $globalArchive === TRUE) { |
403 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
403 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
404 | 404 | FROM spotter_live |
405 | 405 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
406 | 406 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
407 | 407 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC'; |
408 | 408 | } else { |
409 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
409 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
410 | 410 | FROM spotter_live |
411 | 411 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
412 | 412 | FROM spotter_live l |
@@ -418,14 +418,14 @@ discard block |
||
418 | 418 | } |
419 | 419 | } else { |
420 | 420 | if (isset($globalArchive) && $globalArchive === TRUE) { |
421 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
421 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
422 | 422 | FROM spotter_live |
423 | 423 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
424 | 424 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
425 | 425 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
426 | 426 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
427 | 427 | } else { |
428 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
428 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
429 | 429 | FROM spotter_live |
430 | 430 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
431 | 431 | FROM spotter_live l |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | try { |
441 | 441 | $sth = $this->db->prepare($query); |
442 | 442 | $sth->execute(); |
443 | - } catch(PDOException $e) { |
|
443 | + } catch (PDOException $e) { |
|
444 | 444 | echo $e->getMessage(); |
445 | 445 | die; |
446 | 446 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | if ($interval == '1m') |
490 | 490 | { |
491 | 491 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
492 | - } else if ($interval == '15m'){ |
|
492 | + } else if ($interval == '15m') { |
|
493 | 493 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
494 | 494 | } |
495 | 495 | } |
@@ -497,14 +497,14 @@ discard block |
||
497 | 497 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
498 | 498 | } |
499 | 499 | |
500 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
500 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
501 | 501 | WHERE spotter_live.latitude <> '' |
502 | 502 | AND spotter_live.longitude <> '' |
503 | 503 | ".$additional_query." |
504 | 504 | HAVING distance < :radius |
505 | 505 | ORDER BY distance"; |
506 | 506 | |
507 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
507 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
508 | 508 | |
509 | 509 | return $spotter_array; |
510 | 510 | } |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | date_default_timezone_set('UTC'); |
523 | 523 | |
524 | 524 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
525 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
525 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
526 | 526 | |
527 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
527 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
528 | 528 | |
529 | 529 | return $spotter_array; |
530 | 530 | } |
@@ -535,16 +535,16 @@ discard block |
||
535 | 535 | * @return Array the spotter information |
536 | 536 | * |
537 | 537 | */ |
538 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
538 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
539 | 539 | { |
540 | 540 | $Spotter = new Spotter($this->db); |
541 | 541 | date_default_timezone_set('UTC'); |
542 | 542 | |
543 | 543 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
544 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
544 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
545 | 545 | |
546 | - $date = date('c',$date); |
|
547 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
546 | + $date = date('c', $date); |
|
547 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
548 | 548 | |
549 | 549 | return $spotter_array; |
550 | 550 | } |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | $Spotter = new Spotter($this->db); |
561 | 561 | date_default_timezone_set('UTC'); |
562 | 562 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
563 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
564 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
563 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
564 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
565 | 565 | return $spotter_array; |
566 | 566 | } |
567 | 567 | |
@@ -571,15 +571,15 @@ discard block |
||
571 | 571 | * @return Array the spotter information |
572 | 572 | * |
573 | 573 | */ |
574 | - public function getDateLiveSpotterDataById($id,$date) |
|
574 | + public function getDateLiveSpotterDataById($id, $date) |
|
575 | 575 | { |
576 | 576 | $Spotter = new Spotter($this->db); |
577 | 577 | date_default_timezone_set('UTC'); |
578 | 578 | |
579 | 579 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
580 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
581 | - $date = date('c',$date); |
|
582 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
580 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
581 | + $date = date('c', $date); |
|
582 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
583 | 583 | return $spotter_array; |
584 | 584 | } |
585 | 585 | |
@@ -595,13 +595,13 @@ discard block |
||
595 | 595 | date_default_timezone_set('UTC'); |
596 | 596 | |
597 | 597 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
598 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
598 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
599 | 599 | |
600 | 600 | try { |
601 | 601 | |
602 | 602 | $sth = $this->db->prepare($query); |
603 | 603 | $sth->execute(array(':ident' => $ident)); |
604 | - } catch(PDOException $e) { |
|
604 | + } catch (PDOException $e) { |
|
605 | 605 | echo $e->getMessage(); |
606 | 606 | die; |
607 | 607 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | * @return Array the spotter information |
617 | 617 | * |
618 | 618 | */ |
619 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
619 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
620 | 620 | { |
621 | 621 | global $globalDBdriver, $globalLiveInterval; |
622 | 622 | date_default_timezone_set('UTC'); |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | try { |
636 | 636 | $sth = $this->db->prepare($query); |
637 | 637 | $sth->execute(array(':id' => $id)); |
638 | - } catch(PDOException $e) { |
|
638 | + } catch (PDOException $e) { |
|
639 | 639 | echo $e->getMessage(); |
640 | 640 | die; |
641 | 641 | } |
@@ -653,12 +653,12 @@ discard block |
||
653 | 653 | { |
654 | 654 | date_default_timezone_set('UTC'); |
655 | 655 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
656 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
656 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
657 | 657 | try { |
658 | 658 | |
659 | 659 | $sth = $this->db->prepare($query); |
660 | 660 | $sth->execute(array(':ident' => $ident)); |
661 | - } catch(PDOException $e) { |
|
661 | + } catch (PDOException $e) { |
|
662 | 662 | echo $e->getMessage(); |
663 | 663 | die; |
664 | 664 | } |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | |
689 | 689 | $sth = $this->db->prepare($query); |
690 | 690 | $sth->execute(); |
691 | - } catch(PDOException $e) { |
|
691 | + } catch (PDOException $e) { |
|
692 | 692 | return "error"; |
693 | 693 | } |
694 | 694 | |
@@ -711,14 +711,14 @@ discard block |
||
711 | 711 | |
712 | 712 | $sth = $this->db->prepare($query); |
713 | 713 | $sth->execute(); |
714 | - } catch(PDOException $e) { |
|
714 | + } catch (PDOException $e) { |
|
715 | 715 | return "error"; |
716 | 716 | } |
717 | 717 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
718 | 718 | $i = 0; |
719 | - $j =0; |
|
719 | + $j = 0; |
|
720 | 720 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
721 | - foreach($all as $row) |
|
721 | + foreach ($all as $row) |
|
722 | 722 | { |
723 | 723 | $i++; |
724 | 724 | $j++; |
@@ -726,9 +726,9 @@ discard block |
||
726 | 726 | if ($globalDebug) echo "."; |
727 | 727 | try { |
728 | 728 | |
729 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
729 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
730 | 730 | $sth->execute(); |
731 | - } catch(PDOException $e) { |
|
731 | + } catch (PDOException $e) { |
|
732 | 732 | return "error"; |
733 | 733 | } |
734 | 734 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -739,9 +739,9 @@ discard block |
||
739 | 739 | if ($i > 0) { |
740 | 740 | try { |
741 | 741 | |
742 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
742 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
743 | 743 | $sth->execute(); |
744 | - } catch(PDOException $e) { |
|
744 | + } catch (PDOException $e) { |
|
745 | 745 | return "error"; |
746 | 746 | } |
747 | 747 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | |
755 | 755 | $sth = $this->db->prepare($query); |
756 | 756 | $sth->execute(); |
757 | - } catch(PDOException $e) { |
|
757 | + } catch (PDOException $e) { |
|
758 | 758 | return "error"; |
759 | 759 | } |
760 | 760 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -802,13 +802,13 @@ discard block |
||
802 | 802 | public function deleteLiveSpotterDataByIdent($ident) |
803 | 803 | { |
804 | 804 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
805 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
805 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
806 | 806 | |
807 | 807 | try { |
808 | 808 | |
809 | 809 | $sth = $this->db->prepare($query); |
810 | 810 | $sth->execute(array(':ident' => $ident)); |
811 | - } catch(PDOException $e) { |
|
811 | + } catch (PDOException $e) { |
|
812 | 812 | return "error"; |
813 | 813 | } |
814 | 814 | |
@@ -824,13 +824,13 @@ discard block |
||
824 | 824 | public function deleteLiveSpotterDataById($id) |
825 | 825 | { |
826 | 826 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
827 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
827 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
828 | 828 | |
829 | 829 | try { |
830 | 830 | |
831 | 831 | $sth = $this->db->prepare($query); |
832 | 832 | $sth->execute(array(':id' => $id)); |
833 | - } catch(PDOException $e) { |
|
833 | + } catch (PDOException $e) { |
|
834 | 834 | return "error"; |
835 | 835 | } |
836 | 836 | |
@@ -848,13 +848,13 @@ discard block |
||
848 | 848 | { |
849 | 849 | global $globalDBdriver, $globalTimezone; |
850 | 850 | if ($globalDBdriver == 'mysql') { |
851 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
851 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
852 | 852 | WHERE spotter_live.ident = :ident |
853 | 853 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
854 | 854 | AND spotter_live.date < UTC_TIMESTAMP()'; |
855 | 855 | $query_data = array(':ident' => $ident); |
856 | 856 | } else { |
857 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
857 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
858 | 858 | WHERE spotter_live.ident = :ident |
859 | 859 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
860 | 860 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -863,8 +863,8 @@ discard block |
||
863 | 863 | |
864 | 864 | $sth = $this->db->prepare($query); |
865 | 865 | $sth->execute($query_data); |
866 | - $ident_result=''; |
|
867 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
866 | + $ident_result = ''; |
|
867 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
868 | 868 | { |
869 | 869 | $ident_result = $row['ident']; |
870 | 870 | } |
@@ -881,13 +881,13 @@ discard block |
||
881 | 881 | { |
882 | 882 | global $globalDBdriver, $globalTimezone; |
883 | 883 | if ($globalDBdriver == 'mysql') { |
884 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
884 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
885 | 885 | WHERE spotter_live.ident = :ident |
886 | 886 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
887 | 887 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
888 | 888 | $query_data = array(':ident' => $ident); |
889 | 889 | } else { |
890 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
890 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
891 | 891 | WHERE spotter_live.ident = :ident |
892 | 892 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'"; |
893 | 893 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -896,8 +896,8 @@ discard block |
||
896 | 896 | |
897 | 897 | $sth = $this->db->prepare($query); |
898 | 898 | $sth->execute($query_data); |
899 | - $ident_result=''; |
|
900 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
899 | + $ident_result = ''; |
|
900 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
901 | 901 | { |
902 | 902 | $ident_result = $row['flightaware_id']; |
903 | 903 | } |
@@ -914,13 +914,13 @@ discard block |
||
914 | 914 | { |
915 | 915 | global $globalDBdriver, $globalTimezone; |
916 | 916 | if ($globalDBdriver == 'mysql') { |
917 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
917 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
918 | 918 | WHERE spotter_live.flightaware_id = :id |
919 | 919 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
920 | 920 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
921 | 921 | $query_data = array(':id' => $id); |
922 | 922 | } else { |
923 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
923 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
924 | 924 | WHERE spotter_live.flightaware_id = :id |
925 | 925 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
926 | 926 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -929,8 +929,8 @@ discard block |
||
929 | 929 | |
930 | 930 | $sth = $this->db->prepare($query); |
931 | 931 | $sth->execute($query_data); |
932 | - $ident_result=''; |
|
933 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
932 | + $ident_result = ''; |
|
933 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
934 | 934 | { |
935 | 935 | $ident_result = $row['flightaware_id']; |
936 | 936 | } |
@@ -947,13 +947,13 @@ discard block |
||
947 | 947 | { |
948 | 948 | global $globalDBdriver, $globalTimezone; |
949 | 949 | if ($globalDBdriver == 'mysql') { |
950 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
950 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
951 | 951 | WHERE spotter_live.ModeS = :modes |
952 | 952 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
953 | 953 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
954 | 954 | $query_data = array(':modes' => $modes); |
955 | 955 | } else { |
956 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
956 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
957 | 957 | WHERE spotter_live.ModeS = :modes |
958 | 958 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'"; |
959 | 959 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -962,8 +962,8 @@ discard block |
||
962 | 962 | |
963 | 963 | $sth = $this->db->prepare($query); |
964 | 964 | $sth->execute($query_data); |
965 | - $ident_result=''; |
|
966 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
965 | + $ident_result = ''; |
|
966 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
967 | 967 | { |
968 | 968 | //$ident_result = $row['spotter_live_id']; |
969 | 969 | $ident_result = $row['flightaware_id']; |
@@ -988,8 +988,8 @@ discard block |
||
988 | 988 | return array(); |
989 | 989 | } else { |
990 | 990 | $q_array = explode(" ", $q); |
991 | - foreach ($q_array as $q_item){ |
|
992 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
991 | + foreach ($q_array as $q_item) { |
|
992 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
993 | 993 | $additional_query .= " AND ("; |
994 | 994 | $additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR "; |
995 | 995 | $additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR "; |
@@ -1004,11 +1004,11 @@ discard block |
||
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | if ($globalDBdriver == 'mysql') { |
1007 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
1007 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
1008 | 1008 | WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
1009 | 1009 | AND spotter_live.date < UTC_TIMESTAMP()"; |
1010 | 1010 | } else { |
1011 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
1011 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
1012 | 1012 | WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
1013 | 1013 | AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
1014 | 1014 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | * @return String success or false |
1029 | 1029 | * |
1030 | 1030 | */ |
1031 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
1031 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
1032 | 1032 | { |
1033 | 1033 | global $globalURL, $globalArchive, $globalDebug; |
1034 | 1034 | $Common = new Common(); |
@@ -1128,27 +1128,27 @@ discard block |
||
1128 | 1128 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1129 | 1129 | |
1130 | 1130 | |
1131 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1132 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1133 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1134 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1135 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1136 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1137 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1138 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1139 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1140 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1141 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1142 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1143 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1144 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1145 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1146 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1147 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1148 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1149 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1150 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1151 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
1131 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
1132 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1133 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
1134 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1135 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1136 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1137 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1138 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
1139 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1140 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1141 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1142 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1143 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
1144 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
1145 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
1146 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
1147 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
1148 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1149 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1150 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1151 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1152 | 1152 | |
1153 | 1153 | $airline_name = ''; |
1154 | 1154 | $airline_icao = ''; |
@@ -1170,10 +1170,10 @@ discard block |
||
1170 | 1170 | $arrival_airport_country = ''; |
1171 | 1171 | |
1172 | 1172 | |
1173 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1174 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1175 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1176 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1173 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
1174 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
1175 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
1176 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1177 | 1177 | |
1178 | 1178 | $query = ''; |
1179 | 1179 | if ($globalArchive) { |
@@ -1184,19 +1184,19 @@ discard block |
||
1184 | 1184 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
1185 | 1185 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
1186 | 1186 | |
1187 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
1187 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
1188 | 1188 | try { |
1189 | 1189 | |
1190 | 1190 | $sth = $this->db->prepare($query); |
1191 | 1191 | $sth->execute($query_values); |
1192 | 1192 | $sth->closeCursor(); |
1193 | - } catch(PDOException $e) { |
|
1193 | + } catch (PDOException $e) { |
|
1194 | 1194 | return "error : ".$e->getMessage(); |
1195 | 1195 | } |
1196 | 1196 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1197 | 1197 | if ($globalDebug) echo '(Add to SBS archive : '; |
1198 | 1198 | $SpotterArchive = new SpotterArchive($this->db); |
1199 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1199 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
1200 | 1200 | if ($globalDebug) echo $result.')'; |
1201 | 1201 | } elseif ($globalDebug && $putinarchive !== true) { |
1202 | 1202 | echo '(Not adding to archive)'; |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | public function getOrderBy() |
1211 | 1211 | { |
1212 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1212 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1213 | 1213 | return $orderby; |
1214 | 1214 | } |
1215 | 1215 |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
79 | 79 | } |
80 | 80 | } |
81 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
81 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
82 | 82 | } |
83 | 83 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
84 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
84 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
85 | 85 | } |
86 | 86 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
87 | 87 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
88 | 88 | if ($filter_query_where != '') { |
89 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
89 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
90 | 90 | } |
91 | 91 | $filter_query = $filter_query_join.$filter_query_where; |
92 | 92 | return $filter_query; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | if ($limit != '') |
110 | 110 | { |
111 | 111 | $limit_array = explode(',', $limit); |
112 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
113 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
112 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
113 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
114 | 114 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
115 | 115 | { |
116 | 116 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
126 | 126 | } |
127 | 127 | } |
128 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
128 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
129 | 129 | |
130 | 130 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
131 | 131 | if ($globalDBdriver == 'mysql') { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } else { |
135 | 135 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query; |
136 | 136 | } |
137 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
137 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
138 | 138 | |
139 | 139 | return $spotter_array; |
140 | 140 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | global $globalDBdriver, $globalLiveInterval; |
151 | 151 | date_default_timezone_set('UTC'); |
152 | 152 | |
153 | - $filter_query = $this->getFilter($filter,true,true); |
|
153 | + $filter_query = $this->getFilter($filter, true, true); |
|
154 | 154 | |
155 | 155 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
156 | 156 | if ($globalDBdriver == 'mysql') { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | try { |
165 | 165 | $sth = $this->db->prepare($query); |
166 | 166 | $sth->execute(); |
167 | - } catch(PDOException $e) { |
|
167 | + } catch (PDOException $e) { |
|
168 | 168 | echo $e->getMessage(); |
169 | 169 | die; |
170 | 170 | } |
@@ -179,19 +179,19 @@ discard block |
||
179 | 179 | * @return Array the spotter information |
180 | 180 | * |
181 | 181 | */ |
182 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false) |
|
182 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false) |
|
183 | 183 | { |
184 | 184 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
185 | 185 | date_default_timezone_set('UTC'); |
186 | 186 | $usecoord = false; |
187 | 187 | if (is_array($coord) && !empty($coord)) { |
188 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
189 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
190 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
191 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
188 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
189 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
190 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
191 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
192 | 192 | $usecoord = true; |
193 | 193 | } |
194 | - $filter_query = $this->getFilter($filter,true,true); |
|
194 | + $filter_query = $this->getFilter($filter, true, true); |
|
195 | 195 | |
196 | 196 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
197 | 197 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | try { |
241 | 241 | $sth = $this->db->prepare($query); |
242 | 242 | $sth->execute(); |
243 | - } catch(PDOException $e) { |
|
243 | + } catch (PDOException $e) { |
|
244 | 244 | echo $e->getMessage(); |
245 | 245 | die; |
246 | 246 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | public function getLiveMarineCount($filter = array()) |
258 | 258 | { |
259 | 259 | global $globalDBdriver, $globalLiveInterval; |
260 | - $filter_query = $this->getFilter($filter,true,true); |
|
260 | + $filter_query = $this->getFilter($filter, true, true); |
|
261 | 261 | |
262 | 262 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
263 | 263 | if ($globalDBdriver == 'mysql') { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | try { |
269 | 269 | $sth = $this->db->prepare($query); |
270 | 270 | $sth->execute(); |
271 | - } catch(PDOException $e) { |
|
271 | + } catch (PDOException $e) { |
|
272 | 272 | echo $e->getMessage(); |
273 | 273 | die; |
274 | 274 | } |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | $filter_query = $this->getFilter($filter); |
292 | 292 | |
293 | 293 | if (is_array($coord)) { |
294 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
295 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
296 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
297 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
294 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
295 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
296 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
297 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
298 | 298 | } else return array(); |
299 | 299 | if ($globalDBdriver == 'mysql') { |
300 | 300 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query; |
@@ -316,13 +316,13 @@ discard block |
||
316 | 316 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
317 | 317 | $Marine = new Marine($this->db); |
318 | 318 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
319 | - $filter_query = $this->getFilter($filter,true,true); |
|
319 | + $filter_query = $this->getFilter($filter, true, true); |
|
320 | 320 | |
321 | 321 | if (is_array($coord)) { |
322 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
323 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
324 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
325 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
322 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
323 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
324 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
325 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
326 | 326 | } else return array(); |
327 | 327 | /* |
328 | 328 | if ($globalDBdriver == 'mysql') { |
@@ -337,13 +337,13 @@ discard block |
||
337 | 337 | */ |
338 | 338 | if ($globalDBdriver == 'mysql') { |
339 | 339 | if (isset($globalArchive) && $globalArchive === TRUE) { |
340 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
340 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
341 | 341 | FROM marine_live |
342 | 342 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date |
343 | 343 | AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
344 | 344 | AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY date DESC'; |
345 | 345 | } else { |
346 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
346 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
347 | 347 | FROM marine_live |
348 | 348 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
349 | 349 | FROM marine_live l |
@@ -355,14 +355,14 @@ discard block |
||
355 | 355 | } |
356 | 356 | } else { |
357 | 357 | if (isset($globalArchive) && $globalArchive === TRUE) { |
358 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
358 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
359 | 359 | FROM marine_live |
360 | 360 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date |
361 | 361 | AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
362 | 362 | AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
363 | 363 | AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY date DESC"; |
364 | 364 | } else { |
365 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
365 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
366 | 366 | FROM marine_live |
367 | 367 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
368 | 368 | FROM marine_live l |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | if ($interval == '1m') |
420 | 420 | { |
421 | 421 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
422 | - } else if ($interval == '15m'){ |
|
422 | + } else if ($interval == '15m') { |
|
423 | 423 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
424 | 424 | } |
425 | 425 | } |
@@ -427,14 +427,14 @@ discard block |
||
427 | 427 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
428 | 428 | } |
429 | 429 | |
430 | - $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 |
|
430 | + $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 |
|
431 | 431 | WHERE marine_live.latitude <> '' |
432 | 432 | AND marine_live.longitude <> '' |
433 | 433 | ".$additional_query." |
434 | 434 | HAVING distance < :radius |
435 | 435 | ORDER BY distance"; |
436 | 436 | |
437 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
437 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
438 | 438 | |
439 | 439 | return $spotter_array; |
440 | 440 | } |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | date_default_timezone_set('UTC'); |
453 | 453 | |
454 | 454 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
455 | - $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'; |
|
455 | + $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'; |
|
456 | 456 | |
457 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
457 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
458 | 458 | |
459 | 459 | return $spotter_array; |
460 | 460 | } |
@@ -465,14 +465,14 @@ discard block |
||
465 | 465 | * @return Array the spotter information |
466 | 466 | * |
467 | 467 | */ |
468 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
468 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
469 | 469 | { |
470 | 470 | $Marine = new Marine($this->db); |
471 | 471 | date_default_timezone_set('UTC'); |
472 | 472 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
473 | 473 | $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 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'; |
474 | - $date = date('c',$date); |
|
475 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
474 | + $date = date('c', $date); |
|
475 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
476 | 476 | return $spotter_array; |
477 | 477 | } |
478 | 478 | |
@@ -482,14 +482,14 @@ discard block |
||
482 | 482 | * @return Array the spotter information |
483 | 483 | * |
484 | 484 | */ |
485 | - public function getDateLiveMarineDataByMMSI($mmsi,$date) |
|
485 | + public function getDateLiveMarineDataByMMSI($mmsi, $date) |
|
486 | 486 | { |
487 | 487 | $Marine = new Marine($this->db); |
488 | 488 | date_default_timezone_set('UTC'); |
489 | 489 | $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
490 | 490 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi 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'; |
491 | - $date = date('c',$date); |
|
492 | - $spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date)); |
|
491 | + $date = date('c', $date); |
|
492 | + $spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date)); |
|
493 | 493 | return $spotter_array; |
494 | 494 | } |
495 | 495 | |
@@ -505,9 +505,9 @@ discard block |
||
505 | 505 | date_default_timezone_set('UTC'); |
506 | 506 | |
507 | 507 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
508 | - $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'; |
|
508 | + $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'; |
|
509 | 509 | |
510 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
510 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
511 | 511 | |
512 | 512 | return $spotter_array; |
513 | 513 | } |
@@ -518,15 +518,15 @@ discard block |
||
518 | 518 | * @return Array the spotter information |
519 | 519 | * |
520 | 520 | */ |
521 | - public function getDateLiveMarineDataById($id,$date) |
|
521 | + public function getDateLiveMarineDataById($id, $date) |
|
522 | 522 | { |
523 | 523 | $Marine = new Marine($this->db); |
524 | 524 | date_default_timezone_set('UTC'); |
525 | 525 | |
526 | 526 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
527 | - $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'; |
|
528 | - $date = date('c',$date); |
|
529 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
527 | + $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'; |
|
528 | + $date = date('c', $date); |
|
529 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
530 | 530 | |
531 | 531 | return $spotter_array; |
532 | 532 | } |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * @return Array the spotter information |
539 | 539 | * |
540 | 540 | */ |
541 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
541 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
542 | 542 | { |
543 | 543 | global $globalDBdriver, $globalLiveInterval; |
544 | 544 | date_default_timezone_set('UTC'); |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | try { |
558 | 558 | $sth = $this->db->prepare($query); |
559 | 559 | $sth->execute(array(':id' => $id)); |
560 | - } catch(PDOException $e) { |
|
560 | + } catch (PDOException $e) { |
|
561 | 561 | echo $e->getMessage(); |
562 | 562 | die; |
563 | 563 | } |
@@ -575,12 +575,12 @@ discard block |
||
575 | 575 | { |
576 | 576 | date_default_timezone_set('UTC'); |
577 | 577 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
578 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
578 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
579 | 579 | try { |
580 | 580 | |
581 | 581 | $sth = $this->db->prepare($query); |
582 | 582 | $sth->execute(array(':ident' => $ident)); |
583 | - } catch(PDOException $e) { |
|
583 | + } catch (PDOException $e) { |
|
584 | 584 | echo $e->getMessage(); |
585 | 585 | die; |
586 | 586 | } |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | |
611 | 611 | $sth = $this->db->prepare($query); |
612 | 612 | $sth->execute(); |
613 | - } catch(PDOException $e) { |
|
613 | + } catch (PDOException $e) { |
|
614 | 614 | return "error"; |
615 | 615 | } |
616 | 616 | |
@@ -633,14 +633,14 @@ discard block |
||
633 | 633 | |
634 | 634 | $sth = $this->db->prepare($query); |
635 | 635 | $sth->execute(); |
636 | - } catch(PDOException $e) { |
|
636 | + } catch (PDOException $e) { |
|
637 | 637 | return "error"; |
638 | 638 | } |
639 | 639 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
640 | 640 | $i = 0; |
641 | - $j =0; |
|
641 | + $j = 0; |
|
642 | 642 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
643 | - foreach($all as $row) |
|
643 | + foreach ($all as $row) |
|
644 | 644 | { |
645 | 645 | $i++; |
646 | 646 | $j++; |
@@ -648,9 +648,9 @@ discard block |
||
648 | 648 | if ($globalDebug) echo "."; |
649 | 649 | try { |
650 | 650 | |
651 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
651 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
652 | 652 | $sth->execute(); |
653 | - } catch(PDOException $e) { |
|
653 | + } catch (PDOException $e) { |
|
654 | 654 | return "error"; |
655 | 655 | } |
656 | 656 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -661,9 +661,9 @@ discard block |
||
661 | 661 | if ($i > 0) { |
662 | 662 | try { |
663 | 663 | |
664 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
664 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
665 | 665 | $sth->execute(); |
666 | - } catch(PDOException $e) { |
|
666 | + } catch (PDOException $e) { |
|
667 | 667 | return "error"; |
668 | 668 | } |
669 | 669 | } |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | |
677 | 677 | $sth = $this->db->prepare($query); |
678 | 678 | $sth->execute(); |
679 | - } catch(PDOException $e) { |
|
679 | + } catch (PDOException $e) { |
|
680 | 680 | return "error"; |
681 | 681 | } |
682 | 682 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | public function deleteLiveMarineDataByIdent($ident) |
725 | 725 | { |
726 | 726 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
727 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
727 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
728 | 728 | |
729 | 729 | try { |
730 | 730 | |
731 | 731 | $sth = $this->db->prepare($query); |
732 | 732 | $sth->execute(array(':ident' => $ident)); |
733 | - } catch(PDOException $e) { |
|
733 | + } catch (PDOException $e) { |
|
734 | 734 | return "error"; |
735 | 735 | } |
736 | 736 | |
@@ -746,13 +746,13 @@ discard block |
||
746 | 746 | public function deleteLiveMarineDataById($id) |
747 | 747 | { |
748 | 748 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
749 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
749 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
750 | 750 | |
751 | 751 | try { |
752 | 752 | |
753 | 753 | $sth = $this->db->prepare($query); |
754 | 754 | $sth->execute(array(':id' => $id)); |
755 | - } catch(PDOException $e) { |
|
755 | + } catch (PDOException $e) { |
|
756 | 756 | return "error"; |
757 | 757 | } |
758 | 758 | |
@@ -770,13 +770,13 @@ discard block |
||
770 | 770 | { |
771 | 771 | global $globalDBdriver, $globalTimezone; |
772 | 772 | if ($globalDBdriver == 'mysql') { |
773 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
773 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
774 | 774 | WHERE marine_live.ident = :ident |
775 | 775 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
776 | 776 | AND marine_live.date < UTC_TIMESTAMP()'; |
777 | 777 | $query_data = array(':ident' => $ident); |
778 | 778 | } else { |
779 | - $query = "SELECT marine_live.ident FROM marine_live |
|
779 | + $query = "SELECT marine_live.ident FROM marine_live |
|
780 | 780 | WHERE marine_live.ident = :ident |
781 | 781 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
782 | 782 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | |
786 | 786 | $sth = $this->db->prepare($query); |
787 | 787 | $sth->execute($query_data); |
788 | - $ident_result=''; |
|
789 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
788 | + $ident_result = ''; |
|
789 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
790 | 790 | { |
791 | 791 | $ident_result = $row['ident']; |
792 | 792 | } |
@@ -803,13 +803,13 @@ discard block |
||
803 | 803 | { |
804 | 804 | global $globalDBdriver, $globalTimezone; |
805 | 805 | if ($globalDBdriver == 'mysql') { |
806 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
806 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
807 | 807 | WHERE marine_live.ident = :ident |
808 | 808 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
809 | 809 | // AND marine_live.date < UTC_TIMESTAMP()"; |
810 | 810 | $query_data = array(':ident' => $ident); |
811 | 811 | } else { |
812 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
812 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
813 | 813 | WHERE marine_live.ident = :ident |
814 | 814 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
815 | 815 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -818,8 +818,8 @@ discard block |
||
818 | 818 | |
819 | 819 | $sth = $this->db->prepare($query); |
820 | 820 | $sth->execute($query_data); |
821 | - $ident_result=''; |
|
822 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
821 | + $ident_result = ''; |
|
822 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
823 | 823 | { |
824 | 824 | $ident_result = $row['fammarine_id']; |
825 | 825 | } |
@@ -836,13 +836,13 @@ discard block |
||
836 | 836 | { |
837 | 837 | global $globalDBdriver, $globalTimezone; |
838 | 838 | if ($globalDBdriver == 'mysql') { |
839 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
839 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
840 | 840 | WHERE marine_live.fammarine_id = :id |
841 | 841 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
842 | 842 | // AND marine_live.date < UTC_TIMESTAMP()"; |
843 | 843 | $query_data = array(':id' => $id); |
844 | 844 | } else { |
845 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
845 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
846 | 846 | WHERE marine_live.fammarine_id = :id |
847 | 847 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
848 | 848 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -851,8 +851,8 @@ discard block |
||
851 | 851 | |
852 | 852 | $sth = $this->db->prepare($query); |
853 | 853 | $sth->execute($query_data); |
854 | - $ident_result=''; |
|
855 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
854 | + $ident_result = ''; |
|
855 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
856 | 856 | { |
857 | 857 | $ident_result = $row['fammarine_id']; |
858 | 858 | } |
@@ -869,13 +869,13 @@ discard block |
||
869 | 869 | { |
870 | 870 | global $globalDBdriver, $globalTimezone; |
871 | 871 | if ($globalDBdriver == 'mysql') { |
872 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
872 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
873 | 873 | WHERE marine_live.mmsi = :mmsi |
874 | 874 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
875 | 875 | // AND marine_live.date < UTC_TIMESTAMP()"; |
876 | 876 | $query_data = array(':mmsi' => $mmsi); |
877 | 877 | } else { |
878 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
878 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
879 | 879 | WHERE marine_live.mmsi = :mmsi |
880 | 880 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
881 | 881 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -884,8 +884,8 @@ discard block |
||
884 | 884 | |
885 | 885 | $sth = $this->db->prepare($query); |
886 | 886 | $sth->execute($query_data); |
887 | - $ident_result=''; |
|
888 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
887 | + $ident_result = ''; |
|
888 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
889 | 889 | { |
890 | 890 | $ident_result = $row['fammarine_id']; |
891 | 891 | } |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | * @return String success or false |
904 | 904 | * |
905 | 905 | */ |
906 | - 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 = '') |
|
906 | + 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 = '') |
|
907 | 907 | { |
908 | 908 | global $globalURL, $globalArchive, $globalDebug; |
909 | 909 | $Common = new Common(); |
@@ -955,29 +955,29 @@ discard block |
||
955 | 955 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
956 | 956 | |
957 | 957 | |
958 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
959 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
960 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
961 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
962 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
963 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
964 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
965 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
966 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
967 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
968 | - $typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
969 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
970 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
971 | - $statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
972 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
973 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
974 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
975 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
958 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
959 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
960 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
961 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
962 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
963 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
964 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
965 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
966 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
967 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
968 | + $typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
969 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
970 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
971 | + $statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
972 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
973 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
974 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
975 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
976 | 976 | if ($typeid == '') $typeid = NULL; |
977 | 977 | if ($statusid == '') $statusid = NULL; |
978 | 978 | |
979 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
980 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
979 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
980 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
981 | 981 | if ($arrival_date == '') $arrival_date = NULL; |
982 | 982 | $query = ''; |
983 | 983 | if ($globalArchive) { |
@@ -986,19 +986,19 @@ discard block |
||
986 | 986 | } |
987 | 987 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date) |
988 | 988 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date)'; |
989 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
989 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
990 | 990 | try { |
991 | 991 | $sth = $this->db->prepare($query); |
992 | 992 | $sth->execute($query_values); |
993 | 993 | $sth->closeCursor(); |
994 | - } catch(PDOException $e) { |
|
994 | + } catch (PDOException $e) { |
|
995 | 995 | return "error : ".$e->getMessage(); |
996 | 996 | } |
997 | 997 | |
998 | 998 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
999 | 999 | if ($globalDebug) echo '(Add to Marine archive : '; |
1000 | 1000 | $MarineArchive = new MarineArchive($this->db); |
1001 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country); |
|
1001 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country); |
|
1002 | 1002 | if ($globalDebug) echo $result.')'; |
1003 | 1003 | } |
1004 | 1004 | return "success"; |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | |
1007 | 1007 | public function getOrderBy() |
1008 | 1008 | { |
1009 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
1009 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
1010 | 1010 | return $orderby; |
1011 | 1011 | } |
1012 | 1012 |
@@ -14,75 +14,75 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
35 | 35 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
36 | 36 | if (isset($flt['source'])) { |
37 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | 38 | } else { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
44 | 44 | if (isset($flt['source'])) { |
45 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | 46 | } else { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
51 | 51 | if (isset($flt['source'])) { |
52 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | 53 | } else { |
54 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
58 | 58 | if (isset($flt['source'])) { |
59 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | 60 | } else { |
61 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
65 | 65 | if (isset($flt['source'])) { |
66 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
70 | 70 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
71 | 71 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
72 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
76 | 76 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | 82 | if (count($filter['source']) == 1) { |
83 | 83 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
84 | 84 | } else { |
85 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
85 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $filter_query_where .= " AND flightaware_id = '".$filter['id']."'"; |
93 | 93 | } |
94 | 94 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
95 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
95 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
96 | 96 | } |
97 | 97 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
98 | 98 | $filter_query_date = ''; |
@@ -117,41 +117,41 @@ discard block |
||
117 | 117 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
118 | 118 | } |
119 | 119 | } |
120 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
120 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
121 | 121 | } |
122 | 122 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
123 | 123 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
124 | 124 | if ($filter_query_where != '') { |
125 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
125 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
126 | 126 | } |
127 | 127 | $filter_query = $filter_query_join.$filter_query_where; |
128 | 128 | return $filter_query; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Spotter_archive |
132 | - public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
132 | + public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
133 | 133 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
134 | 134 | if ($over_country == '') { |
135 | 135 | $Spotter = new Spotter($this->db); |
136 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
136 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
137 | 137 | if (!empty($data_country)) $country = $data_country['iso2']; |
138 | 138 | else $country = ''; |
139 | 139 | } else $country = $over_country; |
140 | - if ($airline_type === NULL) $airline_type =''; |
|
140 | + if ($airline_type === NULL) $airline_type = ''; |
|
141 | 141 | |
142 | 142 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
143 | 143 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
144 | 144 | |
145 | 145 | // Route is not added in spotter_archive |
146 | - $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
146 | + $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
147 | 147 | VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)"; |
148 | 148 | |
149 | - $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude); |
|
149 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude); |
|
150 | 150 | try { |
151 | 151 | $sth = $this->db->prepare($query); |
152 | 152 | $sth->execute($query_values); |
153 | 153 | $sth->closeCursor(); |
154 | - } catch(PDOException $e) { |
|
154 | + } catch (PDOException $e) { |
|
155 | 155 | return "error : ".$e->getMessage(); |
156 | 156 | } |
157 | 157 | return "success"; |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
172 | 172 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
173 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
173 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
174 | 174 | |
175 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
175 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
176 | 176 | |
177 | 177 | return $spotter_array; |
178 | 178 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
191 | 191 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
192 | 192 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
193 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
193 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
194 | 194 | |
195 | 195 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
196 | 196 | /* |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
205 | 205 | */ |
206 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
206 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
207 | 207 | |
208 | 208 | return $spotter_array; |
209 | 209 | } |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | public function getAllArchiveSpotterDataById($id) { |
218 | 218 | date_default_timezone_set('UTC'); |
219 | 219 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
220 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
220 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
221 | 221 | |
222 | 222 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
223 | 223 | |
224 | 224 | try { |
225 | 225 | $sth = $this->db->prepare($query); |
226 | 226 | $sth->execute(array(':id' => $id)); |
227 | - } catch(PDOException $e) { |
|
227 | + } catch (PDOException $e) { |
|
228 | 228 | echo $e->getMessage(); |
229 | 229 | die; |
230 | 230 | } |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | public function getCoordArchiveSpotterDataById($id) { |
243 | 243 | date_default_timezone_set('UTC'); |
244 | 244 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
245 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
245 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
246 | 246 | try { |
247 | 247 | $sth = $this->db->prepare($query); |
248 | 248 | $sth->execute(array(':id' => $id)); |
249 | - } catch(PDOException $e) { |
|
249 | + } catch (PDOException $e) { |
|
250 | 250 | echo $e->getMessage(); |
251 | 251 | die; |
252 | 252 | } |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | * @return Array the spotter information |
261 | 261 | * |
262 | 262 | */ |
263 | - public function getCoordArchiveSpotterDataByIdDate($id,$begindate,$enddate) { |
|
263 | + public function getCoordArchiveSpotterDataByIdDate($id, $begindate, $enddate) { |
|
264 | 264 | date_default_timezone_set('UTC'); |
265 | 265 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
266 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.date BETWEEN :begindate AND :enddate ORDER by spotter_archive.date ASC"; |
|
266 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.date BETWEEN :begindate AND :enddate ORDER by spotter_archive.date ASC"; |
|
267 | 267 | try { |
268 | 268 | $sth = $this->db->prepare($query); |
269 | - $sth->execute(array(':id' => $id,':begindate' => $begindate,':enddate' => $enddate)); |
|
270 | - } catch(PDOException $e) { |
|
269 | + $sth->execute(array(':id' => $id, ':begindate' => $begindate, ':enddate' => $enddate)); |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | echo $e->getMessage(); |
272 | 272 | die; |
273 | 273 | } |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | date_default_timezone_set('UTC'); |
288 | 288 | |
289 | 289 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
290 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
290 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
291 | 291 | |
292 | 292 | try { |
293 | 293 | $sth = $this->db->prepare($query); |
294 | 294 | $sth->execute(array(':ident' => $ident)); |
295 | - } catch(PDOException $e) { |
|
295 | + } catch (PDOException $e) { |
|
296 | 296 | echo $e->getMessage(); |
297 | 297 | die; |
298 | 298 | } |
@@ -312,12 +312,12 @@ discard block |
||
312 | 312 | date_default_timezone_set('UTC'); |
313 | 313 | |
314 | 314 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
315 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
315 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
316 | 316 | |
317 | 317 | try { |
318 | 318 | $sth = $this->db->prepare($query); |
319 | 319 | $sth->execute(array(':id' => $id)); |
320 | - } catch(PDOException $e) { |
|
320 | + } catch (PDOException $e) { |
|
321 | 321 | echo $e->getMessage(); |
322 | 322 | die; |
323 | 323 | } |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | public function getAltitudeSpeedArchiveSpotterDataById($id) { |
336 | 336 | date_default_timezone_set('UTC'); |
337 | 337 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
338 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
338 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
339 | 339 | try { |
340 | 340 | $sth = $this->db->prepare($query); |
341 | 341 | $sth->execute(array(':id' => $id)); |
342 | - } catch(PDOException $e) { |
|
342 | + } catch (PDOException $e) { |
|
343 | 343 | echo $e->getMessage(); |
344 | 344 | die; |
345 | 345 | } |
@@ -356,12 +356,12 @@ discard block |
||
356 | 356 | public function getLastAltitudeArchiveSpotterDataByIdent($ident) { |
357 | 357 | date_default_timezone_set('UTC'); |
358 | 358 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
359 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
359 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
360 | 360 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
361 | 361 | try { |
362 | 362 | $sth = $this->db->prepare($query); |
363 | 363 | $sth->execute(array(':ident' => $ident)); |
364 | - } catch(PDOException $e) { |
|
364 | + } catch (PDOException $e) { |
|
365 | 365 | echo $e->getMessage(); |
366 | 366 | die; |
367 | 367 | } |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | * @return Array the spotter information |
378 | 378 | * |
379 | 379 | */ |
380 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) { |
|
380 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) { |
|
381 | 381 | $Spotter = new Spotter($this->db); |
382 | 382 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
383 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
384 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
383 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
384 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
385 | 385 | return $spotter_array; |
386 | 386 | } |
387 | 387 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | try { |
396 | 396 | $sth = $this->db->prepare($query); |
397 | 397 | $sth->execute(); |
398 | - } catch(PDOException $e) { |
|
398 | + } catch (PDOException $e) { |
|
399 | 399 | echo $e->getMessage(); |
400 | 400 | die; |
401 | 401 | } |
@@ -407,39 +407,39 @@ discard block |
||
407 | 407 | * @return Array the spotter information |
408 | 408 | * |
409 | 409 | */ |
410 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array(),$part = 0) { |
|
410 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array(), $part = 0) { |
|
411 | 411 | global $globalDBdriver, $globalLiveInterval; |
412 | 412 | date_default_timezone_set('UTC'); |
413 | 413 | //$filter_query = $this->getFilter($filter,true,true); |
414 | 414 | |
415 | 415 | $filter_query = ''; |
416 | 416 | if (isset($filter['source']) && !empty($filter['source'])) { |
417 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
417 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
418 | 418 | } |
419 | 419 | // Use spotter_output also ? |
420 | 420 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
421 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
421 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
422 | 422 | } |
423 | 423 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
424 | 424 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
425 | 425 | } |
426 | 426 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
427 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
427 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | $limit = ''; |
431 | 431 | if ($part != 0) { |
432 | - $limit = ' LIMIT 100 OFFSET '.($part-1)*100; |
|
432 | + $limit = ' LIMIT 100 OFFSET '.($part - 1)*100; |
|
433 | 433 | } |
434 | 434 | if ($globalDBdriver == 'mysql') { |
435 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
435 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
436 | 436 | FROM spotter_archive |
437 | 437 | INNER JOIN aircraft a on spotter_archive.aircraft_icao = a.icao |
438 | 438 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".' |
439 | 439 | '.$filter_query.' ORDER BY flightaware_id'.$limit; |
440 | 440 | } else { |
441 | 441 | |
442 | - $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
442 | + $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
443 | 443 | FROM spotter_archive |
444 | 444 | INNER JOIN aircraft a on spotter_archive.aircraft_icao = a.icao |
445 | 445 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".' |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | try { |
458 | 458 | $sth = $this->db->prepare($query); |
459 | 459 | $sth->execute(); |
460 | - } catch(PDOException $e) { |
|
460 | + } catch (PDOException $e) { |
|
461 | 461 | echo $e->getMessage(); |
462 | 462 | die; |
463 | 463 | } |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @return Array the spotter information |
472 | 472 | * |
473 | 473 | */ |
474 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) { |
|
474 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) { |
|
475 | 475 | global $globalDBdriver, $globalLiveInterval; |
476 | 476 | date_default_timezone_set('UTC'); |
477 | 477 | |
@@ -479,17 +479,17 @@ discard block |
||
479 | 479 | |
480 | 480 | $filter_query = ''; |
481 | 481 | if (isset($filter['source']) && !empty($filter['source'])) { |
482 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
482 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
483 | 483 | } |
484 | 484 | // Use spotter_output also ? |
485 | 485 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
486 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
486 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
487 | 487 | } |
488 | 488 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
489 | 489 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
490 | 490 | } |
491 | 491 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
492 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
492 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | FROM spotter_archive |
501 | 501 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
502 | 502 | */ |
503 | - $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
503 | + $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
504 | 504 | FROM spotter_archive_output |
505 | 505 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
506 | 506 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
516 | 516 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
517 | 517 | */ |
518 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
518 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
519 | 519 | FROM spotter_archive_output |
520 | 520 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
521 | 521 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | try { |
528 | 528 | $sth = $this->db->prepare($query); |
529 | 529 | $sth->execute(); |
530 | - } catch(PDOException $e) { |
|
530 | + } catch (PDOException $e) { |
|
531 | 531 | echo $e->getMessage(); |
532 | 532 | die; |
533 | 533 | } |
@@ -542,22 +542,22 @@ discard block |
||
542 | 542 | * @return Array the spotter information |
543 | 543 | * |
544 | 544 | */ |
545 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) { |
|
545 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) { |
|
546 | 546 | global $globalDBdriver, $globalLiveInterval; |
547 | 547 | date_default_timezone_set('UTC'); |
548 | 548 | |
549 | 549 | $filter_query = ''; |
550 | 550 | if (isset($filter['source']) && !empty($filter['source'])) { |
551 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
551 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
552 | 552 | } |
553 | 553 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
554 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
554 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
555 | 555 | } |
556 | 556 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
557 | 557 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
558 | 558 | } |
559 | 559 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
560 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
560 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | try { |
573 | 573 | $sth = $this->db->prepare($query); |
574 | 574 | $sth->execute(); |
575 | - } catch(PDOException $e) { |
|
575 | + } catch (PDOException $e) { |
|
576 | 576 | echo $e->getMessage(); |
577 | 577 | die; |
578 | 578 | } |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | * @return Array the spotter information |
593 | 593 | * |
594 | 594 | */ |
595 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) { |
|
595 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) { |
|
596 | 596 | global $globalTimezone, $globalDBdriver; |
597 | 597 | require_once(dirname(__FILE__).'/class.Translation.php'); |
598 | 598 | $Translation = new Translation($this->db); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | } |
643 | 643 | |
644 | 644 | if ($registration != "") { |
645 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
645 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
646 | 646 | if (!is_string($registration)) { |
647 | 647 | return array(); |
648 | 648 | } else { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | } |
652 | 652 | |
653 | 653 | if ($aircraft_icao != "") { |
654 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
654 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
655 | 655 | if (!is_string($aircraft_icao)) { |
656 | 656 | return array(); |
657 | 657 | } else { |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | } |
661 | 661 | |
662 | 662 | if ($aircraft_manufacturer != "") { |
663 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
663 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
664 | 664 | if (!is_string($aircraft_manufacturer)) { |
665 | 665 | return array(); |
666 | 666 | } else { |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | } |
678 | 678 | |
679 | 679 | if ($airline_icao != "") { |
680 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
680 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
681 | 681 | if (!is_string($airline_icao)) { |
682 | 682 | return array(); |
683 | 683 | } else { |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | } |
687 | 687 | |
688 | 688 | if ($airline_country != "") { |
689 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
689 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
690 | 690 | if (!is_string($airline_country)) { |
691 | 691 | return array(); |
692 | 692 | } else { |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | } |
696 | 696 | |
697 | 697 | if ($airline_type != "") { |
698 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
698 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
699 | 699 | if (!is_string($airline_type)) { |
700 | 700 | return array(); |
701 | 701 | } else { |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | } |
713 | 713 | |
714 | 714 | if ($airport != "") { |
715 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
715 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
716 | 716 | if (!is_string($airport)) { |
717 | 717 | return array(); |
718 | 718 | } else { |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | } |
722 | 722 | |
723 | 723 | if ($airport_country != "") { |
724 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
724 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
725 | 725 | if (!is_string($airport_country)) { |
726 | 726 | return array(); |
727 | 727 | } else { |
@@ -730,14 +730,14 @@ discard block |
||
730 | 730 | } |
731 | 731 | |
732 | 732 | if ($callsign != "") { |
733 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
733 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
734 | 734 | if (!is_string($callsign)) { |
735 | 735 | return array(); |
736 | 736 | } else { |
737 | 737 | $translate = $Translation->ident2icao($callsign); |
738 | 738 | if ($translate != $callsign) { |
739 | 739 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
740 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
740 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
741 | 741 | } else { |
742 | 742 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
743 | 743 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | } |
746 | 746 | |
747 | 747 | if ($owner != "") { |
748 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
748 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
749 | 749 | if (!is_string($owner)) { |
750 | 750 | return array(); |
751 | 751 | } else { |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | } |
755 | 755 | |
756 | 756 | if ($pilot_name != "") { |
757 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
757 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
758 | 758 | if (!is_string($pilot_name)) { |
759 | 759 | return array(); |
760 | 760 | } else { |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | } |
764 | 764 | |
765 | 765 | if ($pilot_id != "") { |
766 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
766 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
767 | 767 | if (!is_string($pilot_id)) { |
768 | 768 | return array(); |
769 | 769 | } else { |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | } |
773 | 773 | |
774 | 774 | if ($departure_airport_route != "") { |
775 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
775 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
776 | 776 | if (!is_string($departure_airport_route)) { |
777 | 777 | return array(); |
778 | 778 | } else { |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | } |
782 | 782 | |
783 | 783 | if ($arrival_airport_route != "") { |
784 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
784 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
785 | 785 | if (!is_string($arrival_airport_route)) { |
786 | 786 | return array(); |
787 | 787 | } else { |
@@ -792,8 +792,8 @@ discard block |
||
792 | 792 | if ($altitude != "") { |
793 | 793 | $altitude_array = explode(",", $altitude); |
794 | 794 | |
795 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
796 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
795 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
796 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
797 | 797 | |
798 | 798 | |
799 | 799 | if ($altitude_array[1] != "") { |
@@ -808,8 +808,8 @@ discard block |
||
808 | 808 | |
809 | 809 | if ($date_posted != "") { |
810 | 810 | $date_array = explode(",", $date_posted); |
811 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
812 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
811 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
812 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
813 | 813 | if ($globalTimezone != '') { |
814 | 814 | date_default_timezone_set($globalTimezone); |
815 | 815 | $datetime = new DateTime(); |
@@ -834,16 +834,16 @@ discard block |
||
834 | 834 | } |
835 | 835 | if ($limit != "") { |
836 | 836 | $limit_array = explode(",", $limit); |
837 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
838 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
837 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
838 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
839 | 839 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
840 | 840 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
841 | 841 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
842 | 842 | } |
843 | 843 | } |
844 | 844 | if ($origLat != "" && $origLon != "" && $dist != "") { |
845 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
846 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
845 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
846 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
847 | 847 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
848 | 848 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
849 | 849 | } else { |
@@ -857,12 +857,12 @@ discard block |
||
857 | 857 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
858 | 858 | } |
859 | 859 | |
860 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
860 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
861 | 861 | WHERE spotter_archive_output.ident <> '' |
862 | 862 | ".$additional_query." |
863 | 863 | ".$filter_query.$orderby_query; |
864 | 864 | } |
865 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
865 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
866 | 866 | return $spotter_array; |
867 | 867 | } |
868 | 868 | |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | try { |
878 | 878 | $sth = $this->db->prepare($query); |
879 | 879 | $sth->execute(); |
880 | - } catch(PDOException $e) { |
|
880 | + } catch (PDOException $e) { |
|
881 | 881 | return "error"; |
882 | 882 | } |
883 | 883 | } |
@@ -910,8 +910,8 @@ discard block |
||
910 | 910 | if ($limit != "") { |
911 | 911 | $limit_array = explode(",", $limit); |
912 | 912 | |
913 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
914 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
913 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
914 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
915 | 915 | |
916 | 916 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
917 | 917 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | $query_values = array(); |
950 | 950 | $limit_query = ''; |
951 | 951 | $additional_query = ''; |
952 | - $filter_query = $this->getFilter($filter,true,true); |
|
952 | + $filter_query = $this->getFilter($filter, true, true); |
|
953 | 953 | |
954 | 954 | if ($owner != "") { |
955 | 955 | if (!is_string($owner)) { |
@@ -963,8 +963,8 @@ discard block |
||
963 | 963 | if ($limit != "") { |
964 | 964 | $limit_array = explode(",", $limit); |
965 | 965 | |
966 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
967 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
966 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
967 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
968 | 968 | |
969 | 969 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
970 | 970 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | $query_values = array(); |
1002 | 1002 | $limit_query = ''; |
1003 | 1003 | $additional_query = ''; |
1004 | - $filter_query = $this->getFilter($filter,true,true); |
|
1004 | + $filter_query = $this->getFilter($filter, true, true); |
|
1005 | 1005 | |
1006 | 1006 | if ($pilot != "") { |
1007 | 1007 | $additional_query = " AND (spotter_archive_output.pilot_id = :pilot OR spotter_archive_output.pilot_name = :pilot)"; |
@@ -1011,8 +1011,8 @@ discard block |
||
1011 | 1011 | if ($limit != "") { |
1012 | 1012 | $limit_array = explode(",", $limit); |
1013 | 1013 | |
1014 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1015 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1014 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1015 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1016 | 1016 | |
1017 | 1017 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
1018 | 1018 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | * @return Array the airline country list |
1041 | 1041 | * |
1042 | 1042 | */ |
1043 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
1043 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
1044 | 1044 | global $globalDBdriver; |
1045 | 1045 | /* |
1046 | 1046 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | $flight_array = array(); |
1069 | 1069 | $temp_array = array(); |
1070 | 1070 | |
1071 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1071 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1072 | 1072 | $temp_array['flight_count'] = $row['nb']; |
1073 | 1073 | $temp_array['flight_country'] = $row['name']; |
1074 | 1074 | $temp_array['flight_country_iso3'] = $row['iso3']; |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | * @return Array the airline country list |
1085 | 1085 | * |
1086 | 1086 | */ |
1087 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
1087 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
1088 | 1088 | global $globalDBdriver; |
1089 | 1089 | /* |
1090 | 1090 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | $flight_array = array(); |
1113 | 1113 | $temp_array = array(); |
1114 | 1114 | |
1115 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1115 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1116 | 1116 | $temp_array['airline_icao'] = $row['airline_icao']; |
1117 | 1117 | $temp_array['flight_count'] = $row['nb']; |
1118 | 1118 | $temp_array['flight_country'] = $row['name']; |
@@ -1129,13 +1129,13 @@ discard block |
||
1129 | 1129 | * @return Array the spotter information |
1130 | 1130 | * |
1131 | 1131 | */ |
1132 | - public function getDateArchiveSpotterDataById($id,$date) { |
|
1132 | + public function getDateArchiveSpotterDataById($id, $date) { |
|
1133 | 1133 | $Spotter = new Spotter($this->db); |
1134 | 1134 | date_default_timezone_set('UTC'); |
1135 | 1135 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1136 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1137 | - $date = date('c',$date); |
|
1138 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1136 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1137 | + $date = date('c', $date); |
|
1138 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1139 | 1139 | return $spotter_array; |
1140 | 1140 | } |
1141 | 1141 | |
@@ -1145,13 +1145,13 @@ discard block |
||
1145 | 1145 | * @return Array the spotter information |
1146 | 1146 | * |
1147 | 1147 | */ |
1148 | - public function getDateArchiveSpotterDataByIdent($ident,$date) { |
|
1148 | + public function getDateArchiveSpotterDataByIdent($ident, $date) { |
|
1149 | 1149 | $Spotter = new Spotter($this->db); |
1150 | 1150 | date_default_timezone_set('UTC'); |
1151 | 1151 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1152 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1153 | - $date = date('c',$date); |
|
1154 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1152 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1153 | + $date = date('c', $date); |
|
1154 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1155 | 1155 | return $spotter_array; |
1156 | 1156 | } |
1157 | 1157 | |
@@ -1161,14 +1161,14 @@ discard block |
||
1161 | 1161 | * @return Array the spotter information |
1162 | 1162 | * |
1163 | 1163 | */ |
1164 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) { |
|
1164 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) { |
|
1165 | 1165 | global $global_query; |
1166 | 1166 | $Spotter = new Spotter($this->db); |
1167 | 1167 | date_default_timezone_set('UTC'); |
1168 | 1168 | $query_values = array(); |
1169 | 1169 | $limit_query = ''; |
1170 | 1170 | $additional_query = ''; |
1171 | - $filter_query = $this->getFilter($filters,true,true); |
|
1171 | + $filter_query = $this->getFilter($filters, true, true); |
|
1172 | 1172 | |
1173 | 1173 | if ($airport != "") { |
1174 | 1174 | if (!is_string($airport)) { |
@@ -1182,8 +1182,8 @@ discard block |
||
1182 | 1182 | if ($limit != "") { |
1183 | 1183 | $limit_array = explode(",", $limit); |
1184 | 1184 | |
1185 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1186 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1185 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1186 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1187 | 1187 | |
1188 | 1188 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
1189 | 1189 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
76 | 76 | } |
77 | 77 | } |
78 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
78 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
79 | 79 | } |
80 | 80 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
81 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
81 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
82 | 82 | } |
83 | 83 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
84 | 84 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
85 | 85 | if ($filter_query_where != '') { |
86 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
86 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
87 | 87 | } |
88 | 88 | $filter_query = $filter_query_join.$filter_query_where; |
89 | 89 | return $filter_query; |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | if ($limit != '') |
107 | 107 | { |
108 | 108 | $limit_array = explode(',', $limit); |
109 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
110 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
109 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
110 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
111 | 111 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
112 | 112 | { |
113 | 113 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } else { |
131 | 131 | $query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query; |
132 | 132 | } |
133 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); |
|
133 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); |
|
134 | 134 | |
135 | 135 | return $spotter_array; |
136 | 136 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | global $globalDBdriver, $globalLiveInterval; |
147 | 147 | date_default_timezone_set('UTC'); |
148 | 148 | |
149 | - $filter_query = $this->getFilter($filter,true,true); |
|
149 | + $filter_query = $this->getFilter($filter, true, true); |
|
150 | 150 | |
151 | 151 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
152 | 152 | if ($globalDBdriver == 'mysql') { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | try { |
165 | 165 | $sth = $this->db->prepare($query); |
166 | 166 | $sth->execute(); |
167 | - } catch(PDOException $e) { |
|
167 | + } catch (PDOException $e) { |
|
168 | 168 | echo $e->getMessage(); |
169 | 169 | die; |
170 | 170 | } |
@@ -179,25 +179,25 @@ discard block |
||
179 | 179 | * @return Array the spotter information |
180 | 180 | * |
181 | 181 | */ |
182 | - public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false) |
|
182 | + public function getMinLastLiveTrackerData($coord, $filter = array(), $limit = false) |
|
183 | 183 | { |
184 | 184 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit; |
185 | 185 | date_default_timezone_set('UTC'); |
186 | 186 | $usecoord = false; |
187 | 187 | if (is_array($coord) && !empty($coord)) { |
188 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
189 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
190 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
191 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
188 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
189 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
190 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
191 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
192 | 192 | $usecoord = true; |
193 | 193 | } |
194 | - $filter_query = $this->getFilter($filter,true,true); |
|
194 | + $filter_query = $this->getFilter($filter, true, true); |
|
195 | 195 | |
196 | 196 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
197 | 197 | if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300'; |
198 | 198 | if ($globalDBdriver == 'mysql') { |
199 | 199 | if (isset($globalArchive) && $globalArchive) { |
200 | - $query = "SELECT * FROM ( |
|
200 | + $query = "SELECT * FROM ( |
|
201 | 201 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
202 | 202 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
203 | 203 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | } else { |
221 | 221 | if (isset($globalArchive) && $globalArchive) { |
222 | - $query = "SELECT * FROM ( |
|
222 | + $query = "SELECT * FROM ( |
|
223 | 223 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
224 | 224 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
225 | 225 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | try { |
244 | 244 | $sth = $this->db->prepare($query); |
245 | 245 | $sth->execute(); |
246 | - } catch(PDOException $e) { |
|
246 | + } catch (PDOException $e) { |
|
247 | 247 | echo $e->getMessage(); |
248 | 248 | die; |
249 | 249 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function getLiveTrackerCount($filter = array()) |
261 | 261 | { |
262 | 262 | global $globalDBdriver, $globalLiveInterval; |
263 | - $filter_query = $this->getFilter($filter,true,true); |
|
263 | + $filter_query = $this->getFilter($filter, true, true); |
|
264 | 264 | |
265 | 265 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
266 | 266 | if ($globalDBdriver == 'mysql') { |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | try { |
272 | 272 | $sth = $this->db->prepare($query); |
273 | 273 | $sth->execute(); |
274 | - } catch(PDOException $e) { |
|
274 | + } catch (PDOException $e) { |
|
275 | 275 | echo $e->getMessage(); |
276 | 276 | die; |
277 | 277 | } |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | $filter_query = $this->getFilter($filter); |
295 | 295 | |
296 | 296 | if (is_array($coord)) { |
297 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
298 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
299 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
300 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
297 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
298 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
299 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
300 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
301 | 301 | } else return array(); |
302 | 302 | if ($globalDBdriver == 'mysql') { |
303 | 303 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
@@ -319,13 +319,13 @@ discard block |
||
319 | 319 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
320 | 320 | $Tracker = new Tracker($this->db); |
321 | 321 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
322 | - $filter_query = $this->getFilter($filter,true,true); |
|
322 | + $filter_query = $this->getFilter($filter, true, true); |
|
323 | 323 | |
324 | 324 | if (is_array($coord)) { |
325 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
326 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
327 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
328 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
325 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
326 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
327 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
328 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
329 | 329 | } else return array(); |
330 | 330 | /* |
331 | 331 | if ($globalDBdriver == 'mysql') { |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | */ |
340 | 340 | if ($globalDBdriver == 'mysql') { |
341 | 341 | if (isset($globalArchive) && $globalArchive === TRUE) { |
342 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
342 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
343 | 343 | FROM tracker_live |
344 | 344 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= tracker_live.date |
345 | 345 | AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
346 | 346 | AND tracker_live.latitude <> 0 AND tracker_live.longitude <> 0 ORDER BY date DESC'; |
347 | 347 | } else { |
348 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
348 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
349 | 349 | FROM tracker_live |
350 | 350 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate |
351 | 351 | FROM tracker_live l |
@@ -357,14 +357,14 @@ discard block |
||
357 | 357 | } |
358 | 358 | } else { |
359 | 359 | if (isset($globalArchive) && $globalArchive === TRUE) { |
360 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
360 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
361 | 361 | FROM tracker_live |
362 | 362 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date |
363 | 363 | AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
364 | 364 | AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
365 | 365 | AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' ORDER BY date DESC"; |
366 | 366 | } else { |
367 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
367 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
368 | 368 | FROM tracker_live |
369 | 369 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate |
370 | 370 | FROM tracker_live l |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | if ($interval == '1m') |
422 | 422 | { |
423 | 423 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
424 | - } else if ($interval == '15m'){ |
|
424 | + } else if ($interval == '15m') { |
|
425 | 425 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
426 | 426 | } |
427 | 427 | } |
@@ -429,14 +429,14 @@ discard block |
||
429 | 429 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
430 | 430 | } |
431 | 431 | |
432 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
432 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
433 | 433 | WHERE tracker_live.latitude <> '' |
434 | 434 | AND tracker_live.longitude <> '' |
435 | 435 | ".$additional_query." |
436 | 436 | HAVING distance < :radius |
437 | 437 | ORDER BY distance"; |
438 | 438 | |
439 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
439 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
440 | 440 | |
441 | 441 | return $spotter_array; |
442 | 442 | } |
@@ -454,9 +454,9 @@ discard block |
||
454 | 454 | date_default_timezone_set('UTC'); |
455 | 455 | |
456 | 456 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
457 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
457 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
458 | 458 | |
459 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
459 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
460 | 460 | |
461 | 461 | return $spotter_array; |
462 | 462 | } |
@@ -467,16 +467,16 @@ discard block |
||
467 | 467 | * @return Array the spotter information |
468 | 468 | * |
469 | 469 | */ |
470 | - public function getDateLiveTrackerDataByIdent($ident,$date) |
|
470 | + public function getDateLiveTrackerDataByIdent($ident, $date) |
|
471 | 471 | { |
472 | 472 | $Tracker = new Tracker($this->db); |
473 | 473 | date_default_timezone_set('UTC'); |
474 | 474 | |
475 | 475 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
476 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
476 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
477 | 477 | |
478 | - $date = date('c',$date); |
|
479 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
478 | + $date = date('c', $date); |
|
479 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
480 | 480 | |
481 | 481 | return $spotter_array; |
482 | 482 | } |
@@ -493,9 +493,9 @@ discard block |
||
493 | 493 | date_default_timezone_set('UTC'); |
494 | 494 | |
495 | 495 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
496 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
496 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
497 | 497 | |
498 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
|
498 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); |
|
499 | 499 | |
500 | 500 | return $spotter_array; |
501 | 501 | } |
@@ -506,15 +506,15 @@ discard block |
||
506 | 506 | * @return Array the spotter information |
507 | 507 | * |
508 | 508 | */ |
509 | - public function getDateLiveTrackerDataById($id,$date) |
|
509 | + public function getDateLiveTrackerDataById($id, $date) |
|
510 | 510 | { |
511 | 511 | $Tracker = new Tracker($this->db); |
512 | 512 | date_default_timezone_set('UTC'); |
513 | 513 | |
514 | 514 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
515 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
516 | - $date = date('c',$date); |
|
517 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
515 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
516 | + $date = date('c', $date); |
|
517 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
518 | 518 | |
519 | 519 | return $spotter_array; |
520 | 520 | } |
@@ -531,13 +531,13 @@ discard block |
||
531 | 531 | date_default_timezone_set('UTC'); |
532 | 532 | |
533 | 533 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
534 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
534 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
535 | 535 | |
536 | 536 | try { |
537 | 537 | |
538 | 538 | $sth = $this->db->prepare($query); |
539 | 539 | $sth->execute(array(':ident' => $ident)); |
540 | - } catch(PDOException $e) { |
|
540 | + } catch (PDOException $e) { |
|
541 | 541 | echo $e->getMessage(); |
542 | 542 | die; |
543 | 543 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | * @return Array the spotter information |
553 | 553 | * |
554 | 554 | */ |
555 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) |
|
555 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) |
|
556 | 556 | { |
557 | 557 | global $globalDBdriver, $globalLiveInterval; |
558 | 558 | date_default_timezone_set('UTC'); |
@@ -561,19 +561,19 @@ discard block |
||
561 | 561 | if ($globalDBdriver == 'mysql') { |
562 | 562 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
563 | 563 | if ($liveinterval === true) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
564 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
564 | + elseif ($liveinterval !== false) $query .= " AND date <= '".date('c', $liveinterval)."'"; |
|
565 | 565 | $query .= ' ORDER BY date'; |
566 | 566 | } else { |
567 | 567 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
568 | 568 | if ($liveinterval === true) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
569 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
569 | + elseif ($liveinterval !== false) $query .= " AND date <= '".date('c', $liveinterval)."'"; |
|
570 | 570 | $query .= ' ORDER BY date'; |
571 | 571 | } |
572 | 572 | |
573 | 573 | try { |
574 | 574 | $sth = $this->db->prepare($query); |
575 | 575 | $sth->execute(array(':id' => $id)); |
576 | - } catch(PDOException $e) { |
|
576 | + } catch (PDOException $e) { |
|
577 | 577 | echo $e->getMessage(); |
578 | 578 | die; |
579 | 579 | } |
@@ -591,12 +591,12 @@ discard block |
||
591 | 591 | { |
592 | 592 | date_default_timezone_set('UTC'); |
593 | 593 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
594 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
594 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
595 | 595 | try { |
596 | 596 | |
597 | 597 | $sth = $this->db->prepare($query); |
598 | 598 | $sth->execute(array(':ident' => $ident)); |
599 | - } catch(PDOException $e) { |
|
599 | + } catch (PDOException $e) { |
|
600 | 600 | echo $e->getMessage(); |
601 | 601 | die; |
602 | 602 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | |
627 | 627 | $sth = $this->db->prepare($query); |
628 | 628 | $sth->execute(); |
629 | - } catch(PDOException $e) { |
|
629 | + } catch (PDOException $e) { |
|
630 | 630 | return "error"; |
631 | 631 | } |
632 | 632 | |
@@ -649,14 +649,14 @@ discard block |
||
649 | 649 | |
650 | 650 | $sth = $this->db->prepare($query); |
651 | 651 | $sth->execute(); |
652 | - } catch(PDOException $e) { |
|
652 | + } catch (PDOException $e) { |
|
653 | 653 | return "error"; |
654 | 654 | } |
655 | 655 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
656 | 656 | $i = 0; |
657 | - $j =0; |
|
657 | + $j = 0; |
|
658 | 658 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
659 | - foreach($all as $row) |
|
659 | + foreach ($all as $row) |
|
660 | 660 | { |
661 | 661 | $i++; |
662 | 662 | $j++; |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | if ($globalDebug) echo "."; |
665 | 665 | try { |
666 | 666 | |
667 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
667 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
668 | 668 | $sth->execute(); |
669 | - } catch(PDOException $e) { |
|
669 | + } catch (PDOException $e) { |
|
670 | 670 | return "error"; |
671 | 671 | } |
672 | 672 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | if ($i > 0) { |
678 | 678 | try { |
679 | 679 | |
680 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
680 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
681 | 681 | $sth->execute(); |
682 | - } catch(PDOException $e) { |
|
682 | + } catch (PDOException $e) { |
|
683 | 683 | return "error"; |
684 | 684 | } |
685 | 685 | } |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | |
693 | 693 | $sth = $this->db->prepare($query); |
694 | 694 | $sth->execute(); |
695 | - } catch(PDOException $e) { |
|
695 | + } catch (PDOException $e) { |
|
696 | 696 | return "error"; |
697 | 697 | } |
698 | 698 | /* $query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; |
@@ -740,13 +740,13 @@ discard block |
||
740 | 740 | public function deleteLiveTrackerDataByIdent($ident) |
741 | 741 | { |
742 | 742 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
743 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
743 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
744 | 744 | |
745 | 745 | try { |
746 | 746 | |
747 | 747 | $sth = $this->db->prepare($query); |
748 | 748 | $sth->execute(array(':ident' => $ident)); |
749 | - } catch(PDOException $e) { |
|
749 | + } catch (PDOException $e) { |
|
750 | 750 | return "error"; |
751 | 751 | } |
752 | 752 | |
@@ -762,13 +762,13 @@ discard block |
||
762 | 762 | public function deleteLiveTrackerDataById($id) |
763 | 763 | { |
764 | 764 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
765 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
765 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
766 | 766 | |
767 | 767 | try { |
768 | 768 | |
769 | 769 | $sth = $this->db->prepare($query); |
770 | 770 | $sth->execute(array(':id' => $id)); |
771 | - } catch(PDOException $e) { |
|
771 | + } catch (PDOException $e) { |
|
772 | 772 | return "error"; |
773 | 773 | } |
774 | 774 | |
@@ -786,13 +786,13 @@ discard block |
||
786 | 786 | { |
787 | 787 | global $globalDBdriver, $globalTimezone; |
788 | 788 | if ($globalDBdriver == 'mysql') { |
789 | - $query = 'SELECT tracker_live.ident FROM tracker_live |
|
789 | + $query = 'SELECT tracker_live.ident FROM tracker_live |
|
790 | 790 | WHERE tracker_live.ident = :ident |
791 | 791 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
792 | 792 | AND tracker_live.date < UTC_TIMESTAMP()'; |
793 | 793 | $query_data = array(':ident' => $ident); |
794 | 794 | } else { |
795 | - $query = "SELECT tracker_live.ident FROM tracker_live |
|
795 | + $query = "SELECT tracker_live.ident FROM tracker_live |
|
796 | 796 | WHERE tracker_live.ident = :ident |
797 | 797 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
798 | 798 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -801,8 +801,8 @@ discard block |
||
801 | 801 | |
802 | 802 | $sth = $this->db->prepare($query); |
803 | 803 | $sth->execute($query_data); |
804 | - $ident_result=''; |
|
805 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
804 | + $ident_result = ''; |
|
805 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
806 | 806 | { |
807 | 807 | $ident_result = $row['ident']; |
808 | 808 | } |
@@ -819,13 +819,13 @@ discard block |
||
819 | 819 | { |
820 | 820 | global $globalDBdriver, $globalTimezone; |
821 | 821 | if ($globalDBdriver == 'mysql') { |
822 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
822 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
823 | 823 | WHERE tracker_live.ident = :ident |
824 | 824 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
825 | 825 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
826 | 826 | $query_data = array(':ident' => $ident); |
827 | 827 | } else { |
828 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
828 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
829 | 829 | WHERE tracker_live.ident = :ident |
830 | 830 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
831 | 831 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | |
835 | 835 | $sth = $this->db->prepare($query); |
836 | 836 | $sth->execute($query_data); |
837 | - $ident_result=''; |
|
838 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
837 | + $ident_result = ''; |
|
838 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
839 | 839 | { |
840 | 840 | $ident_result = $row['famtrackid']; |
841 | 841 | } |
@@ -852,13 +852,13 @@ discard block |
||
852 | 852 | { |
853 | 853 | global $globalDBdriver, $globalTimezone; |
854 | 854 | if ($globalDBdriver == 'mysql') { |
855 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
855 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
856 | 856 | WHERE tracker_live.famtrackid = :id |
857 | 857 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
858 | 858 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
859 | 859 | $query_data = array(':id' => $id); |
860 | 860 | } else { |
861 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
861 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
862 | 862 | WHERE tracker_live.famtrackid = :id |
863 | 863 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
864 | 864 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -867,8 +867,8 @@ discard block |
||
867 | 867 | |
868 | 868 | $sth = $this->db->prepare($query); |
869 | 869 | $sth->execute($query_data); |
870 | - $ident_result=''; |
|
871 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
870 | + $ident_result = ''; |
|
871 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
872 | 872 | { |
873 | 873 | $ident_result = $row['famtrackid']; |
874 | 874 | } |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * @return String success or false |
887 | 887 | * |
888 | 888 | */ |
889 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
889 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
890 | 890 | { |
891 | 891 | global $globalURL, $globalArchive, $globalDebug; |
892 | 892 | $Common = new Common(); |
@@ -945,21 +945,21 @@ discard block |
||
945 | 945 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
946 | 946 | |
947 | 947 | |
948 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
949 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
950 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
951 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
952 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
953 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
954 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
955 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
956 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
957 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
958 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
959 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
960 | - |
|
961 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
962 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
948 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
949 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
950 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
951 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
952 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
953 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
954 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
955 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
956 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
957 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
958 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
959 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
960 | + |
|
961 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
962 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
963 | 963 | |
964 | 964 | $query = ''; |
965 | 965 | if ($globalArchive) { |
@@ -969,12 +969,12 @@ discard block |
||
969 | 969 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
970 | 970 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
971 | 971 | |
972 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type); |
|
972 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type); |
|
973 | 973 | try { |
974 | 974 | $sth = $this->db->prepare($query); |
975 | 975 | $sth->execute($query_values); |
976 | 976 | $sth->closeCursor(); |
977 | - } catch(PDOException $e) { |
|
977 | + } catch (PDOException $e) { |
|
978 | 978 | return "error : ".$e->getMessage(); |
979 | 979 | } |
980 | 980 | /* |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
985 | 985 | if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
986 | 986 | $TrackerArchive = new TrackerArchive($this->db); |
987 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
987 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country); |
|
988 | 988 | if ($globalDebug) echo $result.')'; |
989 | 989 | } |
990 | 990 | |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | |
995 | 995 | public function getOrderBy() |
996 | 996 | { |
997 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
997 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
998 | 998 | return $orderby; |
999 | 999 | } |
1000 | 1000 |