// it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'index_edit.php'); require './includes/session.php'; $controller = new WT_Controller_Ajax(); // Only one of $user_id and $gedcom_id should be set $user_id = WT_Filter::get('user_id', WT_REGEX_INTEGER, WT_Filter::post('user_id', WT_REGEX_INTEGER)); if ($user_id) { $gedcom_id = null; } else { $gedcom_id = WT_Filter::get('gedcom_id', WT_REGEX_INTEGER, WT_Filter::post('gedcom_id', WT_REGEX_INTEGER)); } // Only an admin can edit the "default" page // Only managers can edit the "home page" // Only a user or an admin can edit a user’s "my page" if ($gedcom_id < 0 && !Auth::isAdmin() || $gedcom_id > 0 && !Auth::isManager(WT_Tree::get($gedcom_id)) || $user_id && Auth::id() != $user_id && !Auth::isAdmin()) { $controller->pageHeader(); $controller->addInlineJavascript('window.location.reload();'); exit; }
$media_paths = media_paths($media_folder); $media_path = WT_Filter::get('media_path', null, ''); // MySQL needs an empty string, not NULL // User paths may contain special characters. Restrict to actual paths. if (!array_key_exists($media_path, $media_paths)) { $media_path = reset($media_paths); } // subfolders within $media_path $subfolders = WT_Filter::get('subfolders', 'include|exclude', 'include'); $action = WT_Filter::get('action'); //////////////////////////////////////////////////////////////////////////////// // POST callback for file deletion //////////////////////////////////////////////////////////////////////////////// $delete_file = WT_Filter::post('delete'); if ($delete_file) { $controller = new WT_Controller_Ajax(); // Only delete valid (i.e. unused) media files $media_folder = WT_Filter::post('media_folder', null, ''); // MySQL needs an empty string, not NULL $disk_files = all_disk_files($media_folder, '', 'include', ''); if (in_array($delete_file, $disk_files)) { $tmp = WT_DATA_DIR . $media_folder . $delete_file; if (@unlink($tmp)) { WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was deleted.', $tmp)); } else { WT_FlashMessages::addMessage(WT_I18N::translate('The file %s could not be deleted.', $tmp)); } $tmp = WT_DATA_DIR . $media_folder . 'thumbs/' . $delete_file; if (file_exists($tmp)) { if (@unlink($tmp)) { WT_FlashMessages::addMessage(WT_I18N::translate('The file %s was deleted.', $tmp));
// 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 define('WT_SCRIPT_NAME', 'import.php'); require './includes/session.php'; require_once WT_ROOT . 'includes/functions/functions_import.php'; if (!WT_USER_GEDCOM_ADMIN) { header('HTTP/1.1 403 Access Denied'); exit; } $controller = new WT_Controller_Ajax(); $controller->pageHeader(); // Don't use ged=XX as we want to be able to run without changing the current gedcom. // This will let us load several gedcoms together, or to edit one while loading another. $gedcom_id = WT_Filter::getInteger('gedcom_id'); // Don't allow the user to cancel the request. We do not want to be left // with an incomplete transaction. ignore_user_abort(true); // Run in a transaction WT_DB::exec("START TRANSACTION"); // Only allow one process to import each gedcom at a time WT_DB::prepare("SELECT * FROM `##gedcom_chunk` WHERE gedcom_id=? FOR UPDATE")->execute(array($gedcom_id)); // What is the current import status? $row = WT_DB::prepare("SELECT" . " SUM(IF(imported, LENGTH(chunk_data), 0)) AS import_offset," . " SUM(LENGTH(chunk_data)) AS import_total" . " FROM `##gedcom_chunk` WHERE gedcom_id=?")->execute(array($gedcom_id))->fetchOneRow(); if ($row->import_offset == $row->import_total) { set_gedcom_setting($gedcom_id, 'imported', true);
// webtrees: Web based Family History software // Copyright (C) 2014 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 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'admin_trees_export.php'); require './includes/session.php'; $controller = new WT_Controller_Ajax(); $controller->pageHeader()->restrictAccess(Auth::isManager()); $filename = WT_DATA_DIR . $WT_TREE->tree_name; // Force a ".ged" suffix if (strtolower(substr($filename, -4)) != '.ged') { $filename .= '.ged'; } if ($WT_TREE->exportGedcom($filename)) { echo '<p>', WT_I18N::translate('Family tree exported to %s.', '<span dir="ltr">' . $filename . '</span>'), '</p>'; } else { echo '<p class="error">', WT_I18N::translate('Unable to create %s. Check the permissions.', $filename), '</p>'; }
beforeLoad: function(event, ui) { jQuery("#loading-indicator").addClass("loading-image"); // Only load each tab once if (ui.tab.data("loaded")) { event.preventDefault(); return; } ui.jqXHR.success(function() { ui.tab.data("loaded", true); }); } }); ')->pageHeader(); echo '<div id="statistics-page"><h2>', WT_I18N::translate('Statistics'), '</h2>', '<div id="statistics_chart">', '<ul>', '<li><a href="statistics.php?ged=', WT_GEDURL, '&ajax=1&tab=0">', '<span id="stats-indi">', WT_I18N::translate('Individuals'), '</span></a></li>', '<li><a href="statistics.php?ged=', WT_GEDURL, '&ajax=1&tab=1">', '<span id="stats-fam">', WT_I18N::translate('Families'), '</span></a></li>', '<li><a href="statistics.php?ged=', WT_GEDURL, '&ajax=1&tab=2">', '<span id="stats-other">', WT_I18N::translate('Others'), '</span></a></li>', '<li><a href="statistics.php?ged=', WT_GEDURL, '&ajax=1&tab=3">', '<span id="stats-own">', WT_I18N::translate('Own charts'), '</span></a></li>', '</ul>', '<div id="loading-indicator" style="margin:auto;width:100%;"></div>', '</div>', '</div>', '<br><br>'; } else { $controller = new WT_Controller_Ajax(); $controller->pageHeader()->addInlineJavascript('autocomplete();')->addInlineJavascript('jQuery("#loading-indicator").removeClass("loading-image");'); $stats = new WT_Stats($GEDCOM); if ($tab == 0) { echo '<fieldset> <legend>', WT_I18N::translate('Total individuals: %s', $stats->totalIndividuals()), '</legend> <table class="facts_table"> <tr> <td class="facts_label">', WT_I18N::translate('Total males'), '</td> <td class="facts_label">', WT_I18N::translate('Total females'), '</td> <td class="facts_label">', WT_I18N::translate('Total living'), '</td> <td class="facts_label">', WT_I18N::translate('Total dead'), '</td> </tr> <tr> <td class="facts_value" align="center">', $stats->totalSexMales(), '</td> <td class="facts_value" align="center">', $stats->totalSexFemales(), '</td>
// 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', 'block_edit.php'); require './includes/session.php'; $block_id = WT_Filter::getInteger('block_id'); $block = WT_DB::prepare("SELECT SQL_CACHE * FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOneRow(); // Check access. (1) the block must exist, (2) gedcom blocks require // managers, (3) user blocks require the user or an admin if (!$block || $block->gedcom_id && !Auth::isManager(WT_Tree::get($block->gedcom_id)) || $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()) { exit; } $class_name = $block->module_name . '_WT_Module'; $block = new $class_name(); $controller = new WT_Controller_Ajax(); $controller->pageHeader(); if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { ckeditor_WT_Module::enableEditor($controller); } ?> <form name="block" method="post" action="block_edit.php?block_id=<?php echo $block_id; ?> " onsubmit="return modalDialogSubmitAjax(this);" > <input type="hidden" name="save" value="1"> <?php echo WT_Filter::getCsrf(); ?> <p> <?php