@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | $s3 = sin($bank/2); |
| 67 | 67 | $c1c2 = $c1*$c2; |
| 68 | 68 | $s1s2 = $s1*$s2; |
| 69 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 70 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 71 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 72 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 73 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 69 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
| 70 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
| 71 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 72 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 73 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
| 74 | 74 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
| 75 | 75 | |
| 76 | 76 | } |
@@ -91,18 +91,18 @@ discard block |
||
| 91 | 91 | $min = false; |
| 92 | 92 | $allhistory = false; |
| 93 | 93 | $filter['source'] = array(); |
| 94 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 95 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 96 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 97 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 98 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 99 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 100 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 101 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 102 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 103 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 104 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 105 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
| 94 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 95 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 96 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 97 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
| 98 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 99 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
| 100 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
| 101 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
| 102 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
| 103 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
| 104 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
| 105 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | 106 | /* |
| 107 | 107 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 108 | 108 | $min = true; |
@@ -149,17 +149,17 @@ discard block |
||
| 149 | 149 | $from_archive = true; |
| 150 | 150 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 151 | 151 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 152 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 153 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 154 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 155 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 156 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 152 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 153 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 154 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 155 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 156 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 157 | 157 | if ($tracker) { |
| 158 | - $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter); |
|
| 158 | + $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter); |
|
| 159 | 159 | } elseif ($marine) { |
| 160 | - $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter); |
|
| 160 | + $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter); |
|
| 161 | 161 | } else { |
| 162 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
| 162 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
| 163 | 163 | } |
| 164 | 164 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
| 165 | 165 | $from_archive = true; |
@@ -176,36 +176,36 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | $enddate = $_COOKIE['archive_end']; |
| 178 | 178 | $enddateinitial = $_COOKIE['archive_end']; |
| 179 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
| 180 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 181 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 179 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
| 180 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 181 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 182 | 182 | //echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
| 183 | 183 | if ($tracker) { |
| 184 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
| 184 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
| 185 | 185 | } elseif ($marine) { |
| 186 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
| 186 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
| 187 | 187 | } else { |
| 188 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 188 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 189 | 189 | } |
| 190 | 190 | } elseif ($tracker) { |
| 191 | 191 | $coord = array(); |
| 192 | 192 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 193 | - $coord = explode(',',$_GET['coord']); |
|
| 194 | - 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) |
|
| 193 | + $coord = explode(',', $_GET['coord']); |
|
| 194 | + 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) |
|
| 195 | 195 | && $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)) { |
| 196 | 196 | $coord = array(); |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | $previous_filter = $filter; |
| 200 | 200 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) { |
| 201 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker'])); |
|
| 202 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false); |
|
| 201 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker'])); |
|
| 202 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false); |
|
| 203 | 203 | /* |
| 204 | 204 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
| 205 | 205 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']); |
| 206 | 206 | */ |
| 207 | 207 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
| 208 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false); |
|
| 208 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false); |
|
| 209 | 209 | } else { |
| 210 | 210 | $spotter_array = array(); |
| 211 | 211 | } |
@@ -214,20 +214,20 @@ discard block |
||
| 214 | 214 | $coord = array(); |
| 215 | 215 | //if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 216 | 216 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
| 217 | - $coord = explode(',',$_GET['coord']); |
|
| 218 | - 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) |
|
| 217 | + $coord = explode(',', $_GET['coord']); |
|
| 218 | + 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) |
|
| 219 | 219 | && $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)) { |
| 220 | 220 | $coord = array(); |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | $previous_filter = $filter; |
| 224 | 224 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) { |
| 225 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine'])); |
|
| 226 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
|
| 225 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackMarine'])); |
|
| 226 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false); |
|
| 227 | 227 | } elseif (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '' && !empty($coord)) { |
| 228 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false,$_COOKIE['MapTrack']); |
|
| 228 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false, $_COOKIE['MapTrack']); |
|
| 229 | 229 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
| 230 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
|
| 230 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false); |
|
| 231 | 231 | } else { |
| 232 | 232 | $spotter_array = array(); |
| 233 | 233 | } |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | } else { |
| 236 | 236 | $coord = array(); |
| 237 | 237 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
| 238 | - $coord = explode(',',$_GET['coord']); |
|
| 239 | - 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) |
|
| 238 | + $coord = explode(',', $_GET['coord']); |
|
| 239 | + 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) |
|
| 240 | 240 | && $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)) { |
| 241 | 241 | $coord = array(); |
| 242 | 242 | } |
@@ -244,14 +244,14 @@ discard block |
||
| 244 | 244 | $previous_filter = $filter; |
| 245 | 245 | if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || ((!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
| 246 | 246 | //$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
| 247 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false); |
|
| 247 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'], $filter, false); |
|
| 248 | 248 | //$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false); |
| 249 | 249 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '') { |
| 250 | 250 | //$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false); |
| 251 | 251 | //if (empty($spotter_array)) $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']); |
| 252 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']); |
|
| 252 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false, $_COOKIE['MapTrack']); |
|
| 253 | 253 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
| 254 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false); |
|
| 254 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false); |
|
| 255 | 255 | } else { |
| 256 | 256 | $spotter_array = array(); |
| 257 | 257 | } |
@@ -261,19 +261,19 @@ discard block |
||
| 261 | 261 | if (!empty($spotter_array) && isset($coord)) { |
| 262 | 262 | if ($tracker) { |
| 263 | 263 | if (isset($_GET['archive'])) { |
| 264 | - $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter); |
|
| 264 | + $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate, $enddate, $filter); |
|
| 265 | 265 | } else { |
| 266 | 266 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
| 267 | 267 | } |
| 268 | 268 | } elseif ($marine) { |
| 269 | 269 | if (isset($_GET['archive'])) { |
| 270 | - $flightcnt = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter); |
|
| 270 | + $flightcnt = $MarineArchive->getLiveMarineCount($begindate, $enddate, $filter); |
|
| 271 | 271 | } else { |
| 272 | 272 | $flightcnt = $MarineLive->getLiveMarineCount($filter); |
| 273 | 273 | } |
| 274 | 274 | } else { |
| 275 | 275 | if (isset($_GET['archive'])) { |
| 276 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 276 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 277 | 277 | } else { |
| 278 | 278 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 279 | 279 | } |
@@ -281,17 +281,17 @@ discard block |
||
| 281 | 281 | if ($flightcnt == '') $flightcnt = 0; |
| 282 | 282 | } else $flightcnt = 0; |
| 283 | 283 | |
| 284 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 284 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 285 | 285 | $minitime = time(); |
| 286 | 286 | $minitracktime_begin = time(); |
| 287 | 287 | $minitracktime = $minitracktime_begin; |
| 288 | 288 | $maxitime = 0; |
| 289 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
| 289 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
| 290 | 290 | $modelsdb = array(); |
| 291 | 291 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
| 292 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
| 293 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
| 294 | - if (isset($row[1]) ){ |
|
| 292 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
| 293 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
| 294 | + if (isset($row[1])) { |
|
| 295 | 295 | $model = $row[0]; |
| 296 | 296 | $modelsdb[$model] = $row[1]; |
| 297 | 297 | } |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | $modelsdb2 = array(); |
| 303 | 303 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
| 304 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
| 305 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
| 306 | - if (isset($row[1]) ){ |
|
| 304 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
| 305 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
| 306 | + if (isset($row[1])) { |
|
| 307 | 307 | $model = $row[0]; |
| 308 | 308 | $glb = $row[1]; |
| 309 | 309 | if (isset($row[2])) { |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 350 | 350 | { |
| 351 | 351 | $nblatlong = 0; |
| 352 | - foreach($spotter_array as $spotter_item) |
|
| 352 | + foreach ($spotter_array as $spotter_item) |
|
| 353 | 353 | { |
| 354 | 354 | $j++; |
| 355 | 355 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -403,16 +403,16 @@ discard block |
||
| 403 | 403 | } |
| 404 | 404 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
| 405 | 405 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
| 406 | - if (isset($spotter_item['ident'])) $output.= '"ident": '.json_encode($spotter_item['ident']).','; |
|
| 406 | + if (isset($spotter_item['ident'])) $output .= '"ident": '.json_encode($spotter_item['ident']).','; |
|
| 407 | 407 | if ($tracker) { |
| 408 | 408 | if (isset($spotter_item['type'])) $output .= '"tracker_type": '.json_encode($spotter_item['type']).','; |
| 409 | - $output.= '"type": "tracker"'; |
|
| 409 | + $output .= '"type": "tracker"'; |
|
| 410 | 410 | } elseif ($marine) { |
| 411 | 411 | if (isset($spotter_item['type'])) $output .= '"marine_type": '.json_encode($spotter_item['type']).','; |
| 412 | 412 | if (isset($spotter_item['captain_name'])) $output .= '"captain": '.json_encode($spotter_item['captain_name']).','; |
| 413 | 413 | if (isset($spotter_item['race_name'])) $output .= '"race": '.json_encode($spotter_item['race_name']).','; |
| 414 | 414 | if (isset($spotter_item['race_rank'])) $output .= '"rank": "'.$spotter_item['race_rank'].'",'; |
| 415 | - $output.= '"type": "marine"'; |
|
| 415 | + $output .= '"type": "marine"'; |
|
| 416 | 416 | } else { |
| 417 | 417 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
| 418 | 418 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -426,14 +426,14 @@ discard block |
||
| 426 | 426 | if (isset($airline_icao)) { |
| 427 | 427 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
| 428 | 428 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
| 429 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
| 429 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | //if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
| 434 | 434 | } |
| 435 | - $output.= '"gltf2": %gltf2%,'; |
|
| 436 | - $output.= '"type": "flight"'; |
|
| 435 | + $output .= '"gltf2": %gltf2%,'; |
|
| 436 | + $output .= '"type": "flight"'; |
|
| 437 | 437 | } |
| 438 | 438 | $output .= '},'; |
| 439 | 439 | |
@@ -808,8 +808,8 @@ discard block |
||
| 808 | 808 | $output .= '},'; |
| 809 | 809 | } |
| 810 | 810 | } |
| 811 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
| 812 | - else $output = str_replace('%onground%','false',$output); |
|
| 811 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
| 812 | + else $output = str_replace('%onground%', 'false', $output); |
|
| 813 | 813 | |
| 814 | 814 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
| 815 | 815 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
| 826 | 826 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
| 827 | 827 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 828 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 828 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 829 | 829 | $output .= $spotter_item['longitude'].', '; |
| 830 | 830 | $output .= $spotter_item['latitude']; |
| 831 | 831 | $prevlong = $spotter_item['longitude']; |
@@ -853,8 +853,8 @@ discard block |
||
| 853 | 853 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
| 854 | 854 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
| 855 | 855 | } else { |
| 856 | - $nblatlong = $nblatlong+1; |
|
| 857 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 856 | + $nblatlong = $nblatlong + 1; |
|
| 857 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 858 | 858 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 859 | 859 | if ($spotter_item['ground_speed'] == 0) { |
| 860 | 860 | $output .= $prevlong.', '; |
@@ -895,26 +895,26 @@ discard block |
||
| 895 | 895 | $output .= ']'; |
| 896 | 896 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 897 | 897 | if (isset($begindateinitial)) { |
| 898 | - $output = str_replace('%minitime%',date("c",$begindateinitial),$output); |
|
| 899 | - } elseif ((time()-$globalLiveInterval) > $minitime) { |
|
| 900 | - if (time()-$globalLiveInterval > $maxitime) { |
|
| 901 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
| 898 | + $output = str_replace('%minitime%', date("c", $begindateinitial), $output); |
|
| 899 | + } elseif ((time() - $globalLiveInterval) > $minitime) { |
|
| 900 | + if (time() - $globalLiveInterval > $maxitime) { |
|
| 901 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
| 902 | 902 | } else { |
| 903 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
| 903 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
| 904 | 904 | } |
| 905 | 905 | } |
| 906 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 906 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 907 | 907 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
| 908 | - $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
|
| 908 | + $output = str_replace('%minitime%', date("c", $minitracktime), $output); |
|
| 909 | 909 | } else { |
| 910 | - $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 910 | + $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 911 | 911 | } |
| 912 | 912 | if (isset($enddateinitial)) { |
| 913 | - $output = str_replace('%maxitime%',date("c",$enddateinitial),$output); |
|
| 913 | + $output = str_replace('%maxitime%', date("c", $enddateinitial), $output); |
|
| 914 | 914 | } else { |
| 915 | - $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
| 915 | + $output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
| 916 | 916 | } |
| 917 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
| 918 | -else $output = str_replace('%gltf2%','false',$output); |
|
| 917 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
| 918 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
| 919 | 919 | print $output; |
| 920 | 920 | ?> |
@@ -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,13 +284,13 @@ 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 ( |
|
| 287 | + $query = "SELECT * FROM ( |
|
| 288 | 288 | 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 |
| 289 | 289 | FROM spotter_archive |
| 290 | 290 | INNER JOIN ( |
| 291 | 291 | SELECT flightaware_id |
| 292 | 292 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date"; |
| 293 | - $query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 293 | + $query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 294 | 294 | if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 295 | 295 | if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
| 296 | 296 | $query .= "UNION |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | try { |
| 317 | 317 | $sth = $this->db->prepare($query); |
| 318 | 318 | $sth->execute($query_values); |
| 319 | - } catch(PDOException $e) { |
|
| 319 | + } catch (PDOException $e) { |
|
| 320 | 320 | echo $e->getMessage(); |
| 321 | 321 | die; |
| 322 | 322 | } |
@@ -330,12 +330,12 @@ discard block |
||
| 330 | 330 | * @return Array the spotter information |
| 331 | 331 | * |
| 332 | 332 | */ |
| 333 | - public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = false) |
|
| 333 | + public function getMinLastLiveSpotterDataByID($id = '', $filter = array(), $limit = false) |
|
| 334 | 334 | { |
| 335 | 335 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
| 336 | 336 | date_default_timezone_set('UTC'); |
| 337 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 338 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 337 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 338 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 339 | 339 | |
| 340 | 340 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
| 341 | 341 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -359,13 +359,13 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | } else { |
| 361 | 361 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 362 | - $query = "SELECT * FROM ( |
|
| 362 | + $query = "SELECT * FROM ( |
|
| 363 | 363 | 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 |
| 364 | 364 | FROM spotter_archive |
| 365 | 365 | INNER JOIN ( |
| 366 | 366 | SELECT flightaware_id |
| 367 | 367 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id"; |
| 368 | - $query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 368 | + $query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 369 | 369 | $query .= "UNION |
| 370 | 370 | 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 |
| 371 | 371 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id"; |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | try { |
| 386 | 386 | $sth = $this->db->prepare($query); |
| 387 | 387 | $sth->execute($query_values); |
| 388 | - } catch(PDOException $e) { |
|
| 388 | + } catch (PDOException $e) { |
|
| 389 | 389 | echo $e->getMessage(); |
| 390 | 390 | die; |
| 391 | 391 | } |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | public function getLiveSpotterCount($filter = array()) |
| 403 | 403 | { |
| 404 | 404 | global $globalDBdriver, $globalLiveInterval; |
| 405 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 405 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 406 | 406 | |
| 407 | 407 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 408 | 408 | if ($globalDBdriver == 'mysql') { |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | try { |
| 416 | 416 | $sth = $this->db->prepare($query); |
| 417 | 417 | $sth->execute(); |
| 418 | - } catch(PDOException $e) { |
|
| 418 | + } catch (PDOException $e) { |
|
| 419 | 419 | echo $e->getMessage(); |
| 420 | 420 | die; |
| 421 | 421 | } |
@@ -438,10 +438,10 @@ discard block |
||
| 438 | 438 | $filter_query = $this->getFilter($filter); |
| 439 | 439 | |
| 440 | 440 | if (is_array($coord)) { |
| 441 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 442 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 443 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 444 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 441 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 442 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 443 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 444 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 445 | 445 | } else return array(); |
| 446 | 446 | if ($globalDBdriver == 'mysql') { |
| 447 | 447 | $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; |
@@ -464,23 +464,23 @@ discard block |
||
| 464 | 464 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 465 | 465 | $Spotter = new Spotter($this->db); |
| 466 | 466 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 467 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 467 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 468 | 468 | |
| 469 | 469 | if (is_array($coord)) { |
| 470 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 471 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 472 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 473 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 470 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 471 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 472 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 473 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 474 | 474 | } else return array(); |
| 475 | 475 | if ($globalDBdriver == 'mysql') { |
| 476 | 476 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 477 | - $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 |
|
| 477 | + $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 |
|
| 478 | 478 | FROM spotter_live |
| 479 | 479 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
| 480 | 480 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
| 481 | 481 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC'; |
| 482 | 482 | } else { |
| 483 | - $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 |
|
| 483 | + $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 |
|
| 484 | 484 | FROM spotter_live |
| 485 | 485 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 486 | 486 | FROM spotter_live l |
@@ -492,14 +492,14 @@ discard block |
||
| 492 | 492 | } |
| 493 | 493 | } else { |
| 494 | 494 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 495 | - $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 |
|
| 495 | + $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 |
|
| 496 | 496 | FROM spotter_live |
| 497 | 497 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
| 498 | 498 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
| 499 | 499 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 500 | 500 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 501 | 501 | } else { |
| 502 | - $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 |
|
| 502 | + $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 |
|
| 503 | 503 | FROM spotter_live |
| 504 | 504 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 505 | 505 | FROM spotter_live l |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | try { |
| 515 | 515 | $sth = $this->db->prepare($query); |
| 516 | 516 | $sth->execute(); |
| 517 | - } catch(PDOException $e) { |
|
| 517 | + } catch (PDOException $e) { |
|
| 518 | 518 | echo $e->getMessage(); |
| 519 | 519 | die; |
| 520 | 520 | } |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | if ($interval == '1m') |
| 564 | 564 | { |
| 565 | 565 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 566 | - } else if ($interval == '15m'){ |
|
| 566 | + } else if ($interval == '15m') { |
|
| 567 | 567 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
| 568 | 568 | } |
| 569 | 569 | } |
@@ -571,14 +571,14 @@ discard block |
||
| 571 | 571 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | - $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 |
|
| 574 | + $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 |
|
| 575 | 575 | WHERE spotter_live.latitude <> '' |
| 576 | 576 | AND spotter_live.longitude <> '' |
| 577 | 577 | ".$additional_query." |
| 578 | 578 | HAVING distance < :radius |
| 579 | 579 | ORDER BY distance"; |
| 580 | 580 | |
| 581 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 581 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 582 | 582 | |
| 583 | 583 | return $spotter_array; |
| 584 | 584 | } |
@@ -596,9 +596,9 @@ discard block |
||
| 596 | 596 | date_default_timezone_set('UTC'); |
| 597 | 597 | |
| 598 | 598 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 599 | - $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'; |
|
| 599 | + $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'; |
|
| 600 | 600 | |
| 601 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 601 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 602 | 602 | |
| 603 | 603 | return $spotter_array; |
| 604 | 604 | } |
@@ -609,16 +609,16 @@ discard block |
||
| 609 | 609 | * @return Array the spotter information |
| 610 | 610 | * |
| 611 | 611 | */ |
| 612 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
| 612 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
| 613 | 613 | { |
| 614 | 614 | $Spotter = new Spotter($this->db); |
| 615 | 615 | date_default_timezone_set('UTC'); |
| 616 | 616 | |
| 617 | 617 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 618 | - $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'; |
|
| 618 | + $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'; |
|
| 619 | 619 | |
| 620 | - $date = date('c',$date); |
|
| 621 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 620 | + $date = date('c', $date); |
|
| 621 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 622 | 622 | |
| 623 | 623 | return $spotter_array; |
| 624 | 624 | } |
@@ -634,8 +634,8 @@ discard block |
||
| 634 | 634 | $Spotter = new Spotter($this->db); |
| 635 | 635 | date_default_timezone_set('UTC'); |
| 636 | 636 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 637 | - $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'; |
|
| 638 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 637 | + $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'; |
|
| 638 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 639 | 639 | return $spotter_array; |
| 640 | 640 | } |
| 641 | 641 | |
@@ -645,15 +645,15 @@ discard block |
||
| 645 | 645 | * @return Array the spotter information |
| 646 | 646 | * |
| 647 | 647 | */ |
| 648 | - public function getDateLiveSpotterDataById($id,$date) |
|
| 648 | + public function getDateLiveSpotterDataById($id, $date) |
|
| 649 | 649 | { |
| 650 | 650 | $Spotter = new Spotter($this->db); |
| 651 | 651 | date_default_timezone_set('UTC'); |
| 652 | 652 | |
| 653 | 653 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 654 | - $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'; |
|
| 655 | - $date = date('c',$date); |
|
| 656 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 654 | + $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'; |
|
| 655 | + $date = date('c', $date); |
|
| 656 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 657 | 657 | return $spotter_array; |
| 658 | 658 | } |
| 659 | 659 | |
@@ -669,13 +669,13 @@ discard block |
||
| 669 | 669 | date_default_timezone_set('UTC'); |
| 670 | 670 | |
| 671 | 671 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 672 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 672 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 673 | 673 | |
| 674 | 674 | try { |
| 675 | 675 | |
| 676 | 676 | $sth = $this->db->prepare($query); |
| 677 | 677 | $sth->execute(array(':ident' => $ident)); |
| 678 | - } catch(PDOException $e) { |
|
| 678 | + } catch (PDOException $e) { |
|
| 679 | 679 | echo $e->getMessage(); |
| 680 | 680 | die; |
| 681 | 681 | } |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | * @return Array the spotter information |
| 691 | 691 | * |
| 692 | 692 | */ |
| 693 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
| 693 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
| 694 | 694 | { |
| 695 | 695 | global $globalDBdriver, $globalLiveInterval; |
| 696 | 696 | date_default_timezone_set('UTC'); |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | try { |
| 710 | 710 | $sth = $this->db->prepare($query); |
| 711 | 711 | $sth->execute(array(':id' => $id)); |
| 712 | - } catch(PDOException $e) { |
|
| 712 | + } catch (PDOException $e) { |
|
| 713 | 713 | echo $e->getMessage(); |
| 714 | 714 | die; |
| 715 | 715 | } |
@@ -727,12 +727,12 @@ discard block |
||
| 727 | 727 | { |
| 728 | 728 | date_default_timezone_set('UTC'); |
| 729 | 729 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 730 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 730 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 731 | 731 | try { |
| 732 | 732 | |
| 733 | 733 | $sth = $this->db->prepare($query); |
| 734 | 734 | $sth->execute(array(':ident' => $ident)); |
| 735 | - } catch(PDOException $e) { |
|
| 735 | + } catch (PDOException $e) { |
|
| 736 | 736 | echo $e->getMessage(); |
| 737 | 737 | die; |
| 738 | 738 | } |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | |
| 763 | 763 | $sth = $this->db->prepare($query); |
| 764 | 764 | $sth->execute(); |
| 765 | - } catch(PDOException $e) { |
|
| 765 | + } catch (PDOException $e) { |
|
| 766 | 766 | return "error"; |
| 767 | 767 | } |
| 768 | 768 | |
@@ -785,14 +785,14 @@ discard block |
||
| 785 | 785 | |
| 786 | 786 | $sth = $this->db->prepare($query); |
| 787 | 787 | $sth->execute(); |
| 788 | - } catch(PDOException $e) { |
|
| 788 | + } catch (PDOException $e) { |
|
| 789 | 789 | return "error"; |
| 790 | 790 | } |
| 791 | 791 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 792 | 792 | $i = 0; |
| 793 | - $j =0; |
|
| 793 | + $j = 0; |
|
| 794 | 794 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 795 | - foreach($all as $row) |
|
| 795 | + foreach ($all as $row) |
|
| 796 | 796 | { |
| 797 | 797 | $i++; |
| 798 | 798 | $j++; |
@@ -800,9 +800,9 @@ discard block |
||
| 800 | 800 | if ($globalDebug) echo "."; |
| 801 | 801 | try { |
| 802 | 802 | |
| 803 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 803 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 804 | 804 | $sth->execute(); |
| 805 | - } catch(PDOException $e) { |
|
| 805 | + } catch (PDOException $e) { |
|
| 806 | 806 | return "error"; |
| 807 | 807 | } |
| 808 | 808 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -813,9 +813,9 @@ discard block |
||
| 813 | 813 | if ($i > 0) { |
| 814 | 814 | try { |
| 815 | 815 | |
| 816 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 816 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 817 | 817 | $sth->execute(); |
| 818 | - } catch(PDOException $e) { |
|
| 818 | + } catch (PDOException $e) { |
|
| 819 | 819 | return "error"; |
| 820 | 820 | } |
| 821 | 821 | } |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | |
| 829 | 829 | $sth = $this->db->prepare($query); |
| 830 | 830 | $sth->execute(); |
| 831 | - } catch(PDOException $e) { |
|
| 831 | + } catch (PDOException $e) { |
|
| 832 | 832 | return "error"; |
| 833 | 833 | } |
| 834 | 834 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -876,13 +876,13 @@ discard block |
||
| 876 | 876 | public function deleteLiveSpotterDataByIdent($ident) |
| 877 | 877 | { |
| 878 | 878 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 879 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 879 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 880 | 880 | |
| 881 | 881 | try { |
| 882 | 882 | |
| 883 | 883 | $sth = $this->db->prepare($query); |
| 884 | 884 | $sth->execute(array(':ident' => $ident)); |
| 885 | - } catch(PDOException $e) { |
|
| 885 | + } catch (PDOException $e) { |
|
| 886 | 886 | return "error"; |
| 887 | 887 | } |
| 888 | 888 | |
@@ -898,13 +898,13 @@ discard block |
||
| 898 | 898 | public function deleteLiveSpotterDataById($id) |
| 899 | 899 | { |
| 900 | 900 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 901 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 901 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 902 | 902 | |
| 903 | 903 | try { |
| 904 | 904 | |
| 905 | 905 | $sth = $this->db->prepare($query); |
| 906 | 906 | $sth->execute(array(':id' => $id)); |
| 907 | - } catch(PDOException $e) { |
|
| 907 | + } catch (PDOException $e) { |
|
| 908 | 908 | return "error"; |
| 909 | 909 | } |
| 910 | 910 | |
@@ -922,13 +922,13 @@ discard block |
||
| 922 | 922 | { |
| 923 | 923 | global $globalDBdriver, $globalTimezone; |
| 924 | 924 | if ($globalDBdriver == 'mysql') { |
| 925 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 925 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 926 | 926 | WHERE spotter_live.ident = :ident |
| 927 | 927 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 928 | 928 | AND spotter_live.date < UTC_TIMESTAMP()'; |
| 929 | 929 | $query_data = array(':ident' => $ident); |
| 930 | 930 | } else { |
| 931 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 931 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 932 | 932 | WHERE spotter_live.ident = :ident |
| 933 | 933 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 934 | 934 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -937,8 +937,8 @@ discard block |
||
| 937 | 937 | |
| 938 | 938 | $sth = $this->db->prepare($query); |
| 939 | 939 | $sth->execute($query_data); |
| 940 | - $ident_result=''; |
|
| 941 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 940 | + $ident_result = ''; |
|
| 941 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 942 | 942 | { |
| 943 | 943 | $ident_result = $row['ident']; |
| 944 | 944 | } |
@@ -955,13 +955,13 @@ discard block |
||
| 955 | 955 | { |
| 956 | 956 | global $globalDBdriver, $globalTimezone; |
| 957 | 957 | if ($globalDBdriver == 'mysql') { |
| 958 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 958 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 959 | 959 | WHERE spotter_live.ident = :ident |
| 960 | 960 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 961 | 961 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 962 | 962 | $query_data = array(':ident' => $ident); |
| 963 | 963 | } else { |
| 964 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 964 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 965 | 965 | WHERE spotter_live.ident = :ident |
| 966 | 966 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'"; |
| 967 | 967 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -970,8 +970,8 @@ discard block |
||
| 970 | 970 | |
| 971 | 971 | $sth = $this->db->prepare($query); |
| 972 | 972 | $sth->execute($query_data); |
| 973 | - $ident_result=''; |
|
| 974 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 973 | + $ident_result = ''; |
|
| 974 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 975 | 975 | { |
| 976 | 976 | $ident_result = $row['flightaware_id']; |
| 977 | 977 | } |
@@ -988,13 +988,13 @@ discard block |
||
| 988 | 988 | { |
| 989 | 989 | global $globalDBdriver, $globalTimezone; |
| 990 | 990 | if ($globalDBdriver == 'mysql') { |
| 991 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 991 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 992 | 992 | WHERE spotter_live.flightaware_id = :id |
| 993 | 993 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 994 | 994 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 995 | 995 | $query_data = array(':id' => $id); |
| 996 | 996 | } else { |
| 997 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 997 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 998 | 998 | WHERE spotter_live.flightaware_id = :id |
| 999 | 999 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 1000 | 1000 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1003,8 +1003,8 @@ discard block |
||
| 1003 | 1003 | |
| 1004 | 1004 | $sth = $this->db->prepare($query); |
| 1005 | 1005 | $sth->execute($query_data); |
| 1006 | - $ident_result=''; |
|
| 1007 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1006 | + $ident_result = ''; |
|
| 1007 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1008 | 1008 | { |
| 1009 | 1009 | $ident_result = $row['flightaware_id']; |
| 1010 | 1010 | } |
@@ -1021,13 +1021,13 @@ discard block |
||
| 1021 | 1021 | { |
| 1022 | 1022 | global $globalDBdriver, $globalTimezone; |
| 1023 | 1023 | if ($globalDBdriver == 'mysql') { |
| 1024 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1024 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1025 | 1025 | WHERE spotter_live.ModeS = :modes |
| 1026 | 1026 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 1027 | 1027 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1028 | 1028 | $query_data = array(':modes' => $modes); |
| 1029 | 1029 | } else { |
| 1030 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1030 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1031 | 1031 | WHERE spotter_live.ModeS = :modes |
| 1032 | 1032 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'"; |
| 1033 | 1033 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -1036,8 +1036,8 @@ discard block |
||
| 1036 | 1036 | |
| 1037 | 1037 | $sth = $this->db->prepare($query); |
| 1038 | 1038 | $sth->execute($query_data); |
| 1039 | - $ident_result=''; |
|
| 1040 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1039 | + $ident_result = ''; |
|
| 1040 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1041 | 1041 | { |
| 1042 | 1042 | //$ident_result = $row['spotter_live_id']; |
| 1043 | 1043 | $ident_result = $row['flightaware_id']; |
@@ -1062,8 +1062,8 @@ discard block |
||
| 1062 | 1062 | return array(); |
| 1063 | 1063 | } else { |
| 1064 | 1064 | $q_array = explode(" ", $q); |
| 1065 | - foreach ($q_array as $q_item){ |
|
| 1066 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 1065 | + foreach ($q_array as $q_item) { |
|
| 1066 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 1067 | 1067 | $additional_query .= " AND ("; |
| 1068 | 1068 | $additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR "; |
| 1069 | 1069 | $additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR "; |
@@ -1078,11 +1078,11 @@ discard block |
||
| 1078 | 1078 | } |
| 1079 | 1079 | } |
| 1080 | 1080 | if ($globalDBdriver == 'mysql') { |
| 1081 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1081 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1082 | 1082 | WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 1083 | 1083 | AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1084 | 1084 | } else { |
| 1085 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1085 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1086 | 1086 | WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 1087 | 1087 | AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 1088 | 1088 | } |
@@ -1102,7 +1102,7 @@ discard block |
||
| 1102 | 1102 | * @return String success or false |
| 1103 | 1103 | * |
| 1104 | 1104 | */ |
| 1105 | - 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 = '') |
|
| 1105 | + 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 = '') |
|
| 1106 | 1106 | { |
| 1107 | 1107 | global $globalURL, $globalArchive, $globalDebug; |
| 1108 | 1108 | $Common = new Common(); |
@@ -1202,27 +1202,27 @@ discard block |
||
| 1202 | 1202 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 1203 | 1203 | |
| 1204 | 1204 | |
| 1205 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 1206 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1207 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 1208 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1209 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1210 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1211 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1212 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 1213 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1214 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1215 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 1216 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1217 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 1218 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 1219 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 1220 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 1221 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 1222 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 1223 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 1224 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 1225 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 1205 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 1206 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1207 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 1208 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1209 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1210 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1211 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1212 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 1213 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1214 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1215 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 1216 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1217 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 1218 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 1219 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 1220 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 1221 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 1222 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 1223 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 1224 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 1225 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 1226 | 1226 | |
| 1227 | 1227 | $airline_name = ''; |
| 1228 | 1228 | $airline_icao = ''; |
@@ -1244,10 +1244,10 @@ discard block |
||
| 1244 | 1244 | $arrival_airport_country = ''; |
| 1245 | 1245 | |
| 1246 | 1246 | |
| 1247 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 1248 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 1249 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1250 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1247 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 1248 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 1249 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 1250 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 1251 | 1251 | |
| 1252 | 1252 | $query = ''; |
| 1253 | 1253 | if ($globalArchive) { |
@@ -1258,19 +1258,19 @@ discard block |
||
| 1258 | 1258 | $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) |
| 1259 | 1259 | 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)'; |
| 1260 | 1260 | |
| 1261 | - $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); |
|
| 1261 | + $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); |
|
| 1262 | 1262 | try { |
| 1263 | 1263 | |
| 1264 | 1264 | $sth = $this->db->prepare($query); |
| 1265 | 1265 | $sth->execute($query_values); |
| 1266 | 1266 | $sth->closeCursor(); |
| 1267 | - } catch(PDOException $e) { |
|
| 1267 | + } catch (PDOException $e) { |
|
| 1268 | 1268 | return "error : ".$e->getMessage(); |
| 1269 | 1269 | } |
| 1270 | 1270 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1271 | 1271 | if ($globalDebug) echo '(Add to SBS archive : '; |
| 1272 | 1272 | $SpotterArchive = new SpotterArchive($this->db); |
| 1273 | - $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); |
|
| 1273 | + $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); |
|
| 1274 | 1274 | if ($globalDebug) echo $result.')'; |
| 1275 | 1275 | } elseif ($globalDebug && $putinarchive !== true) { |
| 1276 | 1276 | echo '(Not adding to archive)'; |
@@ -1283,7 +1283,7 @@ discard block |
||
| 1283 | 1283 | |
| 1284 | 1284 | public function getOrderBy() |
| 1285 | 1285 | { |
| 1286 | - $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")); |
|
| 1286 | + $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")); |
|
| 1287 | 1287 | return $orderby; |
| 1288 | 1288 | } |
| 1289 | 1289 | |