|
|
|
@ -10,17 +10,13 @@ use AnthonyMartin\GeoLocation\GeoLocation as GeoLocation;
|
|
|
|
|
|
|
|
|
|
$userlocation = GeoLocation::fromDegrees($VARS["latitude"], $VARS["longitude"]);
|
|
|
|
|
|
|
|
|
|
$radius = 0.25;
|
|
|
|
|
$radius = 2;
|
|
|
|
|
if (!empty($VARS["radius"])) {
|
|
|
|
|
$radius = min(10, $VARS["radius"] * 1.0);
|
|
|
|
|
$radius = min(10.0, $VARS["radius"] * 1.0);
|
|
|
|
|
}
|
|
|
|
|
$searchbounds = $userlocation->boundingCoordinates($radius, "miles");
|
|
|
|
|
|
|
|
|
|
// (NPR voice): The following horrible workaround is brought to you by:
|
|
|
|
|
// Medoo bugs #797, #828, member stations, and viewers like you
|
|
|
|
|
ob_end_flush();
|
|
|
|
|
ob_start();
|
|
|
|
|
$people = $database->debug()->select("accounts", [
|
|
|
|
|
$people = $database->select("accounts", [
|
|
|
|
|
"publicid",
|
|
|
|
|
"name",
|
|
|
|
|
"username",
|
|
|
|
@ -29,20 +25,14 @@ $people = $database->debug()->select("accounts", [
|
|
|
|
|
"longitude"
|
|
|
|
|
], [
|
|
|
|
|
"AND" => [
|
|
|
|
|
'latitude[>]' => $searchbounds[0]->getLatitudeInDegrees(),
|
|
|
|
|
'latitude[<]' => $searchbounds[1]->getLatitudeInDegrees(),
|
|
|
|
|
'longitude[>]' => $searchbounds[0]->getLongitudeInDegrees(),
|
|
|
|
|
'longitude[<]' => $searchbounds[1]->getLongitudeInDegrees(),
|
|
|
|
|
'latitude[><]' => [$searchbounds[0]->getLatitudeInDegrees(), $searchbounds[1]->getLatitudeInDegrees()],
|
|
|
|
|
'longitude[><]' => [$searchbounds[0]->getLongitudeInDegrees(), $searchbounds[1]->getLongitudeInDegrees()],
|
|
|
|
|
"lastgpsfix[>]" => date("Y-m-d H:i:s", strtotime("-1 hour")),
|
|
|
|
|
"type" => 2
|
|
|
|
|
],
|
|
|
|
|
"LIMIT" => 20
|
|
|
|
|
"LIMIT" => 100
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
$people = $database->query(ob_get_contents())->fetchAll();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
// No more really bad code allowed past this point
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$nearby = [];
|
|
|
|
|
|
|
|
|
|