mirror of
https://github.com/openvk/openvk
synced 2024-11-15 03:31:18 +03:00
Update WallPresenter.php
This commit is contained in:
parent
22ab724ab4
commit
92690767a1
1 changed files with 8 additions and 2 deletions
|
@ -300,6 +300,12 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
if (!$geo["lat"] || !$geo["lng"] || !$geo["name"]) {
|
if (!$geo["lat"] || !$geo["lng"] || !$geo["name"]) {
|
||||||
$this->flashFail("err", tr("error"), tr("error_geolocation"));
|
$this->flashFail("err", tr("error"), tr("error_geolocation"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$latitude = (float) $geo["lat"];
|
||||||
|
$longitude = (float) $geo["lng"];
|
||||||
|
if ($latitude > 90 || $latitude < -90 || $longitude > 180 || $longitude < -180) {
|
||||||
|
$this->flashFail("err", tr("error"), "Invalid latitude or longitude");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($this->postParam("text")) && !$photo && !$video && !$poll && !$note && !$geo)
|
if(empty($this->postParam("text")) && !$photo && !$video && !$poll && !$note && !$geo)
|
||||||
|
@ -316,8 +322,8 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
$post->setNsfw($this->postParam("nsfw") === "on");
|
$post->setNsfw($this->postParam("nsfw") === "on");
|
||||||
if ($geo) {
|
if ($geo) {
|
||||||
$post->setGeo(json_encode($geo));
|
$post->setGeo(json_encode($geo));
|
||||||
$post->setGeo_Lat($geo["lat"]);
|
$post->setGeo_Lat($latitude);
|
||||||
$post->setGeo_Lon($geo["lng"]);
|
$post->setGeo_Lon($longitude);
|
||||||
}
|
}
|
||||||
$post->save();
|
$post->save();
|
||||||
} catch (\LengthException $ex) {
|
} catch (\LengthException $ex) {
|
||||||
|
|
Loading…
Reference in a new issue