Compare commits

...

10 Commits

Author SHA1 Message Date
Sarah Hoffmann
567d81d10d remove more JSON_PRETTY_PRINT parameters 2016-10-17 23:03:21 +02:00
Sarah Hoffmann
6d77c08269 remove JSON_PRETTY_PRINT (requires php >= 5.4) 2016-10-17 21:49:12 +02:00
Sarah Hoffmann
f42ae6b2f6 replace more new-style array constructs 2016-10-17 21:37:13 +02:00
marc tobias
83ce6e12e7 query the last updated timestamp only if output format is HTML 2016-08-02 21:56:30 +02:00
Sarah Hoffmann
5b4c7b7f7e replace [] notation with old-style array() 2016-07-21 22:15:33 +02:00
Sarah Hoffmann
70997a9554 remove reference assignment where unnecessary
Avoids a number of warnings on PHP7.
2016-07-21 22:10:53 +02:00
Sarah Hoffmann
805f16b0cd bump version for 2.5.1 release 2016-04-26 22:05:46 +02:00
Marc Tobias Metten
083c55b230 update.php was checking for static file which is no longer part of the project 2016-04-26 22:02:16 +02:00
marc tobias
a24991b430 corrected layout of keywords on HTML details page 2016-04-26 22:02:04 +02:00
Marc Tobias Metten
3b44edf4a5 corrected layout of keywords on HTML details page 2016-04-26 22:01:51 +02:00
12 changed files with 73 additions and 44 deletions

View File

@@ -1,3 +1,8 @@
2.5.1
* fix layout error in details page when keywords are displayed
* fix website check during setup
2.5 2.5
* reverse geocoding includes looking up housenumbers from Tiger data * reverse geocoding includes looking up housenumbers from Tiger data

View File

@@ -1,4 +1,4 @@
AC_INIT(Nominatim,2.5) AC_INIT(Nominatim,2.5.1)
if git rev-parse HEAD 2>/dev/null >/dev/null; then if git rev-parse HEAD 2>/dev/null >/dev/null; then
AC_SUBST([PACKAGE_VERSION], [$PACKAGE_VERSION-git-`git rev-parse --short HEAD`]) AC_SUBST([PACKAGE_VERSION], [$PACKAGE_VERSION-git-`git rev-parse --short HEAD`])
fi fi

View File

