spaces-to-tabs for all *.php files

This commit is contained in:
Marc Tobias Metten
2016-02-27 00:02:20 +01:00
parent 8b75e1f4c4
commit 78a29b5a87
17 changed files with 351 additions and 351 deletions

View File

@@ -478,15 +478,15 @@
function getGroupedSearches($aSearches, $aPhraseTypes, $aPhrases, $aValidTokens, $aWordFrequencyScores, $bStructuredPhrases) function getGroupedSearches($aSearches, $aPhraseTypes, $aPhrases, $aValidTokens, $aWordFrequencyScores, $bStructuredPhrases)
{ {
/* /*
Calculate all searches using aValidTokens i.e. Calculate all searches using aValidTokens i.e.
'Wodsworth Road, Sheffield' => 'Wodsworth Road, Sheffield' =>
Phrase Wordset Phrase Wordset
0 0 (wodsworth road) 0 0 (wodsworth road)
0 1 (wodsworth)(road) 0 1 (wodsworth)(road)
1 0 (sheffield) 1 0 (sheffield)
Score how good the search is so they can be ordered Score how good the search is so they can be ordered
*/ */
foreach($aPhrases as $iPhrase => $sPhrase) foreach($aPhrases as $iPhrase => $sPhrase)
{ {
@@ -755,32 +755,32 @@
/* Perform the actual query lookup. /* Perform the actual query lookup.
Returns an ordered list of results, each with the following fields: Returns an ordered list of results, each with the following fields:
osm_type: type of corresponding OSM object osm_type: type of corresponding OSM object
N - node N - node
W - way W - way
R - relation R - relation
P - postcode (internally computed) P - postcode (internally computed)
osm_id: id of corresponding OSM object osm_id: id of corresponding OSM object
class: general object class (corresponds to tag key of primary OSM tag) class: general object class (corresponds to tag key of primary OSM tag)
type: subclass of object (corresponds to tag value of primary OSM tag) type: subclass of object (corresponds to tag value of primary OSM tag)
admin_level: see http://wiki.openstreetmap.org/wiki/Admin_level admin_level: see http://wiki.openstreetmap.org/wiki/Admin_level
rank_search: rank in search hierarchy rank_search: rank in search hierarchy
(see also http://wiki.openstreetmap.org/wiki/Nominatim/Development_overview#Country_to_street_level) (see also http://wiki.openstreetmap.org/wiki/Nominatim/Development_overview#Country_to_street_level)
rank_address: rank in address hierarchy (determines orer in address) rank_address: rank in address hierarchy (determines orer in address)
place_id: internal key (may differ between different instances) place_id: internal key (may differ between different instances)
country_code: ISO country code country_code: ISO country code
langaddress: localized full address langaddress: localized full address
placename: localized name of object placename: localized name of object
ref: content of ref tag (if available) ref: content of ref tag (if available)
lon: longitude lon: longitude
lat: latitude lat: latitude
importance: importance of place based on Wikipedia link count importance: importance of place based on Wikipedia link count
addressimportance: cumulated importance of address elements addressimportance: cumulated importance of address elements
extra_place: type of place (for admin boundaries, if there is a place tag) extra_place: type of place (for admin boundaries, if there is a place tag)
aBoundingBox: bounding Box aBoundingBox: bounding Box
label: short description of the object class/type (English only) label: short description of the object class/type (English only)
name: full name (currently the same as langaddress) name: full name (currently the same as langaddress)
foundorder: secondary ordering for places with same importance foundorder: secondary ordering for places with same importance
*/ */
function lookup() function lookup()
{ {
@@ -863,8 +863,8 @@
// Start with a blank search // Start with a blank search
$aSearches = array( $aSearches = array(
array('iSearchRank' => 0, 'iNamePhrase' => -1, 'sCountryCode' => false, 'aName'=>array(), 'aAddress'=>array(), 'aFullNameAddress'=>array(), array('iSearchRank' => 0, 'iNamePhrase' => -1, 'sCountryCode' => false, 'aName'=>array(), 'aAddress'=>array(), 'aFullNameAddress'=>array(),
'aNameNonSearch'=>array(), 'aAddressNonSearch'=>array(), 'aNameNonSearch'=>array(), 'aAddressNonSearch'=>array(),
'sOperator'=>'', 'aFeatureName' => array(), 'sClass'=>'', 'sType'=>'', 'sHouseNumber'=>'', 'fLat'=>'', 'fLon'=>'', 'fRadius'=>'') 'sOperator'=>'', 'aFeatureName' => array(), 'sClass'=>'', 'sType'=>'', 'sHouseNumber'=>'', 'fLat'=>'', 'fLon'=>'', 'fRadius'=>'')
); );
// Do we have a radius search? // Do we have a radius search?
@@ -1194,8 +1194,8 @@
{ {
$sSQL = "select place_id from placex where calculated_country_code='".$aSearch['sCountryCode']."' and rank_search = 4"; $sSQL = "select place_id from placex where calculated_country_code='".$aSearch['sCountryCode']."' and rank_search = 4";
if ($sCountryCodesSQL) $sSQL .= " and calculated_country_code in ($sCountryCodesSQL)"; if ($sCountryCodesSQL) $sSQL .= " and calculated_country_code in ($sCountryCodesSQL)";
if ($bBoundingBoxSearch) if ($bBoundingBoxSearch)
$sSQL .= " and _st_intersects($this->sViewboxSmallSQL, geometry)"; $sSQL .= " and _st_intersects($this->sViewboxSmallSQL, 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); if (CONST_Debug) var_dump($sSQL);
$aPlaceIDs = $this->oDB->getCol($sSQL); $aPlaceIDs = $this->oDB->getCol($sSQL);
@@ -1615,7 +1615,7 @@
if (!preg_match('/\pL/', $sWord)) unset($aRecheckWords[$i]); if (!preg_match('/\pL/', $sWord)) unset($aRecheckWords[$i]);
} }
if (CONST_Debug) { echo '<i>Recheck words:<\i>'; var_dump($aRecheckWords); } if (CONST_Debug) { echo '<i>Recheck words:<\i>'; var_dump($aRecheckWords); }
foreach($aSearchResults as $iResNum => $aResult) foreach($aSearchResults as $iResNum => $aResult)
{ {

View File

@@ -13,7 +13,7 @@
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') exit; if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') exit;
if (CONST_ClosedForIndexing && strpos(CONST_ClosedForIndexingExceptionIPs, ','.$_SERVER["REMOTE_ADDR"].',') === false) if (CONST_ClosedForIndexing && strpos(CONST_ClosedForIndexingExceptionIPs, ','.$_SERVER["REMOTE_ADDR"].',') === false)
{ {
echo "Closed for re-indexing..."; echo "Closed for re-indexing...";
exit; exit;
} }

View File

@@ -7,39 +7,39 @@
if (!CONST_ConnectionBucket_MemcacheServerAddress) return null; if (!CONST_ConnectionBucket_MemcacheServerAddress) return null;
if (!isset($m)) if (!isset($m))
{ {
$m = new Memcached(); $m = new Memcached();
$m->addServer(CONST_ConnectionBucket_MemcacheServerAddress, CONST_ConnectionBucket_MemcacheServerPort); $m->addServer(CONST_ConnectionBucket_MemcacheServerAddress, CONST_ConnectionBucket_MemcacheServerPort);
} }
return $m; return $m;
} }
function doBucket($asKey, $iRequestCost, $iLeakPerSecond, $iThreshold) function doBucket($asKey, $iRequestCost, $iLeakPerSecond, $iThreshold)
{ {
$m = getBucketMemcache(); $m = getBucketMemcache();
if (!$m) return 0; if (!$m) return 0;
$iMaxVal = 0; $iMaxVal = 0;
$t = time(); $t = time();
foreach($asKey as $sKey) foreach($asKey as $sKey)
{ {
$aCurrentBlock = $m->get($sKey); $aCurrentBlock = $m->get($sKey);
if (!$aCurrentBlock) if (!$aCurrentBlock)
{ {
$aCurrentBlock = array($iRequestCost, $t, false); $aCurrentBlock = array($iRequestCost, $t, false);
} }
else else
{ {
// add RequestCost // add RequestCost
// remove leak * the time since the last request // remove leak * the time since the last request
$aCurrentBlock[0] += $iRequestCost - ($t - $aCurrentBlock[1])*$iLeakPerSecond; $aCurrentBlock[0] += $iRequestCost - ($t - $aCurrentBlock[1])*$iLeakPerSecond;
$aCurrentBlock[1] = $t; $aCurrentBlock[1] = $t;
} }
if ($aCurrentBlock[0] <= 0) if ($aCurrentBlock[0] <= 0)
{ {
$m->delete($sKey); $m->delete($sKey);
} }
else else
{ {
// If we have hit the threshold stop and record this to the block list // If we have hit the threshold stop and record this to the block list
@@ -77,7 +77,7 @@
} }
} }
// Only keep in memcache until the time it would have expired (to avoid clutering memcache) // Only keep in memcache until the time it would have expired (to avoid clutering memcache)
$m->set($sKey, $aCurrentBlock, $t + 1 + $aCurrentBlock[0]/$iLeakPerSecond); $m->set($sKey, $aCurrentBlock, $t + 1 + $aCurrentBlock[0]/$iLeakPerSecond);
} }
// Bucket result in the largest bucket we find // Bucket result in the largest bucket we find
@@ -85,16 +85,16 @@
} }
return $iMaxVal; return $iMaxVal;
} }
function isBucketSleeping($asKey) function isBucketSleeping($asKey)
{ {
$m = getBucketMemcache(); $m = getBucketMemcache();
if (!$m) return false; if (!$m) return false;
foreach($asKey as $sKey) foreach($asKey as $sKey)
{ {
$aCurrentBlock = $m->get($sKey); $aCurrentBlock = $m->get($sKey);
if ($aCurrentBlock[2]) return true; if ($aCurrentBlock[2]) return true;
} }
return false; return false;
@@ -102,15 +102,15 @@
function setBucketSleeping($asKey, $bVal) function setBucketSleeping($asKey, $bVal)
{ {
$m = getBucketMemcache(); $m = getBucketMemcache();
if (!$m) return false; if (!$m) return false;
$iMaxVal = 0; $iMaxVal = 0;
$t = time(); $t = time();
foreach($asKey as $sKey) foreach($asKey as $sKey)
{ {
$aCurrentBlock = $m->get($sKey); $aCurrentBlock = $m->get($sKey);
$aCurrentBlock[2] = $bVal; $aCurrentBlock[2] = $bVal;
$m->set($sKey, $aCurrentBlock, $t + 1 + $aCurrentBlock[0]/CONST_ConnectionBucket_LeakRate); $m->set($sKey, $aCurrentBlock, $t + 1 + $aCurrentBlock[0]/CONST_ConnectionBucket_LeakRate);
} }
@@ -137,9 +137,9 @@
function getBucketBlocks() function getBucketBlocks()
{ {
$m = getBucketMemcache(); $m = getBucketMemcache();
if (!$m) return null; if (!$m) return null;
$t = time(); $t = time();
$aBlockedList = $m->get('blockedList', null, $hCasToken); $aBlockedList = $m->get('blockedList', null, $hCasToken);
if (!$aBlockedList) $aBlockedList = array(); if (!$aBlockedList) $aBlockedList = array();
foreach($aBlockedList as $sKey => $aDetails) foreach($aBlockedList as $sKey => $aDetails)
@@ -161,7 +161,7 @@
function clearBucketBlocks() function clearBucketBlocks()
{ {
$m = getBucketMemcache(); $m = getBucketMemcache();
if (!$m) return false; if (!$m) return false;
$m->delete('blockedList'); $m->delete('blockedList');
return true; return true;

View File

@@ -101,7 +101,7 @@
function bySearchRank($a, $b) function bySearchRank($a, $b)
{ {
if ($a['iSearchRank'] == $b['iSearchRank']) if ($a['iSearchRank'] == $b['iSearchRank'])
return strlen($a['sOperator']) + strlen($a['sHouseNumber']) - strlen($b['sOperator']) - strlen($b['sHouseNumber']); return strlen($a['sOperator']) + strlen($a['sHouseNumber']) - strlen($b['sOperator']) - strlen($b['sHouseNumber']);
return ($a['iSearchRank'] < $b['iSearchRank']?-1:1); return ($a['iSearchRank'] < $b['iSearchRank']?-1:1);
} }

View File

@@ -1,106 +1,106 @@
<?php <?php
header("content-type: text/html; charset=UTF-8"); header("content-type: text/html; charset=UTF-8");
?> ?>
<?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?> <?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
<link href="css/common.css" rel="stylesheet" type="text/css" /> <link href="css/common.css" rel="stylesheet" type="text/css" />
<link href="css/search.css" rel="stylesheet" type="text/css" /> <link href="css/search.css" rel="stylesheet" type="text/css" />
</head> </head>
<body id="reverse-page"> <body id="reverse-page">
<?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?> <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
<form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php"> <form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php">
<div class="form-group"> <div class="form-group">
<input name="format" type="hidden" value="html"> <input name="format" type="hidden" value="html">
<input name="lat" type="text" class="form-control input-sm" placeholder="latitude" value="<?php echo htmlspecialchars($_GET['lat']); ?>" > <input name="lat" type="text" class="form-control input-sm" placeholder="latitude" value="<?php echo htmlspecialchars($_GET['lat']); ?>" >
<input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo htmlspecialchars($_GET['lon']); ?>" > <input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo htmlspecialchars($_GET['lon']); ?>" >
max zoom max zoom
<select name="zoom" class="form-control input-sm" value="<?php echo htmlspecialchars($_GET['zoom']); ?>"> <select name="zoom" class="form-control input-sm" value="<?php echo htmlspecialchars($_GET['zoom']); ?>">
<option value="" <?php echo $_GET['zoom']==''?'selected':'' ?> >--</option> <option value="" <?php echo $_GET['zoom']==''?'selected':'' ?> >--</option>
<?php <?php
$aZoomLevels = array( $aZoomLevels = array(
0 => "Continent / Sea", 0 => "Continent / Sea",
1 => "", 1 => "",
2 => "", 2 => "",
3 => "Country", 3 => "Country",
4 => "", 4 => "",
5 => "State", 5 => "State",
6 => "Region", 6 => "Region",
7 => "", 7 => "",
8 => "County", 8 => "County",
9 => "", 9 => "",
10 => "City", 10 => "City",
11 => "", 11 => "",
12 => "Town / Village", 12 => "Town / Village",
13 => "", 13 => "",
14 => "Suburb", 14 => "Suburb",
15 => "", 15 => "",
16 => "Street", 16 => "Street",
17 => "", 17 => "",
18 => "Building", 18 => "Building",
19 => "", 19 => "",
20 => "", 20 => "",
21 => "", 21 => "",
); );
foreach($aZoomLevels as $iZoomLevel => $sLabel) foreach($aZoomLevels as $iZoomLevel => $sLabel)
{ {
$bSel = isset($_GET['zoom']) && ($_GET['zoom'] == (string)$iZoomLevel); $bSel = isset($_GET['zoom']) && ($_GET['zoom'] == (string)$iZoomLevel);
echo '<option value="'.$iZoomLevel.'"'.($bSel?'selected':'').'>'.$iZoomLevel.' '.$sLabel.'</option>'."\n"; echo '<option value="'.$iZoomLevel.'"'.($bSel?'selected':'').'>'.$iZoomLevel.' '.$sLabel.'</option>'."\n";
} }
?> ?>
</select> </select>
</div> </div>
<div class="form-group search-button-group"> <div class="form-group search-button-group">
<button type="submit" class="btn btn-primary btn-sm">Search</button> <button type="submit" class="btn btn-primary btn-sm">Search</button>
</div> </div>
<div class="search-type-link"> <div class="search-type-link">
<a href="<?php echo CONST_Website_BaseURL; ?>search.php">forward search</a> <a href="<?php echo CONST_Website_BaseURL; ?>search.php">forward search</a>
</div> </div>
</form> </form>
<div id="content"> <div id="content">
<?php if ($aPlace) { ?> <?php if ($aPlace) { ?>
<div id="searchresults" class="sidebar"> <div id="searchresults" class="sidebar">
<?php <?php
$aResult = $aPlace; $aResult = $aPlace;
echo '<div class="result" data-position="0">'; echo '<div class="result" data-position="0">';
echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':''); echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
echo ' <span class="name">'.htmlspecialchars($aResult['langaddress']).'</span>'; echo ' <span class="name">'.htmlspecialchars($aResult['langaddress']).'</span>';
if (isset($aResult['label'])) if (isset($aResult['label']))
echo ' <span class="type">('.$aResult['label'].')</span>'; echo ' <span class="type">('.$aResult['label'].')</span>';
else if ($aResult['type'] == 'yes') else if ($aResult['type'] == 'yes')
echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>'; echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
else else
echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>'; echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
echo '<p>'.$aResult['lat'].','.$aResult['lon'].'</p>'; echo '<p>'.$aResult['lat'].','.$aResult['lon'].'</p>';
echo ' <a class="btn btn-default btn-xs details" href="details.php?place_id='.$aResult['place_id'].'">details</a>'; echo ' <a class="btn btn-default btn-xs details" href="details.php?place_id='.$aResult['place_id'].'">details</a>';
echo '</div>'; echo '</div>';
?> ?>
</div> </div>
<?php } else { ?> <?php } else { ?>
<div id="intro" class="sidebar"> <div id="intro" class="sidebar">
Search for coordinates or click anywhere on the map. Search for coordinates or click anywhere on the map.
</div> </div>
<?php } ?> <?php } ?>
<div id="map-wrapper"> <div id="map-wrapper">
<div id="map-position"></div> <div id="map-position"></div>
<div id="map"></div> <div id="map"></div>
</div> </div>
</div> <!-- /content --> </div> <!-- /content -->
@@ -108,22 +108,22 @@
<script type="text/javascript"> <script type="text/javascript">
<?php <?php
$aNominatimMapInit = [ $aNominatimMapInit = [
'zoom' => isset($_GET['zoom']) ? htmlspecialchars($_GET['zoom']) : CONST_Default_Zoom, 'zoom' => isset($_GET['zoom']) ? htmlspecialchars($_GET['zoom']) : CONST_Default_Zoom,
'lat' => isset($_GET['lat'] ) ? htmlspecialchars($_GET['lat'] ) : CONST_Default_Lat, 'lat' => isset($_GET['lat'] ) ? htmlspecialchars($_GET['lat'] ) : CONST_Default_Lat,
'lon' => isset($_GET['lon'] ) ? htmlspecialchars($_GET['lon'] ) : CONST_Default_Lon, 'lon' => isset($_GET['lon'] ) ? htmlspecialchars($_GET['lon'] ) : CONST_Default_Lon,
'tile_url' => $sTileURL, 'tile_url' => $sTileURL,
'tile_attribution' => $sTileAttribution 'tile_attribution' => $sTileAttribution
]; ];
echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';'; echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
echo 'var nominatim_results = ' . json_encode([$aPlace], JSON_PRETTY_PRINT) . ';'; echo 'var nominatim_results = ' . json_encode([$aPlace], JSON_PRETTY_PRINT) . ';';
?> ?>
</script> </script>
<?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?> <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
</body> </body>
</html> </html>

View File

@@ -13,13 +13,13 @@
if (isset($aPlace['place_id'])) $aFilteredPlaces['place_id'] = $aPlace['place_id']; if (isset($aPlace['place_id'])) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright"; $aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
$sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':''))); $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
if ($sOSMType) if ($sOSMType)
{ {
$aFilteredPlaces['osm_type'] = $sOSMType; $aFilteredPlaces['osm_type'] = $sOSMType;
$aFilteredPlaces['osm_id'] = $aPlace['osm_id']; $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
} }
if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat']; if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon']; if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
$aFilteredPlaces['display_name'] = $aPlace['langaddress']; $aFilteredPlaces['display_name'] = $aPlace['langaddress'];
if (isset($aPlace['aAddress'])) $aFilteredPlaces['address'] = $aPlace['aAddress']; if (isset($aPlace['aAddress'])) $aFilteredPlaces['address'] = $aPlace['aAddress'];
if (isset($aPlace['sExtraTags'])) $aFilteredPlaces['extratags'] = $aPlace['sExtraTags']; if (isset($aPlace['sExtraTags'])) $aFilteredPlaces['extratags'] = $aPlace['sExtraTags'];

View File

@@ -13,11 +13,11 @@
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id']; if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright"; $aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
$sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':''))); $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
if ($sOSMType) if ($sOSMType)
{ {
$aFilteredPlaces['osm_type'] = $sOSMType; $aFilteredPlaces['osm_type'] = $sOSMType;
$aFilteredPlaces['osm_id'] = $aPlace['osm_id']; $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
} }
if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat']; if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon']; if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];

View File

@@ -264,21 +264,21 @@
<script type="text/javascript"> <script type="text/javascript">
<?php <?php
$aNominatimMapInit = [ $aNominatimMapInit = [
'tile_url' => $sTileURL, 'tile_url' => $sTileURL,
'tile_attribution' => $sTileAttribution 'tile_attribution' => $sTileAttribution
]; ];
echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';'; echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
$aPlace = [ $aPlace = [
'outlinestring' => $aPointDetails['outlinestring'], 'outlinestring' => $aPointDetails['outlinestring'],
'lon' => $aPointDetails['lon'], 'lon' => $aPointDetails['lon'],
'lat' => $aPointDetails['lat'], 'lat' => $aPointDetails['lat'],
]; ];
echo 'var nominatim_result = ' . json_encode($aPlace, JSON_PRETTY_PRINT) . ';'; echo 'var nominatim_result = ' . json_encode($aPlace, JSON_PRETTY_PRINT) . ';';
?> ?>
</script> </script>

View File

@@ -1,10 +1,10 @@
<footer> <footer>
<p class="disclaimer"> <p class="disclaimer">
Addresses and postcodes are approximate Addresses and postcodes are approximate
</p> </p>
<p class="copyright"> <p class="copyright">
&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors &copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors
</p> </p>
</footer> </footer>
<script src="js/jquery.min.js"></script> <script src="js/jquery.min.js"></script>

View File

@@ -1,49 +1,49 @@
<header class="container-fluid"> <header class="container-fluid">
<div class="row"> <div class="row">
<div class="col-xs-4"> <div class="col-xs-4">
<div class="brand"> <div class="brand">
<a href="<?php echo CONST_Website_BaseURL;?>"> <a href="<?php echo CONST_Website_BaseURL;?>">
<img alt="logo" src="images/osm_logo.120px.png" width="30" height="30"/> <img alt="logo" src="images/osm_logo.120px.png" width="30" height="30"/>
<h1>Nominatim</h1> <h1>Nominatim</h1>
</a> </a>
</div> </div>
</div> </div>
<div id="last-updated" class="col-xs-4 text-center"> <div id="last-updated" class="col-xs-4 text-center">
<?php if ($sDataDate){ ?> <?php if ($sDataDate){ ?>
Data last updated: Data last updated:
<br> <br>
<?php echo $sDataDate; ?> <?php echo $sDataDate; ?>
<?php } ?> <?php } ?>
</div> </div>
<div class="col-xs-4 text-right"> <div class="col-xs-4 text-right">
<div class="btn-group"> <div class="btn-group">
<button class="dropdown-toggle btn btn-sm btn-default" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <button class="dropdown-toggle btn btn-sm btn-default" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
About &amp; Help <span class="caret"></span> About &amp; Help <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a></li> <li><a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a></li>
<li><a href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ" target="_blank">FAQ</a></li> <li><a href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ" target="_blank">FAQ</a></li>
<li role="separator" class="divider"></li> <li role="separator" class="divider"></li>
<li><a href="#" class="" data-toggle="modal" data-target="#report-modal">Report problem with results</a></li> <li><a href="#" class="" data-toggle="modal" data-target="#report-modal">Report problem with results</a></li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
</header> </header>
<div class="modal fade" id="report-modal"> <div class="modal fade" id="report-modal">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Report a problem</h4> <h4 class="modal-title">Report a problem</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<?php include(CONST_BasePath.'/lib/template/includes/report-errors.php'); ?> <?php include(CONST_BasePath.'/lib/template/includes/report-errors.php'); ?>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button> <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -11,8 +11,8 @@
foreach($aSearchResults as $iResNum => $aPointDetails) foreach($aSearchResults as $iResNum => $aPointDetails)
{ {
$aPlace = array( $aPlace = array(
'place_id'=>$aPointDetails['place_id'], 'place_id'=>$aPointDetails['place_id'],
); );
$sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':''))); $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
if ($sOSMType) if ($sOSMType)
@@ -21,8 +21,8 @@
$aPlace['osm_id'] = $aPointDetails['osm_id']; $aPlace['osm_id'] = $aPointDetails['osm_id'];
} }
if (isset($aPointDetails['aBoundingBox'])) if (isset($aPointDetails['aBoundingBox']))
{ {
$aPlace['boundingbox'] = array( $aPlace['boundingbox'] = array(
$aPointDetails['aBoundingBox'][0], $aPointDetails['aBoundingBox'][0],
$aPointDetails['aBoundingBox'][1], $aPointDetails['aBoundingBox'][1],
@@ -33,7 +33,7 @@
{ {
$aPlace['polygonpoints'] = $aPointDetails['aPolyPoints']; $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
} }
} }
if (isset($aPointDetails['zoom'])) if (isset($aPointDetails['zoom']))
{ {
@@ -58,27 +58,27 @@
if (isset($aPointDetails['address']) && sizeof($aPointDetails['address'])>0) if (isset($aPointDetails['address']) && sizeof($aPointDetails['address'])>0)
{ {
$aPlace['address'] = $aPointDetails['address']; $aPlace['address'] = $aPointDetails['address'];
} }
if (isset($aPointDetails['asgeojson'])) if (isset($aPointDetails['asgeojson']))
{ {
$aPlace['geojson'] = json_decode($aPointDetails['asgeojson']); $aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
} }
if (isset($aPointDetails['assvg'])) if (isset($aPointDetails['assvg']))
{ {
$aPlace['svg'] = $aPointDetails['assvg']; $aPlace['svg'] = $aPointDetails['assvg'];
} }
if (isset($aPointDetails['astext'])) if (isset($aPointDetails['astext']))
{ {
$aPlace['geotext'] = $aPointDetails['astext']; $aPlace['geotext'] = $aPointDetails['astext'];
} }
if (isset($aPointDetails['askml'])) if (isset($aPointDetails['askml']))
{ {
$aPlace['geokml'] = $aPointDetails['askml']; $aPlace['geokml'] = $aPointDetails['askml'];
} }
$aFilteredPlaces[] = $aPlace; $aFilteredPlaces[] = $aPlace;
} }

View File

@@ -16,8 +16,8 @@
$aPlace['osm_id'] = $aPointDetails['osm_id']; $aPlace['osm_id'] = $aPointDetails['osm_id'];
} }
if (isset($aPointDetails['aBoundingBox'])) if (isset($aPointDetails['aBoundingBox']))
{ {
$aPlace['boundingbox'] = array( $aPlace['boundingbox'] = array(
$aPointDetails['aBoundingBox'][0], $aPointDetails['aBoundingBox'][0],
$aPointDetails['aBoundingBox'][1], $aPointDetails['aBoundingBox'][1],
@@ -28,7 +28,7 @@
{ {
$aPlace['polygonpoints'] = $aPointDetails['aPolyPoints']; $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
} }
} }
if (isset($aPointDetails['zoom'])) if (isset($aPointDetails['zoom']))
{ {
@@ -52,22 +52,22 @@
if (isset($aPointDetails['address'])) if (isset($aPointDetails['address']))
{ {
$aPlace['address'] = $aPointDetails['address']; $aPlace['address'] = $aPointDetails['address'];
} }
if (isset($aPointDetails['asgeojson'])) if (isset($aPointDetails['asgeojson']))
{ {
$aPlace['geojson'] = json_decode($aPointDetails['asgeojson']); $aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
} }
if (isset($aPointDetails['assvg'])) if (isset($aPointDetails['assvg']))
{ {
$aPlace['svg'] = $aPointDetails['assvg']; $aPlace['svg'] = $aPointDetails['assvg'];
} }
if (isset($aPointDetails['astext'])) if (isset($aPointDetails['astext']))
{ {
$aPlace['geotext'] = $aPointDetails['astext']; $aPlace['geotext'] = $aPointDetails['astext'];
} }
if (isset($aPointDetails['askml'])) if (isset($aPointDetails['askml']))
{ {

View File

@@ -14,8 +14,8 @@
$aPlace['osm_id'] = $aPointDetails['osm_id']; $aPlace['osm_id'] = $aPointDetails['osm_id'];
} }
if (isset($aPointDetails['aBoundingBox'])) if (isset($aPointDetails['aBoundingBox']))
{ {
$aPlace['boundingbox'] = array( $aPlace['boundingbox'] = array(
$aPointDetails['aBoundingBox'][0], $aPointDetails['aBoundingBox'][0],
$aPointDetails['aBoundingBox'][1], $aPointDetails['aBoundingBox'][1],
@@ -26,7 +26,7 @@
{ {
$aPlace['polygonpoints'] = $aPointDetails['aPolyPoints']; $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
} }
} }
if (isset($aPointDetails['zoom'])) if (isset($aPointDetails['zoom']))
{ {
@@ -51,27 +51,27 @@
if (isset($aPointDetails['address']) && sizeof($aPointDetails['address'])>0) if (isset($aPointDetails['address']) && sizeof($aPointDetails['address'])>0)
{ {
$aPlace['address'] = $aPointDetails['address']; $aPlace['address'] = $aPointDetails['address'];
} }
if (isset($aPointDetails['asgeojson'])) if (isset($aPointDetails['asgeojson']))
{ {
$aPlace['geojson'] = json_decode($aPointDetails['asgeojson']); $aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
} }
if (isset($aPointDetails['assvg'])) if (isset($aPointDetails['assvg']))
{ {
$aPlace['svg'] = $aPointDetails['assvg']; $aPlace['svg'] = $aPointDetails['assvg'];
} }
if (isset($aPointDetails['astext'])) if (isset($aPointDetails['astext']))
{ {
$aPlace['geotext'] = $aPointDetails['astext']; $aPlace['geotext'] = $aPointDetails['astext'];
} }
if (isset($aPointDetails['askml'])) if (isset($aPointDetails['askml']))
{ {
$aPlace['geokml'] = $aPointDetails['askml']; $aPlace['geokml'] = $aPointDetails['askml'];
} }
if (isset($aPointDetails['sExtraTags'])) $aPlace['extratags'] = $aPointDetails['sExtraTags']; if (isset($aPointDetails['sExtraTags'])) $aPlace['extratags'] = $aPointDetails['sExtraTags'];
if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails']; if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];

View File

@@ -38,14 +38,14 @@ $aLanguageIn = array(
# class/type combinations to exclude # class/type combinations to exclude
$aTagsBlacklist = array( $aTagsBlacklist = array(
'boundary' => array('administrative'), 'boundary' => array('administrative'),
'place' => array('house', 'houses'), 'place' => array('house', 'houses'),
); );
# If a class is in the white list then all types will # If a class is in the white list then all types will
# be ignored except the ones given in the list. # be ignored except the ones given in the list.
# Also use this list to exclude an entire class from # Also use this list to exclude an entire class from
# special phrases. # special phrases.
$aTagsWhitelist = array( $aTagsWhitelist = array(
'highway' => array('bus_stop', 'rest_area', 'raceway'), 'highway' => array('bus_stop', 'rest_area', 'raceway'),
'building' => array(), 'building' => array(),
); );

View File

@@ -1,6 +1,6 @@
<?php <?php
require_once(dirname(dirname(__FILE__)).'/lib/init-website.php'); require_once(dirname(dirname(__FILE__)).'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php'); require_once(CONST_BasePath.'/lib/log.php');
$sOutputFormat = 'html'; $sOutputFormat = 'html';
ini_set('memory_limit', '200M'); ini_set('memory_limit', '200M');
@@ -19,12 +19,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" > <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>Nominatim Deleted Data</title> <title>Nominatim Deleted Data</title>
<meta name="description" content="List of OSM data that has been deleted" lang="en-US" /> <meta name="description" content="List of OSM data that has been deleted" lang="en-US" />
</head> </head>
@@ -79,16 +79,16 @@ table td {
{ {
switch($sCol) switch($sCol)
{ {
case 'osm_id': case 'osm_id':
$sOSMType = ($aRow['osm_type'] == 'N'?'node':($aRow['osm_type'] == 'W'?'way':($aRow['osm_type'] == 'R'?'relation':''))); $sOSMType = ($aRow['osm_type'] == 'N'?'node':($aRow['osm_type'] == 'W'?'way':($aRow['osm_type'] == 'R'?'relation':'')));
echo '<td><a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$sVal.'" target="_new">'.$sVal.'</a></td>'; echo '<td><a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$sVal.'" target="_new">'.$sVal.'</a></td>';
break; break;
case 'place_id': case 'place_id':
echo '<td><a href="'.CONST_Website_BaseURL.'details?place_id='.$sVal.'">'.$sVal.'</a></td>'; echo '<td><a href="'.CONST_Website_BaseURL.'details?place_id='.$sVal.'">'.$sVal.'</a></td>';
break; break;
default: default:
echo "<td>".($sVal?$sVal:'&nbsp;')."</td>"; echo "<td>".($sVal?$sVal:'&nbsp;')."</td>";
break; break;
} }
} }
echo "</tr>"; echo "</tr>";

View File

@@ -78,7 +78,7 @@
$aBreadcrums[] = array('placeId'=>$aPlace['place_id'], 'osmType'=>$aPlace['osm_type'], 'osmId'=>$aPlace['osm_id'], 'localName'=>$aPlace['localname']); $aBreadcrums[] = array('placeId'=>$aPlace['place_id'], 'osmType'=>$aPlace['osm_type'], 'osmId'=>$aPlace['osm_id'], 'localName'=>$aPlace['localname']);
$sPlaceUrl = 'hierarchy.php?place_id='.$aPlace['place_id']; $sPlaceUrl = 'hierarchy.php?place_id='.$aPlace['place_id'];
$sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':''))); $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
$sOSMUrl = 'http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aPlace['osm_id']; $sOSMUrl = 'http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aPlace['osm_id'];
if ($sOutputFormat == 'html') if ($i) echo " > "; if ($sOutputFormat == 'html') if ($i) echo " > ";
if ($sOutputFormat == 'html') echo '<a href="'.$sPlaceUrl.'">'.$aPlace['localname'].'</a> (<a href="'.$sOSMUrl.'">osm</a>)'; if ($sOutputFormat == 'html') echo '<a href="'.$sPlaceUrl.'">'.$aPlace['localname'].'</a> (<a href="'.$sOSMUrl.'">osm</a>)';
} }
@@ -102,52 +102,52 @@
$sSQL .= " order by rank_address asc,rank_search asc,localname,class, type,housenumber"; $sSQL .= " order by rank_address asc,rank_search asc,localname,class, type,housenumber";
$aParentOfLines = $oDB->getAll($sSQL); $aParentOfLines = $oDB->getAll($sSQL);
if (sizeof($aParentOfLines)) if (sizeof($aParentOfLines))
{ {
echo '<h2>Parent Of:</h2>'; echo '<h2>Parent Of:</h2>';
$aClassType = getClassTypesWithImportance(); $aClassType = getClassTypesWithImportance();
$aGroupedAddressLines = array(); $aGroupedAddressLines = array();
foreach($aParentOfLines as $aAddressLine) foreach($aParentOfLines as $aAddressLine)
{ {
if (isset($aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label']) if (isset($aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label'])
&& $aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label']) && $aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label'])
{ {
$aAddressLine['label'] = $aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label']; $aAddressLine['label'] = $aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label'];
} }
elseif (isset($aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label']) elseif (isset($aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label'])
&& $aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label']) && $aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label'])
{ {
$aAddressLine['label'] = $aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label']; $aAddressLine['label'] = $aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label'];
} }
else $aAddressLine['label'] = ucwords($aAddressLine['type']); else $aAddressLine['label'] = ucwords($aAddressLine['type']);
if (!isset($aGroupedAddressLines[$aAddressLine['label']])) $aGroupedAddressLines[$aAddressLine['label']] = array(); if (!isset($aGroupedAddressLines[$aAddressLine['label']])) $aGroupedAddressLines[$aAddressLine['label']] = array();
$aGroupedAddressLines[$aAddressLine['label']][] = $aAddressLine; $aGroupedAddressLines[$aAddressLine['label']][] = $aAddressLine;
} }
foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines) foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
{ {
echo "<h3>$sGroupHeading</h3>"; echo "<h3>$sGroupHeading</h3>";
foreach($aParentOfLines as $aAddressLine) foreach($aParentOfLines as $aAddressLine)
{ {
$aAddressLine['localname'] = $aAddressLine['localname']?$aAddressLine['localname']:$aAddressLine['housenumber']; $aAddressLine['localname'] = $aAddressLine['localname']?$aAddressLine['localname']:$aAddressLine['housenumber'];
$sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':''))); $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
echo '<div class="line">'; echo '<div class="line">';
echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>'; echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
echo ' ('; echo ' (';
echo '<span class="area">'.($aAddressLine['isarea']=='t'?'Polygon':'Point').'</span>'; echo '<span class="area">'.($aAddressLine['isarea']=='t'?'Polygon':'Point').'</span>';
if ($sOSMType) echo ', <span class="osm"><span class="label"></span>'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>'; if ($sOSMType) echo ', <span class="osm"><span class="label"></span>'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>';
echo ', <a href="hierarchy.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>'; echo ', <a href="hierarchy.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
echo ', '.$aAddressLine['area']; echo ', '.$aAddressLine['area'];
echo ')'; echo ')';
echo '</div>'; echo '</div>';
} }
} }
if (sizeof($aParentOfLines) >= 500) { if (sizeof($aParentOfLines) >= 500) {
echo '<p>There are more child objects which are not shown.</p>'; echo '<p>There are more child objects which are not shown.</p>';
} }
echo '</div>'; echo '</div>';
} }
exit; exit;

View File

@@ -39,12 +39,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" > <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>Nominatim Broken Polygon Data</title> <title>Nominatim Broken Polygon Data</title>
<meta name="description" content="List of broken OSM polygon data by date" lang="en-US" /> <meta name="description" content="List of broken OSM polygon data by date" lang="en-US" />
</head> </head>