Some of the tests with bad parameters now return a HTTP 400.
$sSQL .= " order by importance desc";
if (CONST_Debug) { echo "<hr>"; var_dump($sSQL); }
$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;
"Could not get details for place.");
return $aSearchResults;
$sViewboxCentreSQL .= ")'::geometry,4326)";
$sSQL = "select st_buffer(".$sViewboxCentreSQL.",".(float)($_GET['routewidth']/69).")";
$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";
"Could not get small viewbox.");
$this->sViewboxSmallSQL = "'".$this->sViewboxSmallSQL."'::geometry";
$sSQL .= " limit ".$this->iLimit;
if (CONST_Debug) { var_dump($sSQL); }
$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.");
"Could not get places for search terms.");
//var_dump($aViewBoxPlaceIDs);
// Did we have an viewbox matches?
$aPlaceIDs = array();
//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)
if (CONST_Debug) { echo "<br><b>Place IDs:</b> "; var_Dump($aPlaceIDs); }
foreach($aPlaceIDs as $iPlaceID)
function osmMapUrl($aFeature)
{
function osmMapUrl($aFeature)
{
- $sLon = $aFeature['error_x'];
- $sLat = $aFeature['error_y'];
-
if (isset($sFeature['error_x']) && isset($sFeature['error_y']))
{
$sBaseUrl = '//www.openstreetmap.org/';
if (isset($sFeature['error_x']) && isset($sFeature['error_y']))
{
$sBaseUrl = '//www.openstreetmap.org/';
$sBaseUrl += $sOSMType.'/'.$aFeature['osm_id'];
}
$sBaseUrl += $sOSMType.'/'.$aFeature['osm_id'];
}
- return '<a href="'.$sBaseUrl.'?mlat='.$sLat.'&mlon='.$sLon.'">view on osm.org</a>';
- }
+ return '<a href="'.$sBaseUrl.'?mlat='.$aFeature['error_y'].'&mlon='.$aFeature['error_x'].'">view on osm.org</a>';
{
if (!isset($_GET[$sName])) return $bDefault;
{
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'");
}
{
userError("Integer number expected for parameter '$sName'");
}
| lat
| 51.51
When sending an API call reverse
| 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
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
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
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 |
| <lat> | <lon> |
When sending an API call reverse
Scenario Outline: Bad format for lat or lon
Given the request parameters
| lat | lon |
| <lat> | <lon> |
When sending an API call reverse
- Then exactly 0 results are returned
+ Then a HTTP 400 is returned
| 48.966.0 | 8.4482
| 48.966 | 8.448.2
| Nan | 8.448
| 48.966.0 | 8.4482
| 48.966 | 8.448.2
| Nan | 8.448
- | 48.966 | Nan
\ No newline at end of file
Scenario Outline: Search with polygon threshold (xml)
Given the request parameters
Scenario Outline: Search with polygon threshold (xml)
Given the request parameters
+
+ Scenario Outline: Search with invalid polygon threshold (xml)
+ Given the request parameters
+ | polygon_geojson | polygon_threshold
+ | 1 | <th>
+ When sending xml search query "switzerland"
+ Then a HTTP 400 is returned
+
Scenario Outline: Search with extratags
Given the request parameters
Scenario Outline: Search with extratags
Given the request parameters
| format
| fd$#
When sending search query "Berlin"
| 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 "<query>"
Scenario Outline: Simple Searches
When sending search query "<query>"
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/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)
{
if (strpos(CONST_BulkUserIPs, ','.$_SERVER["REMOTE_ADDR"].',') !== false)
{
$oPlaceLookup->setIncludeExtraTags(getParamBool('extratags', false));
$oPlaceLookup->setIncludeNameDetails(getParamBool('namedetails', false));
$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)
{
if (count($aOsmIds) > CONST_Places_Max_ID_count)
{
$hLog = logStart($oDB, 'reverse', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
$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)
$fLat = getParamFloat('lat');
$fLon = getParamFloat('lon');
if ($sOsmType && $iOsmId > 0)