/** * Generate the HTML content of this block. * * @param int $block_id * @param bool $template * @param string[] $cfg * * @return string */ public function getBlock($block_id, $template = true, $cfg = array()) { global $ctype, $WT_TREE; $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS); $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table'); $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'date_desc'); $block = $this->getBlockSetting($block_id, 'block', '1'); $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', '0'); foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } $found_facts = FunctionsDb::getRecentChanges(WT_CLIENT_JD - $days); if (!$found_facts && $hide_empty) { return ''; } // Print block header $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; } else { $title = ''; } $title .= I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days)); $content = ''; // Print block content if (count($found_facts) == 0) { $content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days)); } else { ob_start(); switch ($infoStyle) { case 'list': $content .= FunctionsPrintLists::changesList($found_facts, $sortStyle); break; case 'table': // sortable table $content .= FunctionsPrintLists::changesTable($found_facts, $sortStyle); break; } $content .= ob_get_clean(); } if ($template) { if ($block) { $class .= ' small_inner_block'; } return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
/** * Generate the HTML content of this block. * * @param int $block_id * @param bool $template * @param string[] $cfg * * @return string */ public function getBlock($block_id, $template = true, $cfg = array()) { global $ctype, $WT_TREE; $num = $this->getBlockSetting($block_id, 'num', '10'); $count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before'); $block = $this->getBlockSetting($block_id, 'block', '0'); foreach (array('count_placement', 'num', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; } else { $title = ''; } $title .= $this->getTitle(); $content = ''; // load the lines from the file $top10 = Database::prepare("SELECT page_parameter, page_count" . " FROM `##hit_counter`" . " WHERE gedcom_id = :tree_id AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')" . " ORDER BY page_count DESC LIMIT :limit")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'limit' => (int) $num))->fetchAssoc(); if ($block) { $content .= '<table width="90%">'; } else { $content .= '<table>'; } foreach ($top10 as $id => $count) { $record = GedcomRecord::getInstance($id, $WT_TREE); if ($record && $record->canShow()) { $content .= '<tr>'; if ($count_placement == 'before') { $content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>'; } $content .= '<td class="name2" ><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>'; if ($count_placement == 'after') { $content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>'; } $content .= '</tr>'; } } $content .= "</table>"; if ($template) { if ($block) { $class .= ' small_inner_block'; } return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
/** {@inheritdoc} */ public function getBlock($block_id, $template = true, $cfg = array()) { global $ctype, $WT_TREE; $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS); $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE); $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE); $show_user = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER); $block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK); $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY); foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'show_user', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } $records = $this->getRecentChanges($WT_TREE, WT_CLIENT_JD - $days); if (empty($records) && $hide_empty) { return ''; } // Print block header $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; } else { $title = ''; } $title .= I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days)); $content = ''; // Print block content if (count($records) == 0) { $content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days)); } else { switch ($infoStyle) { case 'list': $content .= $this->changesList($records, $sortStyle, $show_user); break; case 'table': $content .= $this->changesTable($records, $sortStyle, $show_user); break; } } if ($template) { if ($block) { $class .= ' small_inner_block'; } return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
/** * Generate the HTML content of this block. * * @param int $block_id * @param bool $template * @param string[] $cfg * * @return string */ public function getBlock($block_id, $template = true, $cfg = array()) { global $ctype, $WT_TREE; $days = $this->getBlockSetting($block_id, 'days', '7'); $filter = $this->getBlockSetting($block_id, 'filter', '1'); $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '0'); $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table'); $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha'); $block = $this->getBlockSetting($block_id, 'block', '1'); foreach (array('days', 'filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } $startjd = WT_CLIENT_JD + 1; $endjd = WT_CLIENT_JD + $days; $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; } else { $title = ''; } $title .= $this->getTitle(); $content = ''; switch ($infoStyle) { case 'list': // Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page. $content .= FunctionsPrintLists::eventsList($startjd, $endjd, $onlyBDM ? 'BIRT MARR DEAT' : '', $filter, $sortStyle); break; case 'table': // Style 2: New format, tables, big text, etc. Not too good on right side of page ob_start(); $content .= FunctionsPrintLists::eventsTable($startjd, $endjd, $onlyBDM ? 'BIRT MARR DEAT' : '', $filter, $sortStyle); $content .= ob_get_clean(); break; } if ($template) { if ($block) { $class .= ' small_inner_block'; } return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
} else { echo '><p class="small text-muted">' . I18N::translate('Do not change to keep original filename.') . '</p>'; } } else { echo $fileName; echo '<input name="filename" type="hidden" value="' . Filter::escapeHtml($fileName) . '" size="40">'; } echo '</td>'; echo '</tr>'; } // Box for user to choose the folder to store the image if (!$isExternal) { echo '<tr><td class="descriptionbox wrap width25">'; echo I18N::translate('Folder name on server'), '</td><td class="optionbox wrap">'; //-- don’t let regular users change the location of media items if ($action !== 'update' || Auth::isManager($WT_TREE)) { $mediaFolders = QueryMedia::folderList(); echo '<select name="folder_list" onchange="document.newmedia.folder.value=this.options[this.selectedIndex].value;">'; echo '<option '; if ($folder == '') { echo 'selected'; } echo ' value=""> ', I18N::translate('Choose: '), ' </option>'; if (Auth::isAdmin()) { echo '<option value="other" disabled>', I18N::translate('Other folder… please type in'), "</option>"; } foreach ($mediaFolders as $f) { echo '<option value="', $f, '" '; if ($folder == $f) { echo 'selected'; }
/** * Check whether this fact is protected against edit * * @return bool */ public function canEdit() { // Managers can edit anything // Members cannot edit RESN, CHAN and locked records return $this->parent->canEdit() && !$this->isPendingDeletion() && (Auth::isManager($this->parent->getTree()) || Auth::isEditor($this->parent->getTree()) && strpos($this->gedcom, "\n2 RESN locked") === false && $this->getTag() != 'RESN' && $this->getTag() != 'CHAN'); }
/** * Generate the HTML content of this block. * * @param int $block_id * @param bool $template * @param string[] $cfg * * @return string */ public function getBlock($block_id, $template = true, $cfg = array()) { global $ctype, $WT_TREE; $filter = $this->getBlockSetting($block_id, 'filter', 'all'); $controls = $this->getBlockSetting($block_id, 'controls', '1'); $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start'); // We can apply the filters using SQL // Do not use "ORDER BY RAND()" - it is very slow on large tables. Use PHP::array_rand() instead. $all_media = Database::prepare("SELECT m_id FROM `##media`" . " WHERE m_file = ?" . " AND m_ext IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" . " AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')")->execute(array($WT_TREE->getTreeId(), $this->getBlockSetting($block_id, 'filter_avi', '0') ? 'avi' : null, $this->getBlockSetting($block_id, 'filter_bmp', '1') ? 'bmp' : null, $this->getBlockSetting($block_id, 'filter_gif', '1') ? 'gif' : null, $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpg' : null, $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null, $this->getBlockSetting($block_id, 'filter_mp3', '0') ? 'mp3' : null, $this->getBlockSetting($block_id, 'filter_ole', '1') ? 'ole' : null, $this->getBlockSetting($block_id, 'filter_pcx', '1') ? 'pcx' : null, $this->getBlockSetting($block_id, 'filter_pdf', '0') ? 'pdf' : null, $this->getBlockSetting($block_id, 'filter_png', '1') ? 'png' : null, $this->getBlockSetting($block_id, 'filter_tiff', '1') ? 'tiff' : null, $this->getBlockSetting($block_id, 'filter_wav', '0') ? 'wav' : null, $this->getBlockSetting($block_id, 'filter_audio', '0') ? 'audio' : null, $this->getBlockSetting($block_id, 'filter_book', '1') ? 'book' : null, $this->getBlockSetting($block_id, 'filter_card', '1') ? 'card' : null, $this->getBlockSetting($block_id, 'filter_certificate', '1') ? 'certificate' : null, $this->getBlockSetting($block_id, 'filter_coat', '1') ? 'coat' : null, $this->getBlockSetting($block_id, 'filter_document', '1') ? 'document' : null, $this->getBlockSetting($block_id, 'filter_electronic', '1') ? 'electronic' : null, $this->getBlockSetting($block_id, 'filter_fiche', '1') ? 'fiche' : null, $this->getBlockSetting($block_id, 'filter_film', '1') ? 'film' : null, $this->getBlockSetting($block_id, 'filter_magazine', '1') ? 'magazine' : null, $this->getBlockSetting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null, $this->getBlockSetting($block_id, 'filter_map', '1') ? 'map' : null, $this->getBlockSetting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null, $this->getBlockSetting($block_id, 'filter_other', '1') ? 'other' : null, $this->getBlockSetting($block_id, 'filter_painting', '1') ? 'painting' : null, $this->getBlockSetting($block_id, 'filter_photo', '1') ? 'photo' : null, $this->getBlockSetting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null, $this->getBlockSetting($block_id, 'filter_video', '0') ? 'video' : null))->fetchOneColumn(); // Keep looking through the media until a suitable one is found. $random_media = null; while ($all_media) { $n = array_rand($all_media); $media = Media::getInstance($all_media[$n], $WT_TREE); if ($media->canShow() && !$media->isExternal()) { // Check if it is linked to a suitable individual foreach ($media->linkedIndividuals('OBJE') as $indi) { if ($filter === 'all' || $filter === 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !== false || $filter === 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !== false) { // Found one :-) $random_media = $media; break 2; } } } unset($all_media[$n]); } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; } else { $title = ''; } $title .= $this->getTitle(); if ($random_media) { $content = "<div id=\"random_picture_container{$block_id}\">"; if ($controls) { if ($start) { $icon_class = 'icon-media-stop'; } else { $icon_class = 'icon-media-play'; } $content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id . '"><br>'; $content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"" . $icon_class . "\" title=\"" . I18N::translate('Play') . "/" . I18N::translate('Stop') . '"></a>'; $content .= '<a href="#" onclick="jQuery(\'#block_' . $block_id . '\').load(\'index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '\');return false;" title="' . I18N::translate('Next image') . '" class="icon-media-next"></a>'; $content .= '</div><script> var play = false; function togglePlay() { if (play) { play = false; jQuery("#play_stop").removeClass("icon-media-stop").addClass("icon-media-play"); } else { play = true; playSlideShow(); jQuery("#play_stop").removeClass("icon-media-play").addClass("icon-media-stop"); } } function playSlideShow() { if (play) { window.setTimeout("reload_image()", 6000); } } function reload_image() { if (play) { jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '&start=1"); } } </script>'; } if ($start) { $content .= '<script>togglePlay();</script>'; } $content .= '<div class="center" id="random_picture_content' . $block_id . '">'; $content .= '<table id="random_picture_box"><tr><td class="details1">'; $content .= $random_media->displayImage(); $content .= '<br>'; $content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>'; foreach ($random_media->linkedIndividuals('OBJE') as $individual) { $content .= '<a href="' . $individual->getHtmlUrl() . '">' . I18N::translate('View this individual') . ' — ' . $individual->getFullName() . '</a><br>'; } foreach ($random_media->linkedFamilies('OBJE') as $family) { $content .= '<a href="' . $family->getHtmlUrl() . '">' . I18N::translate('View this family') . ' — ' . $family->getFullName() . '</a><br>'; } foreach ($random_media->linkedSources('OBJE') as $source) { $content .= '<a href="' . $source->getHtmlUrl() . '">' . I18N::translate('View this source') . ' — ' . $source->getFullName() . '</a><br>'; } $content .= '<br><div class="indent">'; $content .= FunctionsPrint::printFactNotes($random_media->getGedcom(), "1", false); $content .= '</div>'; $content .= '</td></tr></table>'; $content .= '</div>'; // random_picture_content $content .= '</div>'; // random_picture_container } else { $content = I18N::translate('This family tree has no images to display.'); } if ($template) { return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
/** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Module\CkeditorModule; define('WT_SCRIPT_NAME', 'block_edit.php'); require './includes/session.php'; $block_id = Filter::getInteger('block_id'); $block = Database::prepare("SELECT SQL_CACHE * FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOneRow(); // 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);
/** * Generate the HTML content of this block. * * @param int $block_id * @param bool $template * @param string[] $cfg * * @return string */ public function getBlock($block_id, $template = true, $cfg = array()) { global $WT_TREE, $ctype; $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1'); $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1'); $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1'); $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1'); $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1'); $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1'); $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1'); $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1'); $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1'); $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1'); $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1'); $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1'); $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1'); $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1'); $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1'); $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1'); $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1'); $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1'); // This can be overriden when embedding in an HTML block $block = '0'; $stat_link = '1'; foreach (array('show_common_surnames', 'stat_indi', 'stat_fam', 'stat_sour', 'stat_media', 'stat_surname', 'stat_events', 'stat_users', 'stat_first_birth', 'stat_last_birth', 'stat_first_death', 'stat_last_death', 'stat_long_life', 'stat_avg_life', 'stat_most_chil', 'stat_avg_chil', 'stat_link', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; } else { $title = ''; } $title .= $this->getTitle(); $stats = new Stats($WT_TREE); $content = '<b>' . $WT_TREE->getTitleHtml() . '</b><br>'; if ($show_last_update) { $content .= '<div>' . I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</div>'; } /** Responsive Design */ $content .= '<div class="stat-table1">'; if ($stat_indi) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Individuals') . '</div><div class="facts_value stats_value stat-cell"><a href="' . "indilist.php?surname_sublist=no&ged=" . $WT_TREE->getNameUrl() . '">' . $stats->totalIndividuals() . '</a></div></div>'; $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Males') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalSexMales() . '<br>' . $stats->totalSexMalesPercentage() . '</div></div>'; $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Females') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalSexFemales() . '<br>' . $stats->totalSexFemalesPercentage() . '</div></div>'; } if ($stat_surname) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total surnames') . '</div><div class="facts_value stats_value stat-cell"><a href="indilist.php?show_all=yes&surname_sublist=yes&ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSurnames() . '</a></div></div>'; } if ($stat_fam) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Families') . '</div><div class="facts_value stats_value stat-cell"><a href="famlist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalFamilies() . '</a></div></div>'; } if ($stat_sour) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Sources') . '</div><div class="facts_value stats_value stat-cell"><a href="sourcelist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSources() . '</a></div></div>'; } if ($stat_media) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Media objects') . '</div><div class="facts_value stats_value stat-cell"><a href="medialist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalMedia() . '</a></div></div>'; } if ($stat_repo) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Repositories') . '</div><div class="facts_value stats_value stat-cell"><a href="repolist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalRepositories() . '</a></div></div>'; } if ($stat_events) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total events') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalEvents() . '</div></div>'; } if ($stat_users) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total users') . '</div><div class="facts_value stats_value stat-cell">'; if (Auth::isManager($WT_TREE)) { $content .= '<a href="admin_users.php">' . $stats->totalUsers() . '</a>'; } else { $content .= $stats->totalUsers(); } $content .= '</div></div>'; } if (!$block) { $content .= '</div><div class="facts_table stat-table2">'; } if ($stat_first_birth) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Earliest birth year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->firstBirthYear() . '</div>'; if (!$block) { $content .= '<div class="facts_value stat-cell left">' . $stats->firstBirth() . '</div>'; } $content .= '</div>'; } if ($stat_last_birth) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Latest birth year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->lastBirthYear() . '</div>'; if (!$block) { $content .= '<div class="facts_value stat-cell left">' . $stats->lastBirth() . '</div>'; } $content .= '</div>'; } if ($stat_first_death) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Earliest death year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->firstDeathYear() . '</div>'; if (!$block) { $content .= '<div class="facts_value stat-cell left">' . $stats->firstDeath() . '</div>'; } $content .= '</div>'; } if ($stat_last_death) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Latest death year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->lastDeathYear() . '</div>'; if (!$block) { $content .= '<div class="facts_value stat-cell left">' . $stats->lastDeath() . '</div>'; } $content .= '</div>'; } if ($stat_long_life) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Individual who lived the longest') . '</div><div class="facts_value stats_value stat-cell">' . $stats->longestLifeAge() . '</div>'; if (!$block) { $content .= '<div class="facts_value stat-cell left">' . $stats->longestLife() . '</div>'; } $content .= '</div>'; } if ($stat_avg_life) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Average age at death') . '</div><div class="facts_value stats_value stat-cell">' . $stats->averageLifespan() . '</div>'; if (!$block) { $content .= '<div class="facts_value stat-cell left">' . I18N::translate('Males') . ': ' . $stats->averageLifespanMale(); $content .= ' ' . I18N::translate('Females') . ': ' . $stats->averageLifespanFemale() . '</div>'; } $content .= '</div>'; } if ($stat_most_chil && !$block) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Family with the most children') . '</div><div class="facts_value stats_value stat-cell">' . $stats->largestFamilySize() . '</div>'; if (!$block) { $content .= '<div class="facts_value stat-cell left">' . $stats->largestFamily() . '</div>'; } $content .= '</div>'; } if ($stat_avg_chil) { $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Average number of children per family') . '</div><div class="facts_value stats_value stat-cell">' . $stats->averageChildren() . '</div>'; if (!$block) { $content .= '<div class="facts_value stat-cell left"></div>'; } $content .= '</div>'; } $content .= '</div>'; if ($stat_link) { $content .= '<div class="clearfloat"><a href="statistics.php?ged=' . $WT_TREE->getNameUrl() . '" rel="nofollow"><b>' . I18N::translate('View statistics as graphs') . '</b></a></div>'; } if ($show_common_surnames) { $surnames = FunctionsDb::getCommonSurnames($WT_TREE->getPreference('COMMON_NAMES_THRESHOLD'), $WT_TREE); if (count($surnames) > 0) { $content .= '<div class="clearfloat"><p><b>' . I18N::translate('Most common surnames') . '</b></p>'; $content .= '<div class="common_surnames">'; $i = 0; foreach ($surnames as $indexval => $surname) { if (stristr($surname['name'], '@N.N') === false) { if ($i > 0) { $content .= ', '; } $content .= '<a href="' . "indilist.php?ged=" . $WT_TREE->getNameUrl() . "&surname=" . rawurlencode($surname['name']) . '">' . $surname['name'] . '</a>'; $i++; } } $content .= '</div>'; } } if ($template) { return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
$controller->setPageTitle(I18N::translate('Change the “My page” blocks')); $can_reset = true; } } else { if ($gedcom_id < 0) { $controller->setPageTitle(I18N::translate('Set the default blocks for new family trees')); $can_reset = false; } else { $controller->setPageTitle(I18N::translate('Change the “Home page” blocks')); $can_reset = true; } } // 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(Tree::findById($gedcom_id)) || $user_id && Auth::id() != $user_id && !Auth::isAdmin()) { header('Location: ' . WT_BASE_URL); return; } $action = Filter::get('action'); if ($can_reset && Filter::post('default') === '1') { if ($user_id) { $defaults = FunctionsDb::getUserBlocks(-1); } else { $defaults = FunctionsDb::getTreeBlocks(-1); } $main = $defaults['main']; $right = $defaults['side']; } else { if (isset($_REQUEST['main'])) { $main = $_REQUEST['main'];
* 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> </ol>
* 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_check.php'); require './includes/session.php'; $controller = new PageController(); $controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Check for errors') . ' — ' . $WT_TREE->getTitleHtml())->pageHeader(); // We need to work with raw GEDCOM data, as we are looking for errors // which may prevent the GedcomRecord objects from working. $rows = Database::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_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchAll(); $records = array(); foreach ($rows as $row) { $records[$row->xref] = $row; } // Need to merge pending new/changed/deleted records $rows = Database::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_TREE->getTreeId()))->fetchAll(); foreach ($rows as $row) { if ($row->gedrec) { // new/updated record $records[$row->xref] = $row; } else { // deleted record
*/ 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\FunctionsPrint; define('WT_SCRIPT_NAME', 'admin_site_merge.php'); require './includes/session.php'; $controller = new PageController(); $controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Merge records') . ' — ' . $WT_TREE->getTitleHtml())->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); $gid1 = Filter::post('gid1', WT_REGEX_XREF, Filter::get('gid1', WT_REGEX_XREF)); $gid2 = Filter::post('gid2', WT_REGEX_XREF, Filter::get('gid2', WT_REGEX_XREF)); $keep1 = Filter::postArray('keep1'); $keep2 = Filter::postArray('keep2'); $rec1 = GedcomRecord::getInstance($gid1, $WT_TREE); $rec2 = GedcomRecord::getInstance($gid2, $WT_TREE); if ($gid1 && !$rec1) { FlashMessages::addMessage(I18N::translate('%1$s does not exist.', $gid1), 'danger'); } if ($gid2 && !$rec2) { FlashMessages::addMessage(I18N::translate('%1$s does not exist.', $gid2), 'danger'); } if ($rec1 && $rec2 && $rec1->getXref() === $rec2->getXref()) { FlashMessages::addMessage(I18N::translate('You entered the same IDs. You cannot merge the same records.'), 'danger'); }
$record = Family::getInstance($row->xref, $WT_TREE, $row->gedcom); foreach ($record->getFacts() as $fact) { $old_place = $fact->getAttribute('PLAC'); if (preg_match('/(^|, )' . preg_quote($search, '/') . '$/i', $old_place)) { $new_place = preg_replace('/(^|, )' . preg_quote($search, '/') . '$/i', '$1' . $replace, $old_place); $changes[$old_place] = $new_place; if ($confirm == 'update') { $gedcom = preg_replace('/(\\n2 PLAC (?:.*, )*)' . preg_quote($search, '/') . '(\\n|$)/i', '$1' . $replace . '$2', $fact->getGedcom()); $record->updateFact($fact->getFactId(), $gedcom, false); } } } } } $controller = new PageController(); $controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Update all the place names in a family tree') . ' — ' . $WT_TREE->getTitleHtml())->addInlineJavascript('autocomplete();')->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>
/** * Can we edit this record? * * @return bool */ public function canEdit() { return Auth::isManager($this->tree) || Auth::isEditor($this->tree) && strpos($this->gedcom, "\n1 RESN locked") === false; }
/** * Generate the HTML content of this block. * * @param int $block_id * @param bool $template * @param string[] $cfg * * @return string */ public function getBlock($block_id, $template = true, $cfg = array()) { global $WT_TREE, $ctype; $COMMON_NAMES_REMOVE = $WT_TREE->getPreference('COMMON_NAMES_REMOVE'); $COMMON_NAMES_THRESHOLD = $WT_TREE->getPreference('COMMON_NAMES_THRESHOLD'); $num = $this->getBlockSetting($block_id, 'num', '10'); $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table'); $block = $this->getBlockSetting($block_id, 'block', '0'); foreach (array('num', 'infoStyle', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } // This next function is a bit out of date, and doesn't cope well with surname variants $top_surnames = FunctionsDb::getTopSurnames($WT_TREE->getTreeId(), $COMMON_NAMES_THRESHOLD, $num); // Remove names found in the "Remove Names" list if ($COMMON_NAMES_REMOVE) { foreach (preg_split("/[,; ]+/", $COMMON_NAMES_REMOVE) as $delname) { unset($top_surnames[$delname]); unset($top_surnames[I18N::strtoupper($delname)]); } } $all_surnames = array(); $i = 0; foreach (array_keys($top_surnames) as $top_surname) { $all_surnames = array_merge($all_surnames, QueryName::surnames($WT_TREE, $top_surname, '', false, false)); if (++$i == $num) { break; } } if ($i < $num) { $num = $i; } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; } else { $title = ''; } if ($num == 1) { // I18N: i.e. most popular surname. $title .= I18N::translate('Top surname'); } else { // I18N: Title for a list of the most common surnames, %s is a number. Note that a separate translation exists when %s is 1 $title .= I18N::plural('Top %s surname', 'Top %s surnames', $num, I18N::number($num)); } switch ($infoStyle) { case 'tagcloud': uksort($all_surnames, '\\Fisharebest\\Webtrees\\I18N::strcasecmp'); $content = FunctionsPrintLists::surnameTagCloud($all_surnames, 'indilist.php', true, $WT_TREE); break; case 'list': uasort($all_surnames, '\\Fisharebest\\Webtrees\\Module\\TopSurnamesModule::surnameCountSort'); $content = FunctionsPrintLists::surnameList($all_surnames, '1', true, 'indilist.php', $WT_TREE); break; case 'array': uasort($all_surnames, '\\Fisharebest\\Webtrees\\Module\\TopSurnamesModule::surnameCountSort'); $content = FunctionsPrintLists::surnameList($all_surnames, '2', true, 'indilist.php', $WT_TREE); break; case 'table': default: uasort($all_surnames, '\\Fisharebest\\Webtrees\\Module\\TopSurnamesModule::surnameCountSort'); $content = FunctionsPrintLists::surnameTable($all_surnames, 'indilist.php', $WT_TREE); break; } if ($template) { if ($block) { $class .= ' small_inner_block'; } return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
echo I18N::translate('Manage family trees'); ?> </li> </ol> <h1><?php echo $controller->getPageTitle(); ?> </h1> <div class="panel-group" id="accordion" role="tablist"> <?php foreach ($all_trees as $tree) { ?> <?php if (Auth::isManager($tree)) { ?> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="panel-tree-<?php echo $tree->getTreeId(); ?> "> <h2 class="panel-title"> <i class="fa fa-fw fa-tree"></i> <a data-toggle="collapse" data-parent="#accordion" href="#tree-<?php echo $tree->getTreeId(); ?> " aria-expanded="true" aria-controls="tree-<?php echo $tree->getTreeId(); ?> ">
/** * Generate a menu item for the control panel. * * @return Menu|null */ protected function menuControlPanel() { if (Auth::isManager($this->tree)) { return new Menu(I18N::translate('Control panel'), 'admin.php', 'menu-admin'); } else { return null; } }
* 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())); Database::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_TREE->getTreeId()));
* 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_config.php'); require './includes/session.php'; $controller = new PageController(); $controller->restrictAccess(Auth::isManager($WT_TREE)); $calendars = array('none' => I18N::translate('No calendar conversion')) + Date::calendarNames(); $french_calendar_start = new Date('22 SEP 1792'); $french_calendar_end = new Date('31 DEC 1805'); $gregorian_calendar_start = new Date('15 OCT 1582'); $hide_show = array(0 => I18N::translate('hide'), 1 => I18N::translate('show')); $surname_list_styles = array('style1' => I18N::translate('list'), 'style2' => I18N::translate('table'), 'style3' => I18N::translate('tag cloud')); $layouts = array(0 => I18N::translate('Portrait'), 1 => I18N::translate('Landscape')); $one_to_nine = array(); for ($n = 1; $n <= 9; ++$n) { $one_to_nine[$n] = I18N::number($n); } $formats = array('' => I18N::translate('none'), 'markdown' => I18N::translate('markdown')); $source_types = array(0 => I18N::translate('none'), 1 => I18N::translate('facts'), 2 => I18N::translate('records')); $no_yes = array(0 => I18N::translate('no'), 1 => I18N::translate('yes')); $PRIVACY_CONSTANTS = array('none' => I18N::translate('Show to visitors'), 'privacy' => I18N::translate('Show to members'), 'confidential' => I18N::translate('Show to managers'), 'hidden' => I18N::translate('Hide from everyone'));
*/ 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')); if (Auth::isAdmin()) {
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 }
* 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\AjaxController; use Fisharebest\Webtrees\Functions\FunctionsImport; use PDOException; define('WT_SCRIPT_NAME', 'import.php'); require './includes/session.php'; // 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 = Filter::getInteger('gedcom_id'); $tree = Tree::findById($gedcom_id); if (!$tree || !Auth::isManager($tree, Auth::user())) { http_response_code(403); return; } $controller = new AjaxController(); $controller->pageHeader(); // 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 Database::beginTransaction(); // Only allow one process to import each gedcom at a time Database::prepare("SELECT * FROM `##gedcom_chunk` WHERE gedcom_id=? FOR UPDATE")->execute(array($gedcom_id)); // What is the current import status? $row = Database::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) {
/** * Generate the HTML content of this block. * * @param int $block_id * @param bool $template * @param string[] $cfg * * @return string */ public function getBlock($block_id, $template = true, $cfg = array()) { global $ctype, $WT_TREE; $num = $this->getBlockSetting($block_id, 'num', '10'); $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table'); $block = $this->getBlockSetting($block_id, 'block', '0'); foreach (array('num', 'infoStyle', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } $stats = new Stats($WT_TREE); $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; } else { $title = ''; } if ($num == 1) { // I18N: i.e. most popular given name. $title .= I18N::translate('Top given name'); } else { // I18N: Title for a list of the most common given names, %s is a number. Note that a separate translation exists when %s is 1 $title .= I18N::plural('Top %s given name', 'Top %s given names', $num, I18N::number($num)); } $content = '<div class="normal_inner_block">'; //Select List or Table switch ($infoStyle) { case "list": // Output style 1: Simple list style. Better suited to left side of page. if (I18N::direction() === 'ltr') { $padding = 'padding-left: 15px'; } else { $padding = 'padding-right: 15px'; } $params = array(1, $num, 'rcount'); // List Female names $totals = $stats->commonGivenFemaleTotals($params); if ($totals) { $content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>'; } // List Male names $totals = $stats->commonGivenMaleTotals($params); if ($totals) { $content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>'; } break; case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page $params = array(1, $num, 'rcount'); $content .= '<table style="margin:auto;"> <tr valign="top"> <td>' . $stats->commonGivenFemaleTable($params) . '</td> <td>' . $stats->commonGivenMaleTable($params) . '</td>'; $content .= '</tr></table>'; break; } $content .= "</div>"; if ($template) { if ($block) { $class .= ' small_inner_block'; } return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
// Add a new, unlinked individual //////////////////////////////////////////////////////////////////////////////// case 'add_unlinked_indi': $controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Create a new individual'))->pageHeader(); print_indi_form('add_unlinked_indi_action', null, null, null, null, null); break; case 'add_unlinked_indi_action': $glevels = Filter::postArray('glevels', '[0-9]'); $tag = Filter::postArray('tag', WT_REGEX_TAG); $text = Filter::postArray('text'); $islink = Filter::postArray('islink', '[01]'); if (!Filter::checkCsrf()) { header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=add_unlinked_indi'); return; } $controller->restrictAccess(Auth::isManager($WT_TREE))->pageHeader(); FunctionsEdit::splitSource(); $gedrec = '0 @REF@ INDI'; $gedrec .= FunctionsEdit::addNewName(); $gedrec .= FunctionsEdit::addNewSex(); if (preg_match_all('/([A-Z0-9_]+)/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { $gedrec .= FunctionsEdit::addNewFact($match); } } if (Filter::postBool('SOUR_INDI')) { $gedrec = FunctionsEdit::handleUpdates($gedrec); } else { $gedrec = FunctionsEdit::updateRest($gedrec); } $new_indi = $WT_TREE->createRecord($gedrec);
/** * Are there any pending changes for us to approve? * * @return bool */ protected function pendingChangesExist() { return $this->tree && $this->tree->hasPendingEdit() && Auth::isManager($this->tree); }
/** * Generate the HTML content of this tab. * * @return string */ public function getTabContent() { global $WT_TREE, $controller; $html = '<div id="' . $this->getName() . '_content">'; //Show Lightbox-Album header Links if (Auth::isEditor($WT_TREE)) { $html .= '<table class="facts_table"><tr><td class="descriptionbox rela">'; // Add a new media object if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) { $html .= '<span><a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&linktoid=' . $controller->record->getXref() . '\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=780,width=600\');return false;">'; $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_add.png" id="head_icon" class="icon" title="' . I18N::translate('Add a new media object') . '" alt="' . I18N::translate('Add a new media object') . '">'; $html .= I18N::translate('Add a new media object'); $html .= '</a></span>'; // Link to an existing item $html .= '<span><a href="#" onclick="window.open(\'inverselink.php?linktoid=' . $controller->record->getXref() . '&linkto=person\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=300,width=450\');">'; $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_link.png" id="head_icon" class="icon" title="' . I18N::translate('Link to an existing media object') . '" alt="' . I18N::translate('Link to an existing media object') . '">'; $html .= I18N::translate('Link to an existing media object'); $html .= '</a></span>'; } if (Auth::isManager($WT_TREE) && $this->getMedia()) { // Popup Reorder Media $html .= '<span><a href="#" onclick="reorder_media(\'' . $controller->record->getXref() . '\')">'; $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/images.png" id="head_icon" class="icon" title="' . I18N::translate('Re-order media') . '" alt="' . I18N::translate('Re-order media') . '">'; $html .= I18N::translate('Re-order media'); $html .= '</a></span>'; } $html .= '</td></tr></table>'; } // Used when sorting media on album tab page $html .= '<table class="facts_table"><tr><td class="facts_value">'; // one-cell table - for presentation only $html .= '<ul class="album-list">'; foreach ($this->getMedia() as $media) { //View Edit Menu ---------------------------------- //Get media item Notes $haystack = $media->getGedcom(); $needle = '1 NOTE'; $before = substr($haystack, 0, strpos($haystack, $needle)); $after = substr(strstr($haystack, $needle), strlen($needle)); $notes = FunctionsPrint::printFactNotes($before . $needle . $after, 1, true); // Prepare Below Thumbnail menu ---------------------------------------------------- $menu = new Menu('<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">' . $media->getFullName() . '</div>'); $menu->addClass('', 'submenu'); // View Notes if (strpos($media->getGedcom(), "\n1 NOTE")) { $submenu = new Menu(I18N::translate('View notes'), '#', '', array('onclick' => 'modalNotes("' . Filter::escapeJs($notes) . '","' . I18N::translate('View notes') . '"); return false;')); $submenu->addClass("submenuitem"); $menu->addSubmenu($submenu); } //View Details $submenu = new Menu(I18N::translate('View details'), $media->getHtmlUrl()); $submenu->addClass("submenuitem"); $menu->addSubmenu($submenu); //View Sources foreach ($media->getFacts('SOUR') as $source_fact) { $source = $source_fact->getTarget(); if ($source && $source->canShow()) { $submenu = new Menu(I18N::translate('Source') . ' – ' . $source->getFullName(), $source->getHtmlUrl()); $submenu->addClass('submenuitem'); $menu->addSubmenu($submenu); } } if (Auth::isEditor($media->getTree())) { // Edit Media $submenu = new Menu(I18N::translate('Edit media'), '#', '', array('onclick' => 'return window.open("addmedia.php?action=editmedia&pid=' . $media->getXref() . '", "_blank", edit_window_specs);')); $submenu->addClass("submenuitem"); $menu->addSubmenu($submenu); if (Auth::isAdmin()) { if (Module::getModuleByName('GEDFact_assistant')) { $submenu = new Menu(I18N::translate('Manage links'), '#', '', array('onclick' => 'return window.open("inverselink.php?mediaid=' . $media->getXref() . '&linkto=manage", "_blank", find_window_specs);')); $submenu->addClass("submenuitem"); $menu->addSubmenu($submenu); } else { $submenu = new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","person");')); $submenu->addClass('submenuitem'); $menu->addSubmenu($submenu); $submenu = new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","family");')); $submenu->addClass('submenuitem'); $menu->addSubmenu($submenu); $submenu = new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","source");')); $submenu->addClass('submenuitem'); $menu->addSubmenu($submenu); } $submenu = new Menu(I18N::translate('Unlink media'), '#', '', array('onclick' => 'return unlink_media("' . I18N::translate('Are you sure you want to remove links to this media object?') . '", "' . $controller->record->getXref() . '", "' . $media->getXref() . '");')); $submenu->addClass("submenuitem"); $menu->addSubmenu($submenu); } } $html .= '<li class="album-list-item">'; $html .= '<div class="album-image">' . $media->displayImage() . '</div>'; $html .= '<div class="album-title">' . $menu->getMenu() . '</div>'; $html .= '</li>'; } $html .= '</ul>'; $html .= '</td></tr></table>'; return $html; }
/** * Show a list of FAQs */ private function show() { global $controller, $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Frequently asked questions'))->pageHeader(); $faqs = Database::prepare("SELECT block_id, bs1.setting_value AS header, bs2.setting_value AS body, bs3.setting_value AS languages" . " FROM `##block` b" . " JOIN `##block_setting` bs1 USING (block_id)" . " JOIN `##block_setting` bs2 USING (block_id)" . " JOIN `##block_setting` bs3 USING (block_id)" . " WHERE module_name = :module_name" . " AND bs1.setting_name = 'header'" . " AND bs2.setting_name = 'faqbody'" . " AND bs3.setting_name = 'languages'" . " AND IFNULL(gedcom_id, :tree_id_1) = :tree_id_2" . " ORDER BY block_order")->execute(array('module_name' => $this->getName(), 'tree_id_1' => $WT_TREE->getTreeId(), 'tree_id_2' => $WT_TREE->getTreeId()))->fetchAll(); // Define your colors for the alternating rows echo '<h2 class="center">', I18N::translate('Frequently asked questions'), '</h2>'; // Instructions echo '<div class="faq_italic">', I18N::translate('Click on a title to go straight to it, or scroll down to read them all.'); if (Auth::isManager($WT_TREE)) { echo '<div class="faq_edit"><a href="module.php?mod=', $this->getName(), '&mod_action=admin_config">', I18N::translate('Click here to add, edit, or delete'), '</a></div>'; } echo '</div>'; $row_count = 0; echo '<table class="faq">'; // List of titles foreach ($faqs as $id => $faq) { if (!$faq->languages || in_array(WT_LOCALE, explode(',', $faq->languages))) { $row_color = $row_count % 2 ? 'odd' : 'even'; // NOTE: Print the header of the current item echo '<tr class="', $row_color, '"><td style="padding: 5px;">'; echo '<a href="#faq', $id, '">', $faq->header, '</a>'; echo '</td></tr>'; $row_count++; } } echo '</table><hr>'; // Detailed entries foreach ($faqs as $id => $faq) { if (!$faq->languages || in_array(WT_LOCALE, explode(',', $faq->languages))) { echo '<div class="faq_title" id="faq', $id, '">', $faq->header; echo '<div class="faq_top faq_italic">'; echo '<a href="#content">', I18N::translate('back to top'), '</a>'; echo '</div>'; echo '</div>'; echo '<div class="faq_body">', substr($faq->body, 0, 1) == '<' ? $faq->body : nl2br($faq->body, false), '</div>'; echo '<hr>'; } } }
*/ 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') { $temp_dir = WT_DATA_DIR . 'tmp-' . $WT_TREE->getName() . '-' . date('YmdHis') . '/';
/** * A form to choose the download options. * * @param ClippingsCartController $clip_ctrl * * @return string */ public function downloadForm(ClippingsCartController $clip_ctrl) { global $WT_TREE; $pid = Filter::get('pid', WT_REGEX_XREF); $out = '<script>'; $out .= 'function cancelDownload() { var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=clippings&pid=' . $pid . '"; jQuery("#sb_clippings_content").load(link); }'; $out .= '</script>'; $out .= '<form method="get" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="pid" value="' . $pid . '"> <input type="hidden" name="action" value="download"> <table> <tr><td colspan="2" class="topbottombar"><h2>' . I18N::translate('Download') . '</h2></td></tr> <tr><td class="descriptionbox width50 wrap">' . I18N::translate('Zip file(s)') . '</td> <td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr> <tr><td class="descriptionbox width50 wrap">' . I18N::translate('Include media (automatically zips files)') . '</td> <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr> '; if (Auth::isManager($WT_TREE)) { $out .= '<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' . '<td class="optionbox">' . '<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' . '<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' . '<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' . '<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') . '</td></tr>'; } elseif (Auth::isMember($WT_TREE)) { $out .= '<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' . '<td class="list_value">' . '<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' . '<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') . '</td></tr>'; } $out .= ' <tr><td class="descriptionbox width50 wrap">' . I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td> <td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr> <tr> <td class="descriptionbox width50 wrap">' . I18N::translate('Add the GEDCOM media path to filenames') . '</td> <td class="optionbox"> <input type="checkbox" name="conv_path" value="' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '"> <span dir="auto">' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</span></td> </tr> <input type="hidden" name="conv_path" value="' . $clip_ctrl->conv_path . '"> </td></tr> <tr><td class="topbottombar" colspan="2"> <input type="button" value="' . I18N::translate('Cancel') . '" onclick="cancelDownload();"> <input type="submit" value="' . I18N::translate('Download') . '"> </form>'; return $out; }