]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/search.php
move error messages to consistent 'userError' function and return 400 Bad Request
[nominatim.git] / website / search.php
index ff82cadd4f66846c47eda076b75324e0707f34a5..ee7979dc4c54b7d08a8e5ecfb2cedd90c25d679f 100755 (executable)
           + ($bAsKML?1:0) 
           + ($bAsSVG?1:0) 
           + ($bAsTEXT?1:0) 
-               ) > 1) {
-               echo "Select only one polgyon output option";
+               ) > CONST_PolygonOutput_MaximumTypes) {
+               if (CONST_PolygonOutput_MaximumTypes) {
+                       userError("Select only ".CONST_PolygonOutput_MaximumTypes." polgyon output option");
+               } else {
+                       userError("Polygon output is disabled");
+               }
                exit;
        }
 
                        $aPoints = explode(',',$_GET['route']);
                        if (sizeof($aPoints) % 2 != 0)
                        {
-                               echo "Uneven number of points";
+                               userError("Uneven number of points");
                                exit;
                        }
                        $sViewboxCentreSQL = "ST_SetSRID('LINESTRING(";
                                $aPhrase = $oDB->getRow("select make_standard_name('".pg_escape_string($sPhrase)."') as string");
                                if (PEAR::isError($aPhrase))
                                {
-                                       echo "Illegal query string (not an UTF-8 string): ".$sPhrase;
+                                       userError("Illegal query string (not an UTF-8 string): ".$sPhrase);
                                        if (CONST_Debug) var_dump($aPhrase);
                                        exit;
                                }