From b81894d3d58aa77246eb19a8a8f99c3c7926dbcf Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Tue, 27 Oct 2020 21:29:35 +0100 Subject: [PATCH] remove now unused settings related to website There are two places where the website URL is still used: for icons, replace the URL with a link to the icon repository of the UI repo. The more URL now builds the link from the server info. --- lib/ClassTypes.php | 6 +++++- lib/setup/SetupClass.php | 9 ++------- settings/defaults.php | 14 +++++--------- website/search.php | 12 +++++++++++- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/lib/ClassTypes.php b/lib/ClassTypes.php index 752db865..bb7b0486 100644 --- a/lib/ClassTypes.php +++ b/lib/ClassTypes.php @@ -252,13 +252,17 @@ function getIcon($aPlace) */ function getIconFile($aPlace) { + if (CONST_MapIcon_URL === false) { + return null; + } + $sIcon = getIcon($aPlace); if (!isset($sIcon)) { return null; } - return CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.p.20.png'; + return CONST_MapIcon_URL.'/'.$sIcon.'.p.20.png'; } /** diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index 2815f8c4..7a4ef533 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -713,13 +713,8 @@ class SetupFunctions @define('CONST_BasePath', '".CONST_BasePath."'); if (file_exists(getenv('NOMINATIM_SETTINGS'))) require_once(getenv('NOMINATIM_SETTINGS')); -@define('CONST_Database_DSN', '".CONST_Database_DSN."'); // or add ;host=...;port=...;user=...;password=... +@define('CONST_Database_DSN', '".CONST_Database_DSN."'); @define('CONST_Default_Language', ".(CONST_Default_Language ? ("'".CONST_Default_Language."'") : 'false')."); -@define('CONST_Default_Lat', ".CONST_Default_Lat."); -@define('CONST_Default_Lon', ".CONST_Default_Lon."); -@define('CONST_Default_Zoom', ".CONST_Default_Zoom."); -@define('CONST_Map_Tile_URL', '".CONST_Map_Tile_URL."'); -@define('CONST_Map_Tile_Attribution', '".CONST_Map_Tile_Attribution."'); // Set if tile source isn't osm.org @define('CONST_Log_DB', ".(CONST_Log_DB ? 'true' : 'false')."); @define('CONST_Log_File', ".(CONST_Log_File ? ("'".CONST_Log_File."'") : 'false')."); @define('CONST_Max_Word_Frequency', '".CONST_Max_Word_Frequency."'); @@ -733,7 +728,7 @@ if (file_exists(getenv('NOMINATIM_SETTINGS'))) require_once(getenv('NOMINATIM_SE @define('CONST_Term_Normalization_Rules', \"".CONST_Term_Normalization_Rules."\"); @define('CONST_Use_Aux_Location_data', ".(CONST_Use_Aux_Location_data ? 'true' : 'false')."); @define('CONST_Use_US_Tiger_Data', ".(CONST_Use_US_Tiger_Data ? 'true' : 'false')."); -@define('CONST_Website_BaseURL', '".CONST_Website_BaseURL."'); +@define('CONST_MapIcon_URL', ".(CONST_MapIcon_URL ? ("'".CONST_MapIcon_URL."'") : 'false')."); "); info(CONST_InstallPath.'/settings/settings-frontend.php has been set up successfully'); } diff --git a/settings/defaults.php b/settings/defaults.php index 02b11237..2ecbb514 100644 --- a/settings/defaults.php +++ b/settings/defaults.php @@ -82,20 +82,16 @@ if (file_exists(CONST_InstallPath.'/settings/local.php')) require_once(CONST_Ins // How long to sleep when no update could be found @define('CONST_Replication_Recheck_Interval', '60'); -// Website settings +// If true, send CORS headers to allow access @define('CONST_NoAccessControl', true); -@define('CONST_Website_BaseURL', '/'); +// Set this to the /mapicon directory of your nominatim-ui to enable returning +// icon URLs with the results. +@define('CONST_MapIcon_URL', false); // Language to assume when none is supplied with the query. // When set to false, the local language (i.e. the name tag without suffix) // will be used. @define('CONST_Default_Language', false); -// Appearance of the map in the debug interface. -@define('CONST_Default_Lat', 20.0); -@define('CONST_Default_Lon', 0.0); -@define('CONST_Default_Zoom', 2); -@define('CONST_Map_Tile_URL', 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'); -@define('CONST_Map_Tile_Attribution', ''); // Set if tile source isn't osm.org @define('CONST_Search_AreaPolygons', true); @@ -103,7 +99,7 @@ if (file_exists(CONST_InstallPath.'/settings/local.php')) require_once(CONST_Ins @define('CONST_Search_NameOnlySearchFrequencyThreshold', 500); // If set to true, then reverse order of queries will be tried by default. -// When set to false only selected languages alloow reverse search. +// When set to false only selected languages allow reverse search. @define('CONST_Search_ReversePlanForAll', true); // Maximum number of OSM ids that may be queried at once diff --git a/website/search.php b/website/search.php index d2a1cc67..43c9fd01 100644 --- a/website/search.php +++ b/website/search.php @@ -74,7 +74,17 @@ $aMoreParams['format'] = $sOutputFormat; if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $aMoreParams['accept-language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE']; } -$sMoreURL = CONST_Website_BaseURL.'search.php?'.http_build_query($aMoreParams); + +if (isset($_SERVER['REQUEST_SCHEME']) + && isset($_SERVER['SERVER_NAME']) + && isset($_SERVER['DOCUMENT_URI']) +) { + $sMoreURL = $_SERVER['REQUEST_SCHEME'].'://' + .$_SERVER['SERVER_NAME'].$_SERVER['DOCUMENT_URI'].'/?' + .http_build_query($aMoreParams); +} else { + $sMoreURL = '/search.php'.http_build_query($aMoreParams); +} if (CONST_Debug) exit; -- 2.45.1