fix syntax errors and update tests

Some of the tests with bad parameters now return a HTTP 400.
This commit is contained in:
Sarah Hoffmann
2016-06-12 22:33:37 +02:00
parent 033b9590bd
commit 348a3082c9
8 changed files with 24 additions and 27 deletions

View File

@@ -514,7 +514,7 @@
$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;
@@ -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 "<br><b>Place IDs:</b> "; var_Dump($aPlaceIDs); }
foreach($aPlaceIDs as $iPlaceID)

View File

@@ -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 '<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>';
}
return '';
}

View File

@@ -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'");
}