always use brackets on if statements

This adds bracket around all one-line if statements that did
not have them yet.
This commit is contained in:
Sarah Hoffmann
2021-07-10 14:59:38 +02:00
parent 500c61685b
commit 27af9b102c
26 changed files with 377 additions and 144 deletions

View File

@@ -95,16 +95,22 @@ $iPlaceID = (int)$sPlaceId;
if (CONST_Use_US_Tiger_Data) {
$iParentPlaceID = $oDB->getOne('SELECT parent_place_id FROM location_property_tiger WHERE place_id = '.$iPlaceID);
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
if ($iParentPlaceID) {
$iPlaceID = $iParentPlaceID;
}
}
// interpolated house numbers
$iParentPlaceID = $oDB->getOne('SELECT parent_place_id FROM location_property_osmline WHERE place_id = '.$iPlaceID);
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
if ($iParentPlaceID) {
$iPlaceID = $iParentPlaceID;
}
// artificial postcodes
$iParentPlaceID = $oDB->getOne('SELECT parent_place_id FROM location_postcode WHERE place_id = '.$iPlaceID);
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
if ($iParentPlaceID) {
$iPlaceID = $iParentPlaceID;
}
$hLog = logStart($oDB, 'details', $_SERVER['QUERY_STRING'], $aLangPrefOrder);

View File

@@ -35,8 +35,10 @@ if (count($aOsmIds) > CONST_Places_Max_ID_count) {
foreach ($aOsmIds as $sItem) {
// Skip empty sItem
if (empty($sItem)) continue;
if (empty($sItem)) {
continue;
}
$sType = $sItem[0];
$iId = (int) substr($sItem, 1);
if ($iId > 0 && ($sType == 'N' || $sType == 'W' || $sType == 'R')) {
@@ -48,7 +50,9 @@ foreach ($aOsmIds as $sItem) {
// key names
$oResult = $oPlace;
unset($oResult['aAddress']);
if (isset($oPlace['aAddress'])) $oResult['address'] = $oPlace['aAddress'];
if (isset($oPlace['aAddress'])) {
$oResult['address'] = $oPlace['aAddress'];
}
if ($sOutputFormat != 'geocodejson') {
unset($oResult['langaddress']);
$oResult['name'] = $oPlace['langaddress'];
@@ -71,7 +75,9 @@ foreach ($aOsmIds as $sItem) {
}
if (CONST_Debug) exit;
if (CONST_Debug) {
exit;
}
$sXmlRootTag = 'lookupresults';
$sQuery = join(',', $aCleanedQueryParts);

View File

@@ -30,8 +30,12 @@ while ($iTotalBroken && empty($aPolygons)) {
$iDays++;
}
if ($bReduced) $aWhere[] = "errormessage like 'Area reduced%'";
if ($sClass) $sWhere[] = "class = '".pg_escape_string($sClass)."'";
if ($bReduced) {
$aWhere[] = "errormessage like 'Area reduced%'";
}
if ($sClass) {
$sWhere[] = "class = '".pg_escape_string($sClass)."'";
}
if (!empty($aWhere)) {
$sSQL .= ' WHERE '.join(' and ', $aWhere);

View File

@@ -77,7 +77,9 @@ if (isset($_SERVER['REQUEST_SCHEME'])
$sMoreURL = '/search.php?'.http_build_query($aMoreParams);
}
if (CONST_Debug) exit;
if (CONST_Debug) {
exit;
}
$sOutputTemplate = ($sOutputFormat == 'jsonv2') ? 'json' : $sOutputFormat;
include(CONST_LibDir.'/template/search-'.$sOutputTemplate.'.php');