}
// Vars
$ajaxdeleted = false;
$locked_by_context = array('index.php', 'config.ini.php');
// If we are storing the media in the data folder (this is the
// defaultl), then don’t delete it.
// Need to consider the settings for all gedcoms
foreach (WT_Tree::getAll() as $tree) {
    $MEDIA_DIRECTORY = $tree->preference('MEDIA_DIRECTORY');
    if (substr($MEDIA_DIRECTORY, 0, 3) != '../') {
        // Just need to add the first part of the path
        $tmp = explode('/', $MEDIA_DIRECTORY);
        $locked_by_context[] = $tmp[0];
    }
}
echo '<h3>', $controller->getPageTitle(), '</h3>', '<p>', WT_I18N::translate('Files marked with %s are required for proper operation and cannot be removed.', '<i class="icon-resn-confidential"></i>'), '</p>';
//post back
if (isset($_REQUEST['to_delete'])) {
    echo '<div class="error">', WT_I18N::translate('Deleted files:'), '</div>';
    foreach ($_REQUEST['to_delete'] as $k => $v) {
        if (is_dir(WT_DATA_DIR . $v)) {
            full_rmdir(WT_DATA_DIR . $v);
        } elseif (file_exists(WT_DATA_DIR . $v)) {
            unlink(WT_DATA_DIR . $v);
        }
        echo '<div class="error">', $v, '</div>';
    }
}
echo '<form name="delete_form" method="post" action="?">';
echo '<div id="cleanup"><ul>';
$dir = dir(WT_DATA_DIR);
Exemple #2
0
                echo '<div class="confirm"><p>', WT_I18N::translate('Hello %s…<br>Thank you for your registration.', $user->getRealName()), '</p><p>';
                if ($REQUIRE_ADMIN_AUTH_REGISTRATION) {
                    echo WT_I18N::translate('We will now send a confirmation email to the address <b>%s</b>. You must verify your account request by following instructions in the confirmation email. If you do not confirm your account request within seven days, your application will be rejected automatically.  You will have to apply again.<br><br>After you have followed the instructions in the confirmation email, the administrator still has to approve your request before your account can be used.<br><br>To login to this site, you will need to know your user name and password.', $user->getEmail());
                } else {
                    echo WT_I18N::translate('We will now send a confirmation email to the address <b>%s</b>. You must verify your account request by following instructions in the confirmation email. If you do not confirm your account request within seven days, your application will be rejected automatically.  You will have to apply again.<br><br>After you have followed the instructions in the confirmation email, you can login.  To login to this site, you will need to know your user name and password.', $user->getEmail());
                }
                echo '</p>
			</div>';
                echo '</div>';
                exit;
            }
        }
        $WT_SESSION->good_to_send = true;
        $controller->pageHeader()->addInlineJavascript('function regex_quote(str) {return str.replace(/[\\\\.?+*()[\\](){}|]/g, "\\\\$&");}');
        echo '<div id="login-register-page">
		<h2>', $controller->getPageTitle(), '</h2>';
        if (WT_Site::preference('SHOW_REGISTER_CAUTION')) {
            echo '<div id="register-text">';
            echo WT_I18N::translate('<div class="largeError">Notice:</div><div class="error">By completing and submitting this form, you agree:<ul><li>to protect the privacy of living individuals listed on our site;</li><li>and in the text box below, to explain to whom you are related, or to provide us with information on someone who should be listed on our site.</li></ul></div>');
            echo '</div>';
        }
        echo '<div id="register-box">
			<form id="register-form" name="register-form" method="post" action="' . WT_LOGIN_URL . '" onsubmit="return checkform(this);" autocomplete="off">
			<input type="hidden" name="action" value="register">
			<h4>', WT_I18N::translate('All fields must be completed.'), '</h4><hr>
			<div>
				<label for="user_realname">', WT_I18N::translate('Real name'), help_link('real_name'), '<input type="text" id="user_realname" name="user_realname" required maxlength="64" value="', WT_Filter::escapeHtml($user_realname), '" autofocus>
				</label>
			</div>
			<div>
				<label for="user_email">', WT_I18N::translate('Email address'), help_link('email'), '<input type="email" id="user_email" name="user_email" required maxlength="64" value="', WT_Filter::escapeHtml($user_email), '">
    Zend_Session::writeClose();
    header('Content-Type: text/plain; charset=UTF-8');
    // We could open "php://compress.zlib" to create a .gz file or "php://compress.bzip2" to create a .bz2 file
    $gedout = fopen('php://output', 'w');
    if (strtolower(substr($fileName, -4, 4)) != '.ged') {
        $fileName .= '.ged';
    }
    header('Content-Disposition: attachment; filename="' . $fileName . '"');
    export_gedcom(WT_GEDCOM, $gedout, $exportOptions);
    fclose($gedout);
    exit;
}
$controller->pageHeader();
?>
<h2><?php 
echo $controller->getPageTitle();
?>
 - <?php 
