Get worldwide chat messages by default when no radius specified

master
Skylar Ittner 4 years ago
parent 9697235891
commit 600fe917e5

@ -19,22 +19,24 @@ $database->update("players", [
"accountid" => getRequestUser()->getUID() "accountid" => getRequestUser()->getUID()
]); ]);
$radius = 2;
if (!empty($VARS["radius"])) {
$radius = min(10.0, $VARS["radius"] * 1.0);
}
$searchbounds = $userlocation->boundingCoordinates($radius, "miles");
$where = [ $where = [
"LIMIT" => 100, "LIMIT" => 100,
"ORDER" => "time" "ORDER" => "time"
]; ];
if (!empty($VARS["latitude"]) && !empty($VARS["longitude"])) { $radius = false;
$where["AND"] = [ if (!empty($VARS["radius"])) {
'lat[<>]' => [$searchbounds[0]->getLatitudeInDegrees(), $searchbounds[1]->getLatitudeInDegrees()], $radius = min(10.0, $VARS["radius"] * 1.0);
'long[<>]' => [$searchbounds[0]->getLongitudeInDegrees(), $searchbounds[1]->getLongitudeInDegrees()], }
]; if ($radius != false) {
$searchbounds = $userlocation->boundingCoordinates($radius, "miles");
if (!empty($VARS["latitude"]) && !empty($VARS["longitude"])) {
$where["AND"] = [
'lat[<>]' => [$searchbounds[0]->getLatitudeInDegrees(), $searchbounds[1]->getLatitudeInDegrees()],
'long[<>]' => [$searchbounds[0]->getLongitudeInDegrees(), $searchbounds[1]->getLongitudeInDegrees()],
];
}
} }
ob_flush(); ob_flush();

Loading…
Cancel
Save