'.$tit.'
'.$des.'
Last updated: '.$lst.'
Status: Rentable, Gallery Offline")
.bindTooltip("'.$nam.'").setIcon(availableIcon);';
} elseif ($rnt == false && $act === 'ACTIVE') {
$marker = 'var scooter'.$id.' = L.marker(['.$pos.'], {time: "'.$lst.'"}).addTo(map)
.bindPopup("'.$tit.'
'.$des.'
Last updated: '.$lst.'
Status: Rented Out, Gallery Online")
.bindTooltip("'.$nam.'").setIcon(isRentedIcon);';
};
//check if scooter is in maintenace
if($act !== "ACTIVE"){
$marker = 'var scooter'.$id.' = L.marker(['.$pos.'], {time: "'.$lst.'"}).addTo(map)
.bindPopup("'.$tit.'
'.$des.'
Last updated: '.$lst.'")
.bindTooltip("'.$nam.'").setIcon(isMaintenanceIcon);';
};
return $marker;
}
//// make date time file------
// TODO save json to file?...mmm one big one? seperate ones, timestamped ones?
// 60 second update interval
// make timestamp file like original python one! to check for updates
// make new custom json:
// scooter 1/marker time1 { lat long }
// time2 { lat long }
// scooter 2/marker time1 { lat long }
// time2 { lat long }
//
//
// for each
// check if lastlocation is different...if update > latest file (map file..)
// check if is rentable
// TODO make two files
// 1: current position and state of scooter, latlong, id, status
// 2: historical json file, contains all scooters, updated everytime php file is loaded (or every 60 sec). No state changes, only lat long and time. even if time does not change
// Custom functions
function checkModified($file, $expiration){ //check if file is older than expiration time
}
function parseJSON(){
}
function callAPI($url){
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'x-api-key: bpEUTJEBTf74oGRWxaIcW7aeZMzDDODe1yBoSxi2',
'Content-Type: application/json',
)); // set the api key
curl_setopt($curl, CURLOPT_USERAGENT,'ProductionRelease/3.8.2 (app.tier.sharing; build:3.8.2.0; iOS 12.4.4) Alamofire/4.9.1'); // set user-agent to that of the Tier.app, sniffed by burpsuite
$result = curl_exec($curl);
if(!$result){die("Connection Failure");}
curl_close($curl);
return $result;
}
?>