]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/Geocode.php
remove IP blocking and rate-limiting code
[nominatim.git] / lib / Geocode.php
index aa65cb69faebc22bf37e8f899c761f9260e8f117..a01abbc564dd26a869eb57cdf212c1f64f62c16a 100644 (file)
 
                        $sSQL .= " order by importance desc";
                        if (CONST_Debug) { echo "<hr>"; var_dump($sSQL); }
-                       $aSearchResults = chksql($this->oDB->getAll($sSQL);
+                       $aSearchResults = chksql($this->oDB->getAll($sSQL),
                                                 "Could not get details for place.");
 
                        return $aSearchResults;
                                $sViewboxCentreSQL .= ")'::geometry,4326)";
 
                                $sSQL = "select st_buffer(".$sViewboxCentreSQL.",".(float)($_GET['routewidth']/69).")";
-                               $this->sViewboxSmallSQL = chksql($this->oDB->getOne($sSQL);
+                               $this->sViewboxSmallSQL = chksql($this->oDB->getOne($sSQL),
                                                                 "Could not get small viewbox.");
                                $this->sViewboxSmallSQL = "'".$this->sViewboxSmallSQL."'::geometry";
 
                                                                }
                                                        }
                                                }
+                                               // If a coordinate is given, the search must either
+                                               // be for a name or a special search. Ignore everythin else.
+                                               else if ($aSearch['fLon'] && !sizeof($aSearch['aName']) && !sizeof($aSearch['aAddress']) && !$aSearch['sClass'])
+                                               {
+                                                       $aPlaceIDs = array();
+                                               }
                                                else
                                                {
                                                        $aPlaceIDs = array();
                                                                        $sSQL .= " limit ".$this->iLimit;
 
                                                                if (CONST_Debug) { var_dump($sSQL); }
-                                                               $aViewBoxPlaceIDs = chksql($this->oDB->getAll($sSQL));
+                                                               $aViewBoxPlaceIDs = chksql($this->oDB->getAll($sSQL),
                                                                                           "Could not get places for search terms.");
-                                                               }
                                                                //var_dump($aViewBoxPlaceIDs);
                                                                // Did we have an viewbox matches?
                                                                $aPlaceIDs = array();
 
                                                }
 
-                                               if (PEAR::IsError($aPlaceIDs))
-                                               {
-                                                       failInternalError("Could not get place IDs from tokens." ,$sSQL, $aPlaceIDs);
-                                               }
-
                                                if (CONST_Debug) { echo "<br><b>Place IDs:</b> "; var_Dump($aPlaceIDs); }
 
                                                foreach($aPlaceIDs as $iPlaceID)