]> git.openstreetmap.org Git - nominatim.git/commitdiff
restrict viewbox size
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 11 Jun 2015 13:51:47 +0000 (15:51 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 11 Jun 2015 13:51:47 +0000 (15:51 +0200)
lib/Geocode.php

index a9fe96114ad1093a68a8d84976d04ed809dea2da..a9fa44fe0578976c9f77b45e491ae7dd5b073fa3 100644 (file)
                        $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()