diff --git a/lib/Geocode.php b/lib/Geocode.php
index aa65cb69..876a40b5 100644
--- a/lib/Geocode.php
+++ b/lib/Geocode.php
@@ -514,7 +514,7 @@
$sSQL .= " order by importance desc";
if (CONST_Debug) { echo "
"; var_dump($sSQL); }
- $aSearchResults = chksql($this->oDB->getAll($sSQL);
+ $aSearchResults = chksql($this->oDB->getAll($sSQL),
"Could not get details for place.");
return $aSearchResults;
@@ -879,7 +879,7 @@
$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";
@@ -1414,9 +1414,8 @@
$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();
@@ -1638,11 +1637,6 @@
}
- if (PEAR::IsError($aPlaceIDs))
- {
- failInternalError("Could not get place IDs from tokens." ,$sSQL, $aPlaceIDs);
- }
-
if (CONST_Debug) { echo "
Place IDs: "; var_Dump($aPlaceIDs); }
foreach($aPlaceIDs as $iPlaceID)
diff --git a/lib/template/details-error-html.php b/lib/template/details-error-html.php
index f93cca4d..bc00f84d 100644
--- a/lib/template/details-error-html.php
+++ b/lib/template/details-error-html.php
@@ -11,9 +11,6 @@
function osmMapUrl($aFeature)
{
- $sLon = $aFeature['error_x'];
- $sLat = $aFeature['error_y'];
-
if (isset($sFeature['error_x']) && isset($sFeature['error_y']))
{
$sBaseUrl = '//www.openstreetmap.org/';
@@ -23,8 +20,7 @@
$sBaseUrl += $sOSMType.'/'.$aFeature['osm_id'];
}
- return 'view on osm.org';
- }
+ return 'view on osm.org';
}
return '';
}
diff --git a/lib/website.php b/lib/website.php
index 22ec08f1..23cec940 100644
--- a/lib/website.php
+++ b/lib/website.php
@@ -100,7 +100,7 @@ INTERNALFAIL;
{
if (!isset($_GET[$sName])) return $bDefault;
- if (!preg_match('/^[+-][0-9]+$/', $_GET[$sName]))
+ if (!preg_match('/^[+-]?[0-9]+$/', $_GET[$sName]))
{
userError("Integer number expected for parameter '$sName'");
}
diff --git a/tests/features/api/reverse_simple.feature b/tests/features/api/reverse_simple.feature
index 5d79fd4b..6100f54c 100644
--- a/tests/features/api/reverse_simple.feature
+++ b/tests/features/api/reverse_simple.feature
@@ -99,35 +99,35 @@ Feature: Simple Reverse Tests
| lat
| 51.51
When sending an API call reverse
- Then exactly 0 results are returned
+ Then a HTTP 400 is returned
Scenario: Missing lat parameter
Given the request parameters
| lon
| -79.39114
When sending an API call reverse
- Then exactly 0 results are returned
+ Then a HTTP 400 is returned
Scenario: Missing osm_id parameter
Given the request parameters
| osm_type
| N
When sending an API call reverse
- Then exactly 0 results are returned
+ Then a HTTP 400 is returned
Scenario: Missing osm_type parameter
Given the request parameters
| osm_id
| 3498564
When sending an API call reverse
- Then exactly 0 results are returned
+ Then a HTTP 400 is returned
Scenario Outline: Bad format for lat or lon
Given the request parameters
| lat | lon |
| | |
When sending an API call reverse
- Then exactly 0 results are returned
+ Then a HTTP 400 is returned
Examples:
| lat | lon
@@ -137,4 +137,4 @@ Feature: Simple Reverse Tests
| 48.966.0 | 8.4482
| 48.966 | 8.448.2
| Nan | 8.448
- | 48.966 | Nan
\ No newline at end of file
+ | 48.966 | Nan
diff --git a/tests/features/api/search_params.feature b/tests/features/api/search_params.feature
index 150d6bdc..0b21d558 100644
--- a/tests/features/api/search_params.feature
+++ b/tests/features/api/search_params.feature
@@ -187,7 +187,6 @@ Feature: Search queries
| 0.0
| 0.5
| 999
- | nan
Scenario Outline: Search with polygon threshold (xml)
Given the request parameters
@@ -203,7 +202,14 @@ Feature: Search queries
| 0.0
| 0.5
| 999
- | nan
+
+ Scenario Outline: Search with invalid polygon threshold (xml)
+ Given the request parameters
+ | polygon_geojson | polygon_threshold
+ | 1 |
+ When sending xml search query "switzerland"
+ Then a HTTP 400 is returned
+
Scenario Outline: Search with extratags
Given the request parameters
diff --git a/tests/features/api/search_simple.feature b/tests/features/api/search_simple.feature
index 2cb27b7c..0020cc2e 100644
--- a/tests/features/api/search_simple.feature
+++ b/tests/features/api/search_simple.feature
@@ -61,7 +61,7 @@ Feature: Simple Tests
| format
| fd$#
When sending search query "Berlin"
- Then the result is valid html
+ Then a HTTP 400 is returned
Scenario Outline: Simple Searches
When sending search query ""
diff --git a/website/lookup.php b/website/lookup.php
index 60bd60eb..9d0cea4c 100755
--- a/website/lookup.php
+++ b/website/lookup.php
@@ -5,6 +5,7 @@
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
+ require_once(CONST_BasePath.'/lib/output.php');
if (strpos(CONST_BulkUserIPs, ','.$_SERVER["REMOTE_ADDR"].',') !== false)
{
@@ -38,7 +39,7 @@
$oPlaceLookup->setIncludeExtraTags(getParamBool('extratags', false));
$oPlaceLookup->setIncludeNameDetails(getParamBool('namedetails', false));
- $aOsmIds = explode(',', $getParamString('osm_ids', ''));
+ $aOsmIds = explode(',', getParamString('osm_ids', ''));
if (count($aOsmIds) > CONST_Places_Max_ID_count)
{
diff --git a/website/reverse.php b/website/reverse.php
index 17b8a2ca..7f5eca78 100755
--- a/website/reverse.php
+++ b/website/reverse.php
@@ -56,8 +56,8 @@
$hLog = logStart($oDB, 'reverse', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
- $sOsmType = getParamSet('osmtype', array('N', 'W', 'R'));
- $iOsmId = getParamInt('osmid', -1);
+ $sOsmType = getParamSet('osm_type', array('N', 'W', 'R'));
+ $iOsmId = getParamInt('osm_id', -1);
$fLat = getParamFloat('lat');
$fLon = getParamFloat('lon');
if ($sOsmType && $iOsmId > 0)
|