echo WT_Filter::escapeHtml(WT_GEDCOM);
?>
</h2>
<form name="convertform" method="get">
	<input type="hidden" name="action" value="download">
	<input type="hidden" name="ged" value="<?php 
echo WT_GEDCOM;
?>
">
	<div id="tree-download" class="ui-helper-clearfix">
		<dl>
			<dt>
				<?php 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
define('WT_SCRIPT_NAME', 'admin_trees_renumber.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Renumber family tree'))->pageHeader();
// Every XREF used by this tree and also used by some other tree
$xrefs = WT_DB::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_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID))->fetchAssoc();
echo '<h2>', $controller->getPageTitle(), ' — ', $WT_TREE->tree_title_html, '</h2>';
if (WT_Filter::get('go')) {
    foreach ($xrefs as $old_xref => $type) {
        WT_DB::exec("START TRANSACTION");
        WT_DB::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 = get_new_xref($type);
        switch ($type) {
            case 'INDI':
                WT_DB::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_GED_ID));
                WT_DB::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_GED_ID));
                WT_DB::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_GED_ID));
                WT_DB::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_GED_ID));
                WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " ASSO @{$old_xref}@", " ASSO @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = '_ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " _ASSO @{$old_xref}@", " _ASSO @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?")->execute(array($old_xref, " ASSO @{$old_xref}@", " ASSO @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = '_ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?")->execute(array($old_xref, " _ASSO @{$old_xref}@", " _ASSO @{$new_xref}@", WT_GED_ID));
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
define('WT_SCRIPT_NAME', 'admin_trees_check.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Check for errors'))->pageHeader();
echo '<form method="get" action="', WT_SCRIPT_NAME, '">';
echo '<input type="hidden" name="go" value="1">';
echo select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM);
echo '<input type="submit" value="', $controller->getPageTitle(), '">';
echo '</form>';
if (!WT_Filter::get('go')) {
    exit;
}
// We need to work with raw GEDCOM data, as we are looking for errors
// which may prevent the WT_GedcomRecord objects from working...
$rows = WT_DB::prepare("SELECT i_id AS xref, 'INDI' AS type, i_gedcom AS gedrec FROM `##individuals` WHERE i_file=?" . " UNION " . "SELECT f_id AS xref, 'FAM'  AS type, f_gedcom AS gedrec FROM `##families`    WHERE f_file=?" . " UNION " . "SELECT s_id AS xref, 'SOUR' AS type, s_gedcom AS gedrec FROM `##sources`     WHERE s_file=?" . " UNION " . "SELECT m_id AS xref, 'OBJE' AS type, m_gedcom AS gedrec FROM `##media`       WHERE m_file=?" . " UNION " . "SELECT o_id AS xref, o_type AS type, o_gedcom AS gedrec FROM `##other`       WHERE o_file=? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array(WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID))->fetchAll();
$records = array();
foreach ($rows as $row) {
    $records[$row->xref] = $row;
}
// Need to merge pending new/changed/deleted records
$rows = WT_DB::prepare(" SELECT xref, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(CASE WHEN old_gedcom='' THEN new_gedcom ELSE old_gedcom END, '\n', 1), ' ', 3), ' ', -1) AS type, new_gedcom AS gedrec" . " FROM (" . "  SELECT MAX(change_id) AS change_id" . "  FROM `##change`" . "  WHERE gedcom_id=? AND status='pending'" . "  GROUP BY xref" . " ) AS t1" . " JOIN `##change` t2 USING (change_id)")->execute(array(WT_GED_ID))->fetchAll();
foreach ($rows as $row) {
    if ($row->gedrec) {