summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin_pgv_to_wt.php1
-rw-r--r--admin_trees_config.php6
-rw-r--r--autocomplete.php7
-rw-r--r--help_text.php4
-rw-r--r--includes/db_schema/db_schema_27_28.php40
-rw-r--r--library/WT/Tree.php1
6 files changed, 49 insertions, 10 deletions
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
</tr>
<tr>
<td>
- <?php echo WT_I18N::translate('Use GeoNames database for autocomplete on places'), help_link('USE_GEONAMES'); ?>
+ <?php echo /* I18N: GeoNames is the www.geonames.org website */ WT_I18N::translate('Use GeoNames database for autocomplete on places'), help_link('GEONAMES_ACCOUNT'); ?>
</td>
<td>
- <?php echo edit_field_yes_no('NEW_USE_GEONAMES', get_gedcom_setting(WT_GED_ID, 'USE_GEONAMES')); ?>
+ <input type="text" id="NEW_GEONAMES_ACCOUNT" name="NEW_GEONAMES_ACCOUNT" value="<?php echo WT_Filter::escapeHtml(get_gedcom_setting(WT_GED_ID, 'GEONAMES_ACCOUNT')); ?>" size="40" maxlength="255" dir="ltr" placeholder="<?php echo WT_I18N::translate('Username'); ?>">
</td>
</tr>
<tr>
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?<br><br>When this option is set to <b>Yes</b>, the GeoNames database will be queried to supply suggestions for the place name being entered. When set to <b>No</b>, 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.<br><br>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 @@
+<?php
+// Update the database schema from version 27-28
+// - delete unused settings and update indexes
+//
+// The script should assume that it can be interrupted at
+// any point, and be able to continue by re-running the script.
+// Fatal errors, however, should be allowed to throw exceptions,
+// which will be caught by the framework.
+// It shouldn't do anything that might take more than a few
+// seconds, for systems with low timeout values.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2014 Greg Roach
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+// Delete old/unused settings
+self::exec(
+ "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_GEONAMES')"
+);
+
+// Update the version to indicate success
+WT_Site::preference($schema_name, $next_version);
diff --git a/library/WT/Tree.php b/library/WT/Tree.php
index 06c1612a29..ca7c188744 100644
--- a/library/WT/Tree.php
+++ b/library/WT/Tree.php
@@ -305,7 +305,6 @@ class WT_Tree {
}
set_gedcom_setting($tree_id, 'THEME_DIR', 'webtrees');
set_gedcom_setting($tree_id, 'THUMBNAIL_WIDTH', '100');
- set_gedcom_setting($tree_id, 'USE_GEONAMES', false);
set_gedcom_setting($tree_id, 'USE_RIN', false);
set_gedcom_setting($tree_id, 'USE_SILHOUETTE', true);
set_gedcom_setting($tree_id, 'WATERMARK_THUMB', false);