summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin.php52
-rw-r--r--admin_module_blocks.php8
-rw-r--r--admin_module_menus.php8
-rw-r--r--admin_module_reports.php8
-rw-r--r--admin_module_sidebar.php8
-rw-r--r--admin_module_tabs.php8
-rw-r--r--admin_site_merge.php2
-rw-r--r--admin_site_upgrade.php2
-rw-r--r--admin_trees_config.php6
-rw-r--r--admin_trees_export.php2
-rw-r--r--admin_trees_manage.php106
-rw-r--r--admin_trees_merge.php8
-rw-r--r--admin_trees_places.php2
-rw-r--r--admin_trees_renumber.php2
-rw-r--r--admin_users.php32
-rw-r--r--includes/functions/functions_db.php2
-rw-r--r--includes/session.php10
-rw-r--r--library/WT/Controller/Search.php36
-rw-r--r--library/WT/Log.php2
-rw-r--r--library/WT/Module.php2
-rw-r--r--library/WT/Stats.php216
-rw-r--r--library/WT/Theme/BaseTheme.php16
-rw-r--r--library/WT/Tree.php162
-rw-r--r--library/WT/User.php2
-rw-r--r--login.php8
-rw-r--r--modules_v3/faq/module.php2
-rw-r--r--modules_v3/googlemap/module.php2
-rw-r--r--modules_v3/html/module.php6
-rw-r--r--modules_v3/sitemap/module.php28
-rw-r--r--search.php4
30 files changed, 399 insertions, 353 deletions
diff --git a/admin.php b/admin.php
index 3b1f19cd65..f82f781d5f 100644
--- a/admin.php
+++ b/admin.php
@@ -653,67 +653,67 @@ $changes = WT_DB::prepare(
</thead>
<tbody>
<?php foreach (WT_Tree::getAll() as $tree): ?>
- <tr class="<?php echo $changes[$tree->tree_id] ? 'danger' : '';?>">
+ <tr class="<?php echo $changes[$tree->id()] ? 'danger' : '';?>">
<td>
- <a href="index.php?ctype=gedcom&amp;ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
- <?php echo WT_Filter::escapeHtml($tree->tree_title); ?>
+ <a href="index.php?ctype=gedcom&amp;ged=<?php echo $tree->nameUrl(); ?>">
+ <?php echo $tree->titleHtml(); ?>
</a>
</td>
<td class="text-right flip">
- <?php if ($changes[$tree->tree_id]): ?>
+ <?php if ($changes[$tree->id()]): ?>
<a onclick="window.open('edit_changes.php', '_blank', chan_window_specs); return false;" href="#">
- <?php echo WT_I18N::number($changes[$tree->tree_id]); ?>
- <span class="sr-only"><?php echo WT_I18N::translate('Pending changes'); ?> <?php echo WT_Filter::escapeHtml($tree->tree_title); ?></span>
+ <?php echo WT_I18N::number($changes[$tree->id()]); ?>
+ <span class="sr-only"><?php echo WT_I18N::translate('Pending changes'); ?> <?php echo $tree->titleHtml(); ?></span>
</a>
<?php else: ?>
-
<?php endif; ?>
</td>
<td class="text-right flip">
- <?php if ($individuals[$tree->tree_id]): ?>
- <a href="indilist.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
- <?php echo WT_I18N::number($individuals[$tree->tree_id]); ?>
- <span class="sr-only"><?php echo WT_I18N::translate('Individuals'); ?> <?php echo WT_Filter::escapeHtml($tree->tree_title); ?></span>
+ <?php if ($individuals[$tree->id()]): ?>
+ <a href="indilist.php?ged=<?php echo $tree->nameUrl(); ?>">
+ <?php echo WT_I18N::number($individuals[$tree->id()]); ?>
+ <span class="sr-only"><?php echo WT_I18N::translate('Individuals'); ?> <?php echo $tree->titleHtml(); ?></span>
</a>
<?php else: ?>
-
<?php endif; ?>
</td>
<td class="text-right flip">
- <?php if ($families[$tree->tree_id]): ?>
- <a href="famlist.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
- <?php echo WT_I18N::number($families[$tree->tree_id]); ?>
- <span class="sr-only"><?php echo WT_I18N::translate('Families'); ?> <?php echo WT_Filter::escapeHtml($tree->tree_title); ?></span>
+ <?php if ($families[$tree->id()]): ?>
+ <a href="famlist.php?ged=<?php echo $tree->nameUrl(); ?>">
+ <?php echo WT_I18N::number($families[$tree->id()]); ?>
+ <span class="sr-only"><?php echo WT_I18N::translate('Families'); ?> <?php echo $tree->titleHtml(); ?></span>
</a>
<?php else: ?>
-
<?php endif; ?>
</td>
<td class="text-right flip">
- <?php if ($sources[$tree->tree_id]): ?>
- <a href="sourlist.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
- <?php echo WT_I18N::number($sources[$tree->tree_id]); ?>
- <span class="sr-only"><?php echo WT_I18N::translate('Sources'); ?> <?php echo WT_Filter::escapeHtml($tree->tree_title); ?></span>
+ <?php if ($sources[$tree->id()]): ?>
+ <a href="sourlist.php?ged=<?php echo $tree->nameUrl(); ?>">
+ <?php echo WT_I18N::number($sources[$tree->id()]); ?>
+ <span class="sr-only"><?php echo WT_I18N::translate('Sources'); ?> <?php echo $tree->titleHtml(); ?></span>
</a>
<?php else: ?>
-
<?php endif; ?>
</td>
<td class="text-right flip">
- <?php if ($repositories[$tree->tree_id]): ?>
- <a href="repolist.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
- <?php echo WT_I18N::number($repositories[$tree->tree_id]); ?>
- <span class="sr-only"><?php echo WT_I18N::translate('Repositories'); ?> <?php echo WT_Filter::escapeHtml($tree->tree_title); ?></span>
+ <?php if ($repositories[$tree->id()]): ?>
+ <a href="repolist.php?ged=<?php echo $tree->nameUrl(); ?>">
+ <?php echo WT_I18N::number($repositories[$tree->id()]); ?>
+ <span class="sr-only"><?php echo WT_I18N::translate('Repositories'); ?> <?php echo $tree->titleHtml(); ?></span>
</a>
<?php else: ?>
-
<?php endif; ?>
</td>
<td class="text-right flip">
- <?php if ($media[$tree->tree_id]): ?>
- <a href="medialist.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
- <?php echo WT_I18N::number($media[$tree->tree_id]); ?>
- <span class="sr-only"><?php echo WT_I18N::translate('Media objects'); ?> <?php echo WT_Filter::escapeHtml($tree->tree_title); ?></span>
+ <?php if ($media[$tree->id()]): ?>
+ <a href="medialist.php?ged=<?php echo $tree->nameUrl(); ?>">
+ <?php echo WT_I18N::number($media[$tree->id()]); ?>
+ <span class="sr-only"><?php echo WT_I18N::translate('Media objects'); ?> <?php echo $tree->titleHtml(); ?></span>
</a>
<?php else: ?>
-
diff --git a/admin_module_blocks.php b/admin_module_blocks.php
index 1f68d126b7..82813d8eff 100644
--- a/admin_module_blocks.php
+++ b/admin_module_blocks.php
@@ -35,10 +35,10 @@ $action = WT_Filter::post('action');
if ($action === 'update_mods' && WT_Filter::checkCsrf()) {
foreach ($modules as $module) {
foreach (WT_Tree::getAll() as $tree) {
- $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->tree_id, WT_REGEX_INTEGER, $module->defaultAccessLevel());
+ $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->id(), WT_REGEX_INTEGER, $module->defaultAccessLevel());
WT_DB::prepare(
"REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'block', ?)"
- )->execute(array($module->getName(), $tree->tree_id, $access_level));
+ )->execute(array($module->getName(), $tree->id(), $access_level));
}
}
@@ -87,10 +87,10 @@ $controller
<?php foreach (WT_Tree::getAll() as $tree): ?>
<tr>
<td>
- <?php echo $tree->tree_title_html; ?>
+ <?php echo $tree->titleHtml(); ?>
</td>
<td>
- <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->tree_id, $module->getAccessLevel($tree, 'block')); ?>
+ <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->id(), $module->getAccessLevel($tree, 'block')); ?>
</td>
</tr>
<?php endforeach; ?>
diff --git a/admin_module_menus.php b/admin_module_menus.php
index 122c3cf4a2..931e53f0dd 100644
--- a/admin_module_menus.php
+++ b/admin_module_menus.php
@@ -35,10 +35,10 @@ $action = WT_Filter::post('action');
if ($action === 'update_mods' && WT_Filter::checkCsrf()) {
foreach ($modules as $module) {
foreach (WT_Tree::getAll() as $tree) {
- $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->tree_id, WT_REGEX_INTEGER, $module->defaultAccessLevel());
+ $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->id(), WT_REGEX_INTEGER, $module->defaultAccessLevel());
WT_DB::prepare(
"REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'menu', ?)"
- )->execute(array($module->getName(), $tree->tree_id, $access_level));
+ )->execute(array($module->getName(), $tree->id(), $access_level));
}
$order = WT_Filter::post('order-' . $module->getName());
WT_DB::prepare(
@@ -112,10 +112,10 @@ $controller
<?php foreach (WT_Tree::getAll() as $tree): ?>
<tr>
<td>
- <?php echo $tree->tree_title_html; ?>
+ <?php echo $tree->titleHtml(); ?>
</td>
<td>
- <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->tree_id, $module->getAccessLevel($tree, 'menu')); ?>
+ <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->id(), $module->getAccessLevel($tree, 'menu')); ?>
</td>
</tr>
<?php endforeach; ?>
diff --git a/admin_module_reports.php b/admin_module_reports.php
index b0497a14dc..46be0cec18 100644
--- a/admin_module_reports.php
+++ b/admin_module_reports.php
@@ -35,10 +35,10 @@ $action = WT_Filter::post('action');
if ($action === 'update_mods' && WT_Filter::checkCsrf()) {
foreach ($modules as $module) {
foreach (WT_Tree::getAll() as $tree) {
- $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->tree_id, WT_REGEX_INTEGER, $module->defaultAccessLevel());
+ $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->id(), WT_REGEX_INTEGER, $module->defaultAccessLevel());
WT_DB::prepare(
"REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'report', ?)"
- )->execute(array($module->getName(), $tree->tree_id, $access_level));
+ )->execute(array($module->getName(), $tree->id(), $access_level));
}
}
@@ -87,10 +87,10 @@ $controller
<?php foreach (WT_Tree::getAll() as $tree): ?>
<tr>
<td>
- <?php echo $tree->tree_title_html; ?>
+ <?php echo $tree->titleHtml(); ?>
</td>
<td>
- <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->tree_id, $module->getAccessLevel($tree, 'report')); ?>
+ <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->id(), $module->getAccessLevel($tree, 'report')); ?>
</td>
</tr>
<?php endforeach; ?>
diff --git a/admin_module_sidebar.php b/admin_module_sidebar.php
index 0002d31394..11d876c626 100644
--- a/admin_module_sidebar.php
+++ b/admin_module_sidebar.php
@@ -35,10 +35,10 @@ $action = WT_Filter::post('action');
if ($action === 'update_mods' && WT_Filter::checkCsrf()) {
foreach ($modules as $module) {
foreach (WT_Tree::getAll() as $tree) {
- $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->tree_id, WT_REGEX_INTEGER, $module->defaultAccessLevel());
+ $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->id(), WT_REGEX_INTEGER, $module->defaultAccessLevel());
WT_DB::prepare(
"REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'sidebar', ?)"
- )->execute(array($module->getName(), $tree->tree_id, $access_level));
+ )->execute(array($module->getName(), $tree->id(), $access_level));
}
$order = WT_Filter::post('order-' . $module->getName());
WT_DB::prepare(
@@ -112,10 +112,10 @@ $controller
<?php foreach (WT_Tree::getAll() as $tree): ?>
<tr>
<td>
- <?php echo $tree->tree_title_html; ?>
+ <?php echo $tree->titleHtml(); ?>
</td>
<td>
- <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->tree_id, $module->getAccessLevel($tree, 'sidebar')); ?>
+ <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->id(), $module->getAccessLevel($tree, 'sidebar')); ?>
</td>
</tr>
<?php endforeach; ?>
diff --git a/admin_module_tabs.php b/admin_module_tabs.php
index 7b875e2f79..7f1734c4a4 100644
--- a/admin_module_tabs.php
+++ b/admin_module_tabs.php
@@ -35,10 +35,10 @@ $action = WT_Filter::post('action');
if ($action === 'update_mods' && WT_Filter::checkCsrf()) {
foreach ($modules as $module) {
foreach (WT_Tree::getAll() as $tree) {
- $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->tree_id, WT_REGEX_INTEGER, $module->defaultAccessLevel());
+ $access_level = WT_Filter::post('access-' . $module->getName() . '-' . $tree->id(), WT_REGEX_INTEGER, $module->defaultAccessLevel());
WT_DB::prepare(
"REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'tab', ?)"
- )->execute(array($module->getName(), $tree->tree_id, $access_level));
+ )->execute(array($module->getName(), $tree->id(), $access_level));
}
$order = WT_Filter::post('order-' . $module->getName());
WT_DB::prepare(
@@ -112,10 +112,10 @@ $controller
<?php foreach (WT_Tree::getAll() as $tree): ?>
<tr>
<td>
- <?php echo $tree->tree_title_html; ?>
+ <?php echo $tree->titleHtml(); ?>
</td>
<td>
- <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->tree_id, $module->getAccessLevel($tree, 'tab')); ?>
+ <?php echo edit_field_access_level('access-' . $module->getName() . '-' . $tree->id(), $module->getAccessLevel($tree, 'tab')); ?>
</td>
</tr>
<?php endforeach; ?>
diff --git a/admin_site_merge.php b/admin_site_merge.php
index 171492cb62..c5959bde8c 100644
--- a/admin_site_merge.php
+++ b/admin_site_merge.php
@@ -31,7 +31,7 @@ require './includes/session.php';
$controller = new WT_Controller_Page;
$controller
->restrictAccess(Auth::isManager())
- ->setPageTitle(WT_I18N::translate('Merge records') . ' — ' . WT_Filter::escapeHtml($WT_TREE->tree_title))
+ ->setPageTitle(WT_I18N::translate('Merge records') . ' — ' . $WT_TREE->titleHtml())
->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();');
diff --git a/admin_site_upgrade.php b/admin_site_upgrade.php
index 704523873b..6a3af19781 100644
--- a/admin_site_upgrade.php
+++ b/admin_site_upgrade.php
@@ -285,7 +285,7 @@ echo '<li>', /* I18N: The system is about to [...] */ WT_I18N::translate('Export
foreach (WT_Tree::getAll() as $tree) {
reset_timeout();
- $filename = WT_DATA_DIR . $tree->tree_name . date('-Y-m-d') . '.ged';
+ $filename = WT_DATA_DIR . $tree->name() . date('-Y-m-d') . '.ged';
if ($tree->exportGedcom($filename)) {
echo '<br>', WT_I18N::translate('Family tree exported to %s.', '<span dir="ltr">' . $filename . '</span>'), $icon_success;
} else {
diff --git a/admin_trees_config.php b/admin_trees_config.php
index bdd04628d0..bf0e58067a 100644
--- a/admin_trees_config.php
+++ b/admin_trees_config.php
@@ -245,7 +245,7 @@ case 'privacy':
$WT_TREE->setPreference('SHOW_LIVING_NAMES', WT_Filter::post('SHOW_LIVING_NAMES'));
$WT_TREE->setPreference('SHOW_PRIVATE_RELATIONSHIPS', WT_Filter::post('SHOW_PRIVATE_RELATIONSHIPS'));
- header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php?ged=' . $WT_TREE->tree_name);
+ header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php?ged=' . $WT_TREE->nameUrl());
return;
@@ -385,7 +385,7 @@ case 'general':
switch (WT_Filter::get('action')) {
case 'privacy':
$controller
- ->setPageTitle(WT_Filter::escapeHtml($WT_TREE->tree_title) . ' — ' . WT_I18N::translate('Privacy'))
+ ->setPageTitle($WT_TREE->titleHtml() . ' — ' . WT_I18N::translate('Privacy'))
->addInlineJavascript('
jQuery("#default-resn input[type=checkbox]").on("click", function() {
if ($(this).prop("checked")) {
@@ -400,7 +400,7 @@ case 'privacy':
');
break;
case 'general':
- $controller->setPageTitle(WT_Filter::escapeHtml($WT_TREE->tree_title) . ' — ' . WT_I18N::translate('Preferences'));
+ $controller->setPageTitle($WT_TREE->titleHtml() . ' — ' . WT_I18N::translate('Preferences'));
break;
default:
header('Location: ' . WT_BASE_URL . 'admin.php');
diff --git a/admin_trees_export.php b/admin_trees_export.php
index 3769870c1f..99a2d40b21 100644
--- a/admin_trees_export.php
+++ b/admin_trees_export.php
@@ -24,7 +24,7 @@ define('WT_SCRIPT_NAME', 'admin_trees_export.php');
require './includes/session.php';
if (Auth::isManager($WT_TREE) && WT_Filter::checkCsrf()) {
- $filename = WT_DATA_DIR . $WT_TREE->tree_name;
+ $filename = WT_DATA_DIR . $WT_TREE->name();
// Force a ".ged" suffix
if (strtolower(substr($filename, -4)) != '.ged') {
$filename .= '.ged';
diff --git a/admin_trees_manage.php b/admin_trees_manage.php
index 509e331c68..59e5a7111e 100644
--- a/admin_trees_manage.php
+++ b/admin_trees_manage.php
@@ -38,7 +38,7 @@ case 'delete':
$gedcom_id = WT_Filter::postInteger('gedcom_id');
if (WT_Filter::checkCsrf() && $gedcom_id) {
$tree = WT_Tree::get($gedcom_id);
- WT_FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ WT_I18N::translate('The family tree “%s” has been deleted.', WT_Filter::escapeHtml($tree->tree_name)), 'success');
+ WT_FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ WT_I18N::translate('The family tree “%s” has been deleted.', $tree->titleHtml()), 'success');
$tree->delete();
}
header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
@@ -47,7 +47,7 @@ case 'delete':
case 'setdefault':
if (WT_Filter::checkCsrf()) {
WT_Site::setPreference('DEFAULT_GEDCOM', WT_Filter::post('ged'));
- WT_FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ WT_I18N::translate('The family tree “%s” will be shown to visitors when they first arrive at this website.', WT_Filter::escapeHtml($WT_TREE->tree_name)), 'success');
+ WT_FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ WT_I18N::translate('The family tree “%s” will be shown to visitors when they first arrive at this website.', $tree->titleHtml()), 'success');
}
header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
@@ -114,8 +114,8 @@ case 'bulk-import':
}
foreach (WT_Tree::getAll() as $tree) {
- if (!in_array($tree->tree_name, $basenames)) {
- WT_FlashMessages::addMessage(WT_I18N::translate('The family tree “%s” has been deleted.', WT_Filter::escapeHtml($tree->tree_name)), 'success');
+ if (!in_array($tree->name(), $basenames)) {
+ WT_FlashMessages::addMessage(WT_I18N::translate('The family tree “%s” has been deleted.', $tree->titleHtml()), 'success');
$tree->delete();
}
}
@@ -162,11 +162,11 @@ case 'importform':
if (!$tree) {
break;
}
- echo '<p>', /* I18N: %s is the name of a family tree */ WT_I18N::translate('This will delete all the genealogical data from “%s” and replace it with data from another GEDCOM file.', $tree->tree_name_html), '</p>';
+ echo '<p>', /* I18N: %s is the name of a family tree */ WT_I18N::translate('This will delete all the genealogical data from “%s” and replace it with data from another GEDCOM file.', $tree->titleHtml()), '</p>';
// the javascript in the next line strips any path associated with the file before comparing it to the current GEDCOM name (both Chrome and IE8 include c:\fakepath\ in the filename).
$previous_gedcom_filename = $tree->getPreference('gedcom_filename');
echo '<form name="replaceform" method="post" enctype="multipart/form-data" action="', WT_SCRIPT_NAME, '" onsubmit="var newfile = document.replaceform.ged_name.value; newfile = newfile.substr(newfile.lastIndexOf(\'\\\\\')+1); if (newfile!=\'', WT_Filter::escapeHtml($previous_gedcom_filename), '\' && \'\' != \'', WT_Filter::escapeHtml($previous_gedcom_filename), '\') return confirm(\'', WT_Filter::escapeHtml(WT_I18N::translate('You have selected a GEDCOM file with a different name. Is this correct?')), '\'); else return true;">';
- echo '<input type="hidden" name="gedcom_id" value="', $tree->tree_id, '">';
+ echo '<input type="hidden" name="gedcom_id" value="', $tree->id(), '">';
echo WT_Filter::getCsrf();
if (WT_Filter::get('action') == 'uploadform') {
echo '<input type="hidden" name="action" value="replace_upload">';
@@ -230,39 +230,39 @@ $controller->pageHeader();
<?php foreach (WT_Tree::GetAll() as $tree): ?>
<?php if (Auth::isManager($tree)): ?>
<div class="panel panel-default">
- <div class="panel-heading" role="tab" id="panel-tree-<?php echo $tree->tree_id; ?>">
+ <div class="panel-heading" role="tab" id="panel-tree-<?php echo $tree->id(); ?>">
<h2 class="panel-title">
<i class="fa fa-fw fa-tree"></i>
- <a data-toggle="collapse" data-parent="#accordion" href="#tree-<?php echo $tree->tree_id; ?>" aria-expanded="true" aria-controls="tree-<?php echo $tree->tree_id; ?>">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?> — <?php echo WT_Filter::escapeHtml($tree->tree_title); ?>
+ <a data-toggle="collapse" data-parent="#accordion" href="#tree-<?php echo $tree->id(); ?>" aria-expanded="true" aria-controls="tree-<?php echo $tree->id(); ?>">
+ <?php echo $tree->nameHtml(); ?> — <?php echo $tree->titleHtml(); ?>
</a>
</h2>
</div>
- <div id="tree-<?php echo $tree->tree_id; ?>" class="panel-collapse collapse<?php echo $tree->tree_id === WT_GED_ID || $tree->getPreference('imported') === '0' ? ' in' : ''; ?>" role="tabpanel" aria-labelledby="panel-tree-<?php echo $tree->tree_id; ?>">
+ <div id="tree-<?php echo $tree->id(); ?>" class="panel-collapse collapse<?php echo $tree->id() === WT_GED_ID || $tree->getPreference('imported') === '0' ? ' in' : ''; ?>" role="tabpanel" aria-labelledby="panel-tree-<?php echo $tree->id(); ?>">
<div class="panel-body">
<?php
// The third row shows an optional progress bar and a list of maintenance options
$importing = WT_DB::prepare(
"SELECT 1 FROM `##gedcom_chunk` WHERE gedcom_id = ? AND imported = '0' LIMIT 1"
- )->execute(array($tree->tree_id))->fetchOne();
+ )->execute(array($tree->id()))->fetchOne();
if ($importing) {
?>
- <div id="import<?php echo $tree->tree_id; ?>" class="col-xs-12">
+ <div id="import<?php echo $tree->id(); ?>" class="col-xs-12">
<div class="progress">
<?php echo WT_I18N::translate('Calculating…'); ?>
</div>
</div>
<?php
$controller->addInlineJavascript(
- 'jQuery("#import' . $tree->tree_id . '").load("import.php?gedcom_id=' . $tree->tree_id . '");'
+ 'jQuery("#import' . $tree->id() . '").load("import.php?gedcom_id=' . $tree->id() . '");'
);
}
?>
- <div class="row<?php echo $importing ? ' hidden' : ''; ?>" id="actions<?php echo $tree->tree_id; ?>">
+ <div class="row<?php echo $importing ? ' hidden' : ''; ?>" id="actions<?php echo $tree->id(); ?>">
<div class="col-sm-6 col-md-3">
<h3>
- <a href="index.php?ctype=gedcom&ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <a href="index.php?ctype=gedcom&ged=<?php echo $tree->nameUrl(); ?>">
<?php echo WT_I18N::translate('Family tree'); ?>
</a>
</h3>
@@ -270,48 +270,48 @@ $controller->pageHeader();
<!-- PREFERENCES -->
<li>
<i class="fa fa-li fa-cogs"></i>
- <a href="admin_trees_config.php?action=general&amp;ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <a href="admin_trees_config.php?action=general&amp;ged=<?php echo $tree->nameUrl(); ?>">
<?php echo WT_I18N::translate('Preferences'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
<!-- PRIVACY -->
<li>
<i class="fa fa-li fa-lock"></i>
- <a href="admin_trees_config.php?action=privacy&amp;ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <a href="admin_trees_config.php?action=privacy&amp;ged=<?php echo $tree->nameUrl(); ?>">
<?php echo WT_I18N::translate('Privacy'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
<!-- HOME PAGE BLOCKS-->
<li>
<i class="fa fa-li fa-th-large"></i>
- <a href="index_edit.php?gedcom_id=<?php echo $tree->tree_id; ?>">
+ <a href="index_edit.php?gedcom_id=<?php echo $tree->id(); ?>">
<?php echo WT_I18N::translate('Change the “Home page” blocks'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
<!-- DELETE -->
<li>
<i class="fa fa-li fa-trash-o"></i>
- <a href="#" onclick="if (confirm('<?php echo WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', $tree->tree_name)); ?>')) { document.delete_form<?php echo $tree->tree_id; ?>.submit(); } return false;">
+ <a href="#" onclick="if (confirm('<?php echo WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', $tree->nameHtml())); ?>')) { document.delete_form<?php echo $tree->id(); ?>.submit(); } return false;">
<?php echo WT_I18N::translate('Delete'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
- <form name="delete_form<?php echo $tree->tree_id; ?>" method="post">
+ <form name="delete_form<?php echo $tree->id(); ?>" method="post">
<input type="hidden" name="action" value="delete">
- <input type="hidden" name="gedcom_id" value="<?php echo $tree->tree_id; ?>">
+ <input type="hidden" name="gedcom_id" value="<?php echo $tree->id(); ?>">
<?php echo WT_Filter::getCsrf(); ?>
<!-- A11Y - forms need submit buttons, but they look ugly here -->
- <button class="sr-only" onclick="return confirm('<?php echo WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', $tree->tree_name)); ?>')" type="submit">
+ <button class="sr-only" onclick="return confirm('<?php echo WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', $tree->titleHtml())); ?>')" type="submit">
<?php echo WT_I18N::translate('Delete'); ?>
</button>
</form>
@@ -320,18 +320,18 @@ $controller->pageHeader();
<?php if (count(WT_Tree::getAll()) > 1): ?>
<li>
<i class="fa fa-li fa-star"></i>
- <?php if ($tree->tree_name == WT_Site::getPreference('DEFAULT_GEDCOM')): ?>
+ <?php if ($tree->name() == WT_Site::getPreference('DEFAULT_GEDCOM')): ?>
<?php echo WT_I18N::translate('Default family tree'); ?>
<?php else: ?>
- <a href="#" onclick="document.defaultform<?php echo $tree->tree_id; ?>.submit();">
+ <a href="#" onclick="document.defaultform<?php echo $tree->id(); ?>.submit();">
<?php echo WT_I18N::translate('Set as default'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
- <form name="defaultform<?php echo $tree->tree_id; ?>" method="post">
+ <form name="defaultform<?php echo $tree->id(); ?>" method="post">
<input type="hidden" name="action" value="setdefault">
- <input type="hidden" name="ged" value="<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <input type="hidden" name="ged" value="<?php echo $tree->nameHtml(); ?>">
<?php echo WT_Filter::getCsrf(); ?>
<!-- A11Y - forms need submit buttons, but they look ugly here -->
<button class="sr-only" type="submit">
@@ -351,50 +351,50 @@ $controller->pageHeader();
<!-- MERGE -->
<li>
<i class="fa fa-li fa-code-fork"></i>
- <a href="admin_site_merge.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <a href="admin_site_merge.php?ged=<?php echo $tree->nameUrl(); ?>">
<?php echo WT_I18N::translate('Merge records'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
<!-- UPDATE PLACE NAMES -->
<li>
<i class="fa fa-li fa-map-marker"></i>
- <a href="admin_trees_places.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <a href="admin_trees_places.php?ged=<?php echo $tree->nameUrl(); ?>">
<?php echo WT_I18N::translate('Update place names'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
<!-- CHECK FOR ERRORS -->
<li>
<i class="fa fa-li fa-check"></i>
- <a href="admin_trees_check.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <a href="admin_trees_check.php?ged=<?php echo $tree->nameUrl(); ?>">
<?php echo WT_I18N::translate('Check for errors'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
<!-- RENUMBER -->
<li>
<i class="fa fa-li fa-sort-numeric-asc"></i>
- <a href="admin_trees_renumber.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <a href="admin_trees_renumber.php?ged=<?php echo $tree->nameUrl(); ?>">
<?php echo WT_I18N::translate('Renumber'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
<!-- CHANGES -->
<li>
<i class="fa fa-li fa-th-list"></i>
- <a href="admin_site_change.php?gedc=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <a href="admin_site_change.php?gedc=<?php echo $tree->nameUrl(); ?>">
<?php echo WT_I18N::translate('Changes log'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
@@ -412,7 +412,7 @@ $controller->pageHeader();
<a href="#" onclick="add_unlinked_indi(); return false;">
<?php echo WT_I18N::translate('Individual'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
@@ -422,7 +422,7 @@ $controller->pageHeader();
<a href="#" onclick="addnewsource(''); return false;">
<?php echo WT_I18N::translate('Source'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
@@ -432,7 +432,7 @@ $controller->pageHeader();
<a href="#" onclick="addnewrepository(''); return false;">
<?php echo WT_I18N::translate('Repository'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
@@ -442,7 +442,7 @@ $controller->pageHeader();
<a href="#" onclick="window.open('addmedia.php?action=showmediaform', '_blank', edit_window_specs); return false;">
<?php echo WT_I18N::translate('Media object'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
@@ -451,7 +451,7 @@ $controller->pageHeader();
<i class="fa fa-li fa-paragraph"></i>
<a href="#" onclick="addnewnote(''); return false;">
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
<?php echo WT_I18N::translate('Shared note'); ?>
</a>
@@ -466,20 +466,20 @@ $controller->pageHeader();
<!-- DOWNLOAD -->
<li>
<i class="fa fa-li fa-download"></i>
- <a href="admin_trees_download.php?ged=<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <a href="admin_trees_download.php?ged=<?php echo $tree->nameUrl(); ?>">
<?php echo WT_I18N::translate('Download'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
<!-- UPLOAD -->
<li>
<i class="fa fa-li fa-upload"></i>
- <a href="?action=uploadform&amp;gedcom_id=<?php echo $tree->tree_id; ?>">
+ <a href="?action=uploadform&amp;gedcom_id=<?php echo $tree->id(); ?>">
<?php echo WT_I18N::translate('Upload'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
@@ -487,7 +487,7 @@ $controller->pageHeader();
<li>
<form action="admin_trees_export.php" method="post">
<?php echo WT_Filter::getCsrf(); ?>
- <input type="hidden" name="ged" value="<?php echo WT_Filter::escapeHtml($tree->tree_name); ?>">
+ <input type="hidden" name="ged" value="<?php echo $tree->nameHtml(); ?>">
<i class="fa fa-li fa-file-text"></i>
<input type="submit" class="hide"><!-- for WCAG2 -->
<a href="#" onclick="jQuery(this).closest('form').submit();">
@@ -498,10 +498,10 @@ $controller->pageHeader();
<!-- IMPORT -->
<li>
<i class="fa fa-li fa-file-text-o"></i>
- <a href="?action=importform&amp;gedcom_id=<?php echo $tree->tree_id; ?>">
+ <a href="?action=importform&amp;gedcom_id=<?php echo $tree->id(); ?>">
<?php echo WT_I18N::translate('Import'); ?>
<span class="sr-only">
- <?php echo WT_Filter::escapeHtml($tree->tree_name); ?>
+ <?php echo $tree->titleHtml(); ?>
</span>
</a>
</li>
diff --git a/admin_trees_merge.php b/admin_trees_merge.php
index aa4723f1a9..9d3021aa6f 100644
--- a/admin_trees_merge.php
+++ b/admin_trees_merge.php
@@ -92,13 +92,13 @@ if ($tree1_id && $tree2_id != $tree1_id) {
WT_I18N::translate('You must renumber the records in one of the trees before you can merge them.'),
'</p>',
'<p>',
- '<a class="current" href="admin_trees_renumber.php?ged=', $tree1->tree_name_html, '">',
- WT_I18N::translate('Renumber family tree'), ' — ', $tree1->tree_title_html,
+ '<a class="current" href="admin_trees_renumber.php?ged=', $tree1->nameUrl(), '">',
+ WT_I18N::translate('Renumber family tree'), ' — ', $tree1->titleHtml(),
'</a>',
'</p>',
'<p>',
- '<a class="current" href="admin_trees_renumber.php?ged=', $tree2->tree_name_html, '">',
- WT_I18N::translate('Renumber family tree'), ' — ', $tree2->tree_title_html,
+ '<a class="current" href="admin_trees_renumber.php?ged=', $tree2->nameUrl(), '">',
+ WT_I18N::translate('Renumber family tree'), ' — ', $tree2->titleHtml(),
'</a>',
'</p>';
} else {
diff --git a/admin_trees_places.php b/admin_trees_places.php
index fc1ee19859..feeacbc13b 100644
--- a/admin_trees_places.php
+++ b/admin_trees_places.php
@@ -78,7 +78,7 @@ if ($search && $replace) {
$controller = new WT_Controller_Page;
$controller
->restrictAccess(Auth::isManager())
- ->setPageTitle(WT_I18N::translate('Update all the place names in a family tree') . ' — ' . WT_Filter::escapeHtml($WT_TREE->tree_title))
+ ->setPageTitle(WT_I18N::translate('Update all the place names in a family tree') . ' — ' . $WT_TREE->titleHtml())
->pageHeader();
?>
diff --git a/admin_trees_renumber.php b/admin_trees_renumber.php
index 93c7a39f66..f3ab6143db 100644
--- a/admin_trees_renumber.php
+++ b/admin_trees_renumber.php
@@ -26,7 +26,7 @@ require './includes/session.php';
$controller = new WT_Controller_Page;
$controller
->restrictAccess(Auth::isManager())
- ->setPageTitle(WT_I18N::translate(/* I18N: Renumber the records in a family tree */ 'Renumber family tree') . ' — ' . WT_Filter::escapeHtml($WT_TREE->tree_title))
+ ->setPageTitle(WT_I18N::translate(/* I18N: Renumber the records in a family tree */ 'Renumber family tree') . ' — ' . $WT_TREE->titleHtml())
->pageHeader();
// Every XREF used by this tree and also used by some other tree
diff --git a/admin_users.php b/admin_users.php
index c841b79938..014d824275 100644
--- a/admin_users.php
+++ b/admin_users.php
@@ -117,11 +117,11 @@ case 'save':
}
foreach (WT_Tree::getAll() as $tree) {
- $tree->setUserPreference($user, 'gedcomid', WT_Filter::post('gedcomid' . $tree->tree_id, WT_REGEX_XREF));
- $tree->setUserPreference($user, 'rootid', WT_Filter::post('rootid' . $tree->tree_id, WT_REGEX_XREF));
- $tree->setUserPreference($user, 'canedit', WT_Filter::post('canedit' . $tree->tree_id, implode('|', array_keys($ALL_EDIT_OPTIONS))));
- if (WT_Filter::post('gedcomid' . $tree->tree_id, WT_REGEX_XREF)) {
- $tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', WT_Filter::postInteger('RELATIONSHIP_PATH_LENGTH' . $tree->tree_id, 0, 10, 0));
+ $tree->setUserPreference($user, 'gedcomid', WT_Filter::post('gedcomid' . $tree->id(), WT_REGEX_XREF));
+ $tree->setUserPreference($user, 'rootid', WT_Filter::post('rootid' . $tree->id(), WT_REGEX_XREF));
+ $tree->setUserPreference($user, 'canedit', WT_Filter::post('canedit' . $tree->id(), implode('|', array_keys($ALL_EDIT_OPTIONS))));
+ if (WT_Filter::post('gedcomid' . $tree->id(), WT_REGEX_XREF)) {
+ $tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', WT_Filter::postInteger('RELATIONSHIP_PATH_LENGTH' . $tree->id(), 0, 10, 0));
} else {
// Do not allow a path length to be set if the individual ID is not
$tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', null);
@@ -579,10 +579,10 @@ case 'edit':
<?php foreach (WT_Tree::getAll() as $tree): ?>
<tr>
<td>
- <?php echo $tree->tree_title_html; ?>
+ <?php echo $tree->titleHtml(); ?>
</td>
<td>
- <select name="canedit<?php echo $tree->tree_id; ?>">
+ <select name="canedit<?php echo $tree->id(); ?>">
<?php foreach ($ALL_EDIT_OPTIONS as $EDIT_OPTION => $desc): ?>
<option value="<?php echo $EDIT_OPTION; ?>"
<?php echo $EDIT_OPTION === $tree->getUserPreference($user, 'canedit') ? 'selected' : ''; ?>
@@ -595,29 +595,29 @@ case 'edit':
<td>
<input
data-autocomplete-type="INDI"
- data-autocomplete-ged="<?php echo $tree->tree_name_html; ?>"
+ data-autocomplete-ged="<?php echo WT_Filter::escapeHtml($tree->name()); ?>"
type="text"
size="12"
- name="rootid<?php echo $tree->tree_id; ?>"
- id="rootid<?php echo $tree->tree_id; ?>"
+ name="rootid<?php echo $tree->id(); ?>"
+ id="rootid<?php echo $tree->id(); ?>"
value="<?php echo WT_Filter::escapeHtml($tree->getUserPreference($user, 'rootid')); ?>"
>
- <?php echo print_findindi_link('rootid' . $tree->tree_id, $tree->tree_name); ?>
+ <?php echo print_findindi_link('rootid' . $tree->id(), $tree->name); ?>
</td>
<td>
<input
data-autocomplete-type="INDI"
- data-autocomplete-ged="<?php echo $tree->tree_name_html; ?>"
+ data-autocomplete-ged="<?php echo WT_Filter::escapeHtml($tree->name()); ?>"
type="text"
size="12"
- name="gedcomid<?php echo $tree->tree_id; ?>"
- id="gedcomid<?php echo $tree->tree_id; ?>"
+ name="gedcomid<?php echo $tree->id(); ?>"
+ id="gedcomid<?php echo $tree->id(); ?>"
value="<?php echo WT_Filter::escapeHtml($tree->getUserPreference($user, 'gedcomid')); ?>"
>
- <?php echo print_findindi_link('gedcomid' . $tree->tree_id, '', $tree->tree_name); ?>
+ <?php echo print_findindi_link('gedcomid' . $tree->id(), '', $tree->name); ?>
</td>
<td>
- <select name="RELATIONSHIP_PATH_LENGTH<?php echo $tree->tree_id; ?>" id="RELATIONSHIP_PATH_LENGTH<?php echo $tree->tree_id; ?>" class="relpath">
+ <select name="RELATIONSHIP_PATH_LENGTH<?php echo $tree->id(); ?>" id="RELATIONSHIP_PATH_LENGTH<?php echo $tree->id(); ?>" class="relpath">
<?php for ($n = 0; $n <= 10; ++$n): ?>
<option value="<?php echo $n; ?>" <?php echo $tree->getUserPreference($user, 'RELATIONSHIP_PATH_LENGTH') === $n ? 'checked' : ''; ?>>
<?php echo $n ? $n : WT_I18N::translate('No'); ?>
diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php
index 9da97d4252..6125245b04 100644
--- a/includes/functions/functions_db.php
+++ b/includes/functions/functions_db.php
@@ -74,7 +74,7 @@ function exists_pending_change(User $user = null, WT_Tree $tree = null) {
"SELECT 1" .
" FROM `##change`" .
" WHERE status='pending' AND gedcom_id=?"
- )->execute(array($tree->tree_id))->fetchOne();
+ )->execute(array($tree->id()))->fetchOne();
}
/**
diff --git a/includes/session.php b/includes/session.php
index 8453f8abeb..b588e626d3 100644
--- a/includes/session.php
+++ b/includes/session.php
@@ -429,17 +429,17 @@ if (isset($_REQUEST['ged'])) {
$WT_TREE = null;
foreach (WT_Tree::getAll() as $tree) {
$WT_TREE = $tree;
- if ($WT_TREE->tree_name == $GEDCOM && ($WT_TREE->getPreference('imported') || Auth::isAdmin())) {
+ if ($WT_TREE->name() == $GEDCOM && ($WT_TREE->getPreference('imported') || Auth::isAdmin())) {
break;
}
}
// These attributes of the currently-selected tree are used frequently
if ($WT_TREE) {
- define('WT_GEDCOM', $WT_TREE->tree_name);
- define('WT_GED_ID', $WT_TREE->tree_id);
- define('WT_GEDURL', $WT_TREE->tree_name_url);
- define('WT_TREE_TITLE', WT_Filter::escapeHtml($WT_TREE->tree_title));
+ define('WT_GEDCOM', $WT_TREE->name());
+ define('WT_GED_ID', $WT_TREE->id());
+ define('WT_GEDURL', $WT_TREE->nameUrl());
+ define('WT_TREE_TITLE', $WT_TREE->titleHtml());
define('WT_USER_GEDCOM_ADMIN', Auth::isManager($WT_TREE));
define('WT_USER_CAN_ACCEPT', Auth::isModerator($WT_TREE));
define('WT_USER_CAN_EDIT', Auth::isEditor($WT_TREE));
diff --git a/library/WT/Controller/Search.php b/library/WT/Controller/Search.php
index b96c93be8c..60786338a9 100644
--- a/library/WT/Controller/Search.php
+++ b/library/WT/Controller/Search.php
@@ -133,9 +133,9 @@ class WT_Controller_Search extends WT_Controller_Page {
// Retrieve the gedcoms to search in
if (count(WT_Tree::getAll()) > 1 && WT_Site::getPreference('ALLOW_CHANGE_GEDCOM')) {
foreach (WT_Tree::getAll() as $search_tree) {
- $str = str_replace(array(".", "-", " "), array("_", "_", "_"), $search_tree->tree_name);
+ $str = str_replace(array(".", "-", " "), array("_", "_", "_"), $search_tree->name);
if (isset ($_REQUEST["$str"]) || $topsearch) {
- $this->search_trees[$search_tree->tree_id] = $search_tree;
+ $this->search_trees[$search_tree->id()] = $search_tree;
$_REQUEST["$str"] = 'yes';
}
}
@@ -607,15 +607,15 @@ class WT_Controller_Search extends WT_Controller_Page {
foreach ($this->search_trees as $search_tree) {
$datalist = array();
foreach ($this->myindilist as $individual) {
- if ($individual->getGedcomId() === $search_tree->tree_id) {
+ if ($individual->getGedcomId() === $search_tree->id()) {
$datalist[] = $individual;
}
}
if ($datalist) {
usort($datalist, array('WT_GedcomRecord', 'compare'));
- $GEDCOM = $search_tree->tree_name;
- load_gedcom_settings($search_tree->tree_id);
- echo '<h3 class="indi-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->tree_title_html, '</span></a></h3>
+ $GEDCOM = $search_tree->name;
+ load_gedcom_settings($search_tree->id());
+ echo '<h3 class="indi-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->titleHtml(), '</span></a></h3>
<div class="indi-acc_content">',
format_indi_table($datalist);
echo '</div>'; //indi-acc_content
@@ -630,15 +630,15 @@ class WT_Controller_Search extends WT_Controller_Page {
foreach ($this->search_trees as $search_tree) {
$datalist = array();
foreach ($this->myfamlist as $family) {
- if ($family->getGedcomId() === $search_tree->tree_id) {
+ if ($family->getGedcomId() === $search_tree->id()) {
$datalist[] = $family;
}
}
if ($datalist) {
usort($datalist, array('WT_GedcomRecord', 'compare'));
- $GEDCOM = $search_tree->tree_name;
- load_gedcom_settings($search_tree->tree_id);
- echo '<h3 class="fam-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->tree_title_html, '</span></a></h3>
+ $GEDCOM = $search_tree->name;
+ load_gedcom_settings($search_tree->id());
+ echo '<h3 class="fam-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->titleHtml(), '</span></a></h3>
<div class="fam-acc_content">',
format_fam_table($datalist);
echo '</div>'; //fam-acc_content
@@ -653,15 +653,15 @@ class WT_Controller_Search extends WT_Controller_Page {
foreach ($this->search_trees as $search_tree) {
$datalist = array();
foreach ($this->mysourcelist as $source) {
- if ($source->getGedcomId() === $search_tree->tree_id) {
+ if ($source->getGedcomId() === $search_tree->id()) {
$datalist[] = $source;
}
}
if ($datalist) {
usort($datalist, array('WT_GedcomRecord', 'compare'));
- $GEDCOM = $search_tree->tree_name;
- load_gedcom_settings($search_tree->tree_id);
- echo '<h3 class="source-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->tree_title_html, '</span></a></h3>
+ $GEDCOM = $search_tree->name;
+ load_gedcom_settings($search_tree->id());
+ echo '<h3 class="source-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->titleHtml(), '</span></a></h3>
<div class="source-acc_content">',
format_sour_table($datalist);
echo '</div>'; //fam-acc_content
@@ -676,15 +676,15 @@ class WT_Controller_Search extends WT_Controller_Page {
foreach ($this->search_trees as $search_tree) {
$datalist = array();
foreach ($this->mynotelist as $note) {
- if ($note->getGedcomId() === $search_tree->tree_id) {
+ if ($note->getGedcomId() === $search_tree->id()) {
$datalist[] = $note;
}
}
if ($datalist) {
usort($datalist, array('WT_GedcomRecord', 'compare'));
- $GEDCOM = $search_tree->tree_name;
- load_gedcom_settings($search_tree->tree_id);
- echo '<h3 class="note-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->tree_title_html, '</span></a></h3>
+ $GEDCOM = $search_tree->name;
+ load_gedcom_settings($search_tree->id());
+ echo '<h3 class="note-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->titleHtml(), '</span></a></h3>
<div class="note-acc_content">',
format_note_table($datalist);
echo '</div>'; //note-acc_content
diff --git a/library/WT/Log.php b/library/WT/Log.php
index aa9a4fd085..38dee21e4a 100644
--- a/library/WT/Log.php
+++ b/library/WT/Log.php
@@ -55,7 +55,7 @@ class Log {
$message,
$WT_REQUEST->getClientIp(),
Auth::id(),
- $tree ? $tree->tree_id : null
+ $tree ? $tree->id() : null
));
}
diff --git a/library/WT/Module.php b/library/WT/Module.php
index 721b9bf212..cfc4a7a03c 100644
--- a/library/WT/Module.php
+++ b/library/WT/Module.php
@@ -171,7 +171,7 @@ abstract class WT_Module {
$access_level = WT_DB::prepare(
"SELECT access_level FROM `##module_privacy` WHERE gedcom_id = :gedcom_id AND module_name = :module_name AND component = :component"
)->execute(array(
- 'gedcom_id' => $tree->tree_id,
+ 'gedcom_id' => $tree->id(),
'module_name' => $this->getName(),
'component' => $component,
))->fetchOne();
diff --git a/library/WT/Stats.php b/library/WT/Stats.php
index 3d6736caae..99817c9e34 100644
--- a/library/WT/Stats.php
+++ b/library/WT/Stats.php
@@ -181,21 +181,21 @@ class WT_Stats {
* @return string
*/
public function gedcomFilename() {
- return $this->tree->tree_name;
+ return $this->tree->name();
}
/**
* @return string
*/
public function gedcomID() {
- return $this->tree->tree_id;
+ return $this->tree->id();
}
/**
* @return string
*/
public function gedcomTitle() {
- return $this->tree->tree_title_html;
+ return $this->tree->titleHtml();
}
/**
@@ -266,7 +266,7 @@ class WT_Stats {
public function gedcomUpdated() {
$row = WT_DB::prepare(
"SELECT SQL_CACHE d_year, d_month, d_day FROM `##dates` WHERE d_julianday1 = (SELECT MAX(d_julianday1) FROM `##dates` WHERE d_file =? AND d_fact='CHAN') LIMIT 1"
- )->execute(array($this->tree->tree_id))->fetchOneRow();
+ )->execute(array($this->tree->id()))->fetchOneRow();
if ($row) {
$date = new WT_Date("{$row->d_day} {$row->d_month} {$row->d_year}");
@@ -328,7 +328,7 @@ class WT_Stats {
private function totalIndividualsQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file = ?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
}
@@ -343,7 +343,7 @@ class WT_Stats {
* @return integer
*/
private function totalIndisWithSourcesQuery() {
- $rows = $this->runSql("SELECT SQL_CACHE COUNT(DISTINCT i_id) AS tot FROM `##link`, `##individuals` WHERE i_id=l_from AND i_file=l_file AND l_file=" . $this->tree->tree_id . " AND l_type='SOUR'");
+ $rows = $this->runSql("SELECT SQL_CACHE COUNT(DISTINCT i_id) AS tot FROM `##link`, `##individuals` WHERE i_id=l_from AND i_file=l_file AND l_file=" . $this->tree->id() . " AND l_type='SOUR'");
return (int) $rows[0]['tot'];
}
@@ -408,7 +408,7 @@ class WT_Stats {
private function totalFamiliesQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##families` WHERE f_file=?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
}
@@ -423,7 +423,7 @@ class WT_Stats {
* @return integer
*/
private function totalFamsWithSourcesQuery() {
- $rows = $this->runSql("SELECT SQL_CACHE COUNT(DISTINCT f_id) AS tot FROM `##link`, `##families` WHERE f_id=l_from AND f_file=l_file AND l_file=" . $this->tree->tree_id . " AND l_type='SOUR'");
+ $rows = $this->runSql("SELECT SQL_CACHE COUNT(DISTINCT f_id) AS tot FROM `##link`, `##families` WHERE f_id=l_from AND f_file=l_file AND l_file=" . $this->tree->id() . " AND l_type='SOUR'");
return (int) $rows[0]['tot'];
}
@@ -489,7 +489,7 @@ class WT_Stats {
private function totalSourcesQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##sources` WHERE s_file=?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
}
@@ -513,7 +513,7 @@ class WT_Stats {
private function totalNotesQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##other` WHERE o_type='NOTE' AND o_file=?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
}
@@ -537,7 +537,7 @@ class WT_Stats {
private function totalRepositoriesQuery() {
return
(Int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##other` WHERE o_type='REPO' AND o_file=?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
}
@@ -571,7 +571,7 @@ class WT_Stats {
$vars = '';
$distinct = 'DISTINCT';
}
- $vars[] = $this->tree->tree_id;
+ $vars[] = $this->tree->id();
$total =
WT_DB::prepare(
"SELECT SQL_CACHE COUNT({$distinct} n_surn COLLATE '" . WT_I18N::$collation . "')" .
@@ -594,7 +594,7 @@ class WT_Stats {
public function totalGivennames($params = array()) {
if ($params) {
$qs = implode(',', array_fill(0, count($params), '?'));
- $params[] = $this->tree->tree_id;
+ $params[] = $this->tree->id();
$total =
WT_DB::prepare("SELECT SQL_CACHE COUNT( n_givn) FROM `##name` WHERE n_givn IN ({$qs}) AND n_file=?")
->execute($params)
@@ -602,7 +602,7 @@ class WT_Stats {
} else {
$total =
WT_DB::prepare("SELECT SQL_CACHE COUNT(DISTINCT n_givn) FROM `##name` WHERE n_givn IS NOT NULL AND n_file=?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
}
@@ -616,7 +616,7 @@ class WT_Stats {
*/
public function totalEvents($params = array()) {
$sql = "SELECT SQL_CACHE COUNT(*) AS tot FROM `##dates` WHERE d_file=?";
- $vars = array($this->tree->tree_id);
+ $vars = array($this->tree->id());
$no_types = array('HEAD', 'CHAN');
if ($params) {
@@ -715,7 +715,7 @@ class WT_Stats {
private function totalSexMalesQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file=? AND i_sex=?")
- ->execute(array($this->tree->tree_id, 'M'))
+ ->execute(array($this->tree->id(), 'M'))
->fetchOne();
}
@@ -739,7 +739,7 @@ class WT_Stats {
private function totalSexFemalesQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file=? AND i_sex=?")
- ->execute(array($this->tree->tree_id, 'F'))
+ ->execute(array($this->tree->id(), 'F'))
->fetchOne();
}
@@ -763,7 +763,7 @@ class WT_Stats {
private function totalSexUnknownQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file=? AND i_sex=?")
- ->execute(array($this->tree->tree_id, 'U'))
+ ->execute(array($this->tree->id(), 'U'))
->fetchOne();
}
@@ -856,7 +856,7 @@ class WT_Stats {
private function totalLivingQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file=? AND i_gedcom NOT REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")'")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
}
@@ -880,7 +880,7 @@ class WT_Stats {
private function totalDeceasedQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file=? AND i_gedcom REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")'")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
}
@@ -983,7 +983,7 @@ class WT_Stats {
return 0;
}
$sql = "SELECT SQL_CACHE COUNT(*) AS tot FROM `##media` WHERE m_file=?";
- $vars = array($this->tree->tree_id);
+ $vars = array($this->tree->id());
if ($type != 'all') {
if ($type == 'unknown') {
@@ -1252,10 +1252,10 @@ class WT_Stats {
$rows = $this->runSql(
"SELECT SQL_CACHE d_year, d_type, d_fact, d_gid" .
" FROM `##dates`" .
- " WHERE d_file={$this->tree->tree_id} AND d_fact IN ({$query_field}) AND d_julianday1=(" .
+ " WHERE d_file={$this->tree->id()} AND d_fact IN ({$query_field}) AND d_julianday1=(" .
" SELECT {$dmod}( d_julianday1 )" .
" FROM `##dates`" .
- " WHERE d_file={$this->tree->tree_id} AND d_fact IN ({$query_field}) AND d_julianday1<>0 )" .
+ " WHERE d_file={$this->tree->id()} AND d_fact IN ({$query_field}) AND d_julianday1<>0 )" .
" LIMIT 1"
);
if (!isset($rows[0])) {
@@ -1305,12 +1305,12 @@ class WT_Stats {
if ($what == 'INDI') {
$rows =
WT_DB::prepare("SELECT i_gedcom AS ged FROM `##individuals` WHERE i_file=?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchAll();
} elseif ($what == 'FAM') {
$rows =
WT_DB::prepare("SELECT f_gedcom AS ged FROM `##families` WHERE f_file=?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchAll();
}
$placelist = array();
@@ -1350,7 +1350,7 @@ class WT_Stats {
$join .
" WHERE" .
" p_id={$parent} AND" .
- " p_file={$this->tree->tree_id}" .
+ " p_file={$this->tree->id()}" .
" GROUP BY place"
);
@@ -1372,7 +1372,7 @@ class WT_Stats {
" JOIN `##placelinks` ON pl_file=p_file AND p_id=pl_p_id" .
$join .
" WHERE" .
- " p_file={$this->tree->tree_id}" .
+ " p_file={$this->tree->id()}" .
" AND p_parent_id='0'" .
" GROUP BY country ORDER BY tot DESC, country ASC"
);
@@ -1387,7 +1387,7 @@ class WT_Stats {
private function totalPlacesQuery() {
return
(int) WT_DB::prepare("SELECT SQL_CACHE COUNT(*) FROM `##places` WHERE p_file=?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
}
@@ -1588,7 +1588,7 @@ class WT_Stats {
foreach ($all_db_countries as $country_code => $country) {
$top10[] = '<li>';
foreach ($country as $country_name => $tot) {
- $tmp = new WT_Place($country_name, $this->tree->tree_id);
+ $tmp = new WT_Place($country_name, $this->tree->id());
$place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $all_countries[$country_code] . '</a>';
$top10[] .= $place . ' - ' . WT_I18N::number($tot);
}
@@ -1610,7 +1610,7 @@ class WT_Stats {
$i = 1;
arsort($places);
foreach ($places as $place => $count) {
- $tmp = new WT_Place($place, $this->tree->tree_id);
+ $tmp = new WT_Place($place, $this->tree->id());
$place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>';
$top10[] = '<li>' . $place . ' - ' . WT_I18N::number($count) . '</li>';
if ($i++ == 10) {
@@ -1631,7 +1631,7 @@ class WT_Stats {
$i = 1;
arsort($places);
foreach ($places as $place => $count) {
- $tmp = new WT_Place($place, $this->tree->tree_id);
+ $tmp = new WT_Place($place, $this->tree->id());
$place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>';
$top10[] = '<li>' . $place . ' - ' . WT_I18N::number($count) . '</li>';
if ($i++ == 10) {
@@ -1652,7 +1652,7 @@ class WT_Stats {
$i = 1;
arsort($places);
foreach ($places as $place => $count) {
- $tmp = new WT_Place($place, $this->tree->tree_id);
+ $tmp = new WT_Place($place, $this->tree->id());
$place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>';
$top10[] = '<li>' . $place . ' - ' . WT_I18N::number($count) . '</li>';
if ($i++ == 10) {
@@ -1684,7 +1684,7 @@ class WT_Stats {
$sql =
"SELECT SQL_CACHE FLOOR(d_year/100+1) AS century, COUNT(*) AS total FROM `##dates` " .
"WHERE " .
- "d_file={$this->tree->tree_id} AND " .
+ "d_file={$this->tree->id()} AND " .
"d_year<>0 AND " .
"d_fact='BIRT' AND " .
"d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
@@ -1693,14 +1693,14 @@ class WT_Stats {
"SELECT SQL_CACHE d_month, i_sex, COUNT(*) AS total FROM `##dates` " .
"JOIN `##individuals` ON d_file = i_file AND d_gid = i_id " .
"WHERE " .
- "d_file={$this->tree->tree_id} AND " .
+ "d_file={$this->tree->id()} AND " .
"d_fact='BIRT' AND " .
"d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
} else {
$sql =
"SELECT SQL_CACHE d_month, COUNT(*) AS total FROM `##dates` " .
"WHERE " .
- "d_file={$this->tree->tree_id} AND " .
+ "d_file={$this->tree->id()} AND " .
"d_fact='BIRT' AND " .
"d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
}
@@ -1775,7 +1775,7 @@ class WT_Stats {
$sql =
"SELECT SQL_CACHE FLOOR(d_year/100+1) AS century, COUNT(*) AS total FROM `##dates` " .
"WHERE " .
- "d_file={$this->tree->tree_id} AND " .
+ "d_file={$this->tree->id()} AND " .
'd_year<>0 AND ' .
"d_fact='DEAT' AND " .
"d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
@@ -1784,14 +1784,14 @@ class WT_Stats {
"SELECT SQL_CACHE d_month, i_sex, COUNT(*) AS total FROM `##dates` " .
"JOIN `##individuals` ON d_file = i_file AND d_gid = i_id " .
"WHERE " .
- "d_file={$this->tree->tree_id} AND " .
+ "d_file={$this->tree->id()} AND " .
"d_fact='DEAT' AND " .
"d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
} else {
$sql =
"SELECT SQL_CACHE d_month, COUNT(*) AS total FROM `##dates` " .
"WHERE " .
- "d_file={$this->tree->tree_id} AND " .
+ "d_file={$this->tree->id()} AND " .
"d_fact='DEAT' AND " .
"d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
}
@@ -2003,7 +2003,7 @@ class WT_Stats {
" WHERE" .
" indi.i_id=birth.d_gid AND" .
" birth.d_gid=death.d_gid AND" .
- " death.d_file={$this->tree->tree_id} AND" .
+ " death.d_file={$this->tree->id()} AND" .
" birth.d_file=death.d_file AND" .
" birth.d_file=indi.i_file AND" .
" birth.d_fact='BIRT' AND" .
@@ -2071,7 +2071,7 @@ class WT_Stats {
"WHERE " .
" indi.i_id=birth.d_gid AND " .
" birth.d_gid=death.d_gid AND " .
- " death.d_file={$this->tree->tree_id} AND " .
+ " death.d_file={$this->tree->id()} AND " .
" birth.d_file=death.d_file AND " .
" birth.d_file=indi.i_file AND " .
" birth.d_fact='BIRT' AND " .
@@ -2155,7 +2155,7 @@ class WT_Stats {
" WHERE" .
" indi.i_id=birth.d_gid AND" .
" indi.i_gedcom NOT REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")' AND" .
- " birth.d_file={$this->tree->tree_id} AND" .
+ " birth.d_file={$this->tree->id()} AND" .
" birth.d_fact='BIRT' AND" .
" birth.d_file=indi.i_file AND" .
" birth.d_julianday1<>0" .
@@ -2220,7 +2220,7 @@ class WT_Stats {
"WHERE " .
" indi.i_id=birth.d_gid AND " .
" birth.d_gid=death.d_gid AND " .
- " death.d_file=" . $this->tree->tree_id . " AND " .
+ " death.d_file=" . $this->tree->id() . " AND " .
" birth.d_file=death.d_file AND " .
" birth.d_file=indi.i_file AND " .
" birth.d_fact='BIRT' AND " .
@@ -2278,7 +2278,7 @@ class WT_Stats {
" WHERE" .
" indi.i_id=birth.d_gid AND" .
" birth.d_gid=death.d_gid AND" .
- " death.d_file={$this->tree->tree_id} AND" .
+ " death.d_file={$this->tree->id()} AND" .
" birth.d_file=death.d_file AND" .
" birth.d_file=indi.i_file AND" .
" birth.d_fact='BIRT' AND" .
@@ -2374,7 +2374,7 @@ class WT_Stats {
" WHERE" .
" indi.i_id=birth.d_gid AND" .
" birth.d_gid=death.d_gid AND" .
- " death.d_file={$this->tree->tree_id} AND" .
+ " death.d_file={$this->tree->id()} AND" .
" birth.d_file=death.d_file AND" .
" birth.d_file=indi.i_file AND" .
" birth.d_fact='BIRT' AND" .
@@ -2631,7 +2631,7 @@ class WT_Stats {
. ' FROM'
. " `##dates`"
. ' WHERE'
- . " d_file={$this->tree->tree_id} AND"
+ . " d_file={$this->tree->id()} AND"
. " d_gid<>'HEAD' AND"
. " d_fact {$fact_query} AND"
. ' d_julianday1<>0'
@@ -2770,14 +2770,14 @@ class WT_Stats {
$rows = $this->runSql(
" SELECT SQL_CACHE fam.f_id AS famid, fam.{$sex_field}, married.d_julianday2-birth.d_julianday1 AS age, indi.i_id AS i_id" .
" FROM `##families` AS fam" .
- " LEFT JOIN `##dates` AS birth ON birth.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##individuals` AS indi ON indi.i_file = {$this->tree->tree_id}" .
+ " LEFT JOIN `##dates` AS birth ON birth.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##individuals` AS indi ON indi.i_file = {$this->tree->id()}" .
" WHERE" .
" birth.d_gid = indi.i_id AND" .
" married.d_gid = fam.f_id AND" .
" indi.i_id = fam.{$sex_field} AND" .
- " fam.f_file = {$this->tree->tree_id} AND" .
+ " fam.f_file = {$this->tree->id()} AND" .
" birth.d_fact = 'BIRT' AND" .
" married.d_fact = 'MARR' AND" .
" birth.d_julianday1 <> 0 AND" .
@@ -2848,10 +2848,10 @@ class WT_Stats {
$hrows = $this->runSql(
" SELECT SQL_CACHE DISTINCT fam.f_id AS family, MIN(husbdeath.d_julianday2-married.d_julianday1) AS age" .
" FROM `##families` AS fam" .
- " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##dates` AS husbdeath ON husbdeath.d_file = {$this->tree->tree_id}" .
+ " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##dates` AS husbdeath ON husbdeath.d_file = {$this->tree->id()}" .
" WHERE" .
- " fam.f_file = {$this->tree->tree_id} AND" .
+ " fam.f_file = {$this->tree->id()} AND" .
" husbdeath.d_gid = fam.f_husb AND" .
" husbdeath.d_fact = 'DEAT' AND" .
" married.d_gid = fam.f_id AND" .
@@ -2863,10 +2863,10 @@ class WT_Stats {
$wrows = $this->runSql(
" SELECT SQL_CACHE DISTINCT fam.f_id AS family, MIN(wifedeath.d_julianday2-married.d_julianday1) AS age" .
" FROM `##families` AS fam" .
- " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##dates` AS wifedeath ON wifedeath.d_file = {$this->tree->tree_id}" .
+ " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##dates` AS wifedeath ON wifedeath.d_file = {$this->tree->id()}" .
" WHERE" .
- " fam.f_file = {$this->tree->tree_id} AND" .
+ " fam.f_file = {$this->tree->id()} AND" .
" wifedeath.d_gid = fam.f_wife AND" .
" wifedeath.d_fact = 'DEAT' AND" .
" married.d_gid = fam.f_id AND" .
@@ -2878,10 +2878,10 @@ class WT_Stats {
$drows = $this->runSql(
" SELECT SQL_CACHE DISTINCT fam.f_id AS family, MIN(divorced.d_julianday2-married.d_julianday1) AS age" .
" FROM `##families` AS fam" .
- " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##dates` AS divorced ON divorced.d_file = {$this->tree->tree_id}" .
+ " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##dates` AS divorced ON divorced.d_file = {$this->tree->id()}" .
" WHERE" .
- " fam.f_file = {$this->tree->tree_id} AND" .
+ " fam.f_file = {$this->tree->id()} AND" .
" married.d_gid = fam.f_id AND" .
" married.d_fact = 'MARR' AND" .
" divorced.d_gid = fam.f_id AND" .
@@ -2986,10 +2986,10 @@ class WT_Stats {
$rows = $this->runSql(
" SELECT SQL_CACHE fam.f_id AS family," . $query1 .
" FROM `##families` AS fam" .
- " LEFT JOIN `##dates` AS wifebirth ON wifebirth.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##dates` AS husbbirth ON husbbirth.d_file = {$this->tree->tree_id}" .
+ " LEFT JOIN `##dates` AS wifebirth ON wifebirth.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##dates` AS husbbirth ON husbbirth.d_file = {$this->tree->id()}" .
" WHERE" .
- " fam.f_file = {$this->tree->tree_id} AND" .
+ " fam.f_file = {$this->tree->id()} AND" .
" husbbirth.d_gid = fam.f_husb AND" .
" husbbirth.d_fact = 'BIRT' AND" .
" wifebirth.d_gid = fam.f_wife AND" .
@@ -3060,16 +3060,16 @@ class WT_Stats {
" parentfamily.l_to AS id," .
" childbirth.d_julianday2-birth.d_julianday1 AS age" .
" FROM `##link` AS parentfamily" .
- " JOIN `##link` AS childfamily ON childfamily.l_file = {$this->tree->tree_id}" .
- " JOIN `##dates` AS birth ON birth.d_file = {$this->tree->tree_id}" .
- " JOIN `##dates` AS childbirth ON childbirth.d_file = {$this->tree->tree_id}" .
+ " JOIN `##link` AS childfamily ON childfamily.l_file = {$this->tree->id()}" .
+ " JOIN `##dates` AS birth ON birth.d_file = {$this->tree->id()}" .
+ " JOIN `##dates` AS childbirth ON childbirth.d_file = {$this->tree->id()}" .
" WHERE" .
" birth.d_gid = parentfamily.l_to AND" .
" childfamily.l_to = childbirth.d_gid AND" .
" childfamily.l_type = 'CHIL' AND" .
" parentfamily.l_type = '{$sex_field}' AND" .
" childfamily.l_from = parentfamily.l_from AND" .
- " parentfamily.l_file = {$this->tree->tree_id} AND" .
+ " parentfamily.l_file = {$this->tree->id()} AND" .
" birth.d_fact = 'BIRT' AND" .
" childbirth.d_fact = 'BIRT' AND" .
" birth.d_julianday1 <> 0 AND" .
@@ -3134,7 +3134,7 @@ class WT_Stats {
$sql =
"SELECT SQL_CACHE FLOOR(d_year/100+1) AS century, COUNT(*) AS total" .
" FROM `##dates`" .
- " WHERE d_file={$this->tree->tree_id} AND d_year<>0 AND d_fact='MARR' AND d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
+ " WHERE d_file={$this->tree->id()} AND d_year<>0 AND d_fact='MARR' AND d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
if ($year1 >= 0 && $year2 >= 0) {
$sql .= " AND d_year BETWEEN '{$year1}' AND '{$year2}'";
}
@@ -3147,11 +3147,11 @@ class WT_Stats {
$sql =
" SELECT SQL_CACHE fam.f_id AS fams, fam.f_husb, fam.f_wife, married.d_julianday2 AS age, married.d_month AS month, indi.i_id AS indi" .
" FROM `##families` AS fam" .
- " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##individuals` AS indi ON indi.i_file = {$this->tree->tree_id}" .
+ " LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##individuals` AS indi ON indi.i_file = {$this->tree->id()}" .
" WHERE" .
" married.d_gid = fam.f_id AND" .
- " fam.f_file = {$this->tree->tree_id} AND" .
+ " fam.f_file = {$this->tree->id()} AND" .
" married.d_fact = 'MARR' AND" .
" married.d_julianday2 <> 0 AND" .
$years .
@@ -3161,7 +3161,7 @@ class WT_Stats {
$sql =
"SELECT SQL_CACHE d_month, COUNT(*) AS total" .
" FROM `##dates`" .
- " WHERE d_file={$this->tree->tree_id} AND d_fact='MARR'";
+ " WHERE d_file={$this->tree->id()} AND d_fact='MARR'";
if ($year1 >= 0 && $year2 >= 0) {
$sql .= " AND d_year BETWEEN '{$year1}' AND '{$year2}'";
}
@@ -3229,7 +3229,7 @@ class WT_Stats {
$sql =
"SELECT SQL_CACHE FLOOR(d_year/100+1) AS century, COUNT(*) AS total" .
" FROM `##dates`" .
- " WHERE d_file={$this->tree->tree_id} AND d_year<>0 AND d_fact = 'DIV' AND d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
+ " WHERE d_file={$this->tree->id()} AND d_year<>0 AND d_fact = 'DIV' AND d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')";
if ($year1 >= 0 && $year2 >= 0) {
$sql .= " AND d_year BETWEEN '{$year1}' AND '{$year2}'";
}
@@ -3242,11 +3242,11 @@ class WT_Stats {
$sql =
" SELECT SQL_CACHE fam.f_id AS fams, fam.f_husb, fam.f_wife, divorced.d_julianday2 AS age, divorced.d_month AS month, indi.i_id AS indi" .
" FROM `##families` AS fam" .
- " LEFT JOIN `##dates` AS divorced ON divorced.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##individuals` AS indi ON indi.i_file = {$this->tree->tree_id}" .
+ " LEFT JOIN `##dates` AS divorced ON divorced.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##individuals` AS indi ON indi.i_file = {$this->tree->id()}" .
" WHERE" .
" divorced.d_gid = fam.f_id AND" .
- " fam.f_file = {$this->tree->tree_id} AND" .
+ " fam.f_file = {$this->tree->id()} AND" .
" divorced.d_fact = 'DIV' AND" .
" divorced.d_julianday2 <> 0 AND" .
$years .
@@ -3255,7 +3255,7 @@ class WT_Stats {
} else {
$sql =
"SELECT SQL_CACHE d_month, COUNT(*) AS total FROM `##dates` " .
- "WHERE d_file={$this->tree->tree_id} AND d_fact = 'DIV'";
+ "WHERE d_file={$this->tree->id()} AND d_fact = 'DIV'";
if ($year1 >= 0 && $year2 >= 0) {
$sql .= " AND d_year BETWEEN '{$year1}' AND '{$year2}'";
}
@@ -3460,7 +3460,7 @@ class WT_Stats {
"JOIN `##dates` AS birth ON (birth.d_gid=fam.f_husb AND birth.d_file=fam.f_file) " .
"WHERE " .
" '{$sex}' IN ('M', 'BOTH') AND " .
- " married.d_file={$this->tree->tree_id} AND married.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND married.d_fact='MARR' AND " .
+ " married.d_file={$this->tree->id()} AND married.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND married.d_fact='MARR' AND " .
" birth.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND birth.d_fact='BIRT' AND " .
" married.d_julianday1>birth.d_julianday1 AND birth.d_julianday1<>0 " .
"GROUP BY century, sex " .
@@ -3474,7 +3474,7 @@ class WT_Stats {
"JOIN `##dates` AS birth ON (birth.d_gid=fam.f_wife AND birth.d_file=fam.f_file) " .
"WHERE " .
" '{$sex}' IN ('F', 'BOTH') AND " .
- " married.d_file={$this->tree->tree_id} AND married.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND married.d_fact='MARR' AND " .
+ " married.d_file={$this->tree->id()} AND married.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND married.d_fact='MARR' AND " .
" birth.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND birth.d_fact='BIRT' AND " .
" married.d_julianday1>birth.d_julianday1 AND birth.d_julianday1<>0 " .
" GROUP BY century, sex ORDER BY century"
@@ -3580,7 +3580,7 @@ class WT_Stats {
"JOIN `##dates` AS birth ON (birth.d_gid=fam.f_husb AND birth.d_file=fam.f_file) " .
"WHERE " .
" '{$sex}' IN ('M', 'BOTH') AND {$years} " .
- " married.d_file={$this->tree->tree_id} AND married.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND married.d_fact='MARR' AND " .
+ " married.d_file={$this->tree->id()} AND married.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND married.d_fact='MARR' AND " .
" birth.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND birth.d_fact='BIRT' AND " .
" married.d_julianday1>birth.d_julianday1 AND birth.d_julianday1<>0 " .
"UNION ALL " .
@@ -3593,7 +3593,7 @@ class WT_Stats {
"JOIN `##dates` AS birth ON (birth.d_gid=fam.f_wife AND birth.d_file=fam.f_file) " .
"WHERE " .
" '{$sex}' IN ('F', 'BOTH') AND {$years} " .
- " married.d_file={$this->tree->tree_id} AND married.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND married.d_fact='MARR' AND " .
+ " married.d_file={$this->tree->id()} AND married.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND married.d_fact='MARR' AND " .
" birth.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND birth.d_fact='BIRT' AND " .
" married.d_julianday1>birth.d_julianday1 AND birth.d_julianday1<>0 "
);
@@ -3899,7 +3899,7 @@ class WT_Stats {
*/
public function totalMarriedMales() {
$n = WT_DB::prepare("SELECT SQL_CACHE COUNT(DISTINCT f_husb) FROM `##families` WHERE f_file=? AND f_gedcom LIKE '%\\n1 MARR%'")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
return WT_I18N::number($n);
}
@@ -3909,7 +3909,7 @@ class WT_Stats {
*/
public function totalMarriedFemales() {
$n = WT_DB::prepare("SELECT SQL_CACHE COUNT(DISTINCT f_wife) FROM `##families` WHERE f_file=? AND f_gedcom LIKE '%\\n1 MARR%'")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
return WT_I18N::number($n);
}
@@ -3924,11 +3924,11 @@ class WT_Stats {
" SELECT SQL_CACHE f_numchil AS tot, f_id AS id" .
" FROM `##families`" .
" WHERE" .
- " f_file={$this->tree->tree_id}" .
+ " f_file={$this->tree->id()}" .
" AND f_numchil = (" .
" SELECT max( f_numchil )" .
" FROM `##families`" .
- " WHERE f_file ={$this->tree->tree_id}" .
+ " WHERE f_file ={$this->tree->id()}" .
" )" .
" LIMIT 1"
);
@@ -3974,7 +3974,7 @@ class WT_Stats {
"SELECT SQL_CACHE f_numchil AS tot, f_id AS id" .
" FROM `##families`" .
" WHERE" .
- " f_file={$this->tree->tree_id}" .
+ " f_file={$this->tree->id()}" .
" ORDER BY tot DESC" .
" LIMIT " . $total
);
@@ -4039,11 +4039,11 @@ class WT_Stats {
" link2.l_to AS ch2," .
" child1.d_julianday2-child2.d_julianday2 AS age" .
" FROM `##link` AS link1" .
- " LEFT JOIN `##dates` AS child1 ON child1.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##dates` AS child2 ON child2.d_file = {$this->tree->tree_id}" .
- " LEFT JOIN `##link` AS link2 ON link2.l_file = {$this->tree->tree_id}" .
+ " LEFT JOIN `##dates` AS child1 ON child1.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##dates` AS child2 ON child2.d_file = {$this->tree->id()}" .
+ " LEFT JOIN `##link` AS link2 ON link2.l_file = {$this->tree->id()}" .
" WHERE" .
- " link1.l_file = {$this->tree->tree_id} AND" .
+ " link1.l_file = {$this->tree->id()} AND" .
" link1.l_from = link2.l_from AND" .
" link1.l_type = 'CHIL' AND" .
" child1.d_gid = link1.l_to AND" .
@@ -4176,10 +4176,10 @@ class WT_Stats {
" child1.d_month as d_month" .
$sql_sex1 .
" FROM `##link` AS link1" .
- " LEFT JOIN `##dates` AS child1 ON child1.d_file = {$this->tree->tree_id}" .
+ " LEFT JOIN `##dates` AS child1 ON child1.d_file = {$this->tree->id()}" .
$sql_sex2 .
" WHERE" .
- " link1.l_file = {$this->tree->tree_id} AND" .
+ " link1.l_file = {$this->tree->id()} AND" .
" link1.l_type = 'CHIL' AND" .
" child1.d_gid = link1.l_to AND" .
" child1.d_fact = 'BIRT' AND" .
@@ -4347,7 +4347,7 @@ class WT_Stats {
$rows = $this->runSql(
" SELECT SQL_CACHE f_numchil AS tot, f_id AS id" .
" FROM `##families`" .
- " WHERE f_file={$this->tree->tree_id}" .
+ " WHERE f_file={$this->tree->id()}" .
" ORDER BY tot DESC" .
" LIMIT " . $total
);
@@ -4381,7 +4381,7 @@ class WT_Stats {
* @return string
*/
public function totalChildren() {
- $rows = $this->runSql("SELECT SQL_CACHE SUM(f_numchil) AS tot FROM `##families` WHERE f_file={$this->tree->tree_id}");
+ $rows = $this->runSql("SELECT SQL_CACHE SUM(f_numchil) AS tot FROM `##families` WHERE f_file={$this->tree->id()}");
return WT_I18N::number($rows[0]['tot']);
}
@@ -4390,7 +4390,7 @@ class WT_Stats {
* @return string
*/
public function averageChildren() {
- $rows = $this->runSql("SELECT SQL_CACHE AVG(f_numchil) AS tot FROM `##families` WHERE f_file={$this->tree->tree_id}");
+ $rows = $this->runSql("SELECT SQL_CACHE AVG(f_numchil) AS tot FROM `##families` WHERE f_file={$this->tree->id()}");
return WT_I18N::number($rows[0]['tot'], 2);
}
@@ -4417,7 +4417,7 @@ class WT_Stats {
" SELECT SQL_CACHE ROUND(AVG(f_numchil),2) AS num, FLOOR(d_year/100+1) AS century" .
" FROM `##families`" .
" JOIN `##dates` ON (d_file = f_file AND d_gid=f_id)" .
- " WHERE f_file = {$this->tree->tree_id}" .
+ " WHERE f_file = {$this->tree->id()}" .
" AND d_julianday1<>0" .
" AND d_fact = 'MARR'" .
" AND d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')" .
@@ -4464,7 +4464,7 @@ class WT_Stats {
"(SELECT count(i_sex) AS num FROM `##link` " .
"LEFT OUTER JOIN `##individuals` " .
"ON l_from=i_id AND l_file=i_file AND i_sex='M' AND l_type='FAMC' " .
- "JOIN `##families` ON f_file=l_file AND f_id=l_to WHERE f_file={$this->tree->tree_id} GROUP BY l_to" .
+ "JOIN `##families` ON f_file=l_file AND f_id=l_to WHERE f_file={$this->tree->id()} GROUP BY l_to" .
") boys" .
" GROUP BY num" .
" ORDER BY num";
@@ -4474,7 +4474,7 @@ class WT_Stats {
"(SELECT count(i_sex) AS num FROM `##link` " .
"LEFT OUTER JOIN `##individuals` " .
"ON l_from=i_id AND l_file=i_file AND i_sex='F' AND l_type='FAMC' " .
- "JOIN `##families` ON f_file=l_file AND f_id=l_to WHERE f_file={$this->tree->tree_id} GROUP BY l_to" .
+ "JOIN `##families` ON f_file=l_file AND f_id=l_to WHERE f_file={$this->tree->id()} GROUP BY l_to" .
") girls" .
" GROUP BY num" .
" ORDER BY num";
@@ -4482,14 +4482,14 @@ class WT_Stats {
$sql = "SELECT SQL_CACHE f_numchil, COUNT(*) AS total FROM `##families` ";
if ($year1 >= 0 && $year2 >= 0) {
$sql .=
- "AS fam LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->tree_id}"
+ "AS fam LEFT JOIN `##dates` AS married ON married.d_file = {$this->tree->id()}"
. " WHERE"
. " married.d_gid = fam.f_id AND"
- . " fam.f_file = {$this->tree->tree_id} AND"
+ . " fam.f_file = {$this->tree->id()} AND"
. " married.d_fact = 'MARR' AND"
. " married.d_year BETWEEN '{$year1}' AND '{$year2}'";
} else {
- $sql .= "WHERE f_file={$this->tree->tree_id}";
+ $sql .= "WHERE f_file={$this->tree->id()}";
}
$sql .= " GROUP BY f_numchil";
}
@@ -4551,7 +4551,7 @@ class WT_Stats {
$rows = $this->runSql(
" SELECT SQL_CACHE COUNT(*) AS tot" .
" FROM `##families`" .
- " WHERE f_numchil = 0 AND f_file = {$this->tree->tree_id}");
+ " WHERE f_numchil = 0 AND f_file = {$this->tree->id()}");
return $rows[0]['tot'];
}
@@ -4579,7 +4579,7 @@ class WT_Stats {
$rows = $this->runSql(
" SELECT SQL_CACHE f_id AS family" .
" FROM `##families` AS fam" .
- " WHERE f_numchil = 0 AND fam.f_file = {$this->tree->tree_id}");
+ " WHERE f_numchil = 0 AND fam.f_file = {$this->tree->id()}");
if (!isset($rows[0])) {
return '';
}
@@ -4648,7 +4648,7 @@ class WT_Stats {
" `##dates` AS married ON (married.d_file = fam.f_file AND married.d_gid = fam.f_id)" .
" WHERE" .
" f_numchil = 0 AND" .
- " fam.f_file = {$this->tree->tree_id} AND" .
+ " fam.f_file = {$this->tree->id()} AND" .
$years .
" married.d_fact = 'MARR' AND" .
" married.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@')" .
@@ -4721,11 +4721,11 @@ class WT_Stats {
$rows = $this->runSql(
"SELECT SQL_CACHE COUNT(*) AS tot, f_id AS id" .
" FROM `##families`" .
- " JOIN `##link` AS children ON children.l_file = {$this->tree->tree_id}" .
- " JOIN `##link` AS mchildren ON mchildren.l_file = {$this->tree->tree_id}" .
- " JOIN `##link` AS gchildren ON gchildren.l_file = {$this->tree->tree_id}" .
+ " JOIN `##link` AS children ON children.l_file = {$this->tree->id()}" .
+ " JOIN `##link` AS mchildren ON mchildren.l_file = {$this->tree->id()}" .
+ " JOIN `##link` AS gchildren ON gchildren.l_file = {$this->tree->id()}" .
" WHERE" .
- " f_file={$this->tree->tree_id} AND" .
+ " f_file={$this->tree->id()} AND" .
" children.l_from=f_id AND" .
" children.l_type='CHIL' AND" .
" children.l_to=mchildren.l_from AND" .
@@ -4843,7 +4843,7 @@ class WT_Stats {
* @return string
*/
public function getCommonSurname() {
- $surnames = array_keys(get_top_surnames($this->tree->tree_id, 1, 1));
+ $surnames = array_keys(get_top_surnames($this->tree->id(), 1, 1));
return array_shift($surnames);
}
@@ -5991,7 +5991,7 @@ class WT_Stats {
public function totalGedcomNews() {
try {
$number = (int) WT_DB::prepare("SELECT COUNT(*) FROM `##news` WHERE gedcom_id = ?")
- ->execute(array($this->tree->tree_id))
+ ->execute(array($this->tree->id()))
->fetchOne();
} catch (PDOException $ex) {
// The module may not be installed, so the table may not exist.
diff --git a/library/WT/Theme/BaseTheme.php b/library/WT/Theme/BaseTheme.php
index 5d066ca8b0..d9a12413d9 100644
--- a/library/WT/Theme/BaseTheme.php
+++ b/library/WT/Theme/BaseTheme.php
@@ -433,7 +433,7 @@ abstract class BaseTheme {
return
'<form action="search.php" class="header-search" method="post" role="search">' .
'<input type="hidden" name="action" value="general">' .
- '<input type="hidden" name="ged" value="' . $this->tree->tree_name_html . '">' .
+ '<input type="hidden" name="ged" value="' . $this->tree->nameHtml() . '">' .
'<input type="hidden" name="topsearch" value="yes">' .
$this->formQuickSearchFields() .
'</form>';
@@ -460,7 +460,7 @@ abstract class BaseTheme {
*/
protected function formatTreeTitle() {
if ($this->tree) {
- return '<h1 class="header-title">' . $this->tree->tree_title_html . '</h1>';
+ return '<h1 class="header-title">' . $this->tree->titleHtml() . '</h1>';
} else {
return '';
}
@@ -535,7 +535,7 @@ abstract class BaseTheme {
$this->metaCanonicalUrl($controller->getCanonicalUrl());
if ($this->tree) {
- $html .= $this->metaDescription($this->tree->getPreference('META_DESCRIPTION', html_entity_decode(strip_tags($this->tree->tree_title_html), ENT_QUOTES)));
+ $html .= $this->metaDescription($this->tree->getPreference('META_DESCRIPTION'));
}
// CSS files
@@ -961,7 +961,7 @@ abstract class BaseTheme {
*/
final public function init(Zend_Session_Namespace $session, $search_engine, WT_Tree $tree = null) {
$this->tree = $tree;
- $this->tree_url = $tree ? 'ged=' . WT_Filter::escapeUrl($tree->tree_name) : null;
+ $this->tree_url = $tree ? 'ged=' . $tree->nameUrl() : '';
$this->session = $session;
$this->search_engine = $search_engine;
@@ -1300,11 +1300,11 @@ abstract class BaseTheme {
$ALLOW_CHANGE_GEDCOM = WT_Site::getPreference('ALLOW_CHANGE_GEDCOM') && count(WT_Tree::getAll()) > 1;
foreach (WT_Tree::getAll() as $tree) {
- if ($tree->tree_id === WT_GED_ID || $ALLOW_CHANGE_GEDCOM) {
+ if ($tree->id() === WT_GED_ID || $ALLOW_CHANGE_GEDCOM) {
$submenu = new WT_Menu(
- $tree->tree_title_html,
- 'index.php?ctype=gedcom&amp;ged=' . $tree->tree_name_url,
- 'menu-tree-' . $tree->tree_id // Cannot use name - it must be a CSS identifier
+ $tree->titleHtml(),
+ 'index.php?ctype=gedcom&amp;ged=' . $tree->nameUrl(),
+ 'menu-tree-' . $tree->id() // Cannot use name - it must be a CSS identifier
);
$submenus[] = $submenu;
}
diff --git a/library/WT/Tree.php b/library/WT/Tree.php
index 77a6974e1d..7907bbc9cf 100644
--- a/library/WT/Tree.php
+++ b/library/WT/Tree.php
@@ -25,13 +25,9 @@ use WT\User;
*/
class WT_Tree {
// Tree attributes
- public $tree_id; // The "gedcom ID" number
- public $tree_name; // The "gedcom name" text
- public $tree_name_url;
- public $tree_name_html;
- public $tree_title; // The "gedcom title" text
- public $tree_title_html;
- public $imported;
+ private $id; // The tree/gedcom ID number
+ private $name; // The tree/gedcom name
+ private $title; // The tree's title
/** @var WT_Tree[] All trees that we have permission to see. */
private static $trees;
@@ -46,18 +42,68 @@ class WT_Tree {
* Create a tree object. This is a private constructor - it can only
* be called from WT_Tree::getAll() to ensure proper initialisation.
*
- * @param $tree_id
- * @param $tree_name
- * @param $tree_title
- * @param $imported
+ * @param string $id
+ * @param string $tree_name
+ * @param string $tree_title
+ */
+ private function __construct($id, $tree_name, $tree_title) {
+ $this->id = $id;
+ $this->name = $tree_name;
+ $this->title = $tree_title;
+ }
+
+ /**
+ * The ID of this tree
+ *
+ * @return string
+ */
+ public function id() {
+ return $this->id;
+ }
+
+ /**
+ * The name of this tree
+ *
+ * @return string
+ */
+ public function name() {
+ return $this->name;
+ }
+
+ /**
+ * The name of this tree
+ *
+ * @return string
+ */
+ public function nameHtml() {
+ return WT_Filter::escapeHtml($this->name);
+ }
+
+ /**
+ * The name of this tree
+ *
+ * @return string
+ */
+ public function nameUrl() {
+ return WT_Filter::escapeUrl($this->name);
+ }
+
+ /**
+ * The title of this tree
+ *
+ * @return string
+ */
+ public function title() {
+ return $this->title;
+ }
+
+ /**
+ * The title of this tree, with HTML markup
+ *
+ * @return string
*/
- private function __construct($tree_id, $tree_name, $tree_title) {
- $this->tree_id = $tree_id;
- $this->tree_name = $tree_name;
- $this->tree_name_url = rawurlencode($tree_name);
- $this->tree_name_html = WT_Filter::escapeHtml($tree_name);
- $this->tree_title = $tree_title;
- $this->tree_title_html = '<span dir="auto">' . WT_Filter::escapeHtml($tree_title) . '</span>';
+ public function titleHtml() {
+ return WT_Filter::escapeHtml($this->title);
}
/**
@@ -72,7 +118,7 @@ class WT_Tree {
if ($this->preferences === null) {
$this->preferences = WT_DB::prepare(
"SELECT SQL_CACHE setting_name, setting_value FROM `##gedcom_setting` WHERE gedcom_id = ?"
- )->execute(array($this->tree_id))->fetchAssoc();
+ )->execute(array($this->id))->fetchAssoc();
}
if (array_key_exists($setting_name, $this->preferences)) {
@@ -97,7 +143,7 @@ class WT_Tree {
WT_DB::prepare(
"DELETE FROM `##gedcom_setting` WHERE gedcom_id = :tree_id AND setting_name = :setting_name"
)->execute(array(
- 'tree_id' => $this->tree_id,
+ 'tree_id' => $this->id,
'setting_name' => $setting_name,
));
} else {
@@ -105,7 +151,7 @@ class WT_Tree {
"REPLACE INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value)" .
" VALUES (:tree_id, :setting_name, LEFT(:setting_value, 255))"
)->execute(array(
- 'tree_id' => $this->tree_id,
+ 'tree_id' => $this->id,
'setting_name' => $setting_name,
'setting_value' => $setting_value,
));
@@ -134,7 +180,7 @@ class WT_Tree {
if (!array_key_exists($user->getUserId(), $this->user_preferences)) {
$this->user_preferences[$user->getUserId()] = WT_DB::prepare(
"SELECT SQL_CACHE setting_name, setting_value FROM `##user_gedcom_setting` WHERE user_id = ? AND gedcom_id = ?"
- )->execute(array($user->getUserId(), $this->tree_id))->fetchAssoc();
+ )->execute(array($user->getUserId(), $this->id))->fetchAssoc();
}
if (array_key_exists($setting_name, $this->user_preferences[$user->getUserId()])) {
@@ -160,7 +206,7 @@ class WT_Tree {
WT_DB::prepare(
"DELETE FROM `##user_gedcom_setting` WHERE gedcom_id = :tree_id AND user_id = :user_id AND setting_name = :setting_name"
)->execute(array(
- 'tree_id' => $this->tree_id,
+ 'tree_id' => $this->id,
'user_id' => $user->getUserId(),
'setting_name' => $setting_name,
));
@@ -169,7 +215,7 @@ class WT_Tree {
"REPLACE INTO `##user_gedcom_setting` (user_id, gedcom_id, setting_name, setting_value) VALUES (:user_id, :tree_id, :setting_name, LEFT(:setting_value, 255))"
)->execute(array(
'user_id' => $user->getUserId(),
- 'tree_id' => $this->tree_id,
+ 'tree_id' => $this->id,
'setting_name' => $setting_name,
'setting_value' => $setting_value
));
@@ -250,7 +296,7 @@ class WT_Tree {
public static function getIdList() {
$list = array();
foreach (self::getAll() as $tree) {
- $list[$tree->tree_id] = $tree->tree_title;
+ $list[$tree->id] = $tree->title;
}
return $list;
@@ -265,7 +311,7 @@ class WT_Tree {
public static function getNameList() {
$list = array();
foreach (self::getAll() as $tree) {
- $list[$tree->tree_name] = $tree->tree_title;
+ $list[$tree->name] = $tree->title;
}
return $list;
@@ -280,7 +326,7 @@ class WT_Tree {
*/
public static function getIdFromName($tree_name) {
foreach (self::getAll() as $tree_id => $tree) {
- if ($tree->tree_name == $tree_name) {
+ if ($tree->name == $tree_name) {
return $tree_id;
}
}
@@ -295,7 +341,7 @@ class WT_Tree {
* @return string
*/
public static function getNameFromId($tree_id) {
- return self::get($tree_id)->tree_name;
+ return self::get($tree_id)->name;
}
/**
@@ -468,7 +514,7 @@ class WT_Tree {
)->execute(array($tree_id));
// Update our cache
- self::$trees[$tree->tree_id] = $tree;
+ self::$trees[$tree->id] = $tree;
return $tree;
}
@@ -482,22 +528,22 @@ class WT_Tree {
* @param bool $keep_media
*/
public function deleteGenealogyData($keep_media) {
- WT_DB::prepare("DELETE FROM `##gedcom_chunk` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##individuals` WHERE i_file = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##families` WHERE f_file = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##sources` WHERE s_file = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##other` WHERE o_file = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##places` WHERE p_file = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##placelinks` WHERE pl_file = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##name` WHERE n_file = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##dates` WHERE d_file = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##change` WHERE gedcom_id = ?")->execute(array($this->tree_id));
+ WT_DB::prepare("DELETE FROM `##gedcom_chunk` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##individuals` WHERE i_file = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##families` WHERE f_file = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##sources` WHERE s_file = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##other` WHERE o_file = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##places` WHERE p_file = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##placelinks` WHERE pl_file = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##name` WHERE n_file = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##dates` WHERE d_file = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##change` WHERE gedcom_id = ?")->execute(array($this->id));
if ($keep_media) {
- WT_DB::prepare("DELETE FROM `##link` WHERE l_file =? AND l_type<>'OBJE'")->execute(array($this->tree_id));
+ WT_DB::prepare("DELETE FROM `##link` WHERE l_file =? AND l_type<>'OBJE'")->execute(array($this->id));
} else {
- WT_DB::prepare("DELETE FROM `##link` WHERE l_file =?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##media` WHERE m_file =?")->execute(array($this->tree_id));
+ WT_DB::prepare("DELETE FROM `##link` WHERE l_file =?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##media` WHERE m_file =?")->execute(array($this->id));
}
}
@@ -506,23 +552,23 @@ class WT_Tree {
*/
public function delete() {
// If this is the default tree, then unset it
- if (WT_Site::getPreference('DEFAULT_GEDCOM') === self::getNameFromId($this->tree_id)) {
+ if (WT_Site::getPreference('DEFAULT_GEDCOM') === self::getNameFromId($this->id)) {
WT_Site::setPreference('DEFAULT_GEDCOM', '');
}
$this->deleteGenealogyData(false);
- WT_DB::prepare("DELETE `##block_setting` FROM `##block_setting` JOIN `##block` USING (block_id) WHERE gedcom_id=?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##block` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##user_gedcom_setting` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##gedcom_setting` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##module_privacy` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##next_id` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##hit_counter` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##default_resn` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##gedcom_chunk` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##log` WHERE gedcom_id = ?")->execute(array($this->tree_id));
- WT_DB::prepare("DELETE FROM `##gedcom` WHERE gedcom_id = ?")->execute(array($this->tree_id));
+ WT_DB::prepare("DELETE `##block_setting` FROM `##block_setting` JOIN `##block` USING (block_id) WHERE gedcom_id=?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##block` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##user_gedcom_setting` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##gedcom_setting` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##module_privacy` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##next_id` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##hit_counter` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##default_resn` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##gedcom_chunk` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##log` WHERE gedcom_id = ?")->execute(array($this->id));
+ WT_DB::prepare("DELETE FROM `##gedcom` WHERE gedcom_id = ?")->execute(array($this->id));
// After updating the database, we need to fetch a new (sorted) copy
self::$trees = null;
@@ -546,7 +592,7 @@ class WT_Tree {
return false;
}
- $buffer = reformat_record_export(gedcom_header($this->tree_name));
+ $buffer = reformat_record_export(gedcom_header($this->name));
$stmt = WT_DB::prepare(
"SELECT i_gedcom AS gedcom FROM `##individuals` WHERE i_file = ?" .
@@ -558,7 +604,7 @@ class WT_Tree {
"SELECT o_gedcom AS gedcom FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" .
" UNION ALL " .
"SELECT m_gedcom AS gedcom FROM `##media` WHERE m_file = ?"
- )->execute(array($this->tree_id, $this->tree_id, $this->tree_id, $this->tree_id, $this->tree_id));
+ )->execute(array($this->id, $this->id, $this->id, $this->id, $this->id));
while ($row = $stmt->fetch()) {
$buffer .= reformat_record_export($row->gedcom);
@@ -612,13 +658,13 @@ class WT_Tree {
if ($pos) {
WT_DB::prepare(
"INSERT INTO `##gedcom_chunk` (gedcom_id, chunk_data) VALUES (?, ?)"
- )->execute(array($this->tree_id, substr($file_data, 0, $pos)));
+ )->execute(array($this->id, substr($file_data, 0, $pos)));
$file_data = substr($file_data, $pos);
}
}
WT_DB::prepare(
"INSERT INTO `##gedcom_chunk` (gedcom_id, chunk_data) VALUES (?, ?)"
- )->execute(array($this->tree_id, $file_data));
+ )->execute(array($this->id, $file_data));
WT_DB::commit();
fclose($fp);
diff --git a/library/WT/User.php b/library/WT/User.php
index 18fafd8ba6..782f24aa31 100644
--- a/library/WT/User.php
+++ b/library/WT/User.php
@@ -91,7 +91,7 @@ class User {
"SELECT SQL_CACHE user_id" .
" FROM `##user_gedcom_setting`" .
" WHERE gedcom_id = ? AND setting_name = 'gedcomid' AND setting_value = ?"
- )->execute(array($tree->tree_id, $individual->getXref()))->fetchOne();
+ )->execute(array($tree->id(), $individual->getXref()))->fetchOne();
return self::find($user_id);
}
diff --git a/login.php b/login.php
index f8c4135095..d116bc1344 100644
--- a/login.php
+++ b/login.php
@@ -312,7 +312,7 @@ case 'register':
$mail1_body =
WT_I18N::translate('Hello administrator…') . WT_Mail::EOL . WT_Mail::EOL .
/* I18N: %s is a server name/URL */
- WT_I18N::translate('A prospective user has registered with webtrees at %s.', WT_BASE_URL . ' ' . WT_Filter::escapeHtml($WT_TREE->tree_title)) . WT_Mail::EOL . WT_Mail::EOL .
+ WT_I18N::translate('A prospective user has registered with webtrees at %s.', WT_BASE_URL . ' ' . $WT_TREE->titleHtml()) . WT_Mail::EOL . WT_Mail::EOL .
WT_I18N::translate('Username') . ' ' . WT_Filter::escapeHtml($user->getUserName()) . WT_Mail::EOL .
WT_I18N::translate('Real name') . ' ' . WT_Filter::escapeHtml($user->getRealName()) . WT_Mail::EOL .
WT_I18N::translate('Email address:') . ' ' . WT_Filter::escapeHtml($user->getEmail()) . WT_Mail::EOL .
@@ -325,7 +325,7 @@ case 'register':
}
$mail1_body .= WT_Mail::auditFooter();
- $mail1_subject = /* I18N: %s is a server name/URL */ WT_I18N::translate('New registration at %s', WT_BASE_URL . ' ' . $WT_TREE->tree_title);
+ $mail1_subject = /* I18N: %s is a server name/URL */ WT_I18N::translate('New registration at %s', WT_BASE_URL . ' ' . $WT_TREE->$WT_TREE->title());
WT_I18N::init(WT_LOCALE);
echo '<div id="login-register-page">';
@@ -334,7 +334,7 @@ case 'register':
$mail2_body =
WT_I18N::translate('Hello %s…', $user->getRealName()) . WT_Mail::EOL . WT_Mail::EOL .
/* I18N: %1$s is the site URL and %2$s is an email address */
- WT_I18N::translate('You (or someone claiming to be you) has requested an account at %1$s using the email address %2$s.', WT_BASE_URL . ' ' . WT_Filter::escapeHtml($WT_TREE->tree_title), $user->getEmail()) . ' ' .
+ WT_I18N::translate('You (or someone claiming to be you) has requested an account at %1$s using the email address %2$s.', WT_BASE_URL . ' ' . $WT_TREE->titleHtml(), $user->getEmail()) . ' ' .
WT_I18N::translate('Information about the request is shown under the link below.') . WT_Mail::EOL .
WT_I18N::translate('Please click on the following link and fill in the requested data to confirm your request and email address.') . WT_Mail::EOL . WT_Mail::EOL .
'<a href="' . WT_LOGIN_URL . "?user_name=" . WT_Filter::escapeUrl($user->getUserName()) . "&amp;user_hashcode=" . $user->getPreference('reg_hashcode') . '&amp;action=userverify">' .
@@ -578,7 +578,7 @@ case 'verify_hash':
'</a>' .
WT_Mail::auditFooter();
- $mail1_subject = /* I18N: %s is a server name/URL */ WT_I18N::translate('New user at %s', WT_BASE_URL . ' ' . $WT_TREE->tree_title);
+ $mail1_subject = /* I18N: %s is a server name/URL */ WT_I18N::translate('New user at %s', WT_BASE_URL . ' ' . $WT_TREE->title());
// Change to the new user’s language
WT_I18N::init($user->getPreference('language'));
diff --git a/modules_v3/faq/module.php b/modules_v3/faq/module.php
index 3b21eab755..e98c56793b 100644
--- a/modules_v3/faq/module.php
+++ b/modules_v3/faq/module.php
@@ -398,7 +398,7 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
if ($faq->gedcom_id == null) {
echo WT_I18N::translate('All');
} else {
- echo $trees[$faq->gedcom_id]->tree_title_html;
+ echo $trees[$faq->gedcom_id]->titleHtml();
}
echo '</td>';
// NOTE: Print the edit options of the current item
diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php
index c8828bd58e..e5e25e231d 100644
--- a/modules_v3/googlemap/module.php
+++ b/modules_v3/googlemap/module.php
@@ -1619,7 +1619,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
case 'go':
//Identify gedcom file
$trees = WT_Tree::getAll();
- echo '<div id="gm_check_title">', $trees[$gedcom_id]->tree_title_html, '</div>';
+ echo '<div id="gm_check_title">', $trees[$gedcom_id]->titleHtml(), '</div>';
//Select all '2 PLAC ' tags in the file and create array
$place_list = array();
$ged_data = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?")
diff --git a/modules_v3/html/module.php b/modules_v3/html/module.php
index 07852d3329..173c664963 100644
--- a/modules_v3/html/module.php
+++ b/modules_v3/html/module.php
@@ -63,7 +63,7 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
$GEDCOM = WT_Site::getPreference('DEFAULT_GEDCOM');
if (!$GEDCOM) {
foreach (WT_Tree::getAll() as $tree) {
- $GEDCOM = $tree->tree_name;
+ $GEDCOM = $tree->name();
break;
}
}
@@ -288,8 +288,8 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
'<option value="__current__" ', $sel_current, '>', WT_I18N::translate('Current'), '</option>',
'<option value="__default__" ', $sel_default, '>', WT_I18N::translate('Default'), '</option>';
foreach (WT_Tree::getAll() as $tree) {
- if ($tree->tree_name == $gedcom) {$sel = 'selected'; } else {$sel = ''; }
- echo '<option value="', $tree->tree_name, '" ', $sel, ' dir="auto">', $tree->tree_title_html, '</option>';
+ if ($tree->name() === $gedcom) {$sel = 'selected'; } else {$sel = ''; }
+ echo '<option value="', $tree->nameHtml(), '" ', $sel, ' dir="auto">', $tree->titleHtml(), '</option>';
}
echo '</select>';
echo '</td></tr>';
diff --git a/modules_v3/sitemap/module.php b/modules_v3/sitemap/module.php
index 7e4d622d92..1b832b1616 100644
--- a/modules_v3/sitemap/module.php
+++ b/modules_v3/sitemap/module.php
@@ -79,40 +79,40 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config {
if ($tree->getPreference('include_in_sitemap')) {
$n = WT_DB::prepare(
"SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id"
- )->execute(array('tree_id' => $tree->tree_id))->fetchOne();
+ )->execute(array('tree_id' => $tree->id()))->fetchOne();
for ($i = 0; $i <= $n / self::RECORDS_PER_VOLUME; ++$i) {
- $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->tree_id . '-i-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
+ $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->id() . '-i-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
}
$n = WT_DB::prepare(
"SELECT COUNT(*) FROM `##sources` WHERE s_file = :tree_id"
- )->execute(array('tree_id' => $tree->tree_id))->fetchOne();
+ )->execute(array('tree_id' => $tree->id()))->fetchOne();
if ($n) {
for ($i = 0; $i <= $n / self::RECORDS_PER_VOLUME; ++$i) {
- $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->tree_id . '-s-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
+ $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->id() . '-s-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
}
}
$n = WT_DB::prepare(
"SELECT COUNT(*) FROM `##other` WHERE o_file = :tree_id AND o_type = 'REPO'"
- )->execute(array('tree_id' => $tree->tree_id))->fetchOne();
+ )->execute(array('tree_id' => $tree->id()))->fetchOne();
if ($n) {
for ($i = 0; $i <= $n / self::RECORDS_PER_VOLUME; ++$i) {
- $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->tree_id . '-r-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
+ $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->id() . '-r-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
}
}
$n = WT_DB::prepare(
"SELECT COUNT(*) FROM `##other` WHERE o_file = :tree_id AND o_type = 'NOTE'"
- )->execute(array('tree_id' => $tree->tree_id))->fetchOne();
+ )->execute(array('tree_id' => $tree->id()))->fetchOne();
if ($n) {
for ($i = 0; $i <= $n / self::RECORDS_PER_VOLUME; ++$i) {
- $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->tree_id . '-n-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
+ $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->id() . '-n-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
}
}
$n = WT_DB::prepare(
"SELECT COUNT(*) FROM `##media` WHERE m_file = :tree_id"
- )->execute(array('tree_id' => $tree->tree_id))->fetchOne();
+ )->execute(array('tree_id' => $tree->id()))->fetchOne();
if ($n) {
for ($i = 0; $i <= $n / self::RECORDS_PER_VOLUME; ++$i) {
- $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->tree_id . '-m-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
+ $data .= '<sitemap><loc>' . WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap-' . $tree->id() . '-m-' . $i . '.xml</loc>' . $lastmod . '</sitemap>' . PHP_EOL;
}
}
}
@@ -142,7 +142,7 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config {
$data = $this->getSetting('sitemap-' . $ged_id . '-' . $rec_type . '-' . $volume . '.xml');
} else {
$tree = WT_Tree::get($ged_id);
- $data = '<url><loc>' . WT_BASE_URL . 'index.php?ctype=gedcom&amp;ged=' . $tree->tree_name_url . '</loc></url>' . PHP_EOL;
+ $data = '<url><loc>' . WT_BASE_URL . 'index.php?ctype=gedcom&amp;ged=' . $tree->nameUrl() . '</loc></url>' . PHP_EOL;
$records = array();
switch ($rec_type) {
case 'i':
@@ -266,7 +266,7 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config {
// Save the updated preferences
if (WT_Filter::post('action') == 'save') {
foreach (WT_Tree::getAll() as $tree) {
- $tree->setPreference('include_in_sitemap', WT_Filter::postBool('include' . $tree->tree_id));
+ $tree->setPreference('include_in_sitemap', WT_Filter::postBool('include' . $tree->id()));
}
// Clear cache and force files to be regenerated
WT_DB::prepare(
@@ -294,12 +294,12 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config {
'<form method="post" action="module.php?mod=' . $this->getName() . '&amp;mod_action=admin">',
'<input type="hidden" name="action" value="save">';
foreach (WT_Tree::getAll() as $tree) {
- echo '<p><input type="checkbox" name="include', $tree->tree_id, '" ';
+ echo '<p><input type="checkbox" name="include', $tree->id(), '" ';
if ($tree->getPreference('include_in_sitemap')) {
echo 'checked';
$include_any = true;
}
- echo '>', $tree->tree_title_html, '</p>';
+ echo '>', $tree->titleHtml(), '</p>';
}
echo
'<input type="submit" value="', WT_I18N::translate('save'), '">',
diff --git a/search.php b/search.php
index 5e50cd5ee0..f1911ad061 100644
--- a/search.php
+++ b/search.php
@@ -201,11 +201,11 @@ echo '<div id="search-page">
<div id="search_trees" class="value">';
//-- sorting menu by gedcom filename
foreach (WT_Tree::getAll() as $tree) {
- $str = str_replace(array(".", "-", " "), array("_", "_", "_"), $tree->tree_name);
+ $str = str_replace(array(".", "-", " "), array("_", "_", "_"), $tree->name);
$controller->inputFieldNames[] = "$str";
echo '<p><input type="checkbox" ';
echo isset ($_REQUEST[$str]) ? 'checked' : '';
- echo ' value="yes" id="checkbox_', $tree->tree_id, '" name="', $str, '"><label for="checkbox_', $tree->tree_id, '">', $tree->tree_title_html, '</label></p>', "\n";
+ echo ' value="yes" id="checkbox_', $tree->id(), '" name="', $str, '"><label for="checkbox_', $tree->id(), '">', $tree->titleHtml(), '</label></p>', "\n";
}
echo '</div>';
}