From 7dd0a63b688c14b49179c47b592bdf309abe6d08 Mon Sep 17 00:00:00 2001 From: Markus Gail Date: Wed, 23 Mar 2016 09:34:36 +0100 Subject: [PATCH] Fix coding style. --- lib/Geocode.php | 28 +++++++++++++++------------- lib/PlaceLookup.php | 2 +- lib/lib.php | 2 +- sql/functions.sql | 2 +- sql/tiger_import_start.sql | 4 +--- website/details.php | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/Geocode.php b/lib/Geocode.php index 4b15b3c8..481be133 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -399,7 +399,7 @@ $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$this->aLangPrefOrder))."]"; // Get the details for display (is this a redundant extra step?) - $sPlaceIDs = join(',',array_keys($aPlaceIDs)); + $sPlaceIDs = join(',', array_keys($aPlaceIDs)); $sImportanceSQL = ''; if ($this->sViewboxSmallSQL) $sImportanceSQL .= " case when ST_Contains($this->sViewboxSmallSQL, ST_Collect(centroid)) THEN 1 ELSE 0.75 END * "; @@ -437,9 +437,10 @@ //Tiger search only if a housenumber was searched and if it was found (i.e. aPlaceIDs[placeID] = housenumber != -1) (realized through a join) //only Tiger housenumbers need to be interpolated, because they are saved as lines with start- and endnumber, the common osm housenumbers are usually saved as points $sHousenumbers = ""; - $i=0; - $length=count($aPlaceIDs); - foreach($aPlaceIDs as $placeID => $housenumber){ + $i = 0; + $length = count($aPlaceIDs); + foreach($aPlaceIDs as $placeID => $housenumber) + { $i++; $sHousenumbers .= "(".$placeID.", ".$housenumber.")"; if($i<$length) @@ -873,7 +874,8 @@ } // Do we have anything that looks like a lat/lon pair? - if ( $aLooksLike = looksLikeLatLonPair($sQuery) ){ + if ( $aLooksLike = looksLikeLatLonPair($sQuery) ) + { $this->setNearPoint(array($aLooksLike['lat'], $aLooksLike['lon'])); $sQuery = $aLooksLike['query']; } @@ -1216,7 +1218,7 @@ foreach($aSearches as $aSearch) { $iQueryLoop++; - $searchedHousenumber=-1; + $searchedHousenumber = -1; if (CONST_Debug) { echo "
Search Loop, group $iGroupLoop, loop $iQueryLoop"; } if (CONST_Debug) _debugDumpGroupedSearches(array($iGroupedRank => array($aSearch)), $aValidTokens); @@ -1447,7 +1449,7 @@ if (!sizeof($aPlaceIDs)) { //new query for lines, not housenumbers anymore - if($searchedHousenumber%2==0){ + if($searchedHousenumber%2 == 0){ //if housenumber is even, look for housenumber in streets with interpolationtype even or all $sSQL = "select distinct place_id from location_property_tiger where parent_place_id in (".$sPlaceIDs.") and (interpolationtype='even' or interpolationtype='all') and ".$searchedHousenumber.">=startnumber and ".$searchedHousenumber."<=endnumber"; }else{ @@ -1470,10 +1472,9 @@ { $aPlaceIDs = $aRoadPlaceIDs; //set to -1, if no housenumbers were found - $searchedHousenumber=-1; - }else{ - //housenumber was found, remains saved in searchedHousenumber + $searchedHousenumber = -1; } + //else: housenumber was found, remains saved in searchedHousenumber } @@ -1624,10 +1625,11 @@ if (CONST_Debug) var_dump($sSQL); $aFilteredPlaceIDs = $this->oDB->getCol($sSQL); $tempIDs = array(); - foreach($aFilteredPlaceIDs as $placeID){ - $tempIDs[$placeID]= $aResultPlaceIDs[$placeID]; //assign housenumber to placeID + foreach($aFilteredPlaceIDs as $placeID) + { + $tempIDs[$placeID] = $aResultPlaceIDs[$placeID]; //assign housenumber to placeID } - $aResultPlaceIDs=$tempIDs; + $aResultPlaceIDs = $tempIDs; } //exit; diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index 985ed224..817d0ec5 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -7,7 +7,7 @@ protected $sType = false; - protected $fTigerFraction =-1; + protected $fTigerFraction = -1; protected $aLangPrefOrder = array(); diff --git a/lib/lib.php b/lib/lib.php index b2924d58..5edd7328 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -805,7 +805,7 @@ } - function getAddressDetails(&$oDB, $sLanguagePrefArraySQL, $iPlaceID, $sCountryCode = false, $housenumber =-1, $bRaw = false) + function getAddressDetails(&$oDB, $sLanguagePrefArraySQL, $iPlaceID, $sCountryCode = false, $housenumber = -1, $bRaw = false) { $sSQL = "select *,get_name_by_language(name,$sLanguagePrefArraySQL) as localname from get_addressdata($iPlaceID, $housenumber)"; if (!$bRaw) $sSQL .= " WHERE isaddress OR type = 'country_code'"; diff --git a/sql/functions.sql b/sql/functions.sql index e060a265..5ec98f20 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -2196,7 +2196,7 @@ BEGIN result := '{}'; prevresult := ''; - FOR location IN select * from get_addressdata(for_place_id,housenumber) where isaddress order by rank_address desc LOOP + FOR location IN select * from get_addressdata(for_place_id, housenumber) where isaddress order by rank_address desc LOOP currresult := trim(get_name_by_language(location.name, languagepref)); IF currresult != prevresult AND currresult IS NOT NULL AND result[(100 - location.rank_address)] IS NULL THEN result[(100 - location.rank_address)] := trim(get_name_by_language(location.name, languagepref)); diff --git a/sql/tiger_import_start.sql b/sql/tiger_import_start.sql index f6d65ae2..5acb3e59 100644 --- a/sql/tiger_import_start.sql +++ b/sql/tiger_import_start.sql @@ -10,7 +10,6 @@ DECLARE endnumber INTEGER; stepsize INTEGER; numberrange INTEGER; - rangestartnumber INTEGER; place_centroid GEOMETRY; out_partition INTEGER; out_parent_place_id BIGINT; @@ -28,8 +27,7 @@ BEGIN END IF; numberrange := endnumber - startnumber; - rangestartnumber := startnumber; - + IF (interpolationtype = 'odd' AND startnumber%2 = 0) OR (interpolationtype = 'even' AND startnumber%2 = 1) THEN startnumber := startnumber + 1; stepsize := 2; diff --git a/website/details.php b/website/details.php index 5b269fc0..c7a56755 100755 --- a/website/details.php +++ b/website/details.php @@ -10,7 +10,7 @@ $fLoadAvg = getLoadAverage(); if ($fLoadAvg > 3) { - echo "Page temporarily blocked due to high server load\n";F + echo "Page temporarily blocked due to high server load\n"; exit; } */ -- 2.45.2