/** * SosaStats@index */ public function index() { global $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Sosa Statistics'))->addInlineJavascript('$(".help_tooltip").tooltip();'); $view_bag = new ViewBag(); $view_bag->set('title', $controller->getPageTitle()); $view_bag->set('is_setup', false); if ($this->sosa_provider->isSetup()) { $view_bag->set('is_setup', true); $view_bag->set('root_indi', $this->sosa_provider->getRootIndi()); $sosaCount = $this->sosa_provider->getSosaCount(); $diffSosaCount = $this->sosa_provider->getDifferentSosaCount(); $general_stats = array('sosa_count' => $sosaCount, 'distinct_count' => $diffSosaCount, 'sosa_rate' => Functions::safeDivision($diffSosaCount, $this->sosa_provider->getTotalIndividuals()), 'pedi_collapse' => 1 - Functions::safeDivision($diffSosaCount, $sosaCount), 'mean_gen_time' => $this->sosa_provider->getMeanGenerationTime()); $view_bag->set('general_stats', $general_stats); $stats_gen = $this->sosa_provider->getStatisticsByGeneration(); $view_bag->set('missinganc_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=SosaList@missing&ged=' . $WT_TREE->getNameUrl() . '&gen='); $view_bag->set('sosaanc_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=SosaList&ged=' . $WT_TREE->getNameUrl() . '&gen='); $gen_theoretical = 1; $total_theoretical = 0; $prev_diff = 0; $prev_known = 0.5; $gen_equiv = 0; $generation_stats = array(); foreach ($stats_gen as $gen => $tab) { $genY1 = I18N::translate('-'); $genY2 = I18N::translate('-'); if ($tab['firstBirth'] > 0) { $genY1 = $tab['firstBirth']; } if ($tab['lastBirth'] > 0) { $genY2 = $tab['lastBirth']; } $total_theoretical += $gen_theoretical; $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); $gen_equiv += $perc_sosa_count_theor; $missing = 2 * $prev_known - $tab['sosaCount']; $gen_diff = $tab['diffSosaTotalCount'] - $prev_diff; $generation_stats[$gen] = array('gen_min_birth' => $genY1, 'gen_max_birth' => $genY2, 'theoretical' => $gen_theoretical, 'known' => $tab['sosaCount'], 'perc_known' => $perc_sosa_count_theor, 'missing' => $missing, 'perc_missing' => 1 - Functions::safeDivision($tab['sosaCount'], 2 * $prev_known), 'total_known' => $tab['sosaTotalCount'], 'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical), 'different' => $gen_diff, 'perc_different' => Functions::safeDivision($gen_diff, $tab['sosaCount']), 'total_different' => $tab['diffSosaTotalCount'], 'pedi_collapse' => 1 - Functions::safeDivision($tab['diffSosaTotalCount'], $tab['sosaTotalCount'])); $gen_theoretical = $gen_theoretical * 2; $prev_known = $tab['sosaCount']; $prev_diff = $tab['diffSosaTotalCount']; } $view_bag->set('generation_stats', $generation_stats); $view_bag->set('equivalent_gen', $gen_equiv); $view_bag->set('chart_img_g2', $this->htmlAncestorDispersionG2()); $view_bag->set('chart_img_g3', $this->htmlAncestorDispersionG3()); } ViewFactory::make('SosaStats', $this, $controller, $view_bag)->render(); }
/** * SosaConfig@index */ public function index() { global $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Sosa Configuration'))->restrictAccess(Auth::check())->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->addInlineJavascript(' $( document ).ready(function() { $("#bt_sosa_compute").click(function() { majComputeSosa($("#maj_sosa_input_userid, #maj-sosa-config-select option:selected").val()); }); }); function majComputeSosa(user_id) { jQuery("#bt_sosa_compute").prop( "disabled", true ); jQuery("#bt_sosa_computing").empty().html("<i class=\\"icon-loading-small\\"></i> ' . I18N::translate('Computing...') . '"); jQuery("#bt_sosa_computing").load( "module.php?mod=' . $this->module->getName() . '&mod_action=SosaConfig@computeAll&ged=' . $WT_TREE->getNameUrl() . '&userid=" + user_id, function() { jQuery("#bt_sosa_compute").prop( "disabled", false ); }); }'); $action = Filter::post('action'); if ($action === 'update') { $this->update($controller); } $view_bag = new ViewBag(); $view_bag->set('title', $controller->getPageTitle()); $view_bag->set('tree', $WT_TREE); $view_bag->set('form_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=SosaConfig&ged=' . $WT_TREE->getNameUrl()); $users_root = array(); $users_js_array = 'var users_array = [];'; if (Auth::check()) { $root_id = $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID'); $users_root[] = array('user' => Auth::user(), 'rootid' => $root_id); $users_js_array .= 'users_array["' . Auth::user()->getUserId() . '"] = "' . $root_id . '";'; if (Auth::isManager($WT_TREE)) { $default_user = User::find(-1); $default_root_id = $WT_TREE->getUserPreference($default_user, 'MAJ_SOSA_ROOT_ID'); $users_root[] = array('user' => $default_user, 'rootid' => $default_root_id); $users_js_array .= 'users_array["' . $default_user->getUserId() . '"] = "' . $default_root_id . '";'; } } $view_bag->set('users_settings', $users_root); $controller->addInlineJavascript($users_js_array . ' $("#maj-sosa-config-select").change(function() { $("#rootid").val(users_array[this.value]); }); '); ViewFactory::make('SosaConfig', $this, $controller, $view_bag)->render(); }
/** * AdminConfig@index */ public function index() { global $WT_TREE; $action = Filter::post('action'); if ($action == 'update' && Filter::checkCsrf()) { $this->update(); } Theme::theme(new AdministrationTheme())->init($WT_TREE); $ctrl = new PageController(); $ctrl->restrictAccess(Auth::isAdmin())->setPageTitle($this->module->getTitle()); $view_bag = new ViewBag(); $view_bag->set('title', $ctrl->getPageTitle()); $view_bag->set('module', $this->module); ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); }
private function pageBody(PageController $controller) { ?> <!-- ADMIN PAGE CONTENT --> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol> <h2><?php echo $controller->getPageTitle(); ?> </h2> <form class="form-inline" method="post"> <?php echo Filter::getCsrf(); ?> <input type="hidden" name="save" value="1"> <!-- SHOW PDF --> <div class="form-group"> <label class="control-label"> <?php echo I18N::translate('Access level'); ?> </label> <?php echo FunctionsEdit::editFieldAccessLevel('NEW_FTV_PDF_ACCESS_LEVEL', $this->getSetting('FTV_PDF_ACCESS_LEVEL'), 'class="form-control"'); ?> </div> <!-- BUTTONS --> <button class="btn btn-primary" type="submit"> <i class="fa fa-check"></i> <?php echo I18N::translate('save'); ?> </button> </form> <?php }
/** * Translation@status */ public function status() { global $WT_TREE; $table_id = \Rhumsaa\Uuid\Uuid::uuid4(); Theme::theme(new AdministrationTheme())->init($WT_TREE); $ctrl = new PageController(); $ctrl->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Translations status'))->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addInlineJavascript(' //Datatable initialisation jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; jQuery("#table_missing_' . $table_id . '").DataTable({ ' . I18N::datatablesI18N() . ', sorting: [[0, "asc"]], pageLength: 15, columns: [ /* 0 Message */ null, /* 1 Reference */ null ], }); jQuery("#table_nonused_' . $table_id . '").DataTable({ ' . I18N::datatablesI18N() . ', sorting: [[0, "asc"]], pageLength: 15, columns: [ /* 0 Message */ null, /* 1 Reference */ null ], }); '); $source_code_paths = array(WT_ROOT . 'vendor/jon48/webtrees-lib/src', WT_ROOT . 'vendor/jon48/webtrees-tools/src/app'); $analyzer = new TranslationsAnalyzer($source_code_paths); $analyzer->load(); $locale = $analyzer->getLocale(); $view_bag = new ViewBag(); $view_bag->set('table_id', $table_id); $view_bag->set('module', $this->module); $view_bag->set('source_code_paths', $source_code_paths); $view_bag->set('title', $ctrl->getPageTitle() . ' - ' . I18N::languageName($locale->languageTag())); $view_bag->set('missing_translations', $analyzer->getMissingTranslations()); $view_bag->set('non_used_translations', $analyzer->getMajNonUsedTranslations()); $view_bag->set('loading_stats', $analyzer->getLoadingStatistics()); ViewFactory::make('TranslationStatus', $this, $ctrl, $view_bag)->render(); }
/** * Get significant information from this page, to allow other pages such as * charts and reports to initialise with the same records * * @return Individual */ public function getSignificantIndividual() { if ($this->root) { return $this->root; } else { return parent::getSignificantIndividual(); } }
/** * WelcomeBlock@index * * @param PageController $parent_controller * @param Tree $tree * @param string $block_id * @param string $template * @return $string */ public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { $view_bag = new ViewBag(); if ($parent_controller && $tree) { $view_bag->set('tree', $tree); $view_bag->set('indi', $parent_controller->getSignificantIndividual()); $id = $this->module->getName() . $block_id; $class = $this->module->getName() . '_block'; $parent_controller->addInlineJavascript(' jQuery("#maj-new_passwd").hide(); jQuery("#maj-passwd_click").click(function() { jQuery("#maj-new_passwd").slideToggle(100, function() { jQuery("#maj-new_passwd_username").focus(); }); return false; }); '); if (Auth::isAdmin()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; } else { $title = ''; } $title .= '<span dir="auto">' . $tree->getTitleHtml() . '</span>'; $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); $view_bag->set('piwik_enabled', $piwik_enabled); if ($piwik_enabled) { $parent_controller->addInlineJavascript('$("#piwik_stats") .load("module.php?mod=' . $this->module->getName() . '&mod_action=Piwik&block_id=' . $block_id . '");'); } $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); if ($template) { return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } } }
/** * Create a branches list controller */ public function __construct() { global $WT_TREE; parent::__construct(); $this->surname = Filter::get('surname'); $this->soundex_std = Filter::getBool('soundex_std'); $this->soundex_dm = Filter::getBool('soundex_dm'); if ($this->surname) { $this->setPageTitle(I18N::translate('Branches of the %s family', Filter::escapeHtml($this->surname))); $this->loadIndividuals(); $self = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE); if ($self) { $this->loadAncestors($self, 1); } } else { $this->setPageTitle(I18N::translate('Branches')); } }
/** * Startup activity * * @param GedcomRecord|null $record */ public function __construct(GedcomRecord $record = null) { $this->record = $record; // Automatically fix broken links if ($this->record && $this->record->canEdit()) { $broken_links = 0; foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) { if (!$fact->isPendingDeletion() && $fact->getTarget() === null) { $this->record->deleteFact($fact->getFactId(), false); FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); $broken_links = true; } } foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) { // These can be links or inline. Only delete links. if (!$fact->isPendingDeletion() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) { $this->record->deleteFact($fact->getFactId(), false); FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); $broken_links = true; } } if ($broken_links) { // Reload the updated family $this->record = GedcomRecord::getInstance($this->record->getXref(), $this->record->getTree()); } } parent::__construct(); // We want robots to index this page $this->setMetaRobots('index,follow'); // Set a page title if ($this->record) { if ($this->record->canShowName()) { // e.g. "John Doe" or "1881 Census of Wales" $this->setPageTitle($this->record->getFullName()); } else { // e.g. "Individual" or "Source" $record = $this->record; $this->setPageTitle(GedcomTag::getLabel($record::RECORD_TYPE)); } } else { // No such record $this->setPageTitle(I18N::translate('Private')); } }
/** * Startup activity */ public function __construct() { global $WT_TREE; parent::__construct(); // $action comes from GET (search) or POST (replace) if (Filter::post('action')) { $this->action = Filter::post('action', 'replace', 'general'); $this->query = Filter::post('query'); $this->replace = Filter::post('replace'); $this->replaceNames = Filter::post('replaceNames', 'checked', ''); $this->replacePlaces = Filter::post('replacePlaces', 'checked', ''); $this->replacePlacesWord = Filter::post('replacePlacesWord', 'checked', ''); $this->replaceAll = Filter::post('replaceAll', 'checked', ''); } else { $this->action = Filter::get('action', 'advanced|general|soundex|replace|header', 'general'); $this->query = Filter::get('query'); $this->replace = Filter::get('replace'); $this->replaceNames = Filter::get('replaceNames', 'checked', ''); $this->replacePlaces = Filter::get('replacePlaces', 'checked', ''); $this->replacePlacesWord = Filter::get('replacePlacesWord', 'checked', ''); $this->replaceAll = Filter::get('replaceAll', 'checked', ''); } // Only editors can use search/replace if ($this->action === 'replace' && !Auth::isEditor($WT_TREE)) { $this->action = 'general'; } $this->srindi = Filter::get('srindi', 'checked', ''); $this->srfams = Filter::get('srfams', 'checked', ''); $this->srsour = Filter::get('srsour', 'checked', ''); $this->srnote = Filter::get('srnote', 'checked', ''); $this->soundex = Filter::get('soundex', 'DaitchM|Russell', 'DaitchM'); $this->showasso = Filter::get('showasso'); $this->firstname = Filter::get('firstname'); $this->lastname = Filter::get('lastname'); $this->place = Filter::get('place'); $this->year = Filter::get('year'); // If no record types specified, search individuals if (!$this->srfams && !$this->srsour && !$this->srnote) { $this->srindi = 'checked'; } // If no replace types specifiied, replace full records if (!$this->replaceNames && !$this->replacePlaces && !$this->replacePlacesWord) { $this->replaceAll = 'checked'; } // Trees to search if (Site::getPreference('ALLOW_CHANGE_GEDCOM')) { foreach (Tree::getAll() as $search_tree) { if (Filter::get('tree_' . $search_tree->getTreeId())) { $this->search_trees[] = $search_tree; } } if (!$this->search_trees) { $this->search_trees[] = $WT_TREE; } } else { $this->search_trees[] = $WT_TREE; } // If we want to show associated persons, build the list switch ($this->action) { case 'header': // We can type in an XREF into the header search, and jump straight to it. // Otherwise, the header search is the same as the general search if (preg_match('/' . WT_REGEX_XREF . '/', $this->query)) { $record = GedcomRecord::getInstance($this->query, $WT_TREE); if ($record && $record->canShowName()) { header('Location: ' . WT_BASE_URL . $record->getRawUrl()); exit; } } $this->action = 'general'; $this->srindi = 'checked'; $this->srfams = 'checked'; $this->srsour = 'checked'; $this->srnote = 'checked'; $this->setPageTitle(I18N::translate('General search')); $this->generalSearch(); break; case 'general': $this->setPageTitle(I18N::translate('General search')); $this->generalSearch(); break; case 'soundex': // Create a dummy search query to use as a title to the results list $this->query = trim($this->firstname . ' ' . $this->lastname . ' ' . $this->place); $this->setPageTitle(I18N::translate('Phonetic search')); $this->soundexSearch(); break; case 'replace': $this->setPageTitle(I18N::translate('Search and replace')); $this->search_trees = array($WT_TREE); $this->srindi = 'checked'; $this->srfams = 'checked'; $this->srsour = 'checked'; $this->srnote = 'checked'; if (Filter::post('query')) { $this->searchAndReplace($WT_TREE); header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=replace&query=' . Filter::escapeUrl($this->query) . '&replace=' . Filter::escapeUrl($this->replace) . '&replaceAll=' . $this->replaceAll . '&replaceNames=' . $this->replaceNames . '&replacePlaces=' . $this->replacePlaces . '&replacePlacesWord=' . $this->replacePlacesWord); exit; } } }
* 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>';
namespace Fisharebest\Webtrees; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsDate; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Functions\FunctionsPrint; use PDO; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; define('WT_SCRIPT_NAME', 'admin_users.php'); require './includes/session.php'; $controller = new PageController(); $controller->restrictAccess(Auth::isAdmin()); // Valid values for form variables $ALL_EDIT_OPTIONS = array('none' => I18N::translate('Visitor'), 'access' => I18N::translate('Member'), 'edit' => I18N::translate('Editor'), 'accept' => I18N::translate('Moderator'), 'admin' => I18N::translate('Manager')); // Form actions switch (Filter::post('action')) { case 'save': if (Filter::checkCsrf()) { $user_id = Filter::postInteger('user_id'); $user = User::find($user_id); $username = Filter::post('username'); $real_name = Filter::post('real_name'); $email = Filter::postEmail('email'); $pass1 = Filter::post('pass1', WT_REGEX_PASSWORD); $pass2 = Filter::post('pass2', WT_REGEX_PASSWORD); $theme = Filter::post('theme', implode('|', array_keys(Theme::themeNames())), '');
// Check access. (1) the block must exist and be enabled, (2) gedcom blocks require // managers, (3) user blocks require the user or an admin $blocks = Module::getActiveBlocks($WT_TREE); if (!$block || !array_key_exists($block->module_name, $blocks) || $block->gedcom_id && !Auth::isManager(Tree::findById($block->gedcom_id)) || $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()) { header('Location: ' . WT_BASE_URL); return; } $block = $blocks[$block->module_name]; if (Filter::post('save')) { $ctype = Filter::post('ctype', 'user', 'gedcom'); header('Location: ' . WT_BASE_URL . 'index.php?ctype=' . $ctype . '&ged=' . $WT_TREE->getNameUrl()); $block->configureBlock($block_id); return; } $ctype = FIlter::get('ctype', 'user', 'gedcom'); $controller = new PageController(); $controller->setPageTitle(I18N::translate('Configure') . ' — ' . $block->getTitle())->pageHeader(); if (Module::getModuleByName('ckeditor')) { CkeditorModule::enableEditor($controller); } ?> <h2><?php echo $controller->getPageTitle(); ?> </h2> <form name="block" method="post" action="?block_id=<?php echo $block_id; ?> "> <input type="hidden" name="save" value="1">
* 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
/** * Get significant information from this page, to allow other pages such as * charts and reports to initialise with the same records * * @return Individual */ public function getSignificantIndividual() { global $WT_TREE; if ($this->people) { return $this->people[0]; } else { return parent::getSignificantIndividual(); } }
* along with this program. If not, see <http://www.gnu.org/licenses/>. */ namespace Fisharebest\Webtrees; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsEdit; use PDO; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; define('WT_SCRIPT_NAME', 'admin_site_change.php'); require './includes/session.php'; $controller = new PageController(); $controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Changes')); $earliest = Database::prepare("SELECT DATE(MIN(change_time)) FROM `##change`")->execute(array())->fetchOne(); $latest = Database::prepare("SELECT DATE(MAX(change_time)) FROM `##change`")->execute(array())->fetchOne(); // Filtering $action = Filter::get('action'); $from = Filter::get('from', '\\d\\d\\d\\d-\\d\\d-\\d\\d', $earliest); $to = Filter::get('to', '\\d\\d\\d\\d-\\d\\d-\\d\\d', $latest); $type = Filter::get('type', 'accepted|rejected|pending'); $oldged = Filter::get('oldged'); $newged = Filter::get('newged'); $xref = Filter::get('xref', WT_REGEX_XREF); $user = Filter::get('user'); $search = Filter::get('search'); $search = isset($search['value']) ? $search['value'] : null; $statuses = array('' => '', 'accepted' => I18N::translate('accepted'), 'rejected' => I18N::translate('rejected'), 'pending' => I18N::translate('pending'));
* 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) {
/** * Places administration. */ private function adminPlaces() { global $WT_TREE; $action = Filter::get('action'); $parent = Filter::get('parent'); $inactive = Filter::getBool('inactive'); $deleteRecord = Filter::get('deleteRecord'); if (!isset($parent)) { $parent = 0; } $controller = new PageController(); $controller->restrictAccess(Auth::isAdmin()); if ($action == 'ExportFile' && Auth::isAdmin()) { $tmp = $this->placeIdToHierarchy($parent); $maxLevel = $this->getHighestLevel(); if ($maxLevel > 8) { $maxLevel = 8; } $tmp[0] = 'places'; $outputFileName = preg_replace('/[:;\\/\\\\(\\)\\{\\}\\[\\] $]/', '_', implode('-', $tmp)) . '.csv'; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $outputFileName . '"'); echo '"', I18N::translate('Level'), '";"', I18N::translate('Country'), '";'; if ($maxLevel > 0) { echo '"', I18N::translate('State'), '";'; } if ($maxLevel > 1) { echo '"', I18N::translate('County'), '";'; } if ($maxLevel > 2) { echo '"', I18N::translate('City'), '";'; } if ($maxLevel > 3) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 4) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 5) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 6) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 7) { echo '"', I18N::translate('Place'), '";'; } echo '"', I18N::translate('Longitude'), '";"', I18N::translate('Latitude'), '";'; echo '"', I18N::translate('Zoom level'), '";"', I18N::translate('Icon'), '";', WT_EOL; $this->outputLevel($parent); exit; } $controller->setPageTitle(I18N::translate('Google Maps™'))->pageHeader(); ?> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol> <ul class="nav nav-tabs nav-justified" role="tablist"> <li role="presentation"> <a href="?mod=googlemap&mod_action=admin_config" role="tab"> <?php echo I18N::translate('Google Maps™ preferences'); ?> </a> </li> <li role="presentation" class="active"> <a href="#"> <?php echo I18N::translate('Geographic data'); ?> </a> </li> <li role="presentation"> <a href="?mod=googlemap&mod_action=admin_placecheck"> <?php echo I18N::translate('Place check'); ?> </a> </li> </ul> <h2><?php echo I18N::translate('Geographic data'); ?> </h2> <?php if ($action == 'ImportGedcom') { $placelist = array(); $j = 0; $gedcom_records = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchOneColumn(); foreach ($gedcom_records as $gedrec) { $i = 1; $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i); while (!empty($placerec)) { if (preg_match("/2 PLAC (.+)/", $placerec, $match)) { $placelist[$j] = array(); $placelist[$j]['place'] = trim($match[1]); if (preg_match("/4 LATI (.*)/", $placerec, $match)) { $placelist[$j]['lati'] = trim($match[1]); if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') { if ($placelist[$j]['lati'] < 0) { $placelist[$j]['lati'][0] = 'S'; } else { $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati']; } } } else { $placelist[$j]['lati'] = null; } if (preg_match("/4 LONG (.*)/", $placerec, $match)) { $placelist[$j]['long'] = trim($match[1]); if ($placelist[$j]['long'][0] != 'E' && $placelist[$j]['long'][0] != 'W') { if ($placelist[$j]['long'] < 0) { $placelist[$j]['long'][0] = 'W'; } else { $placelist[$j]['long'] = 'E' . $placelist[$j]['long']; } } } else { $placelist[$j]['long'] = null; } $j = $j + 1; } $i = $i + 1; $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i); } } asort($placelist); $prevPlace = ''; $prevLati = ''; $prevLong = ''; $placelistUniq = array(); $j = 0; foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; $placelistUniq[$j]['lati'] = $place['lati']; $placelistUniq[$j]['long'] = $place['long']; $j = $j + 1; } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) { if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) { $placelistUniq[$j - 1]['lati'] = $place['lati']; $placelistUniq[$j - 1]['long'] = $place['long']; } elseif ($place['lati'] != '0' || $place['long'] != '0') { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } } $prevPlace = $place['place']; $prevLati = $place['lati']; $prevLong = $place['long']; } $highestIndex = $this->getHighestIndex(); $default_zoom_level = array(4, 7, 10, 12); foreach ($placelistUniq as $k => $place) { $parent = preg_split('/ *, */', $place['place']); $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { if (!isset($default_zoom_level[$i])) { $default_zoom_level[$i] = $default_zoom_level[$i - 1]; } $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } $row = Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?")->execute(array($i, $parent_id, $escparent))->fetchOneRow(); if ($i < count($parent) - 1) { // Create higher-level places, if necessary if (empty($row)) { $highestIndex++; Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i])); echo Filter::escapeHtml($escparent), '<br>'; $parent_id = $highestIndex; } else { $parent_id = $row->pl_id; } } else { // Create lowest-level place, if necessary if (empty($row->pl_id)) { $highestIndex++; Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i])); echo Filter::escapeHtml($escparent), '<br>'; } else { if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') { Database::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $row->pl_id)); echo Filter::escapeHtml($escparent), '<br>'; } } } } } $parent = 0; } if ($action === 'ImportFile') { $placefiles = $this->findFiles(WT_MODULES_DIR . 'googlemap/extra'); sort($placefiles); ?> <form class="form-horizontal" method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&mod_action=admin_places&action=ImportFile2"> <!-- PLACES FILE --> <div class="form-group"> <label class="control-label col-sm-4" for="placesfile"> <?php echo I18N::translate('File containing places (CSV)'); ?> </label> <div class="col-sm-8"> <div class="btn btn-default"> <input id="placesfile" type="file" name="placesfile"> </div> </div> </div> <!-- LOCAL FILE --> <?php if (count($placefiles) > 0) { ?> <div class="form-group"> <label class="control-label col-sm-4" for="localfile"> <?php echo I18N::translate('Server file containing places (CSV)'); ?> </label> <div class="col-sm-8"> <div class="input-group"> <span class="input-group-addon"> <?php echo WT_MODULES_DIR . 'googlemap/extra/'; ?> </span> <?php foreach ($placefiles as $p => $placefile) { unset($placefiles[$p]); $p = Filter::escapeHtml($placefile); if (substr($placefile, 0, 1) == "/") { $placefiles[$p] = substr($placefile, 1); } else { $placefiles[$p] = $placefile; } } echo FunctionsEdit::selectEditControl('localfile', $placefiles, '', '', 'class="form-control"'); ?> </div> </div> </div> <?php } ?> <!-- CLEAR DATABASE --> <fieldset class="form-group"> <legend class="control-label col-sm-4"> <?php echo I18N::translate('Delete all existing geographic data before importing the file.'); ?> </legend> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('cleardatabase', 0, 'class="radio-inline"'); ?> </div> </fieldset> <!-- UPDATE ONLY --> <fieldset class="form-group"> <legend class="control-label col-sm-4"> <?php echo I18N::translate('Do not create new locations, just import coordinates for existing locations.'); ?> </legend> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('updateonly', 0, 'class="radio-inline"'); ?> </div> </fieldset> <!-- OVERWRITE DATA --> <fieldset class="form-group"> <legend class="control-label col-sm-4"> <?php echo I18N::translate('Overwrite existing coordinates.'); ?> </legend> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('overwritedata', 0, 'class="radio-inline"'); ?> </div> </fieldset> <!-- SAVE BUTTON --> <div class="form-group"> <div class="col-sm-offset-4 col-sm-8"> <button type="submit" class="btn btn-primary"> <i class="fa fa-check"></i> <?php echo I18N::translate('Continue adding'); ?> </button> </div> </div> </form> <?php exit; } if ($action === 'ImportFile2') { $country_names = array(); $stats = new Stats($WT_TREE); foreach ($stats->iso3166() as $key => $value) { $country_names[$key] = I18N::translate($key); } if (Filter::postBool('cleardatabase')) { Database::exec("DELETE FROM `##placelocation` WHERE 1=1"); } if (!empty($_FILES['placesfile']['tmp_name'])) { $lines = file($_FILES['placesfile']['tmp_name']); } elseif (!empty($_REQUEST['localfile'])) { $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']); } // Strip BYTE-ORDER-MARK, if present if (!empty($lines[0]) && substr($lines[0], 0, 3) === WT_UTF8_BOM) { $lines[0] = substr($lines[0], 3); } asort($lines); $highestIndex = $this->getHighestIndex(); $placelist = array(); $j = 0; $maxLevel = 0; foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); if ($fieldrec[0] > $maxLevel) { $maxLevel = $fieldrec[0]; } } $fields = count($fieldrec); $set_icon = true; if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) { $set_icon = false; } foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) { $placelist[$j] = array(); $placelist[$j]['place'] = ''; for ($ii = $fields - 4; $ii > 1; $ii--) { if ($fieldrec[0] > $ii - 2) { $placelist[$j]['place'] .= $fieldrec[$ii] . ','; } } foreach ($country_names as $countrycode => $countryname) { if ($countrycode == strtoupper($fieldrec[1])) { $fieldrec[1] = $countryname; break; } } $placelist[$j]['place'] .= $fieldrec[1]; $placelist[$j]['long'] = $fieldrec[$fields - 4]; $placelist[$j]['lati'] = $fieldrec[$fields - 3]; $placelist[$j]['zoom'] = $fieldrec[$fields - 2]; if ($set_icon) { $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]); } else { $placelist[$j]['icon'] = ''; } $j = $j + 1; } } $prevPlace = ''; $prevLati = ''; $prevLong = ''; $placelistUniq = array(); $j = 0; foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; $placelistUniq[$j]['lati'] = $place['lati']; $placelistUniq[$j]['long'] = $place['long']; $placelistUniq[$j]['zoom'] = $place['zoom']; $placelistUniq[$j]['icon'] = $place['icon']; $j = $j + 1; } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) { if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) { $placelistUniq[$j - 1]['lati'] = $place['lati']; $placelistUniq[$j - 1]['long'] = $place['long']; $placelistUniq[$j - 1]['zoom'] = $place['zoom']; $placelistUniq[$j - 1]['icon'] = $place['icon']; } elseif ($place['lati'] != '0' || $place['long'] != '0') { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } } $prevPlace = $place['place']; $prevLati = $place['lati']; $prevLong = $place['long']; } $default_zoom_level = array(); $default_zoom_level[0] = 4; $default_zoom_level[1] = 7; $default_zoom_level[2] = 10; $default_zoom_level[3] = 12; foreach ($placelistUniq as $k => $place) { $parent = explode(',', $place['place']); $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } $row = Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")->execute(array($i, $parent_id, $escparent))->fetchOneRow(); if (empty($row)) { // this name does not yet exist: create entry if (!Filter::postBool('updateonly')) { $highestIndex = $highestIndex + 1; if ($i + 1 == count($parent)) { $zoomlevel = $place['zoom']; } elseif (isset($default_zoom_level[$i])) { $zoomlevel = $default_zoom_level[$i]; } else { $zoomlevel = $this->getSetting('GM_MAX_ZOOM'); } if ($place['lati'] == '0' || $place['long'] == '0' || $i + 1 < count($parent)) { Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon'])); } else { //delete leading zero $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']); $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']); if ($pl_lati >= 0) { $place['lati'] = 'N' . abs($pl_lati); } elseif ($pl_lati < 0) { $place['lati'] = 'S' . abs($pl_lati); } if ($pl_long >= 0) { $place['long'] = 'E' . abs($pl_long); } elseif ($pl_long < 0) { $place['long'] = 'W' . abs($pl_long); } Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon'])); } $parent_id = $highestIndex; } } else { $parent_id = $row->pl_id; if (Filter::postBool('overwritedata') && $i + 1 == count($parent)) { Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ?, pl_zoom = ?, pl_icon = ? WHERE pl_id = ?")->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id)); } else { // Update only if existing data is missing if (!$row->pl_long && !$row->pl_lati) { Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ? WHERE pl_id = ?")->execute(array($place['lati'], $place['long'], $parent_id)); } if (!$row->pl_icon && $place['icon']) { Database::prepare("UPDATE `##placelocation` SET pl_icon = ? WHERE pl_id = ?")->execute(array($place['icon'], $parent_id)); } } } } } $parent = 0; } if ($action == 'DeleteRecord') { $exists = Database::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($deleteRecord))->fetchOne(); if (!$exists) { Database::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")->execute(array($deleteRecord)); } else { echo '<table class="facts_table"><tr><td>', I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>'; } } ?> <script> function updateList(inactive) { window.location.href='<?php if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) { $uri = strstr($_SERVER['REQUEST_URI'], '&inactive', true); } else { $uri = $_SERVER['REQUEST_URI']; } echo $uri, '&inactive='; ?> '+inactive; } function edit_place_location(placeid) { window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid, '_blank', gmap_window_specs); return false; } function add_place_location(placeid) { window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid, '_blank', gmap_window_specs); return false; } function delete_place(placeid) { var answer=confirm('<?php echo I18N::translate('Remove this location?'); ?> '); if (answer == true) { window.location = '<?php echo Functions::getQueryUrl(array('action' => 'DeleteRecord')); ?> &action=DeleteRecord&deleteRecord=' + placeid; } } </script> <p id="gm_breadcrumb"> <?php $where_am_i = $this->placeIdToHierarchy($parent); foreach (array_reverse($where_am_i, true) as $id => $place) { if ($id == $parent) { if ($place != 'Unknown') { echo Filter::escapeHtml($place); } else { echo I18N::translate('unknown'); } } else { echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">'; if ($place != 'Unknown') { echo Filter::escapeHtml($place), '</a>'; } else { echo I18N::translate('unknown'), '</a>'; } } echo ' - '; } ?> <a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '"><?php echo I18N::translate('Top level'); ?> </a> </p> <form class="form-inline" name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '"> <div class="checkbox"> <label for="inactive"> <?php echo FunctionsEdit::checkbox('inactive', $inactive, 'onclick="updateList(this.checked)"'); ?> <?php echo I18N::translate('Show inactive places'); ?> </label> </div> <p class="small text-muted"> <?php echo I18N::translate('By default, the list shows only those places which can be found in your family trees. You may have details for other places, such as those imported in bulk from an external file. Selecting this option will show all places, including ones that are not currently used.'); ?> <?php echo I18N::translate('If you have a large number of inactive places, it can be slow to generate the list.'); ?> </p> </form> <?php $placelist = $this->getPlaceListLocation($parent, $inactive); echo '<div class="gm_plac_edit">'; echo '<table class="table table-bordered table-condensed table-hover"><tr>'; echo '<th>', GedcomTag::getLabel('PLAC'), '</th>'; echo '<th>', GedcomTag::getLabel('LATI'), '</th>'; echo '<th>', GedcomTag::getLabel('LONG'), '</th>'; echo '<th>', I18N::translate('Zoom level'), '</th>'; echo '<th>', I18N::translate('Icon'), '</th>'; echo '<th>'; echo I18N::translate('Edit'), '</th><th>', I18N::translate('Delete'), '</th></tr>'; if (count($placelist) == 0) { echo '<tr><td colspan="7">', I18N::translate('No places found'), '</td></tr>'; } foreach ($placelist as $place) { echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">'; if ($place['place'] != 'Unknown') { echo Filter::escapeHtml($place['place']), '</a></td>'; } else { echo I18N::translate('unknown'), '</a></td>'; } echo '<td>', $place['lati'], '</td>'; echo '<td>', $place['long'], '</td>'; echo '<td>', $place['zoom'], '</td>'; echo '<td>'; if ($place['icon']) { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">'; } else { if ($place['lati'] || $place['long']) { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_red.png">'; } else { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">'; } } echo '</td>'; echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', I18N::translate('Edit'), '"></a></td>'; $noRows = Database::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($place['place_id']))->fetchOne(); if ($noRows == 0) { ?> <td><a href="#" onclick="delete_place(<?php echo $place['place_id']; ?> );return false;" class="icon-delete" title="<?php echo I18N::translate('Remove'); ?> "></a></td> <?php } else { ?> <td><i class="icon-delete-grey"></i></td> <?php } ?> </tr> <?php } ?> </table> </div> <hr> <form class="form-horizontal" action="?" onsubmit="add_place_location(this.parent_id.options[this.parent_id.selectedIndex].value); return false;"> <div class="form-group"> <label class="form-control-static col-sm-4" for="parent_id"> <?php echo I18N::translate('Add a new geographic location'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <?php echo FunctionsEdit::selectEditControl('parent_id', $where_am_i, I18N::translate('Top level'), $parent, 'class="form-control"'); ?> </div> <button type="submit" class="btn btn-default"> <i class="fa fa-plus"></i> <?php echo I18N::translate('Add'); ?> </button> </div> </div> </form> <form class="form-horizontal" action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ImportGedcom"> <div class="form-group"> <label class="form-control-static col-sm-4" for="ged"> <?php echo I18N::translate('Import all places from a family tree'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <?php echo FunctionsEdit::selectEditControl('ged', Tree::getNameList(), null, $WT_TREE->getName(), 'class="form-control"'); ?> </div> <button type="submit" class="btn btn-default"> <i class="fa fa-upload"></i> <?php echo I18N::translate('Import'); ?> </button> </div> </div> </form> <form class="form-horizontal" action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ImportFile"> <div class="form-group"> <label class="form-control-static col-sm-4"> <?php echo I18N::translate('Upload geographic data'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <button type="submit" class="btn btn-default"> <i class="fa fa-upload"></i> <?php echo I18N::translate('Upload'); ?> </button> </div> </div> </div> </form> <form class="form-horizontal" action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ExportFile"> <div class="form-group"> <label class="form-control-static col-sm-4"> <?php echo I18N::translate('Download geographic data'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <?php echo FunctionsEdit::selectEditControl('parent', $where_am_i, I18N::translate('All'), $WT_TREE->getTreeId(), 'class="form-control"'); ?> </div> <button type="submit" class="btn btn-default"> <i class="fa fa-download"></i> <?php echo I18N::translate('Download'); ?> </button> </div> </div> </form> <?php }
/** * SosaList@missing */ public function missing() { global $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Missing Ancestors')); $this->view_bag->set('title', $controller->getPageTitle()); if ($this->view_bag->get('is_setup', false)) { $this->view_bag->set('url_module', $this->module->getName()); $this->view_bag->set('url_action', 'SosaList@missing'); $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); $this->view_bag->set('min_gen', 2); $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1)); $this->view_bag->set('perc_sosa', $perc_sosa); if ($this->view_bag->get('has_missing', false)) { $table_id = 'table-sosa-missing-' . Uuid::uuid4(); $this->view_bag->set('table_id', $table_id); $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript(' /* Initialise datatables */ jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; jQuery("#' . $table_id . '").dataTable( { dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', ' . I18N::datatablesI18N() . ', jQueryUI: true, autoWidth:false, processing: true, retrieve: true, columns: [ /* 0-Sosa */ { type: "num", class: "center" }, /* 1-ID */ { class: "center" }, /* 2-givn */ { dataSort: 4, class: "left"}, /* 3-surn */ { dataSort: 5}, /* 4-GIVN,SURN */ { type: "unicode", visible: false}, /* 5-SURN,GIVN */ { type: "unicode", visible: false}, /* PERSO Modify table to include IsSourced module */ /* 6-INDI_SOUR */ { dataSort : 7, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' }, /* 7-SORT_INDISC */ { visible : false}, /* 8-Father */ { class: "center"}, /* 9-Mother */ { class: "center"}, /* 10-Birth */ { dataSort : 11 , class: "center"}, /* 11-SORT_BIRT */ { visible : false}, /* 12-BIRT_PLAC */ { type: "unicode", class: "center"}, /* 13-BIRT_SOUR */ { dataSort : 14, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' }, /* 14-SORT_BIRTSC */{ visible : false}, /* 15-SEX */ { visible : false} /* END PERSO */ ], sorting: [[0,"asc"]], displayLength: 20, pagingType: "full_numbers" }); jQuery("#' . $table_id . '") /* Filter buttons in table header */ .on("click", "button[data-filter-column]", function() { var btn = jQuery(this); // De-activate the other buttons in this button group btn.siblings().removeClass("ui-state-active"); // Apply (or clear) this filter var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); if (btn.hasClass("ui-state-active")) { btn.removeClass("ui-state-active"); col.search("").draw(); } else { btn.addClass("ui-state-active"); col.search(btn.data("filter-value")).draw(); } }); jQuery(".smissing-list").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); '); $unique_indis = array(); $sum_missing_different = 0; $sum_missing_different_without_hidden = 0; foreach ($missing_list as $num => $missing_tab) { if (isset($unique_indis[$missing_tab['indi']])) { unset($missing_list[$num]); continue; } $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); if (!$person || !$person->canShowName()) { unset($missing_list[$num]); continue; } $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; $unique_indis[$person->getXref()] = true; $missing_tab['indi'] = $person; $missing_list[$num] = $missing_tab; } $this->view_bag->set('missing_list', $missing_list); $this->view_bag->set('missing_diff_count', $sum_missing_different); $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation - 2)); $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); } } ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); }
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()));
* webtrees: online genealogy * 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', 'notelist.php'); require './includes/session.php'; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Shared notes')); $controller->pageHeader(); echo '<div id="notelist-page">', '<h2>', I18N::translate('Shared notes'), '</h2>', FunctionsPrintLists::noteTable(FunctionsDb::getNoteList($WT_TREE)); echo '</div>';
* 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\FunctionsEdit; define('WT_SCRIPT_NAME', 'admin_trees_merge.php'); require './includes/session.php'; $controller = new PageController(); $controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Merge family trees'))->pageHeader(); ?> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_trees_manage.php"><?php echo I18N::translate('Manage family trees'); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li>
private function config() { global $WT_TREE; $controller = new webtrees\Controller\PageController(); $controller->restrictAccess(webtrees\Auth::isManager($WT_TREE))->setPageTitle($this->getTitle())->pageHeader(); $args = array(); $args['module_name'] = $this->getName(); $args['tree_id'] = $WT_TREE->getTreeId(); $items = webtrees\Database::prepare("SELECT block_id, block_order, gedcom_id, bs1.setting_value AS menu_title, bs2.setting_value AS menu_address" . " FROM `##block` b" . " JOIN `##block_setting` bs1 USING (block_id)" . " JOIN `##block_setting` bs2 USING (block_id)" . " WHERE module_name = :module_name" . " AND bs1.setting_name = 'menu_title'" . " AND bs2.setting_name = 'menu_address'" . " AND IFNULL(gedcom_id, :tree_id) = :tree_id" . " ORDER BY block_order")->execute($args)->fetchAll(); unset($args['tree_id']); $min_block_order = webtrees\Database::prepare("SELECT MIN(block_order) FROM `##block` WHERE module_name = :module_name")->execute($args)->fetchOne(); $max_block_order = webtrees\Database::prepare("SELECT MAX(block_order) FROM `##block` WHERE module_name = :module_name")->execute($args)->fetchOne(); ?> <style> .text-left-not-xs, .text-left-not-sm, .text-left-not-md, .text-left-not-lg { text-align: left; } .text-center-not-xs, .text-center-not-sm, .text-center-not-md, .text-center-not-lg { text-align: center; } .text-right-not-xs, .text-right-not-sm, .text-right-not-md, .text-right-not-lg { text-align: right; } .text-justify-not-xs, .text-justify-not-sm, .text-justify-not-md, .text-justify-not-lg { text-align: justify; } @media (max-width: 767px) { .text-left-not-xs, .text-center-not-xs, .text-right-not-xs, .text-justify-not-xs { text-align: inherit; } .text-left-xs { text-align: left; } .text-center-xs { text-align: center; } .text-right-xs { text-align: right; } .text-justify-xs { text-align: justify; } } @media (min-width: 768px) and (max-width: 991px) { .text-left-not-sm, .text-center-not-sm, .text-right-not-sm, .text-justify-not-sm { text-align: inherit; } .text-left-sm { text-align: left; } .text-center-sm { text-align: center; } .text-right-sm { text-align: right; } .text-justify-sm { text-align: justify; } } @media (min-width: 992px) and (max-width: 1199px) { .text-left-not-md, .text-center-not-md, .text-right-not-md, .text-justify-not-md { text-align: inherit; } .text-left-md { text-align: left; } .text-center-md { text-align: center; } .text-right-md { text-align: right; } .text-justify-md { text-align: justify; } } @media (min-width: 1200px) { .text-left-not-lg, .text-center-not-lg, .text-right-not-lg, .text-justify-not-lg { text-align: inherit; } .text-left-lg { text-align: left; } .text-center-lg { text-align: center; } .text-right-lg { text-align: right; } .text-justify-lg { text-align: justify; } } </style> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo webtrees\I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_modules.php"><?php echo webtrees\I18N::translate('Module administration'); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol> <div class="row"> <div class="col-sm-4 col-xs-12"> <form class="form"> <label for="ged" class="sr-only"> <?php echo webtrees\I18N::translate('Family tree'); ?> </label> <input type="hidden" name="mod" value="<?php echo $this->getName(); ?> "> <input type="hidden" name="mod_action" value="admin_config"> <div class="col-sm-9 col-xs-9" style="padding:0;"> <?php echo webtrees\Functions\FunctionsEdit::selectEditControl('ged', webtrees\Tree::getNameList(), null, $WT_TREE->getName(), 'class="form-control"'); ?> </div> <div class="col-sm-3" style="padding:0;"> <input type="submit" class="btn btn-primary" value="<?php echo webtrees\I18N::translate('show'); ?> "> </div> </form> </div> <span class="visible-xs hidden-sm hidden-md hidden-lg" style="display:block;"></br></br></span> <div class="col-sm-4 text-center text-left-xs col-xs-12"> <p> <a href="module.php?mod=<?php echo $this->getName(); ?> &mod_action=admin_edit" class="btn btn-primary"> <i class="fa fa-plus"></i> <?php echo webtrees\I18N::translate('Add Menu'); ?> </a> </p> </div> <div class="col-sm-4 text-right text-left-xs col-xs-12"> <?php // TODO: Move to internal item/page if (file_exists(WT_MODULES_DIR . $this->getName() . '/readme.html')) { ?> <a href="<?php echo WT_MODULES_DIR . $this->getName(); ?> /readme.html" class="btn btn-info"> <i class="fa fa-newspaper-o"></i> <?php echo webtrees\I18N::translate('ReadMe'); ?> </a> <?php } ?> </div> </div> <table class="table table-bordered table-condensed"> <thead> <tr> <th class="col-sm-2"><?php echo webtrees\I18N::translate('Position'); ?> </th> <th class="col-sm-4"><?php echo webtrees\I18N::translate('Menu title'); ?> </th> <th class="col-sm-4"><?php echo webtrees\I18N::translate('Menu address'); ?> </th> <th class="col-sm-2" colspan=4><?php echo webtrees\I18N::translate('Controls'); ?> </th> </tr> </thead> <tbody> <?php foreach ($items as $item) { ?> <tr> <td> <?php echo $item->block_order, ', '; if ($item->gedcom_id == null) { echo webtrees\I18N::translate('All'); } else { echo webtrees\Tree::findById($item->gedcom_id)->getTitleHtml(); } ?> </td> <td> <?php echo webtrees\Filter::escapeHtml(webtrees\I18N::translate($item->menu_title)); ?> </td> <td> <?php echo webtrees\Filter::escapeHtml(substr(webtrees\I18N::translate($item->menu_address), 0, 1) == '<' ? webtrees\I18N::translate($item->menu_address) : nl2br(webtrees\I18N::translate($item->menu_address))); ?> </td> <td class="text-center"> <a href="module.php?mod=<?php echo $this->getName(); ?> &mod_action=admin_edit&block_id=<?php echo $item->block_id; ?> "> <div class="icon-edit"> </div> </a> </td> <td class="text-center"> <a href="module.php?mod=<?php echo $this->getName(); ?> &mod_action=admin_moveup&block_id=<?php echo $item->block_id; ?> "> <?php if ($item->block_order == $min_block_order) { echo ' '; } else { echo '<div class="icon-uarrow"> </div>'; } ?> </a> </td> <td class="text-center"> <a href="module.php?mod=<?php echo $this->getName(); ?> &mod_action=admin_movedown&block_id=<?php echo $item->block_id; ?> "> <?php if ($item->block_order == $max_block_order) { echo ' '; } else { echo '<div class="icon-darrow"> </div>'; } ?> </a> </td> <td class="text-center"> <a href="module.php?mod=<?php echo $this->getName(); ?> &mod_action=admin_delete&block_id=<?php echo $item->block_id; ?> " onclick="return confirm('<?php echo webtrees\I18N::translate('Are you sure you want to delete this menu?'); ?> ');"> <div class="icon-delete"> </div> </a> </td> </tr> <?php } ?> </tbody> </table> <?php }
* 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; use Fisharebest\Webtrees\Functions\FunctionsEdit; define('WT_SCRIPT_NAME', 'admin_site_config.php'); require './includes/session.php'; $controller = new PageController(); $controller->restrictAccess(Auth::isAdmin()); switch (Filter::post('action')) { case 'site': if (Filter::checkCsrf()) { $INDEX_DIRECTORY = Filter::post('INDEX_DIRECTORY'); if (substr($INDEX_DIRECTORY, -1) !== '/') { $INDEX_DIRECTORY .= '/'; } if (File::mkdir($INDEX_DIRECTORY)) { Site::setPreference('INDEX_DIRECTORY', $INDEX_DIRECTORY); } else { FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Filter::escapeHtml($INDEX_DIRECTORY)), 'danger'); } Site::setPreference('MEMORY_LIMIT', Filter::post('MEMORY_LIMIT')); Site::setPreference('MAX_EXECUTION_TIME', Filter::post('MAX_EXECUTION_TIME'));
$cal_date->setJdFromYmd(); if ($year === 0) { $year = $cal_date->y; } // Extract values from date $days_in_month = $cal_date->daysInMonth(); $days_in_week = $cal_date->daysInWeek(); $cal_month = $cal_date->format('%O'); $today_month = $today->format('%O'); // Invalid dates? Go to monthly view, where they'll be found. if ($cal_date->d > $days_in_month && $view === 'day') { $view = 'month'; } // All further uses of $cal are to generate URLs $cal = rawurlencode($cal); $controller = new PageController(); $controller->setPageTitle(I18N::translate('Anniversary calendar')); switch ($view) { case 'day': $controller->setPageTitle(I18N::translate('On this day…') . ' ' . $ged_date->display(false)); break; case 'month': $controller->setPageTitle(I18N::translate('In this month…') . ' ' . $ged_date->display(false, '%F %Y')); break; case 'year': $controller->setPageTitle(I18N::translate('In this year…') . ' ' . $ged_date->display(false, '%Y')); break; } $controller->pageHeader(); ?> <div id="calendar-page">
/** * Startup activity */ public function __construct() { global $WT_TREE; parent::__construct(); $this->setPageTitle(I18N::translate('Lifespans')); $this->facts = explode('|', WT_EVENTS_BIRT . '|' . WT_EVENTS_DEAT . '|' . WT_EVENTS_MARR . '|' . WT_EVENTS_DIV); $tmp = explode('\\', get_class(I18N::defaultCalendar())); $cal = strtolower(array_pop($tmp)); $this->defaultCalendar = str_replace('calendar', '', $cal); $filterPids = false; // Request parameters $clear = Filter::getBool('clear'); $newpid = Filter::get('newpid', WT_REGEX_XREF); $addfam = Filter::getBool('addFamily'); $this->place = Filter::get('place'); $this->beginYear = Filter::getInteger('beginYear', 0, PHP_INT_MAX, null); $this->endYear = Filter::getInteger('endYear', 0, PHP_INT_MAX, null); $this->calendar = Filter::get('calendar', null, $this->defaultCalendar); $this->strictDate = Filter::getBool('strictDate'); // Set up base color parameters $this->colors['M'] = new ColorGenerator(240, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE * -1); $this->colors['F'] = new ColorGenerator(00, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE); // Build a list of people based on the input parameters if ($clear) { // Empty list & reset form $xrefs = array(); $this->place = null; $this->beginYear = null; $this->endYear = null; $this->calendar = $this->defaultCalendar; } elseif ($this->place) { // Get all individual & family records found for a place $this->place_obj = new Place($this->place, $WT_TREE); $xrefs = Database::prepare("SELECT DISTINCT `i_id` FROM `##placelinks`" . " JOIN `##individuals` ON `pl_gid`=`i_id` AND `pl_file`=`i_file`" . " WHERE `i_file`=:tree_id" . " AND `pl_p_id`=:place_id" . " UNION" . " SELECT DISTINCT `f_id` FROM `##placelinks`" . " JOIN `##families` ON `pl_gid`=`f_id` AND `pl_file`=`f_file`" . " WHERE `f_file`=:tree_id" . " AND `pl_p_id`=:place_id")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'place_id' => $this->place_obj->getPlaceId()))->fetchOneColumn(); } else { // Modify an existing list of records $xrefs = Session::get(self::SESSION_DATA, array()); if ($newpid) { $xrefs = array_merge($xrefs, $this->addFamily(Individual::getInstance($newpid, $WT_TREE), $addfam)); $xrefs = array_unique($xrefs); } elseif (!$xrefs) { $xrefs = $this->addFamily($this->getSignificantIndividual(), false); } } $tmp = $this->getCalendarDate(unixtojd()); $this->currentYear = $tmp->today()->y; $tmp = strtoupper(strtr($this->calendar, array('jewish' => 'hebrew', 'french' => 'french r'))); $this->calendarEscape = sprintf('@#D%s@', $tmp); if ($xrefs) { // ensure date ranges are valid in preparation for filtering list if ($this->beginYear || $this->endYear) { $filterPids = true; if (!$this->beginYear) { $tmp = new Date($this->calendarEscape . ' 1'); $this->beginYear = $tmp->minimumDate()->y; } if (!$this->endYear) { $this->endYear = $this->currentYear; } $this->startDate = new Date($this->calendarEscape . $this->beginYear); $this->endDate = new Date($this->calendarEscape . $this->endYear); } // Test each xref to see if the search criteria are met foreach ($xrefs as $key => $xref) { $valid = false; $person = Individual::getInstance($xref, $WT_TREE); if ($person) { if ($person->canShow()) { foreach ($person->getFacts() as $fact) { if ($this->checkFact($fact)) { $this->people[] = $person; $valid = true; break; } } } } else { $family = Family::getInstance($xref, $WT_TREE); if ($family && $family->canShow() && $this->checkFact($family->getMarriage())) { $valid = true; $this->people[] = $family->getHusband(); $this->people[] = $family->getWife(); } } if (!$valid) { unset($xrefs[$key]); // no point in storing a xref if we can't use it } } Session::put(self::SESSION_DATA, $xrefs); } else { Session::forget(self::SESSION_DATA); } $this->people = array_filter(array_unique($this->people)); $count = count($this->people); if ($count) { // Build the subtitle if ($this->place && $filterPids) { $this->subtitle = I18N::plural('%s individual with events in %s between %s and %s', '%s individuals with events in %s between %s and %s', $count, I18N::number($count), $this->place, $this->startDate->display(false, '%Y'), $this->endDate->display(false, '%Y')); } elseif ($this->place) { $this->subtitle = I18N::plural('%s individual with events in %s', '%s individuals with events in %s', $count, I18N::number($count), $this->place); } elseif ($filterPids) { $this->subtitle = I18N::plural('%s individual with events between %s and %s', '%s individuals with events between %s and %s', $count, I18N::number($count), $this->startDate->display(false, '%Y'), $this->endDate->display(false, '%Y')); } else { $this->subtitle = I18N::plural('%s individual', '%s individuals', $count, I18N::number($count)); } // Sort the array in order of birth year usort($this->people, function (Individual $a, Individual $b) { return Date::compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate()); }); //Find the mimimum birth year and maximum death year from the individuals in the array. $bdate = $this->getCalendarDate($this->people[0]->getEstimatedBirthDate()->minimumJulianDay()); $minyear = $bdate->y; $that = $this; // PHP5.3 cannot access $this inside a closure $maxyear = array_reduce($this->people, function ($carry, Individual $item) use($that) { $date = $that->getCalendarDate($item->getEstimatedDeathDate()->maximumJulianDay()); return max($carry, $date->y); }, 0); } elseif ($filterPids) { $minyear = $this->endYear; $maxyear = $this->endYear; } else { $minyear = $this->currentYear; $maxyear = $this->currentYear; } $maxyear = min($maxyear, $this->currentYear); // Limit maximum year to current year as we can't forecast the future $minyear = min($minyear, $maxyear - $WT_TREE->getPreference('MAX_ALIVE_AGE')); // Set default minimum chart length $this->timelineMinYear = (int) floor($minyear / 10) * 10; // round down to start of the decade $this->timelineMaxYear = (int) ceil($maxyear / 10) * 10; // round up to start of next decade }
* 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\FunctionsExport; use PclZip; define('WT_SCRIPT_NAME', 'admin_trees_download.php'); require './includes/session.php'; $controller = new PageController(); $controller->setPageTitle(I18N::translate($WT_TREE->getTitleHtml()) . ' — ' . I18N::translate('Export a GEDCOM file'))->restrictAccess(Auth::isManager($WT_TREE)); // Validate user parameters $action = Filter::get('action', 'download'); $convert = Filter::get('convert', 'yes|no', 'no'); $zip = Filter::get('zip', 'yes|no', 'no'); $conv_path = Filter::get('conv_path'); $privatize_export = Filter::get('privatize_export', 'none|visitor|user|gedadmin'); if ($action === 'download') { $exportOptions = array('privatize' => $privatize_export, 'toANSI' => $convert, 'path' => $conv_path); // What to call the downloaded file $download_filename = $WT_TREE->getName(); if (strtolower(substr($download_filename, -4, 4)) != '.ged') { $download_filename .= '.ged'; } if ($zip === 'yes') {
// Check access. (1) the block must exist and be enabled, (2) gedcom blocks require // managers, (3) user blocks require the user or an admin $blocks = Module::getActiveBlocks($WT_TREE); if (!$block || !array_key_exists($block->module_name, $blocks) || $block->gedcom_id && !Auth::isManager(Tree::findById($block->gedcom_id)) || $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()) { header('Location: ' . WT_BASE_URL); return; } $block = $blocks[$block->module_name]; if (Filter::post('save')) { $ctype = Filter::post('ctype', 'user', 'gedcom'); header('Location: ' . WT_BASE_URL . 'index.php?ctype=' . $ctype . '&ged=' . $WT_TREE->getNameUrl()); $block->configureBlock($block_id); return; } $ctype = Filter::get('ctype', 'user', 'gedcom'); $controller = new PageController(); $controller->setPageTitle($block->getTitle() . ' — ' . I18N::translate('Preferences'))->pageHeader(); if (Module::getModuleByName('ckeditor')) { CkeditorModule::enableEditor($controller); } ?> <h2><?php echo $controller->getPageTitle(); ?> </h2> <form name="block" method="post" action="?block_id=<?php echo $block_id; ?> "> <input type="hidden" name="save" value="1">