From eca1e5174b7fa9d0d31ea4477c151bf10c5a4545 Mon Sep 17 00:00:00 2001 From: Greg Roach Date: Sat, 22 Feb 2014 22:56:23 +0000 Subject: #1280687 Change in Geonames API interface --- admin_pgv_to_wt.php | 1 - admin_trees_config.php | 6 ++--- autocomplete.php | 7 +++--- help_text.php | 4 ++-- includes/db_schema/db_schema_27_28.php | 40 ++++++++++++++++++++++++++++++++++ library/WT/Tree.php | 1 - 6 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 includes/db_schema/db_schema_27_28.php diff --git a/admin_pgv_to_wt.php b/admin_pgv_to_wt.php index 88e7967016..5445a0c5be 100644 --- a/admin_pgv_to_wt.php +++ b/admin_pgv_to_wt.php @@ -777,7 +777,6 @@ foreach ($GEDCOMS as $GEDCOM=>$GED_DATA) { break; } $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THUMBNAIL_WIDTH', $THUMBNAIL_WIDTH)); - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'USE_GEONAMES', $USE_GEONAMES)); $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'USE_RELATIONSHIP_PRIVACY', $USE_RELATIONSHIP_PRIVACY)); $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'USE_RIN', $USE_RIN)); $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'WATERMARK_THUMB', $WATERMARK_THUMB)); diff --git a/admin_trees_config.php b/admin_trees_config.php index 72b51b9b17..1fe1ce27b8 100644 --- a/admin_trees_config.php +++ b/admin_trees_config.php @@ -103,6 +103,7 @@ case 'update': set_gedcom_setting(WT_GED_ID, 'GEDCOM_ID_PREFIX', WT_Filter::post('NEW_GEDCOM_ID_PREFIX')); set_gedcom_setting(WT_GED_ID, 'GEDCOM_MEDIA_PATH', WT_Filter::post('NEW_GEDCOM_MEDIA_PATH')); set_gedcom_setting(WT_GED_ID, 'GENERATE_UIDS', WT_Filter::postBool('NEW_GENERATE_UIDS')); + set_gedcom_setting(WT_GED_ID, 'GEONAMES_ACCOUNT', WT_Filter::post('NEW_GEONAMES_ACCOUNT')); set_gedcom_setting(WT_GED_ID, 'HIDE_GEDCOM_ERRORS', WT_Filter::postBool('NEW_HIDE_GEDCOM_ERRORS')); set_gedcom_setting(WT_GED_ID, 'HIDE_LIVE_PEOPLE', WT_Filter::postBool('NEW_HIDE_LIVE_PEOPLE')); set_gedcom_setting(WT_GED_ID, 'GEDCOM_MEDIA_PATH', WT_Filter::post('GEDCOM_MEDIA_PATH')); @@ -163,7 +164,6 @@ case 'update': set_gedcom_setting(WT_GED_ID, 'SURNAME_TRADITION', WT_Filter::post('NEW_SURNAME_TRADITION')); set_gedcom_setting(WT_GED_ID, 'THEME_DIR', WT_Filter::post('NEW_THEME_DIR')); set_gedcom_setting(WT_GED_ID, 'THUMBNAIL_WIDTH', WT_Filter::post('NEW_THUMBNAIL_WIDTH')); - set_gedcom_setting(WT_GED_ID, 'USE_GEONAMES', WT_Filter::postBool('NEW_USE_GEONAMES')); set_gedcom_setting(WT_GED_ID, 'USE_RIN', WT_Filter::postBool('NEW_USE_RIN')); set_gedcom_setting(WT_GED_ID, 'USE_SILHOUETTE', WT_Filter::postBool('NEW_USE_SILHOUETTE')); set_gedcom_setting(WT_GED_ID, 'WATERMARK_THUMB', WT_Filter::postBool('NEW_WATERMARK_THUMB')); @@ -1273,10 +1273,10 @@ if (count(WT_Tree::getAll())==1) { //Removed because it doesn't work here for mu - + - + diff --git a/autocomplete.php b/autocomplete.php index 2591fbb43f..2135949fc1 100644 --- a/autocomplete.php +++ b/autocomplete.php @@ -234,14 +234,15 @@ case 'PLAC': // Place names (with hierarchy), that include the search term foreach (WT_Place::findPlaces($term, WT_GED_ID) as $place) { $data[]=$place->getGedcomName(); } - if (!$data && get_gedcom_setting(WT_GED_ID, 'USE_GEONAMES')) { + if (!$data && get_gedcom_setting(WT_GED_ID, 'GEONAMES_ACCOUNT')) { // No place found? Use an external gazetteer $url= - "http://ws.geonames.org/searchJSON". + "http://api.geonames.org/searchJSON". "?name_startsWith=".urlencode($term). "&lang=".WT_LOCALE. "&fcode=CMTY&fcode=ADM4&fcode=PPL&fcode=PPLA&fcode=PPLC". - "&style=full"; + "&style=full". + "&username=" . get_gedcom_setting(WT_GED_ID, 'GEONAMES_ACCOUNT'); // try to use curl when file_get_contents not allowed if (ini_get('allow_url_fopen')) { $json = file_get_contents($url); diff --git a/help_text.php b/help_text.php index f911f6b78f..80b7cd0f5e 100644 --- a/help_text.php +++ b/help_text.php @@ -992,9 +992,9 @@ case 'THUMBNAIL_WIDTH': $text=WT_I18N::translate('This is the width (in pixels) that the program will use when automatically generating thumbnails. The default setting is 100.'); break; -case 'USE_GEONAMES': +case 'GEONAMES_ACCOUNT': $title=WT_I18N::translate('Use GeoNames database for autocomplete on places'); - $text=WT_I18N::translate('Should the GeoNames database be used to provide more suggestions for place names?

When this option is set to Yes, the GeoNames database will be queried to supply suggestions for the place name being entered. When set to No, only the current genealogical database will be searched. As you enter more of the place name, the suggestion will become more precise. This option can slow down data entry, particularly if your Internet connection is slow.

The GeoNames geographical database is accessible free of charge. It currently contains over 8,000,000 geographical names.'); + $text=WT_I18N::translate('The website www.geonames.org provides a large database of place names. This can be searched when entering new places. To use this feature, you must register for a free account at www.geonames.org and provide the username.'); break; case 'USE_REGISTRATION_MODULE': diff --git a/includes/db_schema/db_schema_27_28.php b/includes/db_schema/db_schema_27_28.php new file mode 100644 index 0000000000..f60d8e707d --- /dev/null +++ b/includes/db_schema/db_schema_27_28.php @@ -0,0 +1,40 @@ +