diff --git a/VKAPI/Handlers/Wall.php b/VKAPI/Handlers/Wall.php
index bb8e45b3..126c1980 100644
--- a/VKAPI/Handlers/Wall.php
+++ b/VKAPI/Handlers/Wall.php
@@ -436,16 +436,19 @@ final class Wall extends VKAPIRequestHandler
$geo = NULL;
if ($latitude && $longitude) {
+ $latitude = number_format($latitude, 8, ".", '');
+ $longitude = number_format($longitude, 8, ".", '');
+
+ if ((!$latitude || !$longitude) || ($latitude > 90 || $latitude < -90 || $longitude > 180 || $longitude < -180)) {
+ $this->fail(100, "Invalid latitude or longitude");
+ }
+
$geo = array(
"name" => null,
"lat" => $latitude,
"lng" => $longitude,
);
- if ($latitude > 90 || $latitude < -90 || $longitude > 180 || $longitude < -180) {
- $this->fail(100, "Invalid latitude or longitude");
- }
-
if (strlen(trim($geo_name))) {
$geo["name"] = $geo_name;
} else {
diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php
index 0e54ed39..3996c527 100644
--- a/Web/Presenters/WallPresenter.php
+++ b/Web/Presenters/WallPresenter.php
@@ -301,8 +301,8 @@ final class WallPresenter extends OpenVKPresenter
$this->flashFail("err", tr("error"), tr("error_geolocation"));
}
- $latitude = (float) $geo["lat"];
- $longitude = (float) $geo["lng"];
+ $latitude = number_format((float) $geo["lat"], 8, ".", '');
+ $longitude = number_format((float) $geo["lng"], 8, ".", '');
if ($latitude > 90 || $latitude < -90 || $longitude > 180 || $longitude < -180) {
$this->flashFail("err", tr("error"), "Invalid latitude or longitude");
}
diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js
index 0c38c60a..e123e718 100644
--- a/Web/static/js/al_wall.js
+++ b/Web/static/js/al_wall.js
@@ -269,7 +269,7 @@ async function initGeo(tid) {
let marker = {
lat: currentMarker._latlng.lat,
lng: currentMarker._latlng.lng,
- name: $(`#geo-name-input-${tid}`).val() ?? currentMarker._popup._content
+ name: $(`#geo-name-input-${tid}`).val() ? $(`#geo-name-input-${tid}`).val() : $(`#geo-name-${tid}`).text()
};
$(`#post-buttons${tid} #geo`).val(JSON.stringify(marker));
$(`#post-buttons${tid} .post-has-geo`).text(`${tr("geotag")}: ${marker.name}`);
@@ -305,7 +305,7 @@ async function initGeo(tid) {
let name = response?.name ?? response?.display_name ?? tr("geotag");
let content = `${name}`;
- content += ``;
+ content += ``;
currentMarker.bindPopup(content).openPopup();
markerLayers.addLayer(currentMarker);
diff --git a/install/sqls/00038-posts-geo.sql b/install/sqls/00038-posts-geo.sql
index 230abe65..c062227a 100644
--- a/install/sqls/00038-posts-geo.sql
+++ b/install/sqls/00038-posts-geo.sql
@@ -1,4 +1,4 @@
ALTER TABLE `posts`
ADD `geo` LONGTEXT NULL DEFAULT NULL AFTER `deleted`,
- ADD `geo_lat` DECIMAL(10, 8) NULL DEFAULT NULL AFTER `geo`,
- ADD `geo_lon` DECIMAL(10, 8) NULL DEFAULT NULL AFTER `geo_lat`;
+ ADD `geo_lat` DECIMAL(12, 8) NULL DEFAULT NULL AFTER `geo`,
+ ADD `geo_lon` DECIMAL(12, 8) NULL DEFAULT NULL AFTER `geo_lat`;