@@ -4,7 +4,7 @@
function &getDB($bNew = false, $bPersistent = false) function &getDB($bNew = false, $bPersistent = false)
{ {
// Get the database object // Get the database object
$oDB =& DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), $bPersistent); $oDB = DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), $bPersistent);
if (PEAR::IsError($oDB)) if (PEAR::IsError($oDB))
{ {
var_dump(CONST_Database_DSN); var_dump(CONST_Database_DSN);

View File

@@ -111,16 +111,16 @@
<script type="text/javascript"> <script type="text/javascript">
<?php <?php
$aNominatimMapInit = [ $aNominatimMapInit = array(
'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) . ';';
echo 'var nominatim_results = ' . json_encode([$aPlace], JSON_PRETTY_PRINT) . ';'; echo 'var nominatim_results = ' . json_encode([$aPlace]) . ';';
?> ?>
</script> </script>
<?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?> <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>

View File

@@ -113,6 +113,19 @@
echo "</tr>\n"; echo "</tr>\n";
} }
function _one_keyword_row($keyword_token,$word_id){
echo "<tr>\n";
echo '<td>';
// mark partial tokens (those starting with a space) with a star for readability
echo ($keyword_token[0]==' '?'*':'');
echo $keyword_token;
if (isset($word_id))
{
echo '</td><td>word id: '.$word_id;
}
echo "</td></tr>\n";
}
?> ?>
@@ -209,7 +222,7 @@
headline('Name Keywords'); headline('Name Keywords');
foreach($aPlaceSearchNameKeywords as $aRow) foreach($aPlaceSearchNameKeywords as $aRow)
{ {
echo '<div>'.$aRow['word_token']."</div>\n"; _one_keyword_row($aRow['word_token'], $aRow['word_id']);
} }
} }
@@ -218,7 +231,7 @@
headline('Address Keywords'); headline('Address Keywords');
foreach($aPlaceSearchAddressKeywords as $aRow) foreach($aPlaceSearchAddressKeywords as $aRow)
{ {
echo '<div>'.($aRow['word_token'][0]==' '?'*':'').$aRow['word_token'].'('.$aRow['word_id'].')'."</div>\n"; _one_keyword_row($aRow['word_token'], $aRow['word_id']);
} }
} }
@@ -264,18 +277,18 @@
<script type="text/javascript"> <script type="text/javascript">
<?php <?php
$aNominatimMapInit = [ $aNominatimMapInit = array(
'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) . ';';
$aPlace = [ $aPlace = array(
'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) . ';';
?> ?>

View File

@@ -9,7 +9,7 @@
</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 (isset($sDataDate)){ ?>
Data last updated: Data last updated:
<br> <br>
<?php echo $sDataDate; ?> <?php echo $sDataDate; ?>

View File

@@ -96,16 +96,16 @@
<script type="text/javascript"> <script type="text/javascript">
<?php <?php
$aNominatimMapInit = [ $aNominatimMapInit = array(
'zoom' => $iZoom, 'zoom' => $iZoom,
'lat' => $fLat, 'lat' => $fLat,
'lon' => $fLon, 'lon' => $fLon,
'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) . ';';
echo 'var nominatim_results = ' . json_encode($aSearchResults, JSON_PRETTY_PRINT) . ';'; echo 'var nominatim_results = ' . json_encode($aSearchResults) . ';';
?> ?>
</script> </script>
<?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?> <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>

View File

@@ -31,7 +31,7 @@
if (isset($aCMDResult['bounded'])) $aCMDResult['bounded'] = 'true'; if (isset($aCMDResult['bounded'])) $aCMDResult['bounded'] = 'true';
if (isset($aCMDResult['nodedupe'])) $aCMDResult['dedupe'] = 'false'; if (isset($aCMDResult['nodedupe'])) $aCMDResult['dedupe'] = 'false';
$oGeocode =& new Geocode($oDB); $oGeocode = new Geocode($oDB);
if (isset($aCMDResult['accept-language']) && $aCMDResult['accept-language']) if (isset($aCMDResult['accept-language']) && $aCMDResult['accept-language'])
$oGeocode->setLanguagePreference(getPreferredLanguages($aCMDResult['accept-language'])); $oGeocode->setLanguagePreference(getPreferredLanguages($aCMDResult['accept-language']));
else else

View File

@@ -97,7 +97,7 @@
{ {
echo "Create DB\n"; echo "Create DB\n";
$bDidSomething = true; $bDidSomething = true;
$oDB =& DB::connect(CONST_Database_DSN, false); $oDB = DB::connect(CONST_Database_DSN, false);
if (!PEAR::isError($oDB)) if (!PEAR::isError($oDB))
{ {
fail('database already exists ('.CONST_Database_DSN.')'); fail('database already exists ('.CONST_Database_DSN.')');
@@ -722,7 +722,7 @@
@symlink(CONST_BasePath.'/website/css', $sTargetDir.'/css'); @symlink(CONST_BasePath.'/website/css', $sTargetDir.'/css');
echo "Symlinks created\n"; echo "Symlinks created\n";
$sTestFile = @file_get_contents(CONST_Website_BaseURL.'js/tiles.js'); $sTestFile = @file_get_contents(CONST_Website_BaseURL.'js/nominatim-ui.js');
if (!$sTestFile) if (!$sTestFile)
{ {
echo "\nWARNING: Unable to access the website at ".CONST_Website_BaseURL."\n"; echo "\nWARNING: Unable to access the website at ".CONST_Website_BaseURL."\n";

View File

@@ -90,7 +90,7 @@
$aPointDetails['aNames'] = $oDB->getAssoc($sSQL); $aPointDetails['aNames'] = $oDB->getAssoc($sSQL);
if (PEAR::isError($aPointDetails['aNames'])) // possible timeout if (PEAR::isError($aPointDetails['aNames'])) // possible timeout
{ {
$aPointDetails['aNames'] = []; $aPointDetails['aNames'] = array();
} }
// Extra tags // Extra tags
@@ -98,7 +98,7 @@
$aPointDetails['aExtraTags'] = $oDB->getAssoc($sSQL); $aPointDetails['aExtraTags'] = $oDB->getAssoc($sSQL);
if (PEAR::isError($aPointDetails['aExtraTags'])) // possible timeout if (PEAR::isError($aPointDetails['aExtraTags'])) // possible timeout
{ {
$aPointDetails['aExtraTags'] = []; $aPointDetails['aExtraTags'] = array();
} }
// Address // Address
@@ -113,7 +113,7 @@
$aLinkedLines = $oDB->getAll($sSQL); $aLinkedLines = $oDB->getAll($sSQL);
if (PEAR::isError($aLinkedLines)) // possible timeout if (PEAR::isError($aLinkedLines)) // possible timeout
{ {
$aLinkedLines = []; $aLinkedLines = array();
} }
// All places this is an imediate parent of // All places this is an imediate parent of
@@ -126,7 +126,7 @@
$aParentOfLines = $oDB->getAll($sSQL); $aParentOfLines = $oDB->getAll($sSQL);
if (PEAR::isError($aParentOfLines)) // possible timeout if (PEAR::isError($aParentOfLines)) // possible timeout
{ {
$aParentOfLines = []; $aParentOfLines = array();
} }
$aPlaceSearchNameKeywords = false; $aPlaceSearchNameKeywords = false;
@@ -137,14 +137,14 @@
$aPlaceSearchName = $oDB->getRow($sSQL); $aPlaceSearchName = $oDB->getRow($sSQL);
if (PEAR::isError($aPlaceSearchName)) // possible timeout if (PEAR::isError($aPlaceSearchName)) // possible timeout
{ {
$aPlaceSearchName = []; $aPlaceSearchName = array();
} }
$sSQL = "select * from word where word_id in (".substr($aPlaceSearchName['name_vector'],1,-1).")"; $sSQL = "select * from word where word_id in (".substr($aPlaceSearchName['name_vector'],1,-1).")";
$aPlaceSearchNameKeywords = $oDB->getAll($sSQL); $aPlaceSearchNameKeywords = $oDB->getAll($sSQL);
if (PEAR::isError($aPlaceSearchNameKeywords)) // possible timeout if (PEAR::isError($aPlaceSearchNameKeywords)) // possible timeout
{ {
$aPlaceSearchNameKeywords = []; $aPlaceSearchNameKeywords = array();
} }
@@ -152,14 +152,19 @@
$aPlaceSearchAddressKeywords = $oDB->getAll($sSQL); $aPlaceSearchAddressKeywords = $oDB->getAll($sSQL);
if (PEAR::isError($aPlaceSearchAddressKeywords)) // possible timeout if (PEAR::isError($aPlaceSearchAddressKeywords)) // possible timeout
{ {
$aPlaceSearchAddressKeywords = []; $aPlaceSearchAddressKeywords = array();
} }
} }
logEnd($oDB, $hLog, 1); logEnd($oDB, $hLog, 1);
$sTileURL = CONST_Map_Tile_URL; if ($sOutputFormat=='html')
$sTileAttribution = CONST_Map_Tile_Attribution; {
$sDataDate = $oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1");
$sTileURL = CONST_Map_Tile_URL;
$sTileAttribution = CONST_Map_Tile_Attribution;
}
include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php'); include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');

View File

@@ -76,6 +76,10 @@
exit; exit;
} }
$sTileURL = CONST_Map_Tile_URL; if ($sOutputFormat=='html')
$sTileAttribution = CONST_Map_Tile_Attribution; {
$sDataDate = $oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1");
$sTileURL = CONST_Map_Tile_URL;
$sTileAttribution = CONST_Map_Tile_Attribution;
}
include(CONST_BasePath.'/lib/template/address-'.$sOutputFormat.'.php'); include(CONST_BasePath.'/lib/template/address-'.$sOutputFormat.'.php');

View File

@@ -13,8 +13,6 @@
$fLat = CONST_Default_Lat; $fLat = CONST_Default_Lat;
$fLon = CONST_Default_Lon; $fLon = CONST_Default_Lon;
$iZoom = CONST_Default_Zoom; $iZoom = CONST_Default_Zoom;
$sTileURL = CONST_Map_Tile_URL;
$sTileAttribution = CONST_Map_Tile_Attribution;
$oGeocode =& new Geocode($oDB); $oGeocode =& new Geocode($oDB);
@@ -99,17 +97,17 @@
{ {
if (!(isset($_GET['q']) && $_GET['q']) && isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/') if (!(isset($_GET['q']) && $_GET['q']) && isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
{ {
$sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1); $sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
// reverse order of '/' separated string // reverse order of '/' separated string
$aPhrases = explode('/', $sQuery); $aPhrases = explode('/', $sQuery);
$aPhrases = array_reverse($aPhrases); $aPhrases = array_reverse($aPhrases);
$sQuery = join(', ',$aPhrases); $sQuery = join(', ',$aPhrases);
$oGeocode->setQuery($sQuery); $oGeocode->setQuery($sQuery);
} }
else else
{ {
$oGeocode->setQueryFromParams($_GET); $oGeocode->setQueryFromParams($_GET);
} }
} }
@@ -118,8 +116,12 @@
$aSearchResults = $oGeocode->lookup(); $aSearchResults = $oGeocode->lookup();
if ($aSearchResults === false) $aSearchResults = array(); if ($aSearchResults === false) $aSearchResults = array();
$sDataDate = $oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"); if ($sOutputFormat=='html')
{
$sDataDate = $oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1");
$sTileURL = CONST_Map_Tile_URL;
$sTileAttribution = CONST_Map_Tile_Attribution;
}
logEnd($oDB, $hLog, sizeof($aSearchResults)); logEnd($oDB, $hLog, sizeof($aSearchResults));
$bAsText = $oGeocode->getIncludePolygonAsText(); $bAsText = $oGeocode->getIncludePolygonAsText();