@@ -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,8 +214,8 @@ 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 | } |
@@ -224,11 +224,11 @@ discard block |
||
| 224 | 224 | if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) { |
| 225 | 225 | //$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine'])); |
| 226 | 226 | //$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
| 227 | - $spotter_array = $MarineLive->getMinLastLiveMarineDataByID($_COOKIE['MapTrackMarine'],$filter,false); |
|
| 227 | + $spotter_array = $MarineLive->getMinLastLiveMarineDataByID($_COOKIE['MapTrackMarine'], $filter, false); |
|
| 228 | 228 | } elseif (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '' && !empty($coord)) { |
| 229 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false,$_COOKIE['MapTrack']); |
|
| 229 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false, $_COOKIE['MapTrack']); |
|
| 230 | 230 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
| 231 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
|
| 231 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false); |
|
| 232 | 232 | } else { |
| 233 | 233 | $spotter_array = array(); |
| 234 | 234 | } |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | } else { |
| 237 | 237 | $coord = array(); |
| 238 | 238 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
| 239 | - $coord = explode(',',$_GET['coord']); |
|
| 240 | - 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) |
|
| 239 | + $coord = explode(',', $_GET['coord']); |
|
| 240 | + 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) |
|
| 241 | 241 | && $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)) { |
| 242 | 242 | $coord = array(); |
| 243 | 243 | } |
@@ -245,14 +245,14 @@ discard block |
||
| 245 | 245 | $previous_filter = $filter; |
| 246 | 246 | if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
| 247 | 247 | //$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
| 248 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false); |
|
| 248 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'], $filter, false); |
|
| 249 | 249 | //$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false); |
| 250 | 250 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '') { |
| 251 | 251 | //$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false); |
| 252 | 252 | //if (empty($spotter_array)) $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']); |
| 253 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']); |
|
| 253 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false, $_COOKIE['MapTrack']); |
|
| 254 | 254 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
| 255 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false); |
|
| 255 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false); |
|
| 256 | 256 | } else { |
| 257 | 257 | $spotter_array = array(); |
| 258 | 258 | } |
@@ -262,19 +262,19 @@ discard block |
||
| 262 | 262 | if (!empty($spotter_array) && isset($coord)) { |
| 263 | 263 | if ($tracker) { |
| 264 | 264 | if (isset($_GET['archive'])) { |
| 265 | - $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter); |
|
| 265 | + $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate, $enddate, $filter); |
|
| 266 | 266 | } else { |
| 267 | 267 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
| 268 | 268 | } |
| 269 | 269 | } elseif ($marine) { |
| 270 | 270 | if (isset($_GET['archive'])) { |
| 271 | - $flightcnt = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter); |
|
| 271 | + $flightcnt = $MarineArchive->getLiveMarineCount($begindate, $enddate, $filter); |
|
| 272 | 272 | } else { |
| 273 | 273 | $flightcnt = $MarineLive->getLiveMarineCount($filter); |
| 274 | 274 | } |
| 275 | 275 | } else { |
| 276 | 276 | if (isset($_GET['archive'])) { |
| 277 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 277 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 278 | 278 | } else { |
| 279 | 279 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 280 | 280 | } |
@@ -282,17 +282,17 @@ discard block |
||
| 282 | 282 | if ($flightcnt == '') $flightcnt = 0; |
| 283 | 283 | } else $flightcnt = 0; |
| 284 | 284 | |
| 285 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 285 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 286 | 286 | $minitime = time(); |
| 287 | 287 | $minitracktime_begin = time(); |
| 288 | 288 | $minitracktime = $minitracktime_begin; |
| 289 | 289 | $maxitime = 0; |
| 290 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
| 290 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
| 291 | 291 | $modelsdb = array(); |
| 292 | 292 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
| 293 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
| 294 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
| 295 | - if (isset($row[1]) ){ |
|
| 293 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
| 294 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
| 295 | + if (isset($row[1])) { |
|
| 296 | 296 | $model = $row[0]; |
| 297 | 297 | $modelsdb[$model] = $row[1]; |
| 298 | 298 | } |
@@ -302,9 +302,9 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | $modelsdb2 = array(); |
| 304 | 304 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
| 305 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
| 306 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
| 307 | - if (isset($row[1]) ){ |
|
| 305 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
| 306 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
| 307 | + if (isset($row[1])) { |
|
| 308 | 308 | $model = $row[0]; |
| 309 | 309 | $glb = $row[1]; |
| 310 | 310 | if (isset($row[2])) { |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 351 | 351 | { |
| 352 | 352 | $nblatlong = 0; |
| 353 | - foreach($spotter_array as $spotter_item) |
|
| 353 | + foreach ($spotter_array as $spotter_item) |
|
| 354 | 354 | { |
| 355 | 355 | $j++; |
| 356 | 356 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -404,16 +404,16 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
| 406 | 406 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
| 407 | - if (isset($spotter_item['ident'])) $output.= '"ident": '.json_encode($spotter_item['ident']).','; |
|
| 407 | + if (isset($spotter_item['ident'])) $output .= '"ident": '.json_encode($spotter_item['ident']).','; |
|
| 408 | 408 | if ($tracker) { |
| 409 | 409 | if (isset($spotter_item['type'])) $output .= '"tracker_type": '.json_encode($spotter_item['type']).','; |
| 410 | - $output.= '"type": "tracker"'; |
|
| 410 | + $output .= '"type": "tracker"'; |
|
| 411 | 411 | } elseif ($marine) { |
| 412 | 412 | if (isset($spotter_item['type'])) $output .= '"marine_type": '.json_encode($spotter_item['type']).','; |
| 413 | 413 | if (isset($spotter_item['captain_name'])) $output .= '"captain": '.json_encode($spotter_item['captain_name']).','; |
| 414 | 414 | if (isset($spotter_item['race_name'])) $output .= '"race": '.json_encode($spotter_item['race_name']).','; |
| 415 | 415 | if (isset($spotter_item['race_rank'])) $output .= '"rank": "'.$spotter_item['race_rank'].'",'; |
| 416 | - $output.= '"type": "marine"'; |
|
| 416 | + $output .= '"type": "marine"'; |
|
| 417 | 417 | } else { |
| 418 | 418 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
| 419 | 419 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -427,14 +427,14 @@ discard block |
||
| 427 | 427 | if (isset($airline_icao)) { |
| 428 | 428 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
| 429 | 429 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
| 430 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
| 430 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | //if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
| 435 | 435 | } |
| 436 | - $output.= '"gltf2": %gltf2%,'; |
|
| 437 | - $output.= '"type": "flight"'; |
|
| 436 | + $output .= '"gltf2": %gltf2%,'; |
|
| 437 | + $output .= '"type": "flight"'; |
|
| 438 | 438 | } |
| 439 | 439 | $output .= '},'; |
| 440 | 440 | |
@@ -809,8 +809,8 @@ discard block |
||
| 809 | 809 | $output .= '},'; |
| 810 | 810 | } |
| 811 | 811 | } |
| 812 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
| 813 | - else $output = str_replace('%onground%','false',$output); |
|
| 812 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
| 813 | + else $output = str_replace('%onground%', 'false', $output); |
|
| 814 | 814 | |
| 815 | 815 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
| 816 | 816 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
| 827 | 827 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
| 828 | 828 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 829 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 829 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 830 | 830 | $output .= $spotter_item['longitude'].', '; |
| 831 | 831 | $output .= $spotter_item['latitude']; |
| 832 | 832 | $prevlong = $spotter_item['longitude']; |
@@ -854,8 +854,8 @@ discard block |
||
| 854 | 854 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
| 855 | 855 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
| 856 | 856 | } else { |
| 857 | - $nblatlong = $nblatlong+1; |
|
| 858 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 857 | + $nblatlong = $nblatlong + 1; |
|
| 858 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 859 | 859 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 860 | 860 | if ($spotter_item['ground_speed'] == 0) { |
| 861 | 861 | $output .= $prevlong.', '; |
@@ -896,26 +896,26 @@ discard block |
||
| 896 | 896 | $output .= ']'; |
| 897 | 897 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 898 | 898 | if (isset($begindateinitial)) { |
| 899 | - $output = str_replace('%minitime%',date("c",$begindateinitial),$output); |
|
| 900 | - } elseif ((time()-$globalLiveInterval) > $minitime) { |
|
| 901 | - if (time()-$globalLiveInterval > $maxitime) { |
|
| 902 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
| 899 | + $output = str_replace('%minitime%', date("c", $begindateinitial), $output); |
|
| 900 | + } elseif ((time() - $globalLiveInterval) > $minitime) { |
|
| 901 | + if (time() - $globalLiveInterval > $maxitime) { |
|
| 902 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
| 903 | 903 | } else { |
| 904 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
| 904 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
| 905 | 905 | } |
| 906 | 906 | } |
| 907 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 907 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 908 | 908 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
| 909 | - $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
|
| 909 | + $output = str_replace('%minitime%', date("c", $minitracktime), $output); |
|
| 910 | 910 | } else { |
| 911 | - $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 911 | + $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 912 | 912 | } |
| 913 | 913 | if (isset($enddateinitial)) { |
| 914 | - $output = str_replace('%maxitime%',date("c",$enddateinitial),$output); |
|
| 914 | + $output = str_replace('%maxitime%', date("c", $enddateinitial), $output); |
|
| 915 | 915 | } else { |
| 916 | - $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
| 916 | + $output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
| 917 | 917 | } |
| 918 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
| 919 | -else $output = str_replace('%gltf2%','false',$output); |
|
| 918 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
| 919 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
| 920 | 920 | print $output; |
| 921 | 921 | ?> |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
| 23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
| 24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
| 25 | -$title="Install"; |
|
| 25 | +$title = "Install"; |
|
| 26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
| 27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
| 28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | if (!extension_loaded('curl')) { |
| 94 | 94 | $error[] = "Curl is not loaded."; |
| 95 | 95 | } |
| 96 | - if(function_exists('apache_get_modules') ){ |
|
| 97 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
| 96 | + if (function_exists('apache_get_modules')) { |
|
| 97 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
| 98 | 98 | $error[] = "mod_rewrite is not available."; |
| 99 | 99 | } |
| 100 | 100 | /* |
@@ -113,22 +113,22 @@ discard block |
||
| 113 | 113 | $alllng = $Language->listLocaleDir(); |
| 114 | 114 | if (count($alllng) != count($availablelng)) { |
| 115 | 115 | $notavailable = array(); |
| 116 | - foreach($alllng as $lng) { |
|
| 116 | + foreach ($alllng as $lng) { |
|
| 117 | 117 | if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
| 118 | 118 | } |
| 119 | - print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
| 119 | + print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>'; |
| 123 | 123 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
| 124 | 124 | if (function_exists('get_headers')) { |
| 125 | 125 | //$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
| 126 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
| 127 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
| 126 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
| 127 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
| 128 | 128 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
| 129 | 129 | } else { |
| 130 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
| 131 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
| 130 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
| 131 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
| 132 | 132 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
| 209 | 209 | if (isset($_SERVER['REQUEST_URI'])) { |
| 210 | 210 | $URL = $_SERVER['REQUEST_URI']; |
| 211 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
| 211 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | ?> |
@@ -549,13 +549,13 @@ discard block |
||
| 549 | 549 | ?> |
| 550 | 550 | <tr> |
| 551 | 551 | <?php |
| 552 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
| 552 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
| 553 | 553 | ?> |
| 554 | 554 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 555 | 555 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
| 556 | 556 | <?php |
| 557 | 557 | } else { |
| 558 | - $hostport = explode(':',$source['host']); |
|
| 558 | + $hostport = explode(':', $source['host']); |
|
| 559 | 559 | if (isset($hostport[1])) { |
| 560 | 560 | $host = $hostport[0]; |
| 561 | 561 | $port = $hostport[1]; |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | <select name="timezones[]" id="timezones"> |
| 607 | 607 | <?php |
| 608 | 608 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
| 609 | - foreach($timezonelist as $timezones){ |
|
| 609 | + foreach ($timezonelist as $timezones) { |
|
| 610 | 610 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
| 611 | 611 | print '<option selected>'.$timezones.'</option>'; |
| 612 | 612 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | <select name="timezones[]" id="timezones"> |
| 663 | 663 | <?php |
| 664 | 664 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
| 665 | - foreach($timezonelist as $timezones){ |
|
| 665 | + foreach ($timezonelist as $timezones) { |
|
| 666 | 666 | if ($timezones == 'UTC') { |
| 667 | 667 | print '<option selected>'.$timezones.'</option>'; |
| 668 | 668 | } else print '<option>'.$timezones.'</option>'; |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | <br /> |
| 1137 | 1137 | <p> |
| 1138 | 1138 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 1139 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1139 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
| 1140 | 1140 | </p> |
| 1141 | 1141 | <br /> |
| 1142 | 1142 | <p> |
@@ -1219,14 +1219,14 @@ discard block |
||
| 1219 | 1219 | $error = ''; |
| 1220 | 1220 | |
| 1221 | 1221 | if (isset($_POST['dbtype'])) { |
| 1222 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
| 1223 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
| 1224 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
| 1225 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
| 1226 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
| 1227 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
| 1228 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
| 1229 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
| 1222 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
| 1223 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
| 1224 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
| 1225 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
| 1226 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
| 1227 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
| 1228 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
| 1229 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
| 1230 | 1230 | |
| 1231 | 1231 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
| 1232 | 1232 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1246,59 +1246,59 @@ discard block |
||
| 1246 | 1246 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
| 1247 | 1247 | */ |
| 1248 | 1248 | |
| 1249 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
| 1249 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
| 1250 | 1250 | |
| 1251 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
| 1252 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
| 1253 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
| 1254 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
| 1255 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
| 1251 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
| 1252 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
| 1253 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
| 1254 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
| 1255 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
| 1256 | 1256 | |
| 1257 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
| 1258 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
| 1259 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
| 1260 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
| 1261 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
| 1262 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
| 1263 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
| 1264 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
| 1265 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
| 1266 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
| 1257 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
| 1258 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
| 1259 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
| 1260 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
| 1261 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
| 1262 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
| 1263 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
| 1264 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
| 1265 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
| 1266 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
| 1267 | 1267 | |
| 1268 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
| 1269 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
| 1270 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
| 1271 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
| 1272 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 1273 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
| 1268 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
| 1269 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
| 1270 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
| 1271 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
| 1272 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 1273 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
| 1274 | 1274 | |
| 1275 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
| 1276 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
| 1275 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
| 1276 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
| 1277 | 1277 | |
| 1278 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
| 1279 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
| 1280 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
| 1278 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
| 1279 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
| 1280 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
| 1281 | 1281 | |
| 1282 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
| 1282 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
| 1283 | 1283 | if ($acars == 'acars') { |
| 1284 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
| 1284 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
| 1285 | 1285 | } else { |
| 1286 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
| 1286 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
| 1287 | 1287 | } |
| 1288 | - $updatecheck = filter_input(INPUT_POST,'updatecheck',FILTER_SANITIZE_STRING); |
|
| 1288 | + $updatecheck = filter_input(INPUT_POST, 'updatecheck', FILTER_SANITIZE_STRING); |
|
| 1289 | 1289 | if ($updatecheck == 'updatecheck') { |
| 1290 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'TRUE')); |
|
| 1290 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'TRUE')); |
|
| 1291 | 1291 | } else { |
| 1292 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'FALSE')); |
|
| 1292 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'FALSE')); |
|
| 1293 | 1293 | } |
| 1294 | 1294 | |
| 1295 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
| 1296 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
| 1297 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 1295 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
| 1296 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
| 1297 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 1298 | 1298 | |
| 1299 | - $sailawayemail = filter_input(INPUT_POST,'sailawayemail',FILTER_SANITIZE_STRING); |
|
| 1300 | - $sailawaypass = filter_input(INPUT_POST,'sailawaypassword',FILTER_SANITIZE_STRING); |
|
| 1301 | - $settings = array_merge($settings,array('globalSailaway' => array('email' => $sailawayemail,'password' => $sailawaypass))); |
|
| 1299 | + $sailawayemail = filter_input(INPUT_POST, 'sailawayemail', FILTER_SANITIZE_STRING); |
|
| 1300 | + $sailawaypass = filter_input(INPUT_POST, 'sailawaypassword', FILTER_SANITIZE_STRING); |
|
| 1301 | + $settings = array_merge($settings, array('globalSailaway' => array('email' => $sailawayemail, 'password' => $sailawaypass))); |
|
| 1302 | 1302 | |
| 1303 | 1303 | $source_name = $_POST['source_name']; |
| 1304 | 1304 | $source_latitude = $_POST['source_latitude']; |
@@ -1312,8 +1312,8 @@ discard block |
||
| 1312 | 1312 | |
| 1313 | 1313 | $sources = array(); |
| 1314 | 1314 | foreach ($source_name as $keys => $name) { |
| 1315 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1316 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1315 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
| 1316 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
| 1317 | 1317 | } |
| 1318 | 1318 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
| 1319 | 1319 | |
@@ -1322,16 +1322,16 @@ discard block |
||
| 1322 | 1322 | $newstype = $_POST['newstype']; |
| 1323 | 1323 | |
| 1324 | 1324 | $newsfeeds = array(); |
| 1325 | - foreach($newsurl as $newskey => $url) { |
|
| 1325 | + foreach ($newsurl as $newskey => $url) { |
|
| 1326 | 1326 | if ($url != '') { |
| 1327 | 1327 | $type = $newstype[$newskey]; |
| 1328 | 1328 | $lng = $newslng[$newskey]; |
| 1329 | 1329 | if (isset($newsfeeds[$type][$lng])) { |
| 1330 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
| 1330 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url)); |
|
| 1331 | 1331 | } else $newsfeeds[$type][$lng] = array($url); |
| 1332 | 1332 | } |
| 1333 | 1333 | } |
| 1334 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
| 1334 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
| 1335 | 1335 | |
| 1336 | 1336 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
| 1337 | 1337 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1342,28 +1342,28 @@ discard block |
||
| 1342 | 1342 | $sbsurl = $_POST['sbsurl']; |
| 1343 | 1343 | */ |
| 1344 | 1344 | |
| 1345 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
| 1346 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
| 1347 | - $globalvm = filter_input(INPUT_POST,'globalvm',FILTER_SANITIZE_STRING); |
|
| 1348 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
| 1349 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
| 1350 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
| 1351 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
| 1352 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
| 1353 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
| 1345 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
| 1346 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
| 1347 | + $globalvm = filter_input(INPUT_POST, 'globalvm', FILTER_SANITIZE_STRING); |
|
| 1348 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
| 1349 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
| 1350 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
| 1351 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
| 1352 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
| 1353 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
| 1354 | 1354 | |
| 1355 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
| 1356 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1357 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1358 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
| 1359 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1360 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1361 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
| 1362 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1363 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1364 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
| 1365 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1366 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1355 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
| 1356 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
| 1357 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
| 1358 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
| 1359 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
| 1360 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
| 1361 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
| 1362 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
| 1363 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
| 1364 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
| 1365 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
| 1366 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
| 1367 | 1367 | |
| 1368 | 1368 | /* |
| 1369 | 1369 | $globalSBS1Hosts = array(); |
@@ -1379,7 +1379,7 @@ discard block |
||
| 1379 | 1379 | } |
| 1380 | 1380 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
| 1381 | 1381 | */ |
| 1382 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
| 1382 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
| 1383 | 1383 | $host = $_POST['host']; |
| 1384 | 1384 | $port = $_POST['port']; |
| 1385 | 1385 | $name = $_POST['name']; |
@@ -1396,115 +1396,115 @@ discard block |
||
| 1396 | 1396 | else $cov = 'FALSE'; |
| 1397 | 1397 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
| 1398 | 1398 | else $arch = 'FALSE'; |
| 1399 | - if (strpos($format[$key],'_callback')) { |
|
| 1400 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
| 1399 | + if (strpos($format[$key], '_callback')) { |
|
| 1400 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
| 1401 | 1401 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
| 1402 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
| 1402 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
| 1403 | 1403 | } |
| 1404 | 1404 | if ($format[$key] == 'airwhere') $forcepilots = true; |
| 1405 | 1405 | } |
| 1406 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
| 1406 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
| 1407 | 1407 | |
| 1408 | 1408 | /* |
| 1409 | 1409 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
| 1410 | 1410 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
| 1411 | 1411 | */ |
| 1412 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
| 1413 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
| 1414 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
| 1412 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
| 1413 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
| 1414 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
| 1415 | 1415 | |
| 1416 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
| 1417 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
| 1416 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
| 1417 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
| 1418 | 1418 | |
| 1419 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
| 1420 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
| 1419 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
| 1420 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
| 1421 | 1421 | |
| 1422 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
| 1423 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
| 1422 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
| 1423 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
| 1424 | 1424 | |
| 1425 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
| 1426 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
| 1427 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
| 1428 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
| 1425 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
| 1426 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
| 1427 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
| 1428 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
| 1429 | 1429 | |
| 1430 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
| 1431 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
| 1432 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
| 1430 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
| 1431 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
| 1432 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
| 1433 | 1433 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1434 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
| 1435 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1434 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
| 1435 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
| 1436 | 1436 | |
| 1437 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 1438 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
| 1439 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 1440 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
| 1441 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
| 1442 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
| 1443 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
| 1444 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
| 1445 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
| 1446 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
| 1437 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 1438 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
| 1439 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 1440 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
| 1441 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
| 1442 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
| 1443 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
| 1444 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
| 1445 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
| 1446 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
| 1447 | 1447 | |
| 1448 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
| 1449 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
| 1448 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
| 1449 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
| 1450 | 1450 | |
| 1451 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1452 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
| 1451 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1452 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
| 1453 | 1453 | |
| 1454 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
| 1454 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
| 1455 | 1455 | if ($archiveyear == "archiveyear") { |
| 1456 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
| 1456 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
| 1457 | 1457 | } else { |
| 1458 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
| 1458 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
| 1459 | 1459 | } |
| 1460 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1461 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1462 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1463 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1460 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1461 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1462 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1463 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1464 | 1464 | |
| 1465 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
| 1466 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1467 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
| 1468 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
| 1465 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
| 1466 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1467 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
| 1468 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
| 1469 | 1469 | |
| 1470 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
| 1471 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
| 1472 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
| 1470 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
| 1471 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
| 1472 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
| 1473 | 1473 | |
| 1474 | 1474 | // Create in settings.php keys not yet configurable if not already here |
| 1475 | 1475 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1476 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1476 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
| 1477 | 1477 | |
| 1478 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
| 1478 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
| 1479 | 1479 | if ($resetyearstats == 'resetyearstats') { |
| 1480 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
| 1480 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
| 1481 | 1481 | } else { |
| 1482 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
| 1482 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
| 1483 | 1483 | } |
| 1484 | 1484 | |
| 1485 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
| 1485 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
| 1486 | 1486 | if ($archive == 'archive') { |
| 1487 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
| 1487 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
| 1488 | 1488 | } else { |
| 1489 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
| 1489 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
| 1490 | 1490 | } |
| 1491 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
| 1491 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
| 1492 | 1492 | if ($archiveresults == 'archiveresults') { |
| 1493 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
| 1493 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
| 1494 | 1494 | } else { |
| 1495 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
| 1495 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
| 1496 | 1496 | } |
| 1497 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
| 1497 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
| 1498 | 1498 | if ($daemon == 'daemon') { |
| 1499 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
| 1499 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
| 1500 | 1500 | } else { |
| 1501 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
| 1501 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
| 1502 | 1502 | } |
| 1503 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
| 1503 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
| 1504 | 1504 | if ($schedules == 'schedules') { |
| 1505 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
| 1505 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
| 1506 | 1506 | } else { |
| 1507 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
| 1507 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
| 1508 | 1508 | } |
| 1509 | 1509 | |
| 1510 | 1510 | /* |
@@ -1515,308 +1515,308 @@ discard block |
||
| 1515 | 1515 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
| 1516 | 1516 | } |
| 1517 | 1517 | */ |
| 1518 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
| 1519 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1520 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1521 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1522 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1518 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
| 1519 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
| 1520 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
| 1521 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
| 1522 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
| 1523 | 1523 | $va = false; |
| 1524 | 1524 | if ($globalivao == 'ivao') { |
| 1525 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
| 1525 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
| 1526 | 1526 | $va = true; |
| 1527 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1527 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
| 1528 | 1528 | if ($globalvatsim == 'vatsim') { |
| 1529 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
| 1529 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
| 1530 | 1530 | $va = true; |
| 1531 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1531 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
| 1532 | 1532 | if ($globalphpvms == 'phpvms') { |
| 1533 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
| 1533 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
| 1534 | 1534 | $va = true; |
| 1535 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1535 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
| 1536 | 1536 | if ($globalvam == 'vam') { |
| 1537 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
| 1537 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
| 1538 | 1538 | $va = true; |
| 1539 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1539 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
| 1540 | 1540 | if ($va) { |
| 1541 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
| 1542 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1541 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
| 1542 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
| 1543 | 1543 | if ($globalva == 'va' || $va) { |
| 1544 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
| 1545 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1544 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
| 1545 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
| 1546 | 1546 | } else { |
| 1547 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
| 1548 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1549 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1547 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
| 1548 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
| 1549 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
| 1550 | 1550 | } |
| 1551 | 1551 | if ($globalvm == 'vm') { |
| 1552 | - $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
|
| 1552 | + $settings = array_merge($settings, array('globalVM' => 'TRUE')); |
|
| 1553 | 1553 | } else { |
| 1554 | - $settings = array_merge($settings,array('globalVM' => 'FALSE')); |
|
| 1554 | + $settings = array_merge($settings, array('globalVM' => 'FALSE')); |
|
| 1555 | 1555 | } |
| 1556 | 1556 | |
| 1557 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
| 1557 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
| 1558 | 1558 | if ($mapoffline == 'mapoffline') { |
| 1559 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
| 1559 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
| 1560 | 1560 | } else { |
| 1561 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
| 1561 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
| 1562 | 1562 | } |
| 1563 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
| 1563 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
| 1564 | 1564 | if ($globaloffline == 'globaloffline') { |
| 1565 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
| 1565 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
| 1566 | 1566 | } else { |
| 1567 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
| 1567 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
| 1570 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
| 1571 | 1571 | if ($notam == 'notam') { |
| 1572 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
| 1572 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
| 1573 | 1573 | } else { |
| 1574 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
| 1574 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
| 1575 | 1575 | } |
| 1576 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
| 1576 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
| 1577 | 1577 | if ($owner == 'owner') { |
| 1578 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
| 1578 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
| 1579 | 1579 | } else { |
| 1580 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
| 1580 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
| 1581 | 1581 | } |
| 1582 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
| 1582 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
| 1583 | 1583 | if ($map3d == 'map3d') { |
| 1584 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
| 1584 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
| 1585 | 1585 | } else { |
| 1586 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
| 1586 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
| 1587 | 1587 | } |
| 1588 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
| 1588 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
| 1589 | 1589 | if ($crash == 'crash') { |
| 1590 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
| 1590 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
| 1591 | 1591 | } else { |
| 1592 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
| 1592 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
| 1593 | 1593 | } |
| 1594 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
| 1594 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
| 1595 | 1595 | if ($fires == 'fires') { |
| 1596 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
| 1596 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
| 1597 | 1597 | } else { |
| 1598 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
| 1598 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
| 1599 | 1599 | } |
| 1600 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
| 1600 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
| 1601 | 1601 | if ($firessupport == 'firessupport') { |
| 1602 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
| 1602 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
| 1603 | 1603 | } else { |
| 1604 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
| 1604 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
| 1605 | 1605 | } |
| 1606 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
| 1606 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
| 1607 | 1607 | if ($mapsatellites == 'mapsatellites') { |
| 1608 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
| 1608 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
| 1609 | 1609 | } else { |
| 1610 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
| 1610 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
| 1611 | 1611 | } |
| 1612 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
| 1612 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
| 1613 | 1613 | if ($map3ddefault == 'map3ddefault') { |
| 1614 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
| 1614 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
| 1615 | 1615 | } else { |
| 1616 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
| 1616 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
| 1617 | 1617 | } |
| 1618 | - $one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING); |
|
| 1618 | + $one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING); |
|
| 1619 | 1619 | if ($one3dmodel == 'one3dmodel') { |
| 1620 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE')); |
|
| 1620 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE')); |
|
| 1621 | 1621 | } else { |
| 1622 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE')); |
|
| 1622 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE')); |
|
| 1623 | 1623 | } |
| 1624 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
| 1624 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
| 1625 | 1625 | if ($map3dliveries == 'map3dliveries') { |
| 1626 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
| 1626 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
| 1627 | 1627 | } else { |
| 1628 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
| 1628 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
| 1629 | 1629 | } |
| 1630 | - $map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING); |
|
| 1630 | + $map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING); |
|
| 1631 | 1631 | if ($map3dshadows == 'map3dshadows') { |
| 1632 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE')); |
|
| 1632 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE')); |
|
| 1633 | 1633 | } else { |
| 1634 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE')); |
|
| 1634 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE')); |
|
| 1635 | 1635 | } |
| 1636 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
| 1636 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
| 1637 | 1637 | if ($translate == 'translate') { |
| 1638 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
| 1638 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
| 1639 | 1639 | } else { |
| 1640 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
| 1640 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
| 1641 | 1641 | } |
| 1642 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
| 1642 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
| 1643 | 1643 | if ($realairlines == 'realairlines') { |
| 1644 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
| 1644 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
| 1645 | 1645 | } else { |
| 1646 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
| 1646 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
| 1647 | 1647 | } |
| 1648 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
| 1648 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
| 1649 | 1649 | if ($estimation == 'estimation') { |
| 1650 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
| 1650 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
| 1651 | 1651 | } else { |
| 1652 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
| 1652 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
| 1653 | 1653 | } |
| 1654 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
| 1654 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
| 1655 | 1655 | if ($metar == 'metar') { |
| 1656 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
| 1656 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
| 1657 | 1657 | } else { |
| 1658 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
| 1658 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
| 1659 | 1659 | } |
| 1660 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
| 1660 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
| 1661 | 1661 | if ($metarcycle == 'metarcycle') { |
| 1662 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
| 1662 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
| 1663 | 1663 | } else { |
| 1664 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
| 1664 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
| 1665 | 1665 | } |
| 1666 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
| 1666 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
| 1667 | 1667 | if ($fork == 'fork') { |
| 1668 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
| 1668 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
| 1669 | 1669 | } else { |
| 1670 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
| 1670 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
| 1673 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
| 1674 | 1674 | if ($colormap == 'colormap') { |
| 1675 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1675 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1676 | 1676 | } else { |
| 1677 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1677 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | 1680 | if (isset($_POST['aircrafticoncolor'])) { |
| 1681 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
| 1682 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
| 1681 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
| 1682 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
| 1683 | 1683 | } |
| 1684 | 1684 | if (isset($_POST['marineiconcolor'])) { |
| 1685 | - $marineiconcolor = filter_input(INPUT_POST,'marineiconcolor',FILTER_SANITIZE_STRING); |
|
| 1686 | - $settings = array_merge($settings,array('globalMarineIconColor' => substr($marineiconcolor,1))); |
|
| 1685 | + $marineiconcolor = filter_input(INPUT_POST, 'marineiconcolor', FILTER_SANITIZE_STRING); |
|
| 1686 | + $settings = array_merge($settings, array('globalMarineIconColor' => substr($marineiconcolor, 1))); |
|
| 1687 | 1687 | } |
| 1688 | 1688 | if (isset($_POST['trackericoncolor'])) { |
| 1689 | - $trackericoncolor = filter_input(INPUT_POST,'trackericoncolor',FILTER_SANITIZE_STRING); |
|
| 1690 | - $settings = array_merge($settings,array('globalTrackerIconColor' => substr($trackericoncolor,1))); |
|
| 1689 | + $trackericoncolor = filter_input(INPUT_POST, 'trackericoncolor', FILTER_SANITIZE_STRING); |
|
| 1690 | + $settings = array_merge($settings, array('globalTrackerIconColor' => substr($trackericoncolor, 1))); |
|
| 1691 | 1691 | } |
| 1692 | 1692 | if (isset($_POST['satelliteiconcolor'])) { |
| 1693 | - $satelliteiconcolor = filter_input(INPUT_POST,'satelliteiconcolor',FILTER_SANITIZE_STRING); |
|
| 1694 | - $settings = array_merge($settings,array('globalSatelliteIconColor' => substr($satelliteiconcolor,1))); |
|
| 1693 | + $satelliteiconcolor = filter_input(INPUT_POST, 'satelliteiconcolor', FILTER_SANITIZE_STRING); |
|
| 1694 | + $settings = array_merge($settings, array('globalSatelliteIconColor' => substr($satelliteiconcolor, 1))); |
|
| 1695 | 1695 | } |
| 1696 | 1696 | |
| 1697 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 1698 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
| 1697 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 1698 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
| 1699 | 1699 | |
| 1700 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
| 1701 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
| 1702 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
| 1703 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
| 1704 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
| 1705 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
| 1700 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
| 1701 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
| 1702 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
| 1703 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
| 1704 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
| 1705 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
| 1706 | 1706 | |
| 1707 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
| 1707 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
| 1708 | 1708 | if ($mappopup == 'mappopup') { |
| 1709 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
| 1709 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
| 1710 | 1710 | } else { |
| 1711 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
| 1711 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
| 1712 | 1712 | } |
| 1713 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
| 1713 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
| 1714 | 1714 | if ($airportpopup == 'airportpopup') { |
| 1715 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
| 1715 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
| 1716 | 1716 | } else { |
| 1717 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
| 1717 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
| 1718 | 1718 | } |
| 1719 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
| 1719 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
| 1720 | 1720 | if ($maphistory == 'maphistory') { |
| 1721 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
| 1721 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
| 1722 | 1722 | } else { |
| 1723 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
| 1723 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
| 1724 | 1724 | } |
| 1725 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
| 1725 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
| 1726 | 1726 | if ($maptooltip == 'maptooltip') { |
| 1727 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
| 1727 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
| 1728 | 1728 | } else { |
| 1729 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
| 1729 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
| 1730 | 1730 | } |
| 1731 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
| 1731 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
| 1732 | 1732 | if ($flightroute == 'flightroute') { |
| 1733 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
| 1733 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
| 1734 | 1734 | } else { |
| 1735 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
| 1735 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
| 1736 | 1736 | } |
| 1737 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
| 1737 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
| 1738 | 1738 | if ($flightremainingroute == 'flightremainingroute') { |
| 1739 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
| 1739 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
| 1740 | 1740 | } else { |
| 1741 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
| 1741 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
| 1742 | 1742 | } |
| 1743 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
| 1743 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
| 1744 | 1744 | if ($allflights == 'allflights') { |
| 1745 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
| 1745 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
| 1746 | 1746 | } else { |
| 1747 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
| 1747 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
| 1748 | 1748 | } |
| 1749 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
| 1749 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
| 1750 | 1750 | if ($bbox == 'bbox') { |
| 1751 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
| 1751 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
| 1752 | 1752 | } else { |
| 1753 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
| 1753 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
| 1754 | 1754 | } |
| 1755 | - $singlemodel = filter_input(INPUT_POST,'singlemodel',FILTER_SANITIZE_STRING); |
|
| 1755 | + $singlemodel = filter_input(INPUT_POST, 'singlemodel', FILTER_SANITIZE_STRING); |
|
| 1756 | 1756 | if ($singlemodel == 'singlemodel') { |
| 1757 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'TRUE')); |
|
| 1757 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'TRUE')); |
|
| 1758 | 1758 | } else { |
| 1759 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'FALSE')); |
|
| 1759 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'FALSE')); |
|
| 1760 | 1760 | } |
| 1761 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
| 1761 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
| 1762 | 1762 | if ($groundaltitude == 'groundaltitude') { |
| 1763 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
| 1763 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
| 1764 | 1764 | } else { |
| 1765 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
| 1765 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
| 1766 | 1766 | } |
| 1767 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
| 1767 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
| 1768 | 1768 | if ($waypoints == 'waypoints') { |
| 1769 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
| 1769 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
| 1770 | 1770 | } else { |
| 1771 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
| 1771 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
| 1772 | 1772 | } |
| 1773 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
| 1773 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
| 1774 | 1774 | if ($geoid == 'geoid') { |
| 1775 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
| 1775 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
| 1776 | 1776 | } else { |
| 1777 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
| 1777 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
| 1778 | 1778 | } |
| 1779 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
| 1780 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
| 1779 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
| 1780 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
| 1781 | 1781 | |
| 1782 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
| 1782 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
| 1783 | 1783 | if ($noairlines == 'noairlines') { |
| 1784 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
| 1784 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
| 1785 | 1785 | } else { |
| 1786 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
| 1786 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
| 1789 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
| 1790 | 1790 | if ($tsk == 'tsk') { |
| 1791 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
| 1791 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
| 1792 | 1792 | } else { |
| 1793 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
| 1793 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
| 1794 | 1794 | } |
| 1795 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
| 1795 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
| 1796 | 1796 | if ($mapmatching == 'mapmatching') { |
| 1797 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
| 1797 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
| 1798 | 1798 | } else { |
| 1799 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
| 1799 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
| 1800 | 1800 | } |
| 1801 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
| 1802 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
| 1803 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
| 1804 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
| 1801 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
| 1802 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
| 1803 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
| 1804 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
| 1805 | 1805 | |
| 1806 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1806 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
| 1807 | 1807 | |
| 1808 | 1808 | // Set some defaults values... |
| 1809 | 1809 | if (!isset($globalAircraftImageSources)) { |
| 1810 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 1811 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1810 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
| 1811 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1812 | 1812 | } |
| 1813 | 1813 | |
| 1814 | 1814 | if (!isset($globalSchedulesSources)) { |
| 1815 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1816 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1815 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
| 1816 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1817 | 1817 | } |
| 1818 | 1818 | |
| 1819 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
| 1819 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
| 1820 | 1820 | |
| 1821 | 1821 | if ($error == '') settings::modify_settings($settings); |
| 1822 | 1822 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * Get SQL query part for filter used |
|
| 24 | - * @param Array $filter the filter |
|
| 25 | - * @return Array the SQL part |
|
| 26 | - */ |
|
| 23 | + * Get SQL query part for filter used |
|
| 24 | + * @param Array $filter the filter |
|
| 25 | + * @return Array the SQL part |
|
| 26 | + */ |
|
| 27 | 27 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 28 | 28 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 29 | 29 | $filters = array(); |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * Gets all the spotter information based on the latest data entry |
|
| 107 | - * |
|
| 108 | - * @return Array the spotter information |
|
| 109 | - * |
|
| 110 | - */ |
|
| 106 | + * Gets all the spotter information based on the latest data entry |
|
| 107 | + * |
|
| 108 | + * @return Array the spotter information |
|
| 109 | + * |
|
| 110 | + */ |
|
| 111 | 111 | public function getLiveMarineData($limit = '', $sort = '', $filter = array()) |
| 112 | 112 | { |
| 113 | 113 | global $globalDBdriver, $globalLiveInterval; |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | - * Gets Minimal Live Spotter data |
|
| 154 | - * |
|
| 155 | - * @return Array the spotter information |
|
| 156 | - * |
|
| 157 | - */ |
|
| 153 | + * Gets Minimal Live Spotter data |
|
| 154 | + * |
|
| 155 | + * @return Array the spotter information |
|
| 156 | + * |
|
| 157 | + */ |
|
| 158 | 158 | public function getMinLiveMarineData($filter = array()) |
| 159 | 159 | { |
| 160 | 160 | global $globalDBdriver, $globalLiveInterval; |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 188 | - * |
|
| 189 | - * @return Array the spotter information |
|
| 190 | - * |
|
| 191 | - */ |
|
| 187 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 188 | + * |
|
| 189 | + * @return Array the spotter information |
|
| 190 | + * |
|
| 191 | + */ |
|
| 192 | 192 | public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '') |
| 193 | 193 | { |
| 194 | 194 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 272 | - * |
|
| 273 | - * @return Array the spotter information |
|
| 274 | - * |
|
| 275 | - */ |
|
| 271 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 272 | + * |
|
| 273 | + * @return Array the spotter information |
|
| 274 | + * |
|
| 275 | + */ |
|
| 276 | 276 | public function getMinLastLiveMarineDataByID($id = '',$filter = array(), $limit = false) |
| 277 | 277 | { |
| 278 | 278 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
| 335 | - * Gets number of latest data entry |
|
| 336 | - * |
|
| 337 | - * @return String number of entry |
|
| 338 | - * |
|
| 339 | - */ |
|
| 335 | + * Gets number of latest data entry |
|
| 336 | + * |
|
| 337 | + * @return String number of entry |
|
| 338 | + * |
|
| 339 | + */ |
|
| 340 | 340 | public function getLiveMarineCount($filter = array()) |
| 341 | 341 | { |
| 342 | 342 | global $globalDBdriver, $globalLiveInterval; |
@@ -361,11 +361,11 @@ discard block |
||
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
| 364 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 365 | - * |
|
| 366 | - * @return Array the spotter information |
|
| 367 | - * |
|
| 368 | - */ |
|
| 364 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 365 | + * |
|
| 366 | + * @return Array the spotter information |
|
| 367 | + * |
|
| 368 | + */ |
|
| 369 | 369 | public function getLiveMarineDatabyCoord($coord, $filter = array()) |
| 370 | 370 | { |
| 371 | 371 | global $globalDBdriver, $globalLiveInterval; |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 393 | - * |
|
| 394 | - * @return Array the spotter information |
|
| 395 | - * |
|
| 396 | - */ |
|
| 392 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 393 | + * |
|
| 394 | + * @return Array the spotter information |
|
| 395 | + * |
|
| 396 | + */ |
|
| 397 | 397 | public function getMinLiveMarineDatabyCoord($coord, $filter = array()) |
| 398 | 398 | { |
| 399 | 399 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 466 | - * |
|
| 467 | - * @return Array the spotter information |
|
| 468 | - * |
|
| 469 | - */ |
|
| 465 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 466 | + * |
|
| 467 | + * @return Array the spotter information |
|
| 468 | + * |
|
| 469 | + */ |
|
| 470 | 470 | public function getLatestMarineForLayar($lat, $lng, $radius, $interval) |
| 471 | 471 | { |
| 472 | 472 | $Marine = new Marine($this->db); |
@@ -479,75 +479,75 @@ discard block |
||
| 479 | 479 | if ($lng != '') |
| 480 | 480 | { |
| 481 | 481 | if (!is_numeric($lng)) |
| 482 | - { |
|
| 483 | - return false; |
|
| 484 | - } |
|
| 485 | - } |
|
| 486 | - |
|
| 487 | - if ($radius != '') |
|
| 488 | - { |
|
| 489 | - if (!is_numeric($radius)) |
|
| 490 | - { |
|
| 491 | - return false; |
|
| 492 | - } |
|
| 493 | - } |
|
| 482 | + { |
|
| 483 | + return false; |
|
| 484 | + } |
|
| 485 | + } |
|
| 486 | + |
|
| 487 | + if ($radius != '') |
|
| 488 | + { |
|
| 489 | + if (!is_numeric($radius)) |
|
| 490 | + { |
|
| 491 | + return false; |
|
| 492 | + } |
|
| 493 | + } |
|
| 494 | 494 | $additional_query = ''; |
| 495 | 495 | if ($interval != '') |
| 496 | - { |
|
| 497 | - if (!is_string($interval)) |
|
| 498 | - { |
|
| 499 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 500 | - return false; |
|
| 501 | - } else { |
|
| 502 | - if ($interval == '1m') |
|
| 503 | - { |
|
| 504 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 505 | - } else if ($interval == '15m'){ |
|
| 506 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
| 507 | - } |
|
| 508 | - } |
|
| 509 | - } else { |
|
| 510 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 511 | - } |
|
| 512 | - |
|
| 513 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 496 | + { |
|
| 497 | + if (!is_string($interval)) |
|
| 498 | + { |
|
| 499 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 500 | + return false; |
|
| 501 | + } else { |
|
| 502 | + if ($interval == '1m') |
|
| 503 | + { |
|
| 504 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 505 | + } else if ($interval == '15m'){ |
|
| 506 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
| 507 | + } |
|
| 508 | + } |
|
| 509 | + } else { |
|
| 510 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
| 511 | + } |
|
| 512 | + |
|
| 513 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 514 | 514 | WHERE marine_live.latitude <> '' |
| 515 | 515 | AND marine_live.longitude <> '' |
| 516 | 516 | ".$additional_query." |
| 517 | 517 | HAVING distance < :radius |
| 518 | 518 | ORDER BY distance"; |
| 519 | 519 | |
| 520 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 520 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 521 | 521 | |
| 522 | - return $spotter_array; |
|
| 523 | - } |
|
| 522 | + return $spotter_array; |
|
| 523 | + } |
|
| 524 | 524 | |
| 525 | 525 | |
| 526 | - /** |
|
| 527 | - * Gets all the spotter information based on a particular callsign |
|
| 528 | - * |
|
| 529 | - * @return Array the spotter information |
|
| 530 | - * |
|
| 531 | - */ |
|
| 526 | + /** |
|
| 527 | + * Gets all the spotter information based on a particular callsign |
|
| 528 | + * |
|
| 529 | + * @return Array the spotter information |
|
| 530 | + * |
|
| 531 | + */ |
|
| 532 | 532 | public function getLastLiveMarineDataByIdent($ident) |
| 533 | 533 | { |
| 534 | 534 | $Marine = new Marine($this->db); |
| 535 | 535 | date_default_timezone_set('UTC'); |
| 536 | 536 | |
| 537 | 537 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 538 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 538 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 539 | 539 | |
| 540 | 540 | $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
| 541 | 541 | |
| 542 | 542 | return $spotter_array; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - /** |
|
| 546 | - * Gets all the spotter information based on a particular callsign |
|
| 547 | - * |
|
| 548 | - * @return Array the spotter information |
|
| 549 | - * |
|
| 550 | - */ |
|
| 545 | + /** |
|
| 546 | + * Gets all the spotter information based on a particular callsign |
|
| 547 | + * |
|
| 548 | + * @return Array the spotter information |
|
| 549 | + * |
|
| 550 | + */ |
|
| 551 | 551 | public function getDateLiveMarineDataByIdent($ident,$date) |
| 552 | 552 | { |
| 553 | 553 | $Marine = new Marine($this->db); |
@@ -560,11 +560,11 @@ discard block |
||
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | /** |
| 563 | - * Gets all the spotter information based on a particular MMSI |
|
| 564 | - * |
|
| 565 | - * @return Array the spotter information |
|
| 566 | - * |
|
| 567 | - */ |
|
| 563 | + * Gets all the spotter information based on a particular MMSI |
|
| 564 | + * |
|
| 565 | + * @return Array the spotter information |
|
| 566 | + * |
|
| 567 | + */ |
|
| 568 | 568 | public function getDateLiveMarineDataByMMSI($mmsi,$date) |
| 569 | 569 | { |
| 570 | 570 | $Marine = new Marine($this->db); |
@@ -576,51 +576,51 @@ discard block |
||
| 576 | 576 | return $spotter_array; |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - /** |
|
| 580 | - * Gets last spotter information based on a particular callsign |
|
| 581 | - * |
|
| 582 | - * @return Array the spotter information |
|
| 583 | - * |
|
| 584 | - */ |
|
| 579 | + /** |
|
| 580 | + * Gets last spotter information based on a particular callsign |
|
| 581 | + * |
|
| 582 | + * @return Array the spotter information |
|
| 583 | + * |
|
| 584 | + */ |
|
| 585 | 585 | public function getLastLiveMarineDataById($id) |
| 586 | 586 | { |
| 587 | 587 | $Marine = new Marine($this->db); |
| 588 | 588 | date_default_timezone_set('UTC'); |
| 589 | 589 | |
| 590 | 590 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 591 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 591 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 592 | 592 | |
| 593 | 593 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
| 594 | 594 | |
| 595 | 595 | return $spotter_array; |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | - /** |
|
| 599 | - * Gets last spotter information based on a particular callsign |
|
| 600 | - * |
|
| 601 | - * @return Array the spotter information |
|
| 602 | - * |
|
| 603 | - */ |
|
| 598 | + /** |
|
| 599 | + * Gets last spotter information based on a particular callsign |
|
| 600 | + * |
|
| 601 | + * @return Array the spotter information |
|
| 602 | + * |
|
| 603 | + */ |
|
| 604 | 604 | public function getDateLiveMarineDataById($id,$date) |
| 605 | 605 | { |
| 606 | 606 | $Marine = new Marine($this->db); |
| 607 | 607 | date_default_timezone_set('UTC'); |
| 608 | 608 | |
| 609 | 609 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 610 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 611 | - $date = date('c',$date); |
|
| 610 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 611 | + $date = date('c',$date); |
|
| 612 | 612 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
| 613 | 613 | |
| 614 | 614 | return $spotter_array; |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | |
| 618 | - /** |
|
| 619 | - * Gets all the spotter information based on a particular id |
|
| 620 | - * |
|
| 621 | - * @return Array the spotter information |
|
| 622 | - * |
|
| 623 | - */ |
|
| 618 | + /** |
|
| 619 | + * Gets all the spotter information based on a particular id |
|
| 620 | + * |
|
| 621 | + * @return Array the spotter information |
|
| 622 | + * |
|
| 623 | + */ |
|
| 624 | 624 | public function getAllLiveMarineDataById($id,$liveinterval = false) |
| 625 | 625 | { |
| 626 | 626 | global $globalDBdriver, $globalLiveInterval; |
@@ -648,18 +648,18 @@ discard block |
||
| 648 | 648 | return $spotter_array; |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | - /** |
|
| 652 | - * Gets all the spotter information based on a particular ident |
|
| 653 | - * |
|
| 654 | - * @return Array the spotter information |
|
| 655 | - * |
|
| 656 | - */ |
|
| 651 | + /** |
|
| 652 | + * Gets all the spotter information based on a particular ident |
|
| 653 | + * |
|
| 654 | + * @return Array the spotter information |
|
| 655 | + * |
|
| 656 | + */ |
|
| 657 | 657 | public function getAllLiveMarineDataByIdent($ident) |
| 658 | 658 | { |
| 659 | 659 | date_default_timezone_set('UTC'); |
| 660 | 660 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 661 | 661 | $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
| 662 | - try { |
|
| 662 | + try { |
|
| 663 | 663 | |
| 664 | 664 | $sth = $this->db->prepare($query); |
| 665 | 665 | $sth->execute(array(':ident' => $ident)); |
@@ -673,23 +673,23 @@ discard block |
||
| 673 | 673 | |
| 674 | 674 | |
| 675 | 675 | /** |
| 676 | - * Deletes all info in the table |
|
| 677 | - * |
|
| 678 | - * @return String success or false |
|
| 679 | - * |
|
| 680 | - */ |
|
| 676 | + * Deletes all info in the table |
|
| 677 | + * |
|
| 678 | + * @return String success or false |
|
| 679 | + * |
|
| 680 | + */ |
|
| 681 | 681 | public function deleteLiveMarineData() |
| 682 | 682 | { |
| 683 | 683 | global $globalDBdriver; |
| 684 | 684 | if ($globalDBdriver == 'mysql') { |
| 685 | 685 | //$query = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date"; |
| 686 | 686 | $query = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date'; |
| 687 | - //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
| 687 | + //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
| 688 | 688 | } else { |
| 689 | 689 | $query = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date"; |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | - try { |
|
| 692 | + try { |
|
| 693 | 693 | |
| 694 | 694 | $sth = $this->db->prepare($query); |
| 695 | 695 | $sth->execute(); |
@@ -701,18 +701,18 @@ discard block |
||
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
| 704 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 705 | - * |
|
| 706 | - * @return String success or false |
|
| 707 | - * |
|
| 708 | - */ |
|
| 704 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 705 | + * |
|
| 706 | + * @return String success or false |
|
| 707 | + * |
|
| 708 | + */ |
|
| 709 | 709 | public function deleteLiveMarineDataNotUpdated() |
| 710 | 710 | { |
| 711 | 711 | global $globalDBdriver, $globalDebug; |
| 712 | 712 | if ($globalDBdriver == 'mysql') { |
| 713 | 713 | //$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0'; |
| 714 | - $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 715 | - try { |
|
| 714 | + $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 715 | + try { |
|
| 716 | 716 | |
| 717 | 717 | $sth = $this->db->prepare($query); |
| 718 | 718 | $sth->execute(); |
@@ -720,8 +720,8 @@ discard block |
||
| 720 | 720 | return "error"; |
| 721 | 721 | } |
| 722 | 722 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
| 723 | - $i = 0; |
|
| 724 | - $j =0; |
|
| 723 | + $i = 0; |
|
| 724 | + $j =0; |
|
| 725 | 725 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 726 | 726 | foreach($all as $row) |
| 727 | 727 | { |
@@ -729,20 +729,20 @@ discard block |
||
| 729 | 729 | $j++; |
| 730 | 730 | if ($j == 30) { |
| 731 | 731 | if ($globalDebug) echo "."; |
| 732 | - try { |
|
| 732 | + try { |
|
| 733 | 733 | |
| 734 | 734 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 735 | 735 | $sth->execute(); |
| 736 | 736 | } catch(PDOException $e) { |
| 737 | 737 | return "error"; |
| 738 | 738 | } |
| 739 | - $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
| 740 | - $j = 0; |
|
| 739 | + $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
| 740 | + $j = 0; |
|
| 741 | 741 | } |
| 742 | 742 | $query_delete .= "'".$row['fammarine_id']."',"; |
| 743 | 743 | } |
| 744 | 744 | if ($i > 0) { |
| 745 | - try { |
|
| 745 | + try { |
|
| 746 | 746 | |
| 747 | 747 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 748 | 748 | $sth->execute(); |
@@ -753,9 +753,9 @@ discard block |
||
| 753 | 753 | return "success"; |
| 754 | 754 | } elseif ($globalDBdriver == 'pgsql') { |
| 755 | 755 | //$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0"; |
| 756 | - //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 757 | - $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 758 | - try { |
|
| 756 | + //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 757 | + $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 758 | + try { |
|
| 759 | 759 | |
| 760 | 760 | $sth = $this->db->prepare($query); |
| 761 | 761 | $sth->execute(); |
@@ -799,17 +799,17 @@ discard block |
||
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | /** |
| 802 | - * Deletes all info in the table for an ident |
|
| 803 | - * |
|
| 804 | - * @return String success or false |
|
| 805 | - * |
|
| 806 | - */ |
|
| 802 | + * Deletes all info in the table for an ident |
|
| 803 | + * |
|
| 804 | + * @return String success or false |
|
| 805 | + * |
|
| 806 | + */ |
|
| 807 | 807 | public function deleteLiveMarineDataByIdent($ident) |
| 808 | 808 | { |
| 809 | 809 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 810 | 810 | $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
| 811 | 811 | |
| 812 | - try { |
|
| 812 | + try { |
|
| 813 | 813 | |
| 814 | 814 | $sth = $this->db->prepare($query); |
| 815 | 815 | $sth->execute(array(':ident' => $ident)); |
@@ -821,17 +821,17 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | /** |
| 824 | - * Deletes all info in the table for an id |
|
| 825 | - * |
|
| 826 | - * @return String success or false |
|
| 827 | - * |
|
| 828 | - */ |
|
| 824 | + * Deletes all info in the table for an id |
|
| 825 | + * |
|
| 826 | + * @return String success or false |
|
| 827 | + * |
|
| 828 | + */ |
|
| 829 | 829 | public function deleteLiveMarineDataById($id) |
| 830 | 830 | { |
| 831 | 831 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 832 | 832 | $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
| 833 | 833 | |
| 834 | - try { |
|
| 834 | + try { |
|
| 835 | 835 | |
| 836 | 836 | $sth = $this->db->prepare($query); |
| 837 | 837 | $sth->execute(array(':id' => $id)); |
@@ -844,11 +844,11 @@ discard block |
||
| 844 | 844 | |
| 845 | 845 | |
| 846 | 846 | /** |
| 847 | - * Gets the marine races |
|
| 848 | - * |
|
| 849 | - * @return Array all races |
|
| 850 | - * |
|
| 851 | - */ |
|
| 847 | + * Gets the marine races |
|
| 848 | + * |
|
| 849 | + * @return Array all races |
|
| 850 | + * |
|
| 851 | + */ |
|
| 852 | 852 | public function getAllRaces() |
| 853 | 853 | { |
| 854 | 854 | $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
@@ -858,11 +858,11 @@ discard block |
||
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /** |
| 861 | - * Gets the aircraft ident within the last hour |
|
| 862 | - * |
|
| 863 | - * @return String the ident |
|
| 864 | - * |
|
| 865 | - */ |
|
| 861 | + * Gets the aircraft ident within the last hour |
|
| 862 | + * |
|
| 863 | + * @return String the ident |
|
| 864 | + * |
|
| 865 | + */ |
|
| 866 | 866 | public function getIdentFromLastHour($ident) |
| 867 | 867 | { |
| 868 | 868 | global $globalDBdriver, $globalTimezone; |
@@ -888,14 +888,14 @@ discard block |
||
| 888 | 888 | $ident_result = $row['ident']; |
| 889 | 889 | } |
| 890 | 890 | return $ident_result; |
| 891 | - } |
|
| 891 | + } |
|
| 892 | 892 | |
| 893 | 893 | /** |
| 894 | - * Check recent aircraft |
|
| 895 | - * |
|
| 896 | - * @return String the ident |
|
| 897 | - * |
|
| 898 | - */ |
|
| 894 | + * Check recent aircraft |
|
| 895 | + * |
|
| 896 | + * @return String the ident |
|
| 897 | + * |
|
| 898 | + */ |
|
| 899 | 899 | public function checkIdentRecent($ident) |
| 900 | 900 | { |
| 901 | 901 | global $globalDBdriver, $globalTimezone; |
@@ -921,14 +921,14 @@ discard block |
||
| 921 | 921 | $ident_result = $row['fammarine_id']; |
| 922 | 922 | } |
| 923 | 923 | return $ident_result; |
| 924 | - } |
|
| 924 | + } |
|
| 925 | 925 | |
| 926 | 926 | /** |
| 927 | - * Check recent aircraft by id |
|
| 928 | - * |
|
| 929 | - * @return String the ident |
|
| 930 | - * |
|
| 931 | - */ |
|
| 927 | + * Check recent aircraft by id |
|
| 928 | + * |
|
| 929 | + * @return String the ident |
|
| 930 | + * |
|
| 931 | + */ |
|
| 932 | 932 | public function checkIdRecent($id) |
| 933 | 933 | { |
| 934 | 934 | global $globalDBdriver, $globalTimezone; |
@@ -954,14 +954,14 @@ discard block |
||
| 954 | 954 | $ident_result = $row['fammarine_id']; |
| 955 | 955 | } |
| 956 | 956 | return $ident_result; |
| 957 | - } |
|
| 957 | + } |
|
| 958 | 958 | |
| 959 | 959 | /** |
| 960 | - * Check recent aircraft by mmsi |
|
| 961 | - * |
|
| 962 | - * @return String the ident |
|
| 963 | - * |
|
| 964 | - */ |
|
| 960 | + * Check recent aircraft by mmsi |
|
| 961 | + * |
|
| 962 | + * @return String the ident |
|
| 963 | + * |
|
| 964 | + */ |
|
| 965 | 965 | public function checkMMSIRecent($mmsi) |
| 966 | 966 | { |
| 967 | 967 | global $globalDBdriver, $globalTimezone; |
@@ -987,19 +987,19 @@ discard block |
||
| 987 | 987 | $ident_result = $row['fammarine_id']; |
| 988 | 988 | } |
| 989 | 989 | return $ident_result; |
| 990 | - } |
|
| 990 | + } |
|
| 991 | 991 | |
| 992 | 992 | /** |
| 993 | - * Adds a new spotter data |
|
| 994 | - * |
|
| 995 | - * @param String $fammarine_id the ID from flightaware |
|
| 996 | - * @param String $ident the flight ident |
|
| 997 | - * @param String $aircraft_icao the aircraft type |
|
| 998 | - * @param String $departure_airport_icao the departure airport |
|
| 999 | - * @param String $arrival_airport_icao the arrival airport |
|
| 1000 | - * @return String success or false |
|
| 1001 | - * |
|
| 1002 | - */ |
|
| 993 | + * Adds a new spotter data |
|
| 994 | + * |
|
| 995 | + * @param String $fammarine_id the ID from flightaware |
|
| 996 | + * @param String $ident the flight ident |
|
| 997 | + * @param String $aircraft_icao the aircraft type |
|
| 998 | + * @param String $departure_airport_icao the departure airport |
|
| 999 | + * @param String $arrival_airport_icao the arrival airport |
|
| 1000 | + * @return String success or false |
|
| 1001 | + * |
|
| 1002 | + */ |
|
| 1003 | 1003 | public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
| 1004 | 1004 | { |
| 1005 | 1005 | global $globalURL, $globalArchive, $globalDebug; |
@@ -1081,10 +1081,10 @@ discard block |
||
| 1081 | 1081 | if ($statusid == '') $statusid = NULL; |
| 1082 | 1082 | if ($distance == '') $distance = NULL; |
| 1083 | 1083 | |
| 1084 | - //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1085 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1086 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 1087 | - $query = ''; |
|
| 1084 | + //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1085 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1086 | + if ($arrival_date == '') $arrival_date = NULL; |
|
| 1087 | + $query = ''; |
|
| 1088 | 1088 | if ($globalArchive) { |
| 1089 | 1089 | if ($globalDebug) echo '-- Delete previous data -- '; |
| 1090 | 1090 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
@@ -24,33 +24,33 @@ discard block |
||
| 24 | 24 | * @param Array $filter the filter |
| 25 | 25 | * @return Array the SQL part |
| 26 | 26 | */ |
| 27 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 27 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 28 | 28 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 29 | 29 | $filters = array(); |
| 30 | 30 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 31 | 31 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 32 | 32 | $filters = $globalStatsFilters[$globalFilterName]; |
| 33 | 33 | } else { |
| 34 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 34 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | if (isset($filter[0]['source'])) { |
| 38 | - $filters = array_merge($filters,$filter); |
|
| 38 | + $filters = array_merge($filters, $filter); |
|
| 39 | 39 | } |
| 40 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 40 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 41 | 41 | $filter_query_join = ''; |
| 42 | 42 | $filter_query_where = ''; |
| 43 | - foreach($filters as $flt) { |
|
| 43 | + foreach ($filters as $flt) { |
|
| 44 | 44 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 45 | 45 | if (isset($flt['source'])) { |
| 46 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 46 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 47 | 47 | } else { |
| 48 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 48 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 53 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 53 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 54 | 54 | } |
| 55 | 55 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 56 | 56 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -88,15 +88,15 @@ discard block |
||
| 88 | 88 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
| 91 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
| 92 | 92 | } |
| 93 | 93 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 94 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 94 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 95 | 95 | } |
| 96 | 96 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 97 | 97 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 98 | 98 | if ($filter_query_where != '') { |
| 99 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 99 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 100 | 100 | } |
| 101 | 101 | $filter_query = $filter_query_join.$filter_query_where; |
| 102 | 102 | return $filter_query; |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | if ($limit != '') |
| 120 | 120 | { |
| 121 | 121 | $limit_array = explode(',', $limit); |
| 122 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 123 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 122 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 123 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 124 | 124 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 125 | 125 | { |
| 126 | 126 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 138 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
| 139 | 139 | |
| 140 | 140 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 141 | 141 | if ($globalDBdriver == 'mysql') { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } else { |
| 145 | 145 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query; |
| 146 | 146 | } |
| 147 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 147 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 148 | 148 | |
| 149 | 149 | return $spotter_array; |
| 150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | global $globalDBdriver, $globalLiveInterval; |
| 161 | 161 | date_default_timezone_set('UTC'); |
| 162 | 162 | |
| 163 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 163 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 164 | 164 | |
| 165 | 165 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 166 | 166 | if ($globalDBdriver == 'mysql') { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | try { |
| 175 | 175 | $sth = $this->db->prepare($query); |
| 176 | 176 | $sth->execute(); |
| 177 | - } catch(PDOException $e) { |
|
| 177 | + } catch (PDOException $e) { |
|
| 178 | 178 | echo $e->getMessage(); |
| 179 | 179 | die; |
| 180 | 180 | } |
@@ -189,26 +189,26 @@ discard block |
||
| 189 | 189 | * @return Array the spotter information |
| 190 | 190 | * |
| 191 | 191 | */ |
| 192 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '') |
|
| 192 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false, $id = '') |
|
| 193 | 193 | { |
| 194 | 194 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
| 195 | 195 | date_default_timezone_set('UTC'); |
| 196 | 196 | $usecoord = false; |
| 197 | 197 | if (is_array($coord) && !empty($coord)) { |
| 198 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 199 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 200 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 201 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 198 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 199 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 200 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 201 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 202 | 202 | $usecoord = true; |
| 203 | 203 | } |
| 204 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 205 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 204 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 205 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 206 | 206 | |
| 207 | 207 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 208 | 208 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
| 209 | 209 | if ($globalDBdriver == 'mysql') { |
| 210 | 210 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 211 | - $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
| 211 | + $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
| 212 | 212 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 213 | 213 | if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
| 214 | 214 | if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | ORDER BY fammarine_id, date"; |
| 223 | 223 | if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
| 224 | 224 | } else { |
| 225 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 225 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 226 | 226 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date "; |
| 227 | 227 | if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
| 228 | 228 | if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | } else { |
| 234 | 234 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 235 | - $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
| 235 | + $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
| 236 | 236 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 237 | 237 | if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 238 | 238 | if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | try { |
| 260 | 260 | $sth = $this->db->prepare($query); |
| 261 | 261 | $sth->execute($query_values); |
| 262 | - } catch(PDOException $e) { |
|
| 262 | + } catch (PDOException $e) { |
|
| 263 | 263 | echo $e->getMessage(); |
| 264 | 264 | die; |
| 265 | 265 | } |
@@ -273,12 +273,12 @@ discard block |
||
| 273 | 273 | * @return Array the spotter information |
| 274 | 274 | * |
| 275 | 275 | */ |
| 276 | - public function getMinLastLiveMarineDataByID($id = '',$filter = array(), $limit = false) |
|
| 276 | + public function getMinLastLiveMarineDataByID($id = '', $filter = array(), $limit = false) |
|
| 277 | 277 | { |
| 278 | 278 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
| 279 | 279 | date_default_timezone_set('UTC'); |
| 280 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 281 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 280 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 281 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 282 | 282 | |
| 283 | 283 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 284 | 284 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | try { |
| 324 | 324 | $sth = $this->db->prepare($query); |
| 325 | 325 | $sth->execute($query_values); |
| 326 | - } catch(PDOException $e) { |
|
| 326 | + } catch (PDOException $e) { |
|
| 327 | 327 | echo $e->getMessage(); |
| 328 | 328 | die; |
| 329 | 329 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | public function getLiveMarineCount($filter = array()) |
| 341 | 341 | { |
| 342 | 342 | global $globalDBdriver, $globalLiveInterval; |
| 343 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 343 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 344 | 344 | |
| 345 | 345 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 346 | 346 | if ($globalDBdriver == 'mysql') { |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | try { |
| 352 | 352 | $sth = $this->db->prepare($query); |
| 353 | 353 | $sth->execute(); |
| 354 | - } catch(PDOException $e) { |
|
| 354 | + } catch (PDOException $e) { |
|
| 355 | 355 | echo $e->getMessage(); |
| 356 | 356 | die; |
| 357 | 357 | } |
@@ -374,10 +374,10 @@ discard block |
||
| 374 | 374 | $filter_query = $this->getFilter($filter); |
| 375 | 375 | |
| 376 | 376 | if (is_array($coord)) { |
| 377 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 378 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 379 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 380 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 377 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 378 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 379 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 380 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 381 | 381 | } else return array(); |
| 382 | 382 | if ($globalDBdriver == 'mysql') { |
| 383 | 383 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query; |
@@ -399,13 +399,13 @@ discard block |
||
| 399 | 399 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 400 | 400 | $Marine = new Marine($this->db); |
| 401 | 401 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 402 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 402 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 403 | 403 | |
| 404 | 404 | if (is_array($coord)) { |
| 405 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 406 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 407 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 408 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 405 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 406 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 407 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 408 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 409 | 409 | } else return array(); |
| 410 | 410 | /* |
| 411 | 411 | if ($globalDBdriver == 'mysql') { |
@@ -420,13 +420,13 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | if ($globalDBdriver == 'mysql') { |
| 422 | 422 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 423 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 423 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 424 | 424 | FROM marine_live |
| 425 | 425 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date |
| 426 | 426 | AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
| 427 | 427 | AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY race_rank,date DESC'; |
| 428 | 428 | } else { |
| 429 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 429 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 430 | 430 | FROM marine_live |
| 431 | 431 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
| 432 | 432 | FROM marine_live l |
@@ -438,14 +438,14 @@ discard block |
||
| 438 | 438 | } |
| 439 | 439 | } else { |
| 440 | 440 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 441 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 441 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 442 | 442 | FROM marine_live |
| 443 | 443 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date |
| 444 | 444 | AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
| 445 | 445 | AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 446 | 446 | AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY race_rank, date DESC"; |
| 447 | 447 | } else { |
| 448 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 448 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 449 | 449 | FROM marine_live |
| 450 | 450 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
| 451 | 451 | FROM marine_live l |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | if ($interval == '1m') |
| 503 | 503 | { |
| 504 | 504 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
| 505 | - } else if ($interval == '15m'){ |
|
| 505 | + } else if ($interval == '15m') { |
|
| 506 | 506 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
| 507 | 507 | } |
| 508 | 508 | } |
@@ -510,14 +510,14 @@ discard block |
||
| 510 | 510 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 513 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 514 | 514 | WHERE marine_live.latitude <> '' |
| 515 | 515 | AND marine_live.longitude <> '' |
| 516 | 516 | ".$additional_query." |
| 517 | 517 | HAVING distance < :radius |
| 518 | 518 | ORDER BY distance"; |
| 519 | 519 | |
| 520 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 520 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 521 | 521 | |
| 522 | 522 | return $spotter_array; |
| 523 | 523 | } |
@@ -535,9 +535,9 @@ discard block |
||
| 535 | 535 | date_default_timezone_set('UTC'); |
| 536 | 536 | |
| 537 | 537 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 538 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 538 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 539 | 539 | |
| 540 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 540 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 541 | 541 | |
| 542 | 542 | return $spotter_array; |
| 543 | 543 | } |
@@ -548,14 +548,14 @@ discard block |
||
| 548 | 548 | * @return Array the spotter information |
| 549 | 549 | * |
| 550 | 550 | */ |
| 551 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
| 551 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
| 552 | 552 | { |
| 553 | 553 | $Marine = new Marine($this->db); |
| 554 | 554 | date_default_timezone_set('UTC'); |
| 555 | 555 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 556 | 556 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
| 557 | - $date = date('c',$date); |
|
| 558 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 557 | + $date = date('c', $date); |
|
| 558 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 559 | 559 | return $spotter_array; |
| 560 | 560 | } |
| 561 | 561 | |
@@ -565,14 +565,14 @@ discard block |
||
| 565 | 565 | * @return Array the spotter information |
| 566 | 566 | * |
| 567 | 567 | */ |
| 568 | - public function getDateLiveMarineDataByMMSI($mmsi,$date) |
|
| 568 | + public function getDateLiveMarineDataByMMSI($mmsi, $date) |
|
| 569 | 569 | { |
| 570 | 570 | $Marine = new Marine($this->db); |
| 571 | 571 | date_default_timezone_set('UTC'); |
| 572 | 572 | $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
| 573 | 573 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
| 574 | - $date = date('c',$date); |
|
| 575 | - $spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date)); |
|
| 574 | + $date = date('c', $date); |
|
| 575 | + $spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date)); |
|
| 576 | 576 | return $spotter_array; |
| 577 | 577 | } |
| 578 | 578 | |
@@ -588,9 +588,9 @@ discard block |
||
| 588 | 588 | date_default_timezone_set('UTC'); |
| 589 | 589 | |
| 590 | 590 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 591 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 591 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 592 | 592 | |
| 593 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 593 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 594 | 594 | |
| 595 | 595 | return $spotter_array; |
| 596 | 596 | } |
@@ -601,15 +601,15 @@ discard block |
||
| 601 | 601 | * @return Array the spotter information |
| 602 | 602 | * |
| 603 | 603 | */ |
| 604 | - public function getDateLiveMarineDataById($id,$date) |
|
| 604 | + public function getDateLiveMarineDataById($id, $date) |
|
| 605 | 605 | { |
| 606 | 606 | $Marine = new Marine($this->db); |
| 607 | 607 | date_default_timezone_set('UTC'); |
| 608 | 608 | |
| 609 | 609 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 610 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 611 | - $date = date('c',$date); |
|
| 612 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 610 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 611 | + $date = date('c', $date); |
|
| 612 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 613 | 613 | |
| 614 | 614 | return $spotter_array; |
| 615 | 615 | } |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | * @return Array the spotter information |
| 622 | 622 | * |
| 623 | 623 | */ |
| 624 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
| 624 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
| 625 | 625 | { |
| 626 | 626 | global $globalDBdriver, $globalLiveInterval; |
| 627 | 627 | date_default_timezone_set('UTC'); |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | try { |
| 641 | 641 | $sth = $this->db->prepare($query); |
| 642 | 642 | $sth->execute(array(':id' => $id)); |
| 643 | - } catch(PDOException $e) { |
|
| 643 | + } catch (PDOException $e) { |
|
| 644 | 644 | echo $e->getMessage(); |
| 645 | 645 | die; |
| 646 | 646 | } |
@@ -658,12 +658,12 @@ discard block |
||
| 658 | 658 | { |
| 659 | 659 | date_default_timezone_set('UTC'); |
| 660 | 660 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 661 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
| 661 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
| 662 | 662 | try { |
| 663 | 663 | |
| 664 | 664 | $sth = $this->db->prepare($query); |
| 665 | 665 | $sth->execute(array(':ident' => $ident)); |
| 666 | - } catch(PDOException $e) { |
|
| 666 | + } catch (PDOException $e) { |
|
| 667 | 667 | echo $e->getMessage(); |
| 668 | 668 | die; |
| 669 | 669 | } |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | |
| 694 | 694 | $sth = $this->db->prepare($query); |
| 695 | 695 | $sth->execute(); |
| 696 | - } catch(PDOException $e) { |
|
| 696 | + } catch (PDOException $e) { |
|
| 697 | 697 | return "error"; |
| 698 | 698 | } |
| 699 | 699 | |
@@ -716,14 +716,14 @@ discard block |
||
| 716 | 716 | |
| 717 | 717 | $sth = $this->db->prepare($query); |
| 718 | 718 | $sth->execute(); |
| 719 | - } catch(PDOException $e) { |
|
| 719 | + } catch (PDOException $e) { |
|
| 720 | 720 | return "error"; |
| 721 | 721 | } |
| 722 | 722 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
| 723 | 723 | $i = 0; |
| 724 | - $j =0; |
|
| 724 | + $j = 0; |
|
| 725 | 725 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 726 | - foreach($all as $row) |
|
| 726 | + foreach ($all as $row) |
|
| 727 | 727 | { |
| 728 | 728 | $i++; |
| 729 | 729 | $j++; |
@@ -731,9 +731,9 @@ discard block |
||
| 731 | 731 | if ($globalDebug) echo "."; |
| 732 | 732 | try { |
| 733 | 733 | |
| 734 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 734 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 735 | 735 | $sth->execute(); |
| 736 | - } catch(PDOException $e) { |
|
| 736 | + } catch (PDOException $e) { |
|
| 737 | 737 | return "error"; |
| 738 | 738 | } |
| 739 | 739 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -744,9 +744,9 @@ discard block |
||
| 744 | 744 | if ($i > 0) { |
| 745 | 745 | try { |
| 746 | 746 | |
| 747 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 747 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 748 | 748 | $sth->execute(); |
| 749 | - } catch(PDOException $e) { |
|
| 749 | + } catch (PDOException $e) { |
|
| 750 | 750 | return "error"; |
| 751 | 751 | } |
| 752 | 752 | } |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | |
| 760 | 760 | $sth = $this->db->prepare($query); |
| 761 | 761 | $sth->execute(); |
| 762 | - } catch(PDOException $e) { |
|
| 762 | + } catch (PDOException $e) { |
|
| 763 | 763 | return "error"; |
| 764 | 764 | } |
| 765 | 765 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -807,13 +807,13 @@ discard block |
||
| 807 | 807 | public function deleteLiveMarineDataByIdent($ident) |
| 808 | 808 | { |
| 809 | 809 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 810 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
| 810 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
| 811 | 811 | |
| 812 | 812 | try { |
| 813 | 813 | |
| 814 | 814 | $sth = $this->db->prepare($query); |
| 815 | 815 | $sth->execute(array(':ident' => $ident)); |
| 816 | - } catch(PDOException $e) { |
|
| 816 | + } catch (PDOException $e) { |
|
| 817 | 817 | return "error"; |
| 818 | 818 | } |
| 819 | 819 | |
@@ -829,13 +829,13 @@ discard block |
||
| 829 | 829 | public function deleteLiveMarineDataById($id) |
| 830 | 830 | { |
| 831 | 831 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 832 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
| 832 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
| 833 | 833 | |
| 834 | 834 | try { |
| 835 | 835 | |
| 836 | 836 | $sth = $this->db->prepare($query); |
| 837 | 837 | $sth->execute(array(':id' => $id)); |
| 838 | - } catch(PDOException $e) { |
|
| 838 | + } catch (PDOException $e) { |
|
| 839 | 839 | return "error"; |
| 840 | 840 | } |
| 841 | 841 | |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | */ |
| 852 | 852 | public function getAllRaces() |
| 853 | 853 | { |
| 854 | - $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
| 854 | + $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
| 855 | 855 | $sth = $this->db->prepare($query); |
| 856 | 856 | $sth->execute(); |
| 857 | 857 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -867,13 +867,13 @@ discard block |
||
| 867 | 867 | { |
| 868 | 868 | global $globalDBdriver, $globalTimezone; |
| 869 | 869 | if ($globalDBdriver == 'mysql') { |
| 870 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
| 870 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
| 871 | 871 | WHERE marine_live.ident = :ident |
| 872 | 872 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 873 | 873 | AND marine_live.date < UTC_TIMESTAMP()'; |
| 874 | 874 | $query_data = array(':ident' => $ident); |
| 875 | 875 | } else { |
| 876 | - $query = "SELECT marine_live.ident FROM marine_live |
|
| 876 | + $query = "SELECT marine_live.ident FROM marine_live |
|
| 877 | 877 | WHERE marine_live.ident = :ident |
| 878 | 878 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 879 | 879 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -882,8 +882,8 @@ discard block |
||
| 882 | 882 | |
| 883 | 883 | $sth = $this->db->prepare($query); |
| 884 | 884 | $sth->execute($query_data); |
| 885 | - $ident_result=''; |
|
| 886 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 885 | + $ident_result = ''; |
|
| 886 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 887 | 887 | { |
| 888 | 888 | $ident_result = $row['ident']; |
| 889 | 889 | } |
@@ -900,13 +900,13 @@ discard block |
||
| 900 | 900 | { |
| 901 | 901 | global $globalDBdriver, $globalTimezone; |
| 902 | 902 | if ($globalDBdriver == 'mysql') { |
| 903 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 903 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 904 | 904 | WHERE marine_live.ident = :ident |
| 905 | 905 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 906 | 906 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 907 | 907 | $query_data = array(':ident' => $ident); |
| 908 | 908 | } else { |
| 909 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 909 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 910 | 910 | WHERE marine_live.ident = :ident |
| 911 | 911 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 912 | 912 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -915,8 +915,8 @@ discard block |
||
| 915 | 915 | |
| 916 | 916 | $sth = $this->db->prepare($query); |
| 917 | 917 | $sth->execute($query_data); |
| 918 | - $ident_result=''; |
|
| 919 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 918 | + $ident_result = ''; |
|
| 919 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 920 | 920 | { |
| 921 | 921 | $ident_result = $row['fammarine_id']; |
| 922 | 922 | } |
@@ -933,13 +933,13 @@ discard block |
||
| 933 | 933 | { |
| 934 | 934 | global $globalDBdriver, $globalTimezone; |
| 935 | 935 | if ($globalDBdriver == 'mysql') { |
| 936 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 936 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 937 | 937 | WHERE marine_live.fammarine_id = :id |
| 938 | 938 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 939 | 939 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 940 | 940 | $query_data = array(':id' => $id); |
| 941 | 941 | } else { |
| 942 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 942 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 943 | 943 | WHERE marine_live.fammarine_id = :id |
| 944 | 944 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 945 | 945 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -948,8 +948,8 @@ discard block |
||
| 948 | 948 | |
| 949 | 949 | $sth = $this->db->prepare($query); |
| 950 | 950 | $sth->execute($query_data); |
| 951 | - $ident_result=''; |
|
| 952 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 951 | + $ident_result = ''; |
|
| 952 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 953 | 953 | { |
| 954 | 954 | $ident_result = $row['fammarine_id']; |
| 955 | 955 | } |
@@ -966,13 +966,13 @@ discard block |
||
| 966 | 966 | { |
| 967 | 967 | global $globalDBdriver, $globalTimezone; |
| 968 | 968 | if ($globalDBdriver == 'mysql') { |
| 969 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
| 969 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
| 970 | 970 | WHERE marine_live.mmsi = :mmsi |
| 971 | 971 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 972 | 972 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 973 | 973 | $query_data = array(':mmsi' => $mmsi); |
| 974 | 974 | } else { |
| 975 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
| 975 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
| 976 | 976 | WHERE marine_live.mmsi = :mmsi |
| 977 | 977 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 978 | 978 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -981,8 +981,8 @@ discard block |
||
| 981 | 981 | |
| 982 | 982 | $sth = $this->db->prepare($query); |
| 983 | 983 | $sth->execute($query_data); |
| 984 | - $ident_result=''; |
|
| 985 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 984 | + $ident_result = ''; |
|
| 985 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 986 | 986 | { |
| 987 | 987 | $ident_result = $row['fammarine_id']; |
| 988 | 988 | } |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | * @return String success or false |
| 1001 | 1001 | * |
| 1002 | 1002 | */ |
| 1003 | - public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
| 1003 | + public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
| 1004 | 1004 | { |
| 1005 | 1005 | global $globalURL, $globalArchive, $globalDebug; |
| 1006 | 1006 | $Common = new Common(); |
@@ -1052,37 +1052,37 @@ discard block |
||
| 1052 | 1052 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 1053 | 1053 | |
| 1054 | 1054 | |
| 1055 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
| 1056 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1057 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1058 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1059 | - $distance = filter_var($distance,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1060 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 1061 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1062 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 1063 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 1064 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 1065 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 1066 | - $typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
| 1067 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
| 1068 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
| 1069 | - $statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
| 1070 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
| 1071 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 1072 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
| 1073 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
| 1074 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
| 1075 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
| 1076 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
| 1077 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
| 1078 | - $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
|
| 1079 | - $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1055 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
| 1056 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1057 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1058 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1059 | + $distance = filter_var($distance, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1060 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 1061 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1062 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 1063 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 1064 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 1065 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 1066 | + $typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
| 1067 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
| 1068 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
| 1069 | + $statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
| 1070 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
| 1071 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 1072 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
| 1073 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
| 1074 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
| 1075 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
| 1076 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
| 1077 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
| 1078 | + $race_rank = filter_var($race_rank, FILTER_SANITIZE_NUMBER_INT); |
|
| 1079 | + $race_time = filter_var($race_time, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1080 | 1080 | if ($typeid == '') $typeid = NULL; |
| 1081 | 1081 | if ($statusid == '') $statusid = NULL; |
| 1082 | 1082 | if ($distance == '') $distance = NULL; |
| 1083 | 1083 | |
| 1084 | 1084 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
| 1085 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1085 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 1086 | 1086 | if ($arrival_date == '') $arrival_date = NULL; |
| 1087 | 1087 | $query = ''; |
| 1088 | 1088 | if ($globalArchive) { |
@@ -1091,19 +1091,19 @@ discard block |
||
| 1091 | 1091 | } |
| 1092 | 1092 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) |
| 1093 | 1093 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name,:distance,:race_rank,:race_time)'; |
| 1094 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name,':distance' => $distance,':race_time' => $race_time,':race_rank' => $race_rank); |
|
| 1094 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name, ':distance' => $distance, ':race_time' => $race_time, ':race_rank' => $race_rank); |
|
| 1095 | 1095 | try { |
| 1096 | 1096 | $sth = $this->db->prepare($query); |
| 1097 | 1097 | $sth->execute($query_values); |
| 1098 | 1098 | $sth->closeCursor(); |
| 1099 | - } catch(PDOException $e) { |
|
| 1099 | + } catch (PDOException $e) { |
|
| 1100 | 1100 | return "error : ".$e->getMessage(); |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | 1103 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1104 | 1104 | if ($globalDebug) echo '(Add to Marine archive : '; |
| 1105 | 1105 | $MarineArchive = new MarineArchive($this->db); |
| 1106 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time); |
|
| 1106 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country, $captain_id, $captain_name, $race_id, $race_name, $distance, $race_rank, $race_time); |
|
| 1107 | 1107 | if ($globalDebug) echo $result.')'; |
| 1108 | 1108 | } |
| 1109 | 1109 | return "success"; |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | |
| 1112 | 1112 | public function getOrderBy() |
| 1113 | 1113 | { |
| 1114 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
| 1114 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
| 1115 | 1115 | return $orderby; |
| 1116 | 1116 | } |
| 1117 | 1117 | |
@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | public function __construct($dbc = null) { |
| 16 | 16 | $Connection = new Connection($dbc); |
| 17 | 17 | $this->db = $Connection->db(); |
| 18 | - if ($this->db === null) die('Error: No DB connection. (MarineLive)'); |
|
| 18 | + if ($this->db === null) { |
|
| 19 | + die('Error: No DB connection. (MarineLive)'); |
|
| 20 | + } |
|
| 19 | 21 | } |
| 20 | 22 | |
| 21 | 23 | |
@@ -37,7 +39,9 @@ discard block |
||
| 37 | 39 | if (isset($filter[0]['source'])) { |
| 38 | 40 | $filters = array_merge($filters,$filter); |
| 39 | 41 | } |
| 40 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 42 | + if (is_array($globalFilter)) { |
|
| 43 | + $filter = array_merge($filter,$globalFilter); |
|
| 44 | + } |
|
| 41 | 45 | $filter_query_join = ''; |
| 42 | 46 | $filter_query_where = ''; |
| 43 | 47 | foreach($filters as $flt) { |
@@ -93,8 +97,11 @@ discard block |
||
| 93 | 97 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 94 | 98 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 95 | 99 | } |
| 96 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 97 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 100 | + if ($filter_query_where == '' && $where) { |
|
| 101 | + $filter_query_where = ' WHERE'; |
|
| 102 | + } elseif ($filter_query_where != '' && $and) { |
|
| 103 | + $filter_query_where .= ' AND'; |
|
| 104 | + } |
|
| 98 | 105 | if ($filter_query_where != '') { |
| 99 | 106 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 100 | 107 | } |
@@ -135,9 +142,13 @@ discard block |
||
| 135 | 142 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 136 | 143 | } |
| 137 | 144 | } |
| 138 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 145 | + if ($orderby_query == '') { |
|
| 146 | + $orderby_query= ' ORDER BY date DESC'; |
|
| 147 | + } |
|
| 139 | 148 | |
| 140 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 149 | + if (!isset($globalLiveInterval)) { |
|
| 150 | + $globalLiveInterval = '200'; |
|
| 151 | + } |
|
| 141 | 152 | if ($globalDBdriver == 'mysql') { |
| 142 | 153 | //$query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate"; |
| 143 | 154 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -162,7 +173,9 @@ discard block |
||
| 162 | 173 | |
| 163 | 174 | $filter_query = $this->getFilter($filter,true,true); |
| 164 | 175 | |
| 165 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 176 | + if (!isset($globalLiveInterval)) { |
|
| 177 | + $globalLiveInterval = '200'; |
|
| 178 | + } |
|
| 166 | 179 | if ($globalDBdriver == 'mysql') { |
| 167 | 180 | $query = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 168 | 181 | FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY marine_live.race_rank"; |
@@ -204,58 +217,96 @@ discard block |
||
| 204 | 217 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
| 205 | 218 | $filter_query = $this->getFilter($filter,true,true); |
| 206 | 219 | |
| 207 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 208 | - if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
|
| 220 | + if (!isset($globalLiveInterval)) { |
|
| 221 | + $globalLiveInterval = '200'; |
|
| 222 | + } |
|
| 223 | + if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') { |
|
| 224 | + $globalMap3DMarinesLimit = '300'; |
|
| 225 | + } |
|
| 209 | 226 | if ($globalDBdriver == 'mysql') { |
| 210 | 227 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 211 | 228 | $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
| 212 | 229 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 213 | - if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 214 | - if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 230 | + if ($usecoord) { |
|
| 231 | + $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 232 | + } |
|
| 233 | + if ($id != '') { |
|
| 234 | + $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 235 | + } |
|
| 215 | 236 | $query .= "UNION |
| 216 | 237 | SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 217 | 238 | FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date"; |
| 218 | - if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 219 | - if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
|
| 239 | + if ($usecoord) { |
|
| 240 | + $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 241 | + } |
|
| 242 | + if ($id != '') { |
|
| 243 | + $query .= "OR marine_live.fammarine_id = :id "; |
|
| 244 | + } |
|
| 220 | 245 | $query .= ") AS marine |
| 221 | 246 | WHERE latitude <> '0' AND longitude <> '0' |
| 222 | 247 | ORDER BY fammarine_id, date"; |
| 223 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 248 | + if ($limit) { |
|
| 249 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 250 | + } |
|
| 224 | 251 | } else { |
| 225 | 252 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 226 | 253 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date "; |
| 227 | - if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 228 | - if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
|
| 254 | + if ($usecoord) { |
|
| 255 | + $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 256 | + } |
|
| 257 | + if ($id != '') { |
|
| 258 | + $query .= "OR marine_live.fammarine_id = :id "; |
|
| 259 | + } |
|
| 229 | 260 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 230 | 261 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 231 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 262 | + if ($limit) { |
|
| 263 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 264 | + } |
|
| 232 | 265 | } |
| 233 | 266 | } else { |
| 234 | 267 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 235 | 268 | $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
| 236 | 269 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 237 | - if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 238 | - if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 270 | + if ($usecoord) { |
|
| 271 | + $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 272 | + } |
|
| 273 | + if ($id != '') { |
|
| 274 | + $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 275 | + } |
|
| 239 | 276 | $query .= "UNION |
| 240 | 277 | SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 241 | 278 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date"; |
| 242 | - if ($usecoord) $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 243 | - if ($id != '') $query .= " OR marine_live.fammarine_id = :id"; |
|
| 279 | + if ($usecoord) { |
|
| 280 | + $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 281 | + } |
|
| 282 | + if ($id != '') { |
|
| 283 | + $query .= " OR marine_live.fammarine_id = :id"; |
|
| 284 | + } |
|
| 244 | 285 | $query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' "; |
| 245 | 286 | $query .= "ORDER BY fammarine_id, date"; |
| 246 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 287 | + if ($limit) { |
|
| 288 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 289 | + } |
|
| 247 | 290 | } else { |
| 248 | 291 | $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 249 | 292 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date "; |
| 250 | - if ($usecoord) $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 251 | - if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
|
| 293 | + if ($usecoord) { |
|
| 294 | + $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 295 | + } |
|
| 296 | + if ($id != '') { |
|
| 297 | + $query .= "OR marine_live.fammarine_id = :id "; |
|
| 298 | + } |
|
| 252 | 299 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 253 | 300 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 254 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 301 | + if ($limit) { |
|
| 302 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 303 | + } |
|
| 255 | 304 | } |
| 256 | 305 | } |
| 257 | 306 | $query_values = array(); |
| 258 | - if ($id != '') $query_values = array(':id' => $id); |
|
| 307 | + if ($id != '') { |
|
| 308 | + $query_values = array(':id' => $id); |
|
| 309 | + } |
|
| 259 | 310 | try { |
| 260 | 311 | $sth = $this->db->prepare($query); |
| 261 | 312 | $sth->execute($query_values); |
@@ -280,8 +331,12 @@ discard block |
||
| 280 | 331 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
| 281 | 332 | $filter_query = $this->getFilter($filter,true,true); |
| 282 | 333 | |
| 283 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 284 | - if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
|
| 334 | + if (!isset($globalLiveInterval)) { |
|
| 335 | + $globalLiveInterval = '200'; |
|
| 336 | + } |
|
| 337 | + if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') { |
|
| 338 | + $globalMap3DMarinesLimit = '300'; |
|
| 339 | + } |
|
| 285 | 340 | if ($globalDBdriver == 'mysql') { |
| 286 | 341 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 287 | 342 | $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
@@ -292,13 +347,17 @@ discard block |
||
| 292 | 347 | $query .= ") AS marine |
| 293 | 348 | WHERE latitude <> '0' AND longitude <> '0' |
| 294 | 349 | ORDER BY fammarine_id, date"; |
| 295 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 350 | + if ($limit) { |
|
| 351 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 352 | + } |
|
| 296 | 353 | } else { |
| 297 | 354 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 298 | 355 | FROM marine_live'.$filter_query.' marine_live.fammarine_id = :id '; |
| 299 | 356 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 300 | 357 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 301 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 358 | + if ($limit) { |
|
| 359 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 360 | + } |
|
| 302 | 361 | } |
| 303 | 362 | } else { |
| 304 | 363 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -310,13 +369,17 @@ discard block |
||
| 310 | 369 | $query .= ") AS marine |
| 311 | 370 | WHERE latitude <> '0' AND longitude <> '0' |
| 312 | 371 | ORDER BY fammarine_id, date"; |
| 313 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 372 | + if ($limit) { |
|
| 373 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 374 | + } |
|
| 314 | 375 | } else { |
| 315 | 376 | $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 316 | 377 | FROM marine_live".$filter_query." marine_live.fammarine_id = :id "; |
| 317 | 378 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 318 | 379 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 319 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 380 | + if ($limit) { |
|
| 381 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 382 | + } |
|
| 320 | 383 | } |
| 321 | 384 | } |
| 322 | 385 | $query_values = array(':id' => $id); |
@@ -342,7 +405,9 @@ discard block |
||
| 342 | 405 | global $globalDBdriver, $globalLiveInterval; |
| 343 | 406 | $filter_query = $this->getFilter($filter,true,true); |
| 344 | 407 | |
| 345 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 408 | + if (!isset($globalLiveInterval)) { |
|
| 409 | + $globalLiveInterval = '200'; |
|
| 410 | + } |
|
| 346 | 411 | if ($globalDBdriver == 'mysql') { |
| 347 | 412 | $query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 348 | 413 | } else { |
@@ -370,7 +435,9 @@ discard block |
||
| 370 | 435 | { |
| 371 | 436 | global $globalDBdriver, $globalLiveInterval; |
| 372 | 437 | $Marine = new Marine($this->db); |
| 373 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 438 | + if (!isset($globalLiveInterval)) { |
|
| 439 | + $globalLiveInterval = '200'; |
|
| 440 | + } |
|
| 374 | 441 | $filter_query = $this->getFilter($filter); |
| 375 | 442 | |
| 376 | 443 | if (is_array($coord)) { |
@@ -378,7 +445,9 @@ discard block |
||
| 378 | 445 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 379 | 446 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 380 | 447 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 381 | - } else return array(); |
|
| 448 | + } else { |
|
| 449 | + return array(); |
|
| 450 | + } |
|
| 382 | 451 | if ($globalDBdriver == 'mysql') { |
| 383 | 452 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query; |
| 384 | 453 | } else { |
@@ -398,7 +467,9 @@ discard block |
||
| 398 | 467 | { |
| 399 | 468 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 400 | 469 | $Marine = new Marine($this->db); |
| 401 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 470 | + if (!isset($globalLiveInterval)) { |
|
| 471 | + $globalLiveInterval = '200'; |
|
| 472 | + } |
|
| 402 | 473 | $filter_query = $this->getFilter($filter,true,true); |
| 403 | 474 | |
| 404 | 475 | if (is_array($coord)) { |
@@ -406,7 +477,9 @@ discard block |
||
| 406 | 477 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 407 | 478 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 408 | 479 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 409 | - } else return array(); |
|
| 480 | + } else { |
|
| 481 | + return array(); |
|
| 482 | + } |
|
| 410 | 483 | /* |
| 411 | 484 | if ($globalDBdriver == 'mysql') { |
| 412 | 485 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
@@ -629,11 +702,15 @@ discard block |
||
| 629 | 702 | //$query = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date'; |
| 630 | 703 | if ($globalDBdriver == 'mysql') { |
| 631 | 704 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 632 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 705 | + if ($liveinterval) { |
|
| 706 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 707 | + } |
|
| 633 | 708 | $query .= ' ORDER BY date'; |
| 634 | 709 | } else { |
| 635 | 710 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 636 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 711 | + if ($liveinterval) { |
|
| 712 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 713 | + } |
|
| 637 | 714 | $query .= ' ORDER BY date'; |
| 638 | 715 | } |
| 639 | 716 | |
@@ -728,7 +805,9 @@ discard block |
||
| 728 | 805 | $i++; |
| 729 | 806 | $j++; |
| 730 | 807 | if ($j == 30) { |
| 731 | - if ($globalDebug) echo "."; |
|
| 808 | + if ($globalDebug) { |
|
| 809 | + echo "."; |
|
| 810 | + } |
|
| 732 | 811 | try { |
| 733 | 812 | |
| 734 | 813 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -1022,7 +1101,9 @@ discard block |
||
| 1022 | 1101 | { |
| 1023 | 1102 | return false; |
| 1024 | 1103 | } |
| 1025 | - } else return ''; |
|
| 1104 | + } else { |
|
| 1105 | + return ''; |
|
| 1106 | + } |
|
| 1026 | 1107 | |
| 1027 | 1108 | if ($longitude != '') |
| 1028 | 1109 | { |
@@ -1030,7 +1111,9 @@ discard block |
||
| 1030 | 1111 | { |
| 1031 | 1112 | return false; |
| 1032 | 1113 | } |
| 1033 | - } else return ''; |
|
| 1114 | + } else { |
|
| 1115 | + return ''; |
|
| 1116 | + } |
|
| 1034 | 1117 | |
| 1035 | 1118 | |
| 1036 | 1119 | if ($heading != '') |
@@ -1039,7 +1122,9 @@ discard block |
||
| 1039 | 1122 | { |
| 1040 | 1123 | return false; |
| 1041 | 1124 | } |
| 1042 | - } else $heading = 0; |
|
| 1125 | + } else { |
|
| 1126 | + $heading = 0; |
|
| 1127 | + } |
|
| 1043 | 1128 | |
| 1044 | 1129 | if ($groundspeed != '') |
| 1045 | 1130 | { |
@@ -1047,9 +1132,13 @@ discard block |
||
| 1047 | 1132 | { |
| 1048 | 1133 | return false; |
| 1049 | 1134 | } |
| 1050 | - } else $groundspeed = 0; |
|
| 1135 | + } else { |
|
| 1136 | + $groundspeed = 0; |
|
| 1137 | + } |
|
| 1051 | 1138 | date_default_timezone_set('UTC'); |
| 1052 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 1139 | + if ($date == '') { |
|
| 1140 | + $date = date("Y-m-d H:i:s", time()); |
|
| 1141 | + } |
|
| 1053 | 1142 | |
| 1054 | 1143 | |
| 1055 | 1144 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1077,16 +1166,28 @@ discard block |
||
| 1077 | 1166 | $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
| 1078 | 1167 | $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
| 1079 | 1168 | $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1080 | - if ($typeid == '') $typeid = NULL; |
|
| 1081 | - if ($statusid == '') $statusid = NULL; |
|
| 1082 | - if ($distance == '') $distance = NULL; |
|
| 1169 | + if ($typeid == '') { |
|
| 1170 | + $typeid = NULL; |
|
| 1171 | + } |
|
| 1172 | + if ($statusid == '') { |
|
| 1173 | + $statusid = NULL; |
|
| 1174 | + } |
|
| 1175 | + if ($distance == '') { |
|
| 1176 | + $distance = NULL; |
|
| 1177 | + } |
|
| 1083 | 1178 | |
| 1084 | 1179 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
| 1085 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1086 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 1180 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1181 | + $heading = 0; |
|
| 1182 | + } |
|
| 1183 | + if ($arrival_date == '') { |
|
| 1184 | + $arrival_date = NULL; |
|
| 1185 | + } |
|
| 1087 | 1186 | $query = ''; |
| 1088 | 1187 | if ($globalArchive) { |
| 1089 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 1188 | + if ($globalDebug) { |
|
| 1189 | + echo '-- Delete previous data -- '; |
|
| 1190 | + } |
|
| 1090 | 1191 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
| 1091 | 1192 | } |
| 1092 | 1193 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) |
@@ -1101,10 +1202,14 @@ discard block |
||
| 1101 | 1202 | } |
| 1102 | 1203 | |
| 1103 | 1204 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1104 | - if ($globalDebug) echo '(Add to Marine archive : '; |
|
| 1205 | + if ($globalDebug) { |
|
| 1206 | + echo '(Add to Marine archive : '; |
|
| 1207 | + } |
|
| 1105 | 1208 | $MarineArchive = new MarineArchive($this->db); |
| 1106 | 1209 | $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time); |
| 1107 | - if ($globalDebug) echo $result.')'; |
|
| 1210 | + if ($globalDebug) { |
|
| 1211 | + echo $result.')'; |
|
| 1212 | + } |
|
| 1108 | 1213 | } |
| 1109 | 1214 | return "success"; |
| 1110 | 1215 | } |