$this->sViewboxCentreSQL = "ST_SetSRID('LINESTRING(";
$sSep = '';
- foreach ($this->aRoutePoints as $aPoint) {
+ foreach ($aRoutePoints as $aPoint) {
$fPoint = (float)$aPoint;
$this->sViewboxCentreSQL .= $sSep.$fPoint;
$sSep = ($sSep == ' ') ? ',' : ' ';
{
$this->aViewBox = array_map('floatval', $aViewbox);
+ if ($this->aViewBox[0] < -180
+ || $this->aViewBox[2] > 180
+ || $this->aViewBox[0] >= $this->aViewBox[2]
+ || $this->aViewBox[1] < -90
+ || $this->aViewBox[3] > 90
+ || $this->aViewBox[1] >= $this->aViewBox[3]
+ ) {
+ userError("Bad parameter 'viewbox'. Out of range".$this->aViewBox[0]."|".$this->aViewBox[1]."|".$this->aViewBox[2]."|".$this->aViewBox[3]);
+ }
+
$fHeight = $this->aViewBox[0] - $this->aViewBox[2];
$fWidth = $this->aViewBox[1] - $this->aViewBox[3];
$aBigViewBox[0] = $this->aViewBox[0] + $fHeight;
$aViewbox = $oParams->getStringList('viewboxlbrt');
if ($aViewbox) {
+ if (count($aViewbox) != 4) {
+ userError("Bad parmater 'viewbox'. Expected 4 coordinates.");
+ }
$this->setViewbox($aViewbox);
} else {
$aViewbox = $oParams->getStringList('viewbox');
if ($aViewbox) {
+ if (count($aViewbox) != 4) {
+ userError("Bad parmater 'viewbox'. Expected 4 coordinates.");
+ }
$this->setViewBox(array(
$aViewbox[0],
$aViewbox[3],
}
$sQuery = $this->sQuery;
+ if (!preg_match('//u', $sQuery)) {
+ userError("Query string is not UTF-8 encoded.");
+ }
// Conflicts between US state abreviations and various words for 'the' in different languages
if (isset($this->aLangPrefOrder['name:en'])) {
foreach ($aPhrases as $iPhrase => $sPhrase) {
$aPhrase = chksql(
$this->oDB->getRow("select make_standard_name('".pg_escape_string($sPhrase)."') as string"),
- "Cannot nomralize query string (is it an UTF-8 string?)"
+ "Cannot normalize query string (is it a UTF-8 string?)"
);
if (trim($aPhrase['string'])) {
$aPhrases[$iPhrase] = $aPhrase;