diff --git a/lib/Geocode.php b/lib/Geocode.php
index 496a3c6b..7566d18b 100644
--- a/lib/Geocode.php
+++ b/lib/Geocode.php
@@ -525,12 +525,12 @@ class Geocode
$sNormQuery = $this->normTerm($this->sQuery);
$sLanguagePrefArraySQL = getArraySQL(
- array_map("getDBQuoted", $this->aLangPrefOrder)
+ array_map('getDBQuoted', $this->aLangPrefOrder)
);
$sQuery = $this->sQuery;
if (!preg_match('//u', $sQuery)) {
- userError("Query string is not UTF-8 encoded.");
+ userError('Query string is not UTF-8 encoded.');
}
// Conflicts between US state abreviations and various words for 'the' in different languages
@@ -577,7 +577,7 @@ class Geocode
$sSpecialTerm = pg_escape_string($sSpecialTerm);
$sToken = chksql(
$this->oDB->getOne("SELECT make_standard_name('$sSpecialTerm')"),
- "Cannot decode query. Wrong encoding?"
+ 'Cannot decode query. Wrong encoding?'
);
$sSQL = 'SELECT class, type FROM word ';
$sSQL .= ' WHERE word_token in (\' '.$sToken.'\')';
@@ -618,7 +618,7 @@ class Geocode
foreach ($aInPhrases as $iPhrase => $sPhrase) {
$sPhrase = chksql(
$this->oDB->getOne('SELECT make_standard_name('.getDBQuoted($sPhrase).')'),
- "Cannot normalize query string (is it a UTF-8 string?)"
+ 'Cannot normalize query string (is it a UTF-8 string?)'
);
if (trim($sPhrase)) {
$oPhrase = new Phrase($sPhrase, is_string($iPhrase) ? $iPhrase : '');
@@ -631,14 +631,14 @@ class Geocode
// Check which tokens we have, get the ID numbers
$sSQL = 'SELECT word_id, word_token, word, class, type, country_code, operator, search_name_count';
$sSQL .= ' FROM word ';
- $sSQL .= ' WHERE word_token in ('.join(',', array_map("getDBQuoted", $aTokens)).')';
+ $sSQL .= ' WHERE word_token in ('.join(',', array_map('getDBQuoted', $aTokens)).')';
if (CONST_Debug) var_Dump($sSQL);
$aValidTokens = array();
$aDatabaseWords = chksql(
$this->oDB->getAll($sSQL),
- "Could not get word tokens."
+ 'Could not get word tokens.'
);
$aWordFrequencyScores = array();
foreach ($aDatabaseWords as $aToken) {
@@ -780,15 +780,15 @@ class Geocode
if ($sPlaceIds) {
$sSQL = 'SELECT place_id FROM placex ';
$sSQL .= 'WHERE place_id in ('.$sPlaceIds.') ';
- $sSQL .= " AND (";
+ $sSQL .= ' AND (';
$sSQL .= " placex.rank_address between $this->iMinAddressRank and $this->iMaxAddressRank ";
if (14 >= $this->iMinAddressRank && 14 <= $this->iMaxAddressRank) {
$sSQL .= " OR (extratags->'place') = 'city'";
}
if ($this->aAddressRankList) {
- $sSQL .= " OR placex.rank_address in (".join(',', $this->aAddressRankList).")";
+ $sSQL .= ' OR placex.rank_address in ('.join(',', $this->aAddressRankList).')';
}
- $sSQL .= ")";
+ $sSQL .= ')';
$aFilterSql[] = $sSQL;
}
$sPlaceIds = Result::joinIdsByTable($aResults, Result::TABLE_POSTCODE);
@@ -797,9 +797,9 @@ class Geocode
$sSQL .= 'WHERE place_id in ('.$sPlaceIds.') ';
$sSQL .= " AND (lp.rank_address between $this->iMinAddressRank and $this->iMaxAddressRank ";
if ($this->aAddressRankList) {
- $sSQL .= " OR lp.rank_address in (".join(',', $this->aAddressRankList).")";
+ $sSQL .= ' OR lp.rank_address in ('.join(',', $this->aAddressRankList).')';
}
- $sSQL .= ") ";
+ $sSQL .= ') ';
$aFilterSql[] = $sSQL;
}
@@ -835,7 +835,7 @@ class Geocode
$oLookup = $oReverse->lookupPoint($oCtx->sqlNear, false);
- if (CONST_Debug) var_dump("Reverse search", $aLookup);
+ if (CONST_Debug) var_dump('Reverse search', $aLookup);
if ($oLookup) {
$aResults = array($oLookup->iId => $oLookup);
@@ -932,7 +932,7 @@ class Geocode
foreach ($aRecheckWords as $i => $sWord) {
if (stripos($sAddress, $sWord)!==false) {
$iCountWords++;
- if (preg_match("/(^|,)\s*".preg_quote($sWord, '/')."\s*(,|$)/", $sAddress)) $iCountWords += 0.1;
+ if (preg_match('/(^|,)\s*'.preg_quote($sWord, '/').'\s*(,|$)/', $sAddress)) $iCountWords += 0.1;
}
}
diff --git a/lib/ParameterParser.php b/lib/ParameterParser.php
index 5177a08e..2eed1629 100644
--- a/lib/ParameterParser.php
+++ b/lib/ParameterParser.php
@@ -82,8 +82,8 @@ class ParameterParser
public function getPreferredLanguages($sFallback = null)
{
- if ($sFallback === null && isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
- $sFallback = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
+ if ($sFallback === null && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+ $sFallback = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
}
$aLanguages = array();
diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php
index 6d190c2a..4fce7e36 100644
--- a/lib/PlaceLookup.php
+++ b/lib/PlaceLookup.php
@@ -76,9 +76,9 @@ class PlaceLookup
($this->bIncludePolygonAsSVG ? 1 : 0);
if ($iWantedTypes > CONST_PolygonOutput_MaximumTypes) {
if (CONST_PolygonOutput_MaximumTypes) {
- userError("Select only ".CONST_PolygonOutput_MaximumTypes." polgyon output option");
+ userError('Select only '.CONST_PolygonOutput_MaximumTypes.' polgyon output option');
} else {
- userError("Polygon output is disabled");
+ userError('Polygon output is disabled');
}
}
}
@@ -216,7 +216,7 @@ class PlaceLookup
if ($this->sAddressRankListSql) {
$sSQL .= ' OR placex.rank_address in '.$this->sAddressRankListSql;
}
- $sSQL .= " ) ";
+ $sSQL .= ' ) ';
if ($this->sAllowedTypesSQLList) {
$sSQL .= 'AND placex.class in '.$this->sAllowedTypesSQLList;
}
@@ -248,22 +248,22 @@ class PlaceLookup
if ($sPlaceIDs) {
$sSQL = 'SELECT';
$sSQL .= " 'P' as osm_type,";
- $sSQL .= " (SELECT osm_id from placex p WHERE p.place_id = lp.parent_place_id) as osm_id,";
+ $sSQL .= ' (SELECT osm_id from placex p WHERE p.place_id = lp.parent_place_id) as osm_id,';
$sSQL .= " 'place' as class, 'postcode' as type,";
$sSQL .= ' null as admin_level, rank_search, rank_address,';
$sSQL .= ' place_id, parent_place_id,';
$sSQL .= ' null as housenumber,';
$sSQL .= ' country_code,';
$sSQL .= $this->langAddressSql('-1');
- $sSQL .= " postcode as placename,";
- $sSQL .= " postcode as ref,";
- if ($this->bExtraTags) $sSQL .= "null AS extra,";
- if ($this->bNameDetails) $sSQL .= "null AS names,";
- $sSQL .= " ST_x(geometry) AS lon, ST_y(geometry) AS lat,";
- $sSQL .= " (0.75-(rank_search::float/40)) AS importance, ";
+ $sSQL .= ' postcode as placename,';
+ $sSQL .= ' postcode as ref,';
+ if ($this->bExtraTags) $sSQL .= 'null AS extra,';
+ if ($this->bNameDetails) $sSQL .= 'null AS names,';
+ $sSQL .= ' ST_x(geometry) AS lon, ST_y(geometry) AS lat,';
+ $sSQL .= ' (0.75-(rank_search::float/40)) AS importance, ';
$sSQL .= $this->addressImportanceSql('geometry', 'lp.parent_place_id');
- $sSQL .= " null AS extra_place ";
- $sSQL .= "FROM location_postcode lp";
+ $sSQL .= ' null AS extra_place ';
+ $sSQL .= 'FROM location_postcode lp';
$sSQL .= " WHERE place_id in ($sPlaceIDs) ";
$sSQL .= " AND lp.rank_address between $iMinRank and $iMaxRank";
@@ -279,9 +279,9 @@ class PlaceLookup
$sHousenumbers = Result::sqlHouseNumberTable($aResults, Result::TABLE_TIGER);
// Tiger search only if a housenumber was searched and if it was found
// (realized through a join)
- $sSQL = " SELECT ";
+ $sSQL = ' SELECT ';
$sSQL .= " 'T' AS osm_type, ";
- $sSQL .= " (SELECT osm_id from placex p WHERE p.place_id=blub.parent_place_id) as osm_id, ";
+ $sSQL .= ' (SELECT osm_id from placex p WHERE p.place_id=blub.parent_place_id) as osm_id, ';
$sSQL .= " 'place' AS class, ";
$sSQL .= " 'house' AS type, ";
$sSQL .= ' null AS admin_level, ';
@@ -292,27 +292,27 @@ class PlaceLookup
$sSQL .= ' housenumber_for_place as housenumber,';
$sSQL .= " 'us' AS country_code, ";
$sSQL .= $this->langAddressSql('housenumber_for_place');
- $sSQL .= " null AS placename, ";
- $sSQL .= " null AS ref, ";
- if ($this->bExtraTags) $sSQL .= "null AS extra,";
- if ($this->bNameDetails) $sSQL .= "null AS names,";
- $sSQL .= " st_x(centroid) AS lon, ";
- $sSQL .= " st_y(centroid) AS lat,";
- $sSQL .= " -1.15 AS importance, ";
+ $sSQL .= ' null AS placename, ';
+ $sSQL .= ' null AS ref, ';
+ if ($this->bExtraTags) $sSQL .= 'null AS extra,';
+ if ($this->bNameDetails) $sSQL .= 'null AS names,';
+ $sSQL .= ' st_x(centroid) AS lon, ';
+ $sSQL .= ' st_y(centroid) AS lat,';
+ $sSQL .= ' -1.15 AS importance, ';
$sSQL .= $this->addressImportanceSql('centroid', 'blub.parent_place_id');
- $sSQL .= " null AS extra_place ";
- $sSQL .= " FROM (";
- $sSQL .= " SELECT place_id, "; // interpolate the Tiger housenumbers here
- $sSQL .= " ST_LineInterpolatePoint(linegeo, (housenumber_for_place-startnumber::float)/(endnumber-startnumber)::float) AS centroid, ";
- $sSQL .= " parent_place_id, ";
- $sSQL .= " housenumber_for_place";
- $sSQL .= " FROM (";
- $sSQL .= " location_property_tiger ";
- $sSQL .= " JOIN (values ".$sHousenumbers.") AS housenumbers(place_id, housenumber_for_place) USING(place_id)) ";
- $sSQL .= " WHERE ";
- $sSQL .= " housenumber_for_place >= startnumber";
- $sSQL .= " AND housenumber_for_place <= endnumber";
- $sSQL .= " ) AS blub"; //postgres wants an alias here
+ $sSQL .= ' null AS extra_place ';
+ $sSQL .= ' FROM (';
+ $sSQL .= ' SELECT place_id, '; // interpolate the Tiger housenumbers here
+ $sSQL .= ' ST_LineInterpolatePoint(linegeo, (housenumber_for_place-startnumber::float)/(endnumber-startnumber)::float) AS centroid, ';
+ $sSQL .= ' parent_place_id, ';
+ $sSQL .= ' housenumber_for_place';
+ $sSQL .= ' FROM (';
+ $sSQL .= ' location_property_tiger ';
+ $sSQL .= ' JOIN (values '.$sHousenumbers.') AS housenumbers(place_id, housenumber_for_place) USING(place_id)) ';
+ $sSQL .= ' WHERE ';
+ $sSQL .= ' housenumber_for_place >= startnumber';
+ $sSQL .= ' AND housenumber_for_place <= endnumber';
+ $sSQL .= ' ) AS blub'; //postgres wants an alias here
$aSubSelects[] = $sSQL;
}
@@ -324,9 +324,9 @@ class PlaceLookup
$sHousenumbers = Result::sqlHouseNumberTable($aResults, Result::TABLE_OSMLINE);
// interpolation line search only if a housenumber was searched
// (realized through a join)
- $sSQL = "SELECT ";
+ $sSQL = 'SELECT ';
$sSQL .= " 'W' AS osm_type, ";
- $sSQL .= " osm_id, ";
+ $sSQL .= ' osm_id, ';
$sSQL .= " 'place' AS class, ";
$sSQL .= " 'house' AS type, ";
$sSQL .= ' 15 AS admin_level, ';
@@ -344,27 +344,27 @@ class PlaceLookup
$sSQL .= ' st_x(centroid) AS lon, ';
$sSQL .= ' st_y(centroid) AS lat, ';
// slightly smaller than the importance for normal houses
- $sSQL .= " -0.1 AS importance, ";
+ $sSQL .= ' -0.1 AS importance, ';
$sSQL .= $this->addressImportanceSql('centroid', 'blub.parent_place_id');
- $sSQL .= " null AS extra_place ";
- $sSQL .= " FROM (";
- $sSQL .= " SELECT ";
- $sSQL .= " osm_id, ";
- $sSQL .= " place_id, ";
- $sSQL .= " country_code, ";
- $sSQL .= " CASE "; // interpolate the housenumbers here
- $sSQL .= " WHEN startnumber != endnumber ";
- $sSQL .= " THEN ST_LineInterpolatePoint(linegeo, (housenumber_for_place-startnumber::float)/(endnumber-startnumber)::float) ";
- $sSQL .= " ELSE ST_LineInterpolatePoint(linegeo, 0.5) ";
- $sSQL .= " END as centroid, ";
- $sSQL .= " parent_place_id, ";
- $sSQL .= " housenumber_for_place ";
- $sSQL .= " FROM (";
- $sSQL .= " location_property_osmline ";
- $sSQL .= " JOIN (values ".$sHousenumbers.") AS housenumbers(place_id, housenumber_for_place) USING(place_id)";
- $sSQL .= " ) ";
- $sSQL .= " WHERE housenumber_for_place >= 0 ";
- $sSQL .= " ) as blub"; //postgres wants an alias here
+ $sSQL .= ' null AS extra_place ';
+ $sSQL .= ' FROM (';
+ $sSQL .= ' SELECT ';
+ $sSQL .= ' osm_id, ';
+ $sSQL .= ' place_id, ';
+ $sSQL .= ' country_code, ';
+ $sSQL .= ' CASE '; // interpolate the housenumbers here
+ $sSQL .= ' WHEN startnumber != endnumber ';
+ $sSQL .= ' THEN ST_LineInterpolatePoint(linegeo, (housenumber_for_place-startnumber::float)/(endnumber-startnumber)::float) ';
+ $sSQL .= ' ELSE ST_LineInterpolatePoint(linegeo, 0.5) ';
+ $sSQL .= ' END as centroid, ';
+ $sSQL .= ' parent_place_id, ';
+ $sSQL .= ' housenumber_for_place ';
+ $sSQL .= ' FROM (';
+ $sSQL .= ' location_property_osmline ';
+ $sSQL .= ' JOIN (values '.$sHousenumbers.') AS housenumbers(place_id, housenumber_for_place) USING(place_id)';
+ $sSQL .= ' ) ';
+ $sSQL .= ' WHERE housenumber_for_place >= 0 ';
+ $sSQL .= ' ) as blub'; //postgres wants an alias here
$aSubSelects[] = $sSQL;
}
@@ -373,9 +373,9 @@ class PlaceLookup
$sPlaceIDs = Result::joinIdsByTable($aResults, Result::TABLE_AUX);
if ($sPlaceIDs) {
$sHousenumbers = Result::sqlHouseNumberTable($aResults, Result::TABLE_AUX);
- $sSQL = " SELECT ";
+ $sSQL = ' SELECT ';
$sSQL .= " 'L' AS osm_type, ";
- $sSQL .= " place_id AS osm_id, ";
+ $sSQL .= ' place_id AS osm_id, ';
$sSQL .= " 'place' AS class,";
$sSQL .= " 'house' AS type, ";
$sSQL .= ' null AS admin_level, ';
@@ -386,19 +386,19 @@ class PlaceLookup
$sSQL .= ' housenumber,';
$sSQL .= " 'us' AS country_code, ";
$sSQL .= $this->langAddressSql('-1');
- $sSQL .= " null AS placename, ";
- $sSQL .= " null AS ref, ";
- if ($this->bExtraTags) $sSQL .= "null AS extra, ";
- if ($this->bNameDetails) $sSQL .= "null AS names, ";
- $sSQL .= " ST_X(centroid) AS lon, ";
- $sSQL .= " ST_Y(centroid) AS lat, ";
- $sSQL .= " -1.10 AS importance, ";
+ $sSQL .= ' null AS placename, ';
+ $sSQL .= ' null AS ref, ';
+ if ($this->bExtraTags) $sSQL .= 'null AS extra, ';
+ if ($this->bNameDetails) $sSQL .= 'null AS names, ';
+ $sSQL .= ' ST_X(centroid) AS lon, ';
+ $sSQL .= ' ST_Y(centroid) AS lat, ';
+ $sSQL .= ' -1.10 AS importance, ';
$sSQL .= $this->addressImportanceSql(
'centroid',
'location_property_aux.parent_place_id'
);
- $sSQL .= " null AS extra_place ";
- $sSQL .= " FROM location_property_aux ";
+ $sSQL .= ' null AS extra_place ';
+ $sSQL .= ' FROM location_property_aux ';
$sSQL .= " WHERE place_id in ($sPlaceIDs) ";
$aSubSelects[] = $sSQL;
@@ -414,7 +414,7 @@ class PlaceLookup
$aPlaces = chksql(
$this->oDB->getAll(join(' UNION ', $aSubSelects)),
- "Could not lookup place"
+ 'Could not lookup place'
);
$aClassType = getClassTypes();
@@ -534,22 +534,22 @@ class PlaceLookup
if (CONST_Search_AreaPolygons) {
// Get the bounding box and outline polygon
- $sSQL = "select place_id,0 as numfeatures,st_area(geometry) as area,";
- $sSQL .= "ST_Y(centroid) as centrelat,ST_X(centroid) as centrelon,";
- $sSQL .= "ST_YMin(geometry) as minlat,ST_YMax(geometry) as maxlat,";
- $sSQL .= "ST_XMin(geometry) as minlon,ST_XMax(geometry) as maxlon";
- if ($this->bIncludePolygonAsGeoJSON) $sSQL .= ",ST_AsGeoJSON(geometry) as asgeojson";
- if ($this->bIncludePolygonAsKML) $sSQL .= ",ST_AsKML(geometry) as askml";
- if ($this->bIncludePolygonAsSVG) $sSQL .= ",ST_AsSVG(geometry) as assvg";
- if ($this->bIncludePolygonAsText || $this->bIncludePolygonAsPoints) $sSQL .= ",ST_AsText(geometry) as astext";
- $sFrom = " from placex where place_id = ".$iPlaceID;
+ $sSQL = 'select place_id,0 as numfeatures,st_area(geometry) as area,';
+ $sSQL .= 'ST_Y(centroid) as centrelat,ST_X(centroid) as centrelon,';
+ $sSQL .= 'ST_YMin(geometry) as minlat,ST_YMax(geometry) as maxlat,';
+ $sSQL .= 'ST_XMin(geometry) as minlon,ST_XMax(geometry) as maxlon';
+ if ($this->bIncludePolygonAsGeoJSON) $sSQL .= ',ST_AsGeoJSON(geometry) as asgeojson';
+ if ($this->bIncludePolygonAsKML) $sSQL .= ',ST_AsKML(geometry) as askml';
+ if ($this->bIncludePolygonAsSVG) $sSQL .= ',ST_AsSVG(geometry) as assvg';
+ if ($this->bIncludePolygonAsText || $this->bIncludePolygonAsPoints) $sSQL .= ',ST_AsText(geometry) as astext';
+ $sFrom = ' from placex where place_id = '.$iPlaceID;
if ($this->fPolygonSimplificationThreshold > 0) {
- $sSQL .= " from (select place_id,centroid,ST_SimplifyPreserveTopology(geometry,".$this->fPolygonSimplificationThreshold.") as geometry".$sFrom.") as plx";
+ $sSQL .= ' from (select place_id,centroid,ST_SimplifyPreserveTopology(geometry,'.$this->fPolygonSimplificationThreshold.') as geometry'.$sFrom.') as plx';
} else {
$sSQL .= $sFrom;
}
- $aPointPolygon = chksql($this->oDB->getRow($sSQL), "Could not get outline");
+ $aPointPolygon = chksql($this->oDB->getRow($sSQL), 'Could not get outline');
if ($aPointPolygon['place_id']) {
if ($aPointPolygon['centrelon'] !== null && $aPointPolygon['centrelat'] !== null) {
diff --git a/lib/ReverseGeocode.php b/lib/ReverseGeocode.php
index ce2ee5e5..0bcd3d33 100644
--- a/lib/ReverseGeocode.php
+++ b/lib/ReverseGeocode.php
@@ -65,7 +65,7 @@ class ReverseGeocode
return chksql(
$this->oDB->getRow($sSQL),
- "Could not determine closest housenumber on an osm interpolation line."
+ 'Could not determine closest housenumber on an osm interpolation line.'
);
}
@@ -141,7 +141,7 @@ class ReverseGeocode
if (CONST_Debug) var_dump($sSQL);
$aPlace = chksql(
$this->oDB->getRow($sSQL),
- "Could not determine closest place."
+ 'Could not determine closest place.'
);
if ($aPlace) {
$oResult = new Result($aPlace['place_id']);
@@ -186,7 +186,7 @@ class ReverseGeocode
$aPlaceTiger = chksql(
$this->oDB->getRow($sSQL),
- "Could not determine closest Tiger place."
+ 'Could not determine closest Tiger place.'
);
if ($aPlaceTiger) {
if (CONST_Debug) var_dump('found Tiger housenumber', $aPlaceTiger);
@@ -210,7 +210,7 @@ class ReverseGeocode
$sSQL .= " WHERE place_id = $iPlaceID";
$sSQL .= " ORDER BY abs(cached_rank_address - $iMaxRank) asc,cached_rank_address desc,isaddress desc,distance desc";
$sSQL .= ' LIMIT 1';
- $iPlaceID = chksql($this->oDB->getOne($sSQL), "Could not get parent for place.");
+ $iPlaceID = chksql($this->oDB->getOne($sSQL), 'Could not get parent for place.');
if ($iPlaceID) {
$oResult = new Result($iPlaceID);
}
diff --git a/lib/SearchContext.php b/lib/SearchContext.php
index 134b138f..3e722d87 100644
--- a/lib/SearchContext.php
+++ b/lib/SearchContext.php
@@ -146,11 +146,11 @@ class SearchContext
$this->sqlViewboxCentre .= ")'::geometry,4326)";
$sSQL = 'ST_BUFFER('.$this->sqlViewboxCentre.','.($fRouteWidth/69).')';
- $sGeom = chksql($oDB->getOne("select ".$sSQL), "Could not get small viewbox");
+ $sGeom = chksql($oDB->getOne('select '.$sSQL), 'Could not get small viewbox');
$this->sqlViewboxSmall = "'".$sGeom."'::geometry";
$sSQL = 'ST_BUFFER('.$this->sqlViewboxCentre.','.($fRouteWidth/30).')';
- $sGeom = chksql($oDB->getOne("select ".$sSQL), "Could not get large viewbox");
+ $sGeom = chksql($oDB->getOne('select '.$sSQL), 'Could not get large viewbox');
$this->sqlViewboxLarge = "'".$sGeom."'::geometry";
}
diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php
index edf4d059..bf45dada 100644
--- a/lib/SearchDescription.php
+++ b/lib/SearchDescription.php
@@ -240,7 +240,7 @@ class SearchDescription
$oSearch->sHouseNumber = trim($aSearchTerm['word_token']);
// sanity check: if the housenumber is not mainly made
// up of numbers, add a penalty
- if (preg_match_all("/[^0-9]/", $oSearch->sHouseNumber, $aMatches) > 2) {
+ if (preg_match_all('/[^0-9]/', $oSearch->sHouseNumber, $aMatches) > 2) {
$oSearch->iSearchRank++;
}
if (!isset($aSearchTerm['word_id'])) {
@@ -450,7 +450,7 @@ class SearchDescription
}
if (CONST_Debug) {
- echo "
Place IDs: ";
+ echo '
Place IDs: ';
var_dump(array_keys($aResults));
}
@@ -469,7 +469,7 @@ class SearchDescription
}
$aResults = $aNewResults;
if (CONST_Debug) {
- echo "
Place IDs after postcode filtering: ";
+ echo '
Place IDs after postcode filtering: ';
var_dump(array_keys($aResults));
}
}
@@ -488,7 +488,7 @@ class SearchDescription
if ($this->oContext->bViewboxBounded) {
$sSQL .= ' AND ST_Intersects('.$this->oContext->sqlViewboxSmall.', geometry)';
}
- $sSQL .= " ORDER BY st_area(geometry) DESC LIMIT 1";
+ $sSQL .= ' ORDER BY st_area(geometry) DESC LIMIT 1';
if (CONST_Debug) var_dump($sSQL);
@@ -543,7 +543,7 @@ class SearchDescription
if ($this->oContext->sqlCountryList) {
$sSQL .= ' AND country_code in '.$this->oContext->sqlCountryList;
}
- $sSQL .= ' ORDER BY '.$this->oContext->distanceSQL('centroid')." ASC";
+ $sSQL .= ' ORDER BY '.$this->oContext->distanceSQL('centroid').' ASC';
$sSQL .= " LIMIT $iLimit";
if (CONST_Debug) var_dump($sSQL);
$aDBResults = chksql($oDB->getCol($sSQL));
@@ -638,13 +638,13 @@ class SearchDescription
}
if ($this->sHouseNumber) {
- $aTerms[] = "address_rank between 16 and 27";
+ $aTerms[] = 'address_rank between 16 and 27';
} elseif (!$this->sClass || $this->iOperator == Operator::NAME) {
if ($iMinAddressRank > 0) {
- $aTerms[] = "address_rank >= ".$iMinAddressRank;
+ $aTerms[] = 'address_rank >= '.$iMinAddressRank;
}
if ($iMaxAddressRank < 30) {
- $aTerms[] = "address_rank <= ".$iMaxAddressRank;
+ $aTerms[] = 'address_rank <= '.$iMaxAddressRank;
}
}
@@ -710,7 +710,7 @@ class SearchDescription
$aDBResults = chksql(
$oDB->getAll($sSQL),
- "Could not get places for search terms."
+ 'Could not get places for search terms.'
);
foreach ($aDBResults as $aResult) {
@@ -762,8 +762,8 @@ class SearchDescription
$sSQL .= "interpolationtype='odd'";
}
$sSQL .= " or interpolationtype='all') and ";
- $sSQL .= $iHousenumber.">=startnumber and ";
- $sSQL .= $iHousenumber."<=endnumber";
+ $sSQL .= $iHousenumber.'>=startnumber and ';
+ $sSQL .= $iHousenumber.'<=endnumber';
$sSQL .= $this->oContext->excludeSQL(' AND place_id');
$sSQL .= " limit $iLimit";
@@ -801,8 +801,8 @@ class SearchDescription
$sSQL .= "interpolationtype='odd'";
}
$sSQL .= " or interpolationtype='all') and ";
- $sSQL .= $iHousenumber.">=startnumber and ";
- $sSQL .= $iHousenumber."<=endnumber";
+ $sSQL .= $iHousenumber.'>=startnumber and ';
+ $sSQL .= $iHousenumber.'<=endnumber';
$sSQL .= $this->oContext->excludeSQL(' AND place_id');
$sSQL .= " limit $iLimit";
@@ -835,9 +835,9 @@ class SearchDescription
$sSQL .= " WHERE place_id in ($sPlaceIDs)";
$sSQL .= " AND class='".$this->sClass."' ";
$sSQL .= " AND type='".$this->sType."'";
- $sSQL .= " AND linked_place_id is null";
+ $sSQL .= ' AND linked_place_id is null';
$sSQL .= $this->oContext->excludeSQL(' AND place_id');
- $sSQL .= " ORDER BY rank_search ASC ";
+ $sSQL .= ' ORDER BY rank_search ASC ';
$sSQL .= " LIMIT $iLimit";
if (CONST_Debug) var_dump($sSQL);
@@ -865,8 +865,8 @@ class SearchDescription
$sSQL .= " WHERE place_id in ($sPlaceIDs)";
$sSQL .= " AND rank_search < $iMaxRank + 5";
$sSQL .= " AND ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon')";
- $sSQL .= " ORDER BY rank_search ASC ";
- $sSQL .= " LIMIT 1";
+ $sSQL .= ' ORDER BY rank_search ASC ';
+ $sSQL .= ' LIMIT 1';
if (CONST_Debug) var_dump($sSQL);
$sPlaceGeom = chksql($oDB->getOne($sSQL));
}
@@ -892,7 +892,7 @@ class SearchDescription
if ($this->oContext->hasNearPoint()) {
$sOrderBySQL = $this->oContext->distanceSQL('l.centroid');
} elseif ($sPlaceIDs) {
- $sOrderBySQL = "ST_Distance(l.centroid, f.geometry)";
+ $sOrderBySQL = 'ST_Distance(l.centroid, f.geometry)';
} elseif ($sPlaceGeom) {
$sOrderBySQL = "ST_Distance(st_centroid('".$sPlaceGeom."'), l.centroid)";
}
@@ -908,7 +908,7 @@ class SearchDescription
$sSQL .= ' from '.$sClassTable.' as l';
if ($sPlaceIDs) {
- $sSQL .= ",placex as f WHERE ";
+ $sSQL .= ',placex as f WHERE ';
$sSQL .= "f.place_id in ($sPlaceIDs) ";
$sSQL .= " AND ST_DWithin(l.centroid, f.centroid, $fRange)";
} elseif ($sPlaceGeom) {
@@ -936,7 +936,7 @@ class SearchDescription
if ($this->oContext->hasNearPoint()) {
$sOrderBySQL = $this->oContext->distanceSQL('l.geometry');
} else {
- $sOrderBySQL = "ST_Distance(l.geometry, f.geometry)";
+ $sOrderBySQL = 'ST_Distance(l.geometry, f.geometry)';
}
$sSQL = 'SELECT distinct l.place_id';
@@ -950,7 +950,7 @@ class SearchDescription
$sSQL .= " AND l.type='".$this->sType."'";
$sSQL .= $this->oContext->excludeSQL(' AND l.place_id');
if ($sOrderBySQL) {
- $sSQL .= "ORDER BY orderterm ASC";
+ $sSQL .= 'ORDER BY orderterm ASC';
}
$sSQL .= " limit $iLimit";
@@ -1005,19 +1005,19 @@ class SearchDescription
return $aWordIDs[$k];
};
- echo "
\n".$oSql->getUserInfo().""; + echo "
\n".$oSql->getUserInfo().''; } - echo "