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", [ "publicid", "name", "username", "verified", "latitude", "longitude" ], [ "AND" => [ 'latitude[>]' => $searchbounds[0]->getLatitudeInDegrees(), 'latitude[<]' => $searchbounds[1]->getLatitudeInDegrees(), 'longitude[>]' => $searchbounds[0]->getLongitudeInDegrees(), 'longitude[<]' => $searchbounds[1]->getLongitudeInDegrees(), "lastgpsfix[>]" => date("Y-m-d H:i:s", strtotime("-1 hour")), "type" => 2 ], "LIMIT" => 20 ] ); $people = $database->query(ob_get_contents())->fetchAll(); ob_end_clean(); // No more really bad code allowed past this point $nearby = []; foreach ($people as $person) { $nearby[] = [ "name" => (empty($person["name"]) ? $person["username"] : $person["name"]), "username" => $person["username"], "verified" => $person["verified"] == 1, "publicid" => $person["publicid"], "latitude" => $person["latitude"] * 1.0, "longitude" => $person["longitude"] * 1.0 ]; } exitWithJson([ "status" => "OK", "radius" => $radius, "bounds" => [ 0 => [ "latitude" => $searchbounds[0]->getLatitudeInDegrees(), "longitude" => $searchbounds[0]->getLongitudeInDegrees() ], 1 => [ "latitude" => $searchbounds[1]->getLatitudeInDegrees(), "longitude" => $searchbounds[1]->getLongitudeInDegrees() ], ], "nearby" => $nearby ]);