From 5be0f828c1cdf9f69aefdcc158fc06f2f5a67cfc Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 11 Jun 2015 15:51:47 +0200 Subject: [PATCH] restrict viewbox size --- lib/Geocode.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Geocode.php b/lib/Geocode.php index a9fe9611..a9fa44fe 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -148,9 +148,15 @@ $this->bBoundedSearch = (bool)$bBoundedSearch; } - function setViewBox($fLeft, $fBottom, $fRight, $fTop) + function setViewBox($sLeft, $sBottom, $sRight, $sTop) { - $this->aViewBox = array($fLeft, $fBottom, $fRight, $fTop); + $fLeft = (float)$sLeft; + $fRight = (float)$sRight; + $fTop = (float)$sTop; + $fBottom = (float)$sBottom; + if ($fRight > $fLeft && $fBottom > $fTop + && ($fRight - $fLeft) < 2 && ($fBottom - $fTop) < 2) + $this->aViewBox = array($fLeft, $fBottom, $fRight, $fTop); } function getViewBoxString() -- 2.39.5