* Copyright (C) 2015 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Fisharebest\Webtrees;
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsDb;
use Fisharebest\Webtrees\Functions\FunctionsPrintLists;
define('WT_SCRIPT_NAME', 'sourcelist.php');
require './includes/session.php';
$controller = new PageController();
$controller->setPageTitle(I18N::translate('Sources'));
$controller->pageHeader();
echo '<div id="sourcelist-page">', '<h2>', I18N::translate('Sources'), '</h2>';
echo FunctionsPrintLists::sourceTable(FunctionsDb::getSourceList($WT_TREE));
echo '</div>';
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Fisharebest\Webtrees;
use Fisharebest\Webtrees\Controller\PageController;
define('WT_SCRIPT_NAME', 'admin_site_info.php');
require './includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Server information'))->pageHeader();
$variables = Database::prepare("SHOW VARIABLES")->fetchAssoc();
array_walk($variables, function (&$x) {
$x = str_replace(',', ', ', $x);
});
ob_start();
phpinfo(INFO_ALL & ~INFO_CREDITS & ~INFO_LICENSE);
preg_match('%<body>(.*)</body>%s', ob_get_clean(), $matches);
$html = $matches[1];
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Fisharebest\Webtrees;
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsPrintLists;
use Fisharebest\Webtrees\Query\QueryName;
define('WT_SCRIPT_NAME', 'indilist.php');
require './includes/session.php';
$controller = new PageController();
// We show three different lists: initials, surnames and individuals
// Note that the data may contain special chars, such as surname="<unknown>",
$alpha = Filter::get('alpha');
// All surnames beginning with this letter where "@"=unknown and ","=none
$surname = Filter::get('surname');
// All indis with this surname
$show_all = Filter::get('show_all', 'no|yes', 'no');
// All indis
// Long lists can be broken down by given name
$show_all_firstnames = Filter::get('show_all_firstnames', 'no|yes', 'no');
if ($show_all_firstnames === 'yes') {
$falpha = '';
} else {
$falpha = Filter::get('falpha');
// All first names beginning with this letter
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Fisharebest\Webtrees;
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
define('WT_SCRIPT_NAME', 'admin_trees_manage.php');
require './includes/session.php';
$controller = new PageController();
$controller->addExternalJavascript(WT_ADMIN_JS_URL)->restrictAccess(Auth::isAdmin() || Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Manage family trees'));
// Show a reduced page when there are more than a certain number of trees
$multiple_tree_threshold = Site::getPreference('MULTIPLE_TREE_THRESHOLD') ?: 500;
// Note that glob() returns false instead of an empty array when open_basedir_restriction
// is in force and no files are found. See PHP bug #47358.
if (defined('GLOB_BRACE')) {
$gedcom_files = glob(WT_DATA_DIR . '*.{ged,Ged,GED}', GLOB_NOSORT | GLOB_BRACE) ?: array();
} else {
$gedcom_files = array_merge(glob(WT_DATA_DIR . '*.ged', GLOB_NOSORT) ?: array(), glob(WT_DATA_DIR . '*.Ged', GLOB_NOSORT) ?: array(), glob(WT_DATA_DIR . '*.GED', GLOB_NOSORT) ?: array());
}
// Process POST actions
switch (Filter::post('action')) {
case 'delete':
$gedcom_id = Filter::postInteger('gedcom_id');
if (Filter::checkCsrf() && $gedcom_id) {
break;
case 'delete':
// An administrator can only be deleted by another administrator
if (!Auth::user()->getPreference('canadmin')) {
// Keep a reference to the currently logged in user because after logging out this user,
// a call to Auth::user() will not return this user anymore
$currentUser = Auth::user();
Auth::logout();
$currentUser->delete();
}
break;
}
header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
return;
}
$controller = new PageController();
$controller->setPageTitle(I18N::translate('My account'))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
$my_individual_record = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE);
$default_individual = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'rootid'), $WT_TREE);
// Form validation
?>
<script>
function checkform(frm) {
if (frm.form_username.value=="") {
alert("<?php
echo I18N::translate('You must enter a user name.');
?>
");
frm.form_username.focus();
return false;
}
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Fisharebest\Webtrees;
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
define('WT_SCRIPT_NAME', 'admin_trees_renumber.php');
require './includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Renumber family tree') . ' — ' . $WT_TREE->getTitleHtml())->pageHeader();
// Every XREF used by this tree and also used by some other tree
$xrefs = Database::prepare("SELECT xref, type FROM (" . " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . " UNION " . " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . " UNION " . " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . " UNION " . " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . " UNION " . " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS this_tree JOIN (" . " SELECT xref FROM `##change` WHERE gedcom_id <> ?" . " UNION " . " SELECT i_id AS xref FROM `##individuals` WHERE i_file <> ?" . " UNION " . " SELECT f_id AS xref FROM `##families` WHERE f_file <> ?" . " UNION " . " SELECT s_id AS xref FROM `##sources` WHERE s_file <> ?" . " UNION " . " SELECT m_id AS xref FROM `##media` WHERE m_file <> ?" . " UNION " . " SELECT o_id AS xref FROM `##other` WHERE o_file <> ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS other_trees USING (xref)")->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchAssoc();
echo '<h1>', $controller->getPageTitle(), '</h1>';
if (Filter::get('action') === 'renumber') {
foreach ($xrefs as $old_xref => $type) {
Database::beginTransaction();
Database::exec("LOCK TABLE `##individuals` WRITE," . " `##families` WRITE," . " `##sources` WRITE," . " `##media` WRITE," . " `##other` WRITE," . " `##name` WRITE," . " `##placelinks` WRITE," . " `##change` WRITE," . " `##next_id` WRITE," . " `##dates` WRITE," . " `##default_resn` WRITE," . " `##hit_counter` WRITE," . " `##link` WRITE," . " `##user_gedcom_setting` WRITE");
$new_xref = $WT_TREE->getNewXref($type);
switch ($type) {
case 'INDI':
Database::prepare("UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?")->execute(array($new_xref, "0 @{$old_xref}@ INDI\n", "0 @{$new_xref}@ INDI\n", $old_xref, $WT_TREE->getTreeId()));
Database::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " HUSB @{$old_xref}@", " HUSB @{$new_xref}@", $WT_TREE->getTreeId()));
Database::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " WIFE @{$old_xref}@", " WIFE @{$new_xref}@", $WT_TREE->getTreeId()));
Database::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " CHIL @{$old_xref}@", " CHIL @{$new_xref}@", $WT_TREE->getTreeId()));
请发表评论