public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'gedcom', WT_Filter::post('gedcom')); set_block_setting($block_id, 'title', WT_Filter::post('title')); set_block_setting($block_id, 'html', WT_Filter::post('html')); set_block_setting($block_id, 'show_timestamp', WT_Filter::postBool('show_timestamp')); set_block_setting($block_id, 'timestamp', WT_Filter::post('timestamp')); $languages = array(); foreach (WT_I18N::installed_languages() as $code => $name) { if (WT_Filter::postBool('lang_' . $code)) { $languages[] = $code; } } set_block_setting($block_id, 'languages', implode(',', $languages)); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $templates = array(WT_I18N::translate('Keyword examples') => '#getAllTagsTable#', WT_I18N::translate('Narrative description') => WT_I18N::translate('This GEDCOM (family tree) was last updated on #gedcomUpdated#. There are #totalSurnames# surnames in this family tree. The earliest recorded event is the #firstEventType# of #firstEventName# in #firstEventYear#. The most recent event is the #lastEventType# of #lastEventName# in #lastEventYear#.<br><br>If you have any comments or feedback please contact #contactWebmaster#.'), WT_I18N::translate('Statistics') => '<div class="gedcom_stats"> <span style="font-weight: bold"><a href="index.php?command=gedcom">#gedcomTitle#</a></span><br> ' . WT_I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') . ' <table id="keywords"> <tr> <td valign="top" class="width20"> <table cellspacing="1" cellpadding="0"> <tr> <td class="facts_label">' . WT_I18N::translate('Individuals') . '</td> <td class="facts_value" align="right"><a href="indilist.php?surname_sublist=no">#totalIndividuals#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Males') . '</td> <td class="facts_value" align="right">#totalSexMales#<br>#totalSexMalesPercentage#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Females') . '</td> <td class="facts_value" align="right">#totalSexFemales#<br>#totalSexFemalesPercentage#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Total surnames') . '</td> <td class="facts_value" align="right"><a href="indilist.php?show_all=yes&surname_sublist=yes&ged=' . WT_GEDURL . '">#totalSurnames#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Families') . '</td> <td class="facts_value" align="right"><a href="famlist.php?ged=' . WT_GEDURL . '">#totalFamilies#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Sources') . '</td> <td class="facts_value" align="right"><a href="sourcelist.php?ged=' . WT_GEDURL . '">#totalSources#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Media objects') . '</td> <td class="facts_value" align="right"><a href="medialist.php?ged=' . WT_GEDURL . '">#totalMedia#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Repositories') . '</td> <td class="facts_value" align="right"><a href="repolist.php?ged=' . WT_GEDURL . '">#totalRepositories#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Total events') . '</td> <td class="facts_value" align="right">#totalEvents#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Total users') . '</td> <td class="facts_value" align="right">#totalUsers#</td> </tr> </table> </td> <td><br></td> <td valign="top"> <table cellspacing="1" cellpadding="0" border="0"> <tr> <td class="facts_label">' . WT_I18N::translate('Earliest birth year') . '</td> <td class="facts_value" align="right">#firstBirthYear#</td> <td class="facts_value">#firstBirth#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Latest birth year') . '</td> <td class="facts_value" align="right">#lastBirthYear#</td> <td class="facts_value">#lastBirth#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Earliest death year') . '</td> <td class="facts_value" align="right">#firstDeathYear#</td> <td class="facts_value">#firstDeath#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Latest death year') . '</td> <td class="facts_value" align="right">#lastDeathYear#</td> <td class="facts_value">#lastDeath#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Individual who lived the longest') . '</td> <td class="facts_value" align="right">#longestLifeAge#</td> <td class="facts_value">#longestLife#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Average age at death') . '</td> <td class="facts_value" align="right">#averageLifespan#</td> <td class="facts_value"></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Family with the most children') . '</td> <td class="facts_value" align="right">#largestFamilySize#</td> <td class="facts_value">#largestFamily#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Average number of children per family') . '</td> <td class="facts_value" align="right">#averageChildren#</td> <td class="facts_value"></td> </tr> </table> </td> </tr> </table><br> <span style="font-weight: bold">' . WT_I18N::translate('Most common surnames') . '</span><br> #commonSurnames# </div>'); $title = get_block_setting($block_id, 'title'); $html = get_block_setting($block_id, 'html'); // title echo '<tr><td class="descriptionbox wrap">', WT_Gedcom_Tag::getLabel('TITL'), '</td><td class="optionbox"><input type="text" name="title" size="30" value="', WT_Filter::escapeHtml($title), '"></td></tr>'; // templates echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Templates'), help_link('block_html_template', $this->getName()), '</td><td class="optionbox">'; // The CK editor needs lots of help to load/save data :-( if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { $ckeditor_onchange = 'CKEDITOR.instances.html.setData(document.block.html.value);'; } else { $ckeditor_onchange = ''; } echo '<select name="template" onchange="document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;', $ckeditor_onchange, '">'; echo '<option value="', WT_Filter::escapeHtml($html), '">', WT_I18N::translate('Custom'), '</option>'; foreach ($templates as $title => $template) { echo '<option value="', WT_Filter::escapeHtml($template), '">', $title, '</option>'; } echo '</select></td></tr>'; // gedcom $gedcom = get_block_setting($block_id, 'gedcom'); if (count(WT_Tree::getAll()) > 1) { if ($gedcom == '__current__') { $sel_current = ' selected="selected"'; } else { $sel_current = ''; } if ($gedcom == '__default__') { $sel_default = ' selected="selected"'; } else { $sel_default = ''; } echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Family tree'), '</td><td class="optionbox">', '<select name="gedcom">', '<option value="__current__"', $sel_current, '>', WT_I18N::translate('Current'), '</option>', '<option value="__default__"', $sel_default, '>', WT_I18N::translate('Default'), '</option>'; foreach (WT_Tree::getAll() as $tree) { if ($tree->tree_name == $gedcom) { $sel = ' selected="selected"'; } else { $sel = ''; } echo '<option value="', $tree->tree_name, '"', $sel, ' dir="auto">', $tree->tree_title_html, '</option>'; } echo '</select></td></tr>'; } // html echo '<tr><td colspan="2" class="descriptionbox">', WT_I18N::translate('Content'), help_link('block_html_content', $this->getName()), '</td></tr><tr>', '<td colspan="2" class="optionbox">'; echo '<textarea name="html" class="html-edit" rows="10" style="width:98%;">', WT_Filter::escapeHtml($html), '</textarea>'; echo '</td></tr>'; $show_timestamp = get_block_setting($block_id, 'show_timestamp', false); echo '<tr><td class="descriptionbox wrap">'; echo WT_I18N::translate('Show the date and time of update'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('show_timestamp', $show_timestamp); echo '<input type="hidden" name="timestamp" value="', WT_TIMESTAMP, '">'; echo '</td></tr>'; $languages = get_block_setting($block_id, 'languages'); echo '<tr><td class="descriptionbox wrap">'; echo WT_I18N::translate('Show this block for which languages?'); echo '</td><td class="optionbox">'; echo edit_language_checkboxes('lang_', $languages); echo '</td></tr>'; }
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10)); set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|array|table|tagcloud', 'table')); set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $num = get_block_setting($block_id, 'num', 10); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Number of items to show'); echo '</td><td class="optionbox">'; echo '<input type="text" name="num" size="2" value="', $num, '">'; echo '</td></tr>'; $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('bullet list'), 'array' => WT_I18N::translate('compact list'), 'table' => WT_I18N::translate('table'), 'tagcloud' => WT_I18N::translate('tag cloud')), null, $infoStyle, ''); echo '</td></tr>'; $block = get_block_setting($block_id, 'block', false); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('block', $block); echo '</td></tr>'; }
private function edit() { require_once WT_ROOT . 'includes/functions/functions_edit.php'; if (WT_USER_CAN_EDIT) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { $block_id = WT_Filter::postInteger('block_id'); if ($block_id) { WT_DB::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $block_id)); } else { WT_DB::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0)); $block_id = WT_DB::getInstance()->lastInsertId(); } set_block_setting($block_id, 'title', WT_Filter::post('title')); set_block_setting($block_id, 'story_body', WT_Filter::post('story_body')); $languages = array(); foreach (WT_I18N::installed_languages() as $code => $name) { if (WT_Filter::postBool('lang_' . $code)) { $languages[] = $code; } } set_block_setting($block_id, 'languages', implode(',', $languages)); $this->config(); } else { $block_id = WT_Filter::getInteger('block_id'); $controller = new WT_Controller_Page(); if ($block_id) { $controller->setPageTitle(WT_I18N::translate('Edit story')); $title = get_block_setting($block_id, 'title'); $story_body = get_block_setting($block_id, 'story_body'); $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); $xref = WT_DB::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); } else { $controller->setPageTitle(WT_I18N::translate('Add a story')); $title = ''; $story_body = ''; $gedcom_id = WT_GED_ID; $xref = WT_Filter::get('xref', WT_REGEX_XREF); } $controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();'); if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { ckeditor_WT_Module::enableEditor($controller); } echo '<form name="story" method="post" action="module.php?mod=', $this->getName(), '&mod_action=admin_edit">'; echo WT_Filter::getCsrf(); echo '<input type="hidden" name="save" value="1">'; echo '<input type="hidden" name="block_id" value="', $block_id, '">'; echo '<input type="hidden" name="gedcom_id" value="', WT_GED_ID, '">'; echo '<table id="story_module">'; echo '<tr><th>'; echo WT_I18N::translate('Story title'); echo '</th></tr><tr><td><textarea name="title" rows="1" cols="90" tabindex="2">', WT_Filter::escapeHtml($title), '</textarea></td></tr>'; echo '<tr><th>'; echo WT_I18N::translate('Story'); echo '</th></tr><tr><td>'; echo '<textarea name="story_body" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($story_body), '</textarea>'; echo '</td></tr>'; echo '</table><table id="story_module2">'; echo '<tr>'; echo '<th>', WT_I18N::translate('Individual'), '</th>'; echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>'; echo '</tr>'; echo '<tr>'; echo '<td class="optionbox">'; echo '<input data-autocomplete-type="INDI" type="text" name="xref" id="pid" size="4" value="' . $xref . '">'; echo print_findindi_link('pid'); if ($xref) { $person = WT_Individual::getInstance($xref); if ($person) { echo ' ', $person->format_list('span'); } } echo '</td>'; $languages = get_block_setting($block_id, 'languages'); echo '<td class="optionbox">'; echo edit_language_checkboxes('lang_', $languages); echo '</td></tr></table>'; echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">'; echo '</p>'; echo '</form>'; exit; } } else { header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH); exit; } }
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'show_other', WT_Filter::postBool('show_other')); set_block_setting($block_id, 'show_unassigned', WT_Filter::postBool('show_unassigned')); set_block_setting($block_id, 'show_future', WT_Filter::postBool('show_future')); set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $show_other = get_block_setting($block_id, 'show_other', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show research tasks that are assigned to other users'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('show_other', $show_other); echo '</td></tr>'; $show_unassigned = get_block_setting($block_id, 'show_unassigned', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show research tasks that are not assigned to any user'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('show_unassigned', $show_unassigned); echo '</td></tr>'; $show_future = get_block_setting($block_id, 'show_future', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show research tasks that have a date in the future'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('show_future', $show_future); echo '</td></tr>'; $block = get_block_setting($block_id, 'block', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('block', $block); echo '</td></tr>'; }
define('WT_SCRIPT_NAME', 'addmedia.php'); require './includes/session.php'; require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $pid = WT_Filter::get('pid', WT_REGEX_XREF, WT_Filter::post('pid', WT_REGEX_XREF)); // edit this media object $linktoid = WT_Filter::get('linktoid', WT_REGEX_XREF, WT_Filter::post('linktoid', WT_REGEX_XREF)); // create a new media object, linked to this record $action = WT_Filter::get('action', null, WT_Filter::post('action')); $filename = WT_Filter::get('filename', null, WT_Filter::post('filename')); $text = WT_Filter::postArray('text'); $tag = WT_Filter::postArray('tag', WT_REGEX_TAG); $islink = WT_Filter::postArray('islink'); $glevels = WT_Filter::postArray('glevels', '[0-9]'); $folder = WT_Filter::post('folder'); $update_CHAN = !WT_Filter::postBool('preserve_last_changed'); $controller = new WT_Controller_Simple(); $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();')->restrictAccess(Auth::isMember()); $disp = true; $media = WT_Media::getInstance($pid); if ($media) { $disp = $media->canShow(); } if ($action == 'update' || $action == 'create') { if ($linktoid) { $disp = WT_GedcomRecord::getInstance($linktoid)->canShow(); } } if (!WT_USER_CAN_EDIT || !$disp) { $controller->pageHeader()->addInlineJavascript('closePopupAndReloadParent();'); exit;
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7)); set_block_setting($block_id, 'filter', WT_Filter::postBool('filter')); set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM')); set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table')); set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'alpha|anniv', 'alpha')); set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $days = get_block_setting($block_id, 'days', 7); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Number of days to show'); echo '</td><td class="optionbox">'; echo '<input type="text" name="days" size="2" value="', $days, '">'; echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>'; echo '</td></tr>'; $filter = get_block_setting($block_id, 'filter', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show only events of living individuals?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('filter', $filter); echo '</td></tr>'; $onlyBDM = get_block_setting($block_id, 'onlyBDM', false); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show only births, deaths, and marriages?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('onlyBDM', $onlyBDM); echo '</td></tr>'; $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Sort order'); echo '</td><td class="optionbox">'; echo select_edit_control('sortStyle', array('alpha' => WT_I18N::translate('sort by name'), 'anniv' => WT_I18N::translate('sort by date')), null, $sortStyle, ''); echo '</td></tr>'; $block = get_block_setting($block_id, 'block', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('block', $block); echo '</td></tr>'; }
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $block = get_block_setting($block_id, 'block', false); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('block', $block); echo '</td></tr>'; }
echo WT_I18N::translate('sort by date of marriage'); ?> "> <input type="button" class="cancel" value="<?php echo WT_I18N::translate('close'); ?> " onclick="window.close();"> </p> </form> </div> <?php break; case 'reorder_fams_update': $xref = WT_Filter::post('xref', WT_REGEX_XREF); $order = WT_Filter::post('order'); $keep_chan = WT_Filter::postBool('keep_chan'); if (!WT_Filter::checkCsrf()) { Zend_Session::writeClose(); header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=reorder_fams&xref=' . $xref); exit; } $person = WT_Individual::getInstance($xref); check_record_access($person); $controller->setPageTitle(WT_I18N::translate('Re-order families'))->pageHeader(); if (is_array($order)) { $gedcom = array('0 @' . $person->getXref() . '@ INDI'); $facts = $person->getFacts(); // Move families to the end of the record foreach ($order as $family => $num) { foreach ($facts as $n => $fact) { if ($fact->getValue() == '@' . $family . '@') {
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7)); set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table')); set_block_setting($block_id, 'calendar', WT_Filter::post('calendar', 'jewish|gregorian', 'jewish')); set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $days = get_block_setting($block_id, 'days', 7); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Number of days to show'); echo '</td><td class="optionbox">'; echo '<input type="text" name="days" size="2" value="' . $days . '">'; echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>'; echo '</td></tr>'; $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; $calendar = get_block_setting($block_id, 'calendar'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Calendar'); echo '</td><td class="optionbox">'; echo select_edit_control('calendar', array('jewish' => WT_Date_Jewish::calendarName(), 'gregorian' => WT_Date_Gregorian::calendarName()), null, $calendar, ''); echo '</td></tr>'; $block = get_block_setting($block_id, 'block', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('block', $block); echo '</td></tr>'; }
set_gedcom_setting(WT_GED_ID, 'SHOW_STATS', WT_Filter::postBool('NEW_SHOW_STATS')); set_gedcom_setting(WT_GED_ID, 'SOURCE_ID_PREFIX', WT_Filter::post('NEW_SOURCE_ID_PREFIX')); set_gedcom_setting(WT_GED_ID, 'SOUR_FACTS_ADD', str_replace(' ', '', WT_Filter::post('NEW_SOUR_FACTS_ADD'))); set_gedcom_setting(WT_GED_ID, 'SOUR_FACTS_QUICK', str_replace(' ', '', WT_Filter::post('NEW_SOUR_FACTS_QUICK'))); set_gedcom_setting(WT_GED_ID, 'SOUR_FACTS_UNIQUE', str_replace(' ', '', WT_Filter::post('NEW_SOUR_FACTS_UNIQUE'))); set_gedcom_setting(WT_GED_ID, 'SUBLIST_TRIGGER_I', WT_Filter::post('NEW_SUBLIST_TRIGGER_I', WT_REGEX_INTEGER, 200)); set_gedcom_setting(WT_GED_ID, 'SURNAME_LIST_STYLE', WT_Filter::post('NEW_SURNAME_LIST_STYLE')); set_gedcom_setting(WT_GED_ID, 'SURNAME_TRADITION', WT_Filter::post('NEW_SURNAME_TRADITION')); set_gedcom_setting(WT_GED_ID, 'THEME_DIR', WT_Filter::post('NEW_THEME_DIR')); set_gedcom_setting(WT_GED_ID, 'THUMBNAIL_WIDTH', WT_Filter::post('NEW_THUMBNAIL_WIDTH')); set_gedcom_setting(WT_GED_ID, 'USE_RIN', WT_Filter::postBool('NEW_USE_RIN')); set_gedcom_setting(WT_GED_ID, 'USE_SILHOUETTE', WT_Filter::postBool('NEW_USE_SILHOUETTE')); set_gedcom_setting(WT_GED_ID, 'WATERMARK_THUMB', WT_Filter::postBool('NEW_WATERMARK_THUMB')); set_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID', WT_Filter::post('NEW_WEBMASTER_USER_ID')); set_gedcom_setting(WT_GED_ID, 'WEBTREES_EMAIL', WT_Filter::post('NEW_WEBTREES_EMAIL')); set_gedcom_setting(WT_GED_ID, 'WORD_WRAPPED_NOTES', WT_Filter::postBool('NEW_WORD_WRAPPED_NOTES')); if (WT_Filter::post('gedcom_title')) { set_gedcom_setting(WT_GED_ID, 'title', WT_Filter::post('gedcom_title')); } // Only accept valid folders for NEW_MEDIA_DIRECTORY $NEW_MEDIA_DIRECTORY = preg_replace('/[\\/\\\\]+/', '/', WT_Filter::post('NEW_MEDIA_DIRECTORY') . '/'); if (substr($NEW_MEDIA_DIRECTORY, 0, 1) == '/') { $NEW_MEDIA_DIRECTORY = substr($NEW_MEDIA_DIRECTORY, 1); } if ($NEW_MEDIA_DIRECTORY) { if (is_dir(WT_DATA_DIR . $NEW_MEDIA_DIRECTORY)) { set_gedcom_setting(WT_GED_ID, 'MEDIA_DIRECTORY', $NEW_MEDIA_DIRECTORY); } elseif (@mkdir(WT_DATA_DIR . $NEW_MEDIA_DIRECTORY, 0755, true)) { set_gedcom_setting(WT_GED_ID, 'MEDIA_DIRECTORY', $NEW_MEDIA_DIRECTORY); WT_FlashMessages::addMessage(WT_I18N::translate('The folder %s was created.', WT_DATA_DIR . $NEW_MEDIA_DIRECTORY)); } else {
private function edit() { require_once WT_ROOT . 'includes/functions/functions_edit.php'; if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { $block_id = WT_Filter::postInteger('block_id'); if ($block_id) { WT_DB::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, '0'), block_order=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::postInteger('block_order'), $block_id)); } else { WT_DB::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, '0'), ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), $this->getName(), WT_Filter::postInteger('block_order'))); $block_id = WT_DB::getInstance()->lastInsertId(); } set_block_setting($block_id, 'header', WT_Filter::post('header')); set_block_setting($block_id, 'faqbody', WT_Filter::post('faqbody')); $languages = array(); foreach (WT_I18N::installed_languages() as $code => $name) { if (WT_Filter::postBool('lang_' . $code)) { $languages[] = $code; } } set_block_setting($block_id, 'languages', implode(',', $languages)); $this->config(); } else { $block_id = WT_Filter::getInteger('block_id'); $controller = new WT_Controller_Page(); if ($block_id) { $controller->setPageTitle(WT_I18N::translate('Edit FAQ item')); $header = get_block_setting($block_id, 'header'); $faqbody = get_block_setting($block_id, 'faqbody'); $block_order = WT_DB::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); } else { $controller->setPageTitle(WT_I18N::translate('Add an FAQ item')); $header = ''; $faqbody = ''; $block_order = WT_DB::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne(); $gedcom_id = WT_GED_ID; } $controller->pageHeader(); if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { ckeditor_WT_Module::enableEditor($controller); } // "Help for this page" link echo '<div id="page_help">', help_link('add_faq_item', $this->getName()), '</div>'; echo '<form name="faq" method="post" action="module.php?mod=', $this->getName(), '&mod_action=admin_edit">'; echo WT_Filter::getCsrf(); echo '<input type="hidden" name="save" value="1">'; echo '<input type="hidden" name="block_id" value="', $block_id, '">'; echo '<table id="faq_module">'; echo '<tr><th>'; echo WT_I18N::translate('Question'); echo '</th></tr><tr><td><input type="text" name="header" size="90" tabindex="1" value="' . WT_Filter::escapeHtml($header) . '"></td></tr>'; echo '<tr><th>'; echo WT_I18N::translate('Answer'); echo '</th></tr><tr><td>'; echo '<textarea name="faqbody" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($faqbody), '</textarea>'; echo '</td></tr>'; echo '</table><table id="faq_module2">'; echo '<tr>'; echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>'; echo '<th>', WT_I18N::translate('FAQ position'), help_link('add_faq_order', $this->getName()), '</th>'; echo '<th>', WT_I18N::translate('FAQ visibility'), help_link('add_faq_visibility', $this->getName()), '</th>'; echo '</tr><tr>'; echo '<td>'; $languages = get_block_setting($block_id, 'languages'); echo edit_language_checkboxes('lang_', $languages); echo '</td><td>'; echo '<input type="text" name="block_order" size="3" tabindex="3" value="', $block_order, '"></td>'; echo '</td><td>'; echo select_edit_control('gedcom_id', WT_Tree::getIdList(), WT_I18N::translate('All'), $gedcom_id, 'tabindex="4"'); echo '</td></tr>'; echo '</table>'; echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">'; echo '</form>'; exit; } }
function __construct() { parent::__construct(); // $action comes from GET (menus) or POST (form submission) $this->action = WT_Filter::post('action', 'advanced|general|soundex|replace'); if (!$this->action) { $this->action = WT_Filter::get('action', 'advanced|general|soundex|replace', 'general'); } $topsearch = WT_Filter::postBool('topsearch'); if ($topsearch) { $this->isPostBack = true; $this->srfams = 'yes'; $this->srindi = 'yes'; $this->srsour = 'yes'; $this->srnote = 'yes'; } // Get the query $this->query = WT_Filter::post('query', '.{2,}'); $this->myquery = WT_Filter::escapeHtml($this->query); $this->replace = WT_Filter::post('replace'); $this->replaceNames = WT_Filter::postBool('replaceNames'); $this->replacePlaces = WT_Filter::postBool('replacePlaces'); $this->replacePlacesWord = WT_Filter::postBool('replacePlacesWord'); $this->replaceAll = WT_Filter::postBool('replaceAll'); // TODO: fetch each variable independently, using appropriate validation // Aquire all the variables values from the $_REQUEST $varNames = array("isPostBack", "srfams", "srindi", "srsour", "srnote", "view", "soundex", "subaction", "nameprt", "showasso", "resultsPageNum", "resultsPerPage", "totalResults", "totalGeneralResults", "indiResultsPrinted", "famResultsPrinted", "srcResultsPrinted", "myindilist", "mysourcelist", "mynotelist", "myfamlist"); $this->setRequestValues($varNames); if (!$this->isPostBack) { // Enable the default gedcom for search $str = str_replace(array(".", "-", " "), array("_", "_", "_"), WT_GEDCOM); $_REQUEST["{$str}"] = $str; } // Retrieve the gedcoms to search in if (count(WT_Tree::getAll()) > 1 && WT_Site::getPreference('ALLOW_CHANGE_GEDCOM')) { foreach (WT_Tree::getAll() as $tree) { $str = str_replace(array(".", "-", " "), array("_", "_", "_"), $tree->tree_name); if (isset($_REQUEST["{$str}"]) || $topsearch) { $this->sgeds[$tree->tree_id] = $tree->tree_name; $_REQUEST["{$str}"] = 'yes'; } } } else { $this->sgeds[WT_GED_ID] = WT_GEDCOM; } // vars use for soundex search $this->firstname = WT_Filter::post('firstname'); $this->lastname = WT_Filter::post('lastname'); $this->place = WT_Filter::post('place'); $this->year = WT_Filter::post('year'); // Set the search result titles for soundex searches if ($this->firstname || $this->lastname || $this->place) { $this->myquery = WT_Filter::escapeHtml(implode(' ', array($this->firstname, $this->lastname, $this->place))); } if (!empty($_REQUEST["name"])) { $this->name = $_REQUEST["name"]; $this->myname = $this->name; } else { $this->name = ""; $this->myname = ""; } if (!empty($_REQUEST["birthdate"])) { $this->birthdate = $_REQUEST["birthdate"]; $this->mybirthdate = $this->birthdate; } else { $this->birthdate = ""; $this->mybirthdate = ""; } if (!empty($_REQUEST["birthplace"])) { $this->birthplace = $_REQUEST["birthplace"]; $this->mybirthplace = $this->birthplace; } else { $this->birthplace = ""; $this->mybirthplace = ""; } if (!empty($_REQUEST["deathdate"])) { $this->deathdate = $_REQUEST["deathdate"]; $this->mydeathdate = $this->deathdate; } else { $this->deathdate = ""; $this->mydeathdate = ""; } if (!empty($_REQUEST["deathplace"])) { $this->deathplace = $_REQUEST["deathplace"]; $this->mydeathplace = $this->deathplace; } else { $this->deathplace = ""; $this->mydeathplace = ""; } if (!empty($_REQUEST["gender"])) { $this->gender = $_REQUEST["gender"]; $this->mygender = $this->gender; } else { $this->gender = ""; $this->mygender = ""; } $this->inputFieldNames[] = "action"; $this->inputFieldNames[] = "isPostBack"; $this->inputFieldNames[] = "resultsPerPage"; $this->inputFieldNames[] = "query"; $this->inputFieldNames[] = "srindi"; $this->inputFieldNames[] = "srfams"; $this->inputFieldNames[] = "srsour"; $this->inputFieldNames[] = "srnote"; $this->inputFieldNames[] = "showasso"; $this->inputFieldNames[] = "firstname"; $this->inputFieldNames[] = "lastname"; $this->inputFieldNames[] = "place"; $this->inputFieldNames[] = "year"; $this->inputFieldNames[] = "soundex"; $this->inputFieldNames[] = "nameprt"; $this->inputFieldNames[] = "subaction"; $this->inputFieldNames[] = "name"; $this->inputFieldNames[] = "birthdate"; $this->inputFieldNames[] = "birthplace"; $this->inputFieldNames[] = "deathdate"; $this->inputFieldNames[] = "deathplace"; $this->inputFieldNames[] = "gender"; // Get the search results based on the action if ($topsearch) { $this->TopSearch(); } // If we want to show associated persons, build the list switch ($this->action) { case 'general': $this->setPageTitle(WT_I18N::translate('General search')); $this->GeneralSearch(); break; case 'soundex': $this->setPageTitle(WT_I18N::translate('Phonetic search')); $this->SoundexSearch(); break; case 'replace': $this->setPageTitle(WT_I18N::translate('Search and replace')); $this->SearchAndReplace(); return; } }
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10)); set_block_setting($block_id, 'count_placement', WT_Filter::post('count_placement', 'before|after', 'before')); set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $num = get_block_setting($block_id, 'num', 10); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Number of items to show'); echo '</td><td class="optionbox">'; echo '<input type="text" name="num" size="2" value="', $num, '">'; echo '</td></tr>'; $count_placement = get_block_setting($block_id, 'count_placement', 'left'); echo "<tr><td class=\"descriptionbox wrap width33\">"; echo WT_I18N::translate('Place counts before or after name?'); echo "</td><td class=\"optionbox\">"; echo select_edit_control('count_placement', array('before' => WT_I18N::translate('before'), 'after' => WT_I18N::translate('after')), null, $count_placement, ''); echo '</td></tr>'; $block = get_block_setting($block_id, 'block', false); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('block', $block); echo '</td></tr>'; }
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'limit', WT_Filter::post('limit')); set_block_setting($block_id, 'flag', WT_Filter::post('flag')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; // Limit Type $limit = get_block_setting($block_id, 'limit', 'nolimit'); echo '<tr><td class="descriptionbox wrap width33">', WT_I18N::translate('Limit display by:'), help_link('gedcom_news_limit'), '</td><td class="optionbox"><select name="limit"><option value="nolimit"', ($limit == 'nolimit' ? ' selected="selected"' : '') . ">", WT_I18N::translate('No limit') . "</option>", '<option value="date"' . ($limit == 'date' ? ' selected="selected"' : '') . ">" . WT_I18N::translate('Age of item') . "</option>", '<option value="count"' . ($limit == 'count' ? ' selected="selected"' : '') . ">" . WT_I18N::translate('Number of items') . "</option>", '</select></td></tr>'; // Flag to look for $flag = get_block_setting($block_id, 'flag', 0); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Limit:'), help_link('gedcom_news_flag'); echo '</td><td class="optionbox"><input type="text" name="flag" size="4" maxlength="4" value="' . $flag . '"></td></tr>'; }
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'filter', WT_Filter::post('filter', 'indi|event|all', 'all')); set_block_setting($block_id, 'controls', WT_Filter::postBool('controls')); set_block_setting($block_id, 'start', WT_Filter::postBool('start')); set_block_setting($block_id, 'filter_avi', WT_Filter::postBool('filter_avi')); set_block_setting($block_id, 'filter_bmp', WT_Filter::postBool('filter_bmp')); set_block_setting($block_id, 'filter_gif', WT_Filter::postBool('filter_gif')); set_block_setting($block_id, 'filter_jpeg', WT_Filter::postBool('filter_jpeg')); set_block_setting($block_id, 'filter_mp3', WT_Filter::postBool('filter_mp3')); set_block_setting($block_id, 'filter_ole', WT_Filter::postBool('filter_ole')); set_block_setting($block_id, 'filter_pcx', WT_Filter::postBool('filter_pcx')); set_block_setting($block_id, 'filter_pdf', WT_Filter::postBool('filter_pdf')); set_block_setting($block_id, 'filter_png', WT_Filter::postBool('filter_png')); set_block_setting($block_id, 'filter_tiff', WT_Filter::postBool('filter_tiff')); set_block_setting($block_id, 'filter_wav', WT_Filter::postBool('filter_wav')); set_block_setting($block_id, 'filter_audio', WT_Filter::postBool('filter_audio')); set_block_setting($block_id, 'filter_book', WT_Filter::postBool('filter_book')); set_block_setting($block_id, 'filter_card', WT_Filter::postBool('filter_card')); set_block_setting($block_id, 'filter_certificate', WT_Filter::postBool('filter_certificate')); set_block_setting($block_id, 'filter_coat', WT_Filter::postBool('filter_coat')); set_block_setting($block_id, 'filter_document', WT_Filter::postBool('filter_document')); set_block_setting($block_id, 'filter_electronic', WT_Filter::postBool('filter_electronic')); set_block_setting($block_id, 'filter_fiche', WT_Filter::postBool('filter_fiche')); set_block_setting($block_id, 'filter_film', WT_Filter::postBool('filter_film')); set_block_setting($block_id, 'filter_magazine', WT_Filter::postBool('filter_magazine')); set_block_setting($block_id, 'filter_manuscript', WT_Filter::postBool('filter_manuscript')); set_block_setting($block_id, 'filter_map', WT_Filter::postBool('filter_map')); set_block_setting($block_id, 'filter_newspaper', WT_Filter::postBool('filter_newspaper')); set_block_setting($block_id, 'filter_other', WT_Filter::postBool('filter_other')); set_block_setting($block_id, 'filter_painting', WT_Filter::postBool('filter_painting')); set_block_setting($block_id, 'filter_photo', WT_Filter::postBool('filter_photo')); set_block_setting($block_id, 'filter_tombstone', WT_Filter::postBool('filter_tombstone')); set_block_setting($block_id, 'filter_video', WT_Filter::postBool('filter_video')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $filter = get_block_setting($block_id, 'filter', 'all'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show only individuals, events, or all?'); echo '</td><td class="optionbox">'; echo select_edit_control('filter', array('indi' => WT_I18N::translate('Individuals'), 'event' => WT_I18N::translate('Facts and events'), 'all' => WT_I18N::translate('All')), null, $filter, ''); echo '</td></tr>'; $filters = array('avi' => get_block_setting($block_id, 'filter_avi', false), 'bmp' => get_block_setting($block_id, 'filter_bmp', true), 'gif' => get_block_setting($block_id, 'filter_gif', true), 'jpeg' => get_block_setting($block_id, 'filter_jpeg', true), 'mp3' => get_block_setting($block_id, 'filter_mp3', false), 'ole' => get_block_setting($block_id, 'filter_ole', true), 'pcx' => get_block_setting($block_id, 'filter_pcx', true), 'pdf' => get_block_setting($block_id, 'filter_pdf', false), 'png' => get_block_setting($block_id, 'filter_png', true), 'tiff' => get_block_setting($block_id, 'filter_tiff', true), 'wav' => get_block_setting($block_id, 'filter_wav', false), 'audio' => get_block_setting($block_id, 'filter_audio', false), 'book' => get_block_setting($block_id, 'filter_book', true), 'card' => get_block_setting($block_id, 'filter_card', true), 'certificate' => get_block_setting($block_id, 'filter_certificate', true), 'coat' => get_block_setting($block_id, 'filter_coat', true), 'document' => get_block_setting($block_id, 'filter_document', true), 'electronic' => get_block_setting($block_id, 'filter_electronic', true), 'fiche' => get_block_setting($block_id, 'filter_fiche', true), 'film' => get_block_setting($block_id, 'filter_film', true), 'magazine' => get_block_setting($block_id, 'filter_magazine', true), 'manuscript' => get_block_setting($block_id, 'filter_manuscript', true), 'map' => get_block_setting($block_id, 'filter_map', true), 'newspaper' => get_block_setting($block_id, 'filter_newspaper', true), 'other' => get_block_setting($block_id, 'filter_other', true), 'painting' => get_block_setting($block_id, 'filter_painting', true), 'photo' => get_block_setting($block_id, 'filter_photo', true), 'tombstone' => get_block_setting($block_id, 'filter_tombstone', true), 'video' => get_block_setting($block_id, 'filter_video', false)); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Filter'); ?> </td> <td class="optionbox"> <center><b><?php echo WT_Gedcom_Tag::getLabel('FORM'); ?> </b></center> <table class="width100"> <tr> <td class="width33"><input type="checkbox" value="yes" name="filter_avi" <?php if ($filters['avi']) { echo " checked=\"checked\""; } ?> > avi </td> <td class="width33"><input type="checkbox" value="yes" name="filter_bmp" <?php if ($filters['bmp']) { echo " checked=\"checked\""; } ?> > bmp </td> <td class="width33"><input type="checkbox" value="yes" name="filter_gif" <?php if ($filters['gif']) { echo " checked=\"checked\""; } ?> > gif </td> </tr> <tr> <td class="width33"><input type="checkbox" value="yes" name="filter_jpeg" <?php if ($filters['jpeg']) { echo " checked=\"checked\""; } ?> > jpeg </td> <td class="width33"><input type="checkbox" value="yes" name="filter_mp3" <?php if ($filters['mp3']) { echo " checked=\"checked\""; } ?> > mp3 </td> <td class="width33"><input type="checkbox" value="yes" name="filter_ole" <?php if ($filters['ole']) { echo " checked=\"checked\""; } ?> > ole </td> </tr> <tr> <td class="width33"><input type="checkbox" value="yes" name="filter_pcx" <?php if ($filters['pcx']) { echo " checked=\"checked\""; } ?> > pcx </td> <td class="width33"><input type="checkbox" value="yes" name="filter_pdf" <?php if ($filters['pdf']) { echo " checked=\"checked\""; } ?> > pdf </td> <td class="width33"><input type="checkbox" value="yes" name="filter_png" <?php if ($filters['png']) { echo " checked=\"checked\""; } ?> > png </td> </tr> <tr> <td class="width33"><input type="checkbox" value="yes" name="filter_tiff" <?php if ($filters['tiff']) { echo " checked=\"checked\""; } ?> > tiff </td> <td class="width33"><input type="checkbox" value="yes" name="filter_wav" <?php if ($filters['wav']) { echo " checked=\"checked\""; } ?> > wav </td> <td class="width33"> </td> <td class="width33"> </td> </tr> </table> <br> <center><b><?php echo WT_Gedcom_Tag::getLabel('TYPE'); ?> </b></center> <table class="width100"> <tr> <?php //-- Build the list of checkboxes $i = 0; foreach (WT_Gedcom_Tag::getFileFormTypes() as $typeName => $typeValue) { $i++; if ($i > 3) { $i = 1; echo "</tr><tr>"; } echo "<td class=\"width33\"><input type=\"checkbox\" value=\"yes\" name=\"filter_" . $typeName . "\""; if ($filters[$typeName]) { echo " checked=\"checked\""; } echo "> " . $typeValue . " </td>"; } ?> </tr> </table> </td> </tr> <?php $controls = get_block_setting($block_id, 'controls', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show slide show controls?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('controls', $controls); echo '</td></tr>'; $start = get_block_setting($block_id, 'start', false); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Start slide show on page load?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('start', $start); echo '</td></tr>'; }
$ALL_THEMES_DIRS = array(); foreach (get_theme_names() as $themename => $themedir) { $ALL_THEME_DIRS[] = $themedir; } // Extract form variables $form_action = WT_Filter::post('form_action'); $form_username = WT_Filter::post('form_username'); $form_realname = WT_Filter::post('form_realname'); $form_pass1 = WT_Filter::post('form_pass1', WT_REGEX_PASSWORD); $form_pass2 = WT_Filter::post('form_pass2', WT_REGEX_PASSWORD); $form_email = WT_Filter::postEmail('form_email'); $form_rootid = WT_Filter::post('form_rootid', WT_REGEX_XREF); $form_theme = WT_Filter::post('form_theme', implode('|', $ALL_THEME_DIRS)); $form_language = WT_Filter::post('form_language', implode('|', array_keys(WT_I18N::installed_languages())), WT_LOCALE); $form_contact_method = WT_Filter::post('form_contact_method'); $form_visible_online = WT_Filter::postBool('form_visible_online'); // Respond to form action if ($form_action == 'update' && WT_Filter::checkCsrf()) { if ($form_username != Auth::user()->getUserName() && User::findByIdentifier($form_username)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.')); } elseif ($form_email != Auth::user()->getEmail() && User::findByIdentifier($form_email)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address. A user with that email already exists.')); } else { // Change username if ($form_username != WT_USER_NAME) { Log::addAuthenticationLog('User ' . Auth::user()->getUserName() . ' renamed to ' . $form_username); Auth::user()->setUserName($form_username); } // Change password if ($form_pass1 && $form_pass1 == $form_pass2) { Auth::user()->setPassword($form_pass1);
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'days', WT_Filter::postInteger('num', 1, 180, 7)); set_block_setting($block_id, 'sendmail', WT_Filter::postBool('sendmail')); set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $sendmail = get_block_setting($block_id, 'sendmail', true); $days = get_block_setting($block_id, 'days', 7); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Send out reminder emails?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('sendmail', $sendmail); echo '<br>'; echo WT_I18N::translate('Reminder email frequency (days)') . " <input type='text' name='days' value='" . $days . "' size='2'>"; echo '</td></tr>'; $block = get_block_setting($block_id, 'block', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('block', $block); echo '</td></tr>'; }
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'show_last_update', WT_Filter::postBool('show_last_update')); set_block_setting($block_id, 'show_common_surnames', WT_Filter::postBool('show_common_surnames')); set_block_setting($block_id, 'stat_indi', WT_Filter::postBool('stat_indi')); set_block_setting($block_id, 'stat_fam', WT_Filter::postBool('stat_fam')); set_block_setting($block_id, 'stat_sour', WT_Filter::postBool('stat_sour')); set_block_setting($block_id, 'stat_other', WT_Filter::postBool('stat_other')); set_block_setting($block_id, 'stat_media', WT_Filter::postBool('stat_media')); set_block_setting($block_id, 'stat_repo', WT_Filter::postBool('stat_repo')); set_block_setting($block_id, 'stat_surname', WT_Filter::postBool('stat_surname')); set_block_setting($block_id, 'stat_events', WT_Filter::postBool('stat_events')); set_block_setting($block_id, 'stat_users', WT_Filter::postBool('stat_users')); set_block_setting($block_id, 'stat_first_birth', WT_Filter::postBool('stat_first_birth')); set_block_setting($block_id, 'stat_last_birth', WT_Filter::postBool('stat_last_birth')); set_block_setting($block_id, 'stat_first_death', WT_Filter::postBool('stat_first_death')); set_block_setting($block_id, 'stat_last_death', WT_Filter::postBool('stat_last_death')); set_block_setting($block_id, 'stat_long_life', WT_Filter::postBool('stat_long_life')); set_block_setting($block_id, 'stat_avg_life', WT_Filter::postBool('stat_avg_life')); set_block_setting($block_id, 'stat_most_chil', WT_Filter::postBool('stat_most_chil')); set_block_setting($block_id, 'stat_avg_chil', WT_Filter::postBool('stat_avg_chil')); set_block_setting($block_id, 'stat_link', WT_Filter::postBool('stat_link')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $show_last_update = get_block_setting($block_id, 'show_last_update', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show date of last update?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('show_last_update', $show_last_update); echo '</td></tr>'; $show_common_surnames = get_block_setting($block_id, 'show_common_surnames', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show common surnames?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('show_common_surnames', $show_common_surnames); echo '</td></tr>'; $stat_indi = get_block_setting($block_id, 'stat_indi', true); $stat_fam = get_block_setting($block_id, 'stat_fam', true); $stat_sour = get_block_setting($block_id, 'stat_sour', true); $stat_other = get_block_setting($block_id, 'stat_other', true); $stat_media = get_block_setting($block_id, 'stat_media', true); $stat_repo = get_block_setting($block_id, 'stat_repo', true); $stat_surname = get_block_setting($block_id, 'stat_surname', true); $stat_events = get_block_setting($block_id, 'stat_events', true); $stat_users = get_block_setting($block_id, 'stat_users', true); $stat_first_birth = get_block_setting($block_id, 'stat_first_birth', true); $stat_last_birth = get_block_setting($block_id, 'stat_last_birth', true); $stat_first_death = get_block_setting($block_id, 'stat_first_death', true); $stat_last_death = get_block_setting($block_id, 'stat_last_death', true); $stat_long_life = get_block_setting($block_id, 'stat_long_life', true); $stat_avg_life = get_block_setting($block_id, 'stat_avg_life', true); $stat_most_chil = get_block_setting($block_id, 'stat_most_chil', true); $stat_avg_chil = get_block_setting($block_id, 'stat_avg_chil', true); $stat_link = get_block_setting($block_id, 'stat_link', true); ?> <tr> <td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Select the stats to show in this block'); ?> </td> <td class="optionbox"> <table> <tr> <td><input type="checkbox" value="yes" name="stat_indi" <?php if ($stat_indi) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Individuals'); ?> </td> <td><input type="checkbox" value="yes" name="stat_first_birth" <?php if ($stat_first_birth) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Earliest birth year'); ?> </td> </tr> <tr> <td><input type="checkbox" value="yes" name="stat_surname" <?php if ($stat_surname) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Total surnames'); ?> </td> <td><input type="checkbox" value="yes" name="stat_last_birth" <?php if ($stat_last_birth) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Latest birth year'); ?> </td> </tr> <tr> <td><input type="checkbox" value="yes" name="stat_fam" <?php if ($stat_fam) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Families'); ?> </td> <td><input type="checkbox" value="yes" name="stat_first_death" <?php if ($stat_first_death) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Earliest death year'); ?> </td> </tr> <tr> <td><input type="checkbox" value="yes" name="stat_sour" <?php if ($stat_sour) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Sources'); ?> </td> <td><input type="checkbox" value="yes" name="stat_last_death" <?php if ($stat_last_death) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Latest death year'); ?> </td> </tr> <tr> <td><input type="checkbox" value="yes" name="stat_media" <?php if ($stat_media) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Media objects'); ?> </td> <td><input type="checkbox" value="yes" name="stat_long_life" <?php if ($stat_long_life) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Individual who lived the longest'); ?> </td> </tr> <tr> <td><input type="checkbox" value="yes" name="stat_repo" <?php if ($stat_repo) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Repositories'); ?> </td> <td><input type="checkbox" value="yes" name="stat_avg_life" <?php if ($stat_avg_life) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Average age at death'); ?> </td> </tr> <tr> <td><input type="checkbox" value="yes" name="stat_other" <?php if ($stat_other) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Other records'); ?> </td> <td><input type="checkbox" value="yes" name="stat_most_chil" <?php if ($stat_most_chil) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Family with the most children'); ?> </td> </tr> <tr> <td><input type="checkbox" value="yes" name="stat_events" <?php if ($stat_events) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Total events'); ?> </td> <td><input type="checkbox" value="yes" name="stat_avg_chil" <?php if ($stat_avg_chil) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Average number of children per family'); ?> </td> </tr> <tr> <td><input type="checkbox" value="yes" name="stat_users" <?php if ($stat_users) { echo ' checked="checked"'; } ?> > <?php echo WT_I18N::translate('Total users'); ?> </td> <td> </td> </tr> </table> </td> </tr> <?php $stat_link = get_block_setting($block_id, 'stat_link', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show link to Statistics charts?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('stat_link', $stat_link); echo '</td></tr>'; }
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, self::MAX_DAYS, self::DEFAULT_DAYS)); set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table')); set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'name|date_asc|date_desc', 'date_desc')); set_block_setting($block_id, 'hide_empty', WT_Filter::postBool('hide_empty')); set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Number of days to show'); echo '</td><td class="optionbox">'; echo '<input type="text" name="days" size="2" value="', $days, '">'; echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', self::MAX_DAYS, self::MAX_DAYS), '</em>'; echo '</td></tr>'; $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; $sortStyle = get_block_setting($block_id, 'sortStyle', 'date'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Sort order'); echo '</td><td class="optionbox">'; echo select_edit_control('sortStyle', array('name' => WT_I18N::translate('sort by name'), 'date_asc' => WT_I18N::translate('sort by date, oldest first'), 'date_desc' => WT_I18N::translate('sort by date, newest first')), null, $sortStyle, ''); echo '</td></tr>'; $block = get_block_setting($block_id, 'block', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('block', $block); echo '</td></tr>'; $hide_empty = get_block_setting($block_id, 'hide_empty', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Should this block be hidden when it is empty?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('hide_empty', $hide_empty); echo '</td></tr>'; echo '<tr><td colspan="2" class="optionbox wrap">'; echo '<span class="error">', WT_I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>'; echo '</td></tr>'; }
foreach ($_FILES as $FILE) { if ($FILE['error'] == 0 && is_readable($FILE['tmp_name'])) { import_gedcom_file($gedcom_id, $FILE['tmp_name'], $FILE['name']); } } } header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?keep_media' . $gedcom_id . '=' . WT_Filter::postBool('keep_media' . $gedcom_id)); exit; case 'replace_import': $gedcom_id = WT_Filter::postInteger('gedcom_id'); // Make sure the gedcom still exists if (WT_Filter::checkCsrf() && get_gedcom_from_id($gedcom_id)) { $ged_name = basename(WT_Filter::post('ged_name')); import_gedcom_file($gedcom_id, WT_DATA_DIR . $ged_name, $ged_name); } header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?keep_media' . $gedcom_id . '=' . WT_Filter::postBool('keep_media' . $gedcom_id)); exit; } $controller->pageHeader(); // Process GET actions switch (WT_Filter::get('action')) { case 'uploadform': case 'importform': $gedcom_id = WT_Filter::getInteger('gedcom_id'); $gedcom_name = get_gedcom_from_id($gedcom_id); // Check it exists if (!$gedcom_name) { break; } echo '<p>', WT_I18N::translate('This will delete all the genealogical data from <b>%s</b> and replace it with data from another GEDCOM.', $gedcom_name), '</p>'; // the javascript in the next line strips any path associated with the file before comparing it to the current GEDCOM name (both Chrome and IE8 include c:\fakepath\ in the filename).
public function configureBlock($block_id) { global $ctype, $controller; $PEDIGREE_ROOT_ID = get_gedcom_setting(WT_GED_ID, 'PEDIGREE_ROOT_ID'); if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'details', WT_Filter::postBool('details')); set_block_setting($block_id, 'type', WT_Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree')); set_block_setting($block_id, 'pid', WT_Filter::post('pid', WT_REGEX_XREF)); exit; } $details = get_block_setting($block_id, 'details', false); $type = get_block_setting($block_id, 'type', 'pedigree'); $pid = get_block_setting($block_id, 'pid', WT_USER_ID ? WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID : $PEDIGREE_ROOT_ID); $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();'); ?> <tr><td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Chart type'); ?> </td> <td class="optionbox"> <select name="type"> <option value="pedigree"<?php if ($type == "pedigree") { echo " selected=\"selected\""; } ?> ><?php echo WT_I18N::translate('Pedigree'); ?> </option> <option value="descendants"<?php if ($type == "descendants") { echo " selected=\"selected\""; } ?> ><?php echo WT_I18N::translate('Descendants'); ?> </option> <option value="hourglass"<?php if ($type == "hourglass") { echo " selected=\"selected\""; } ?> ><?php echo WT_I18N::translate('Hourglass chart'); ?> </option> <option value="treenav"<?php if ($type == "treenav") { echo " selected=\"selected\""; } ?> ><?php echo WT_I18N::translate('Interactive tree'); ?> </option> </select> </td></tr> <tr> <td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Show details'); ?> </td> <td class="optionbox"> <select name="details"> <option value="no" <?php if (!$details) { echo " selected=\"selected\""; } ?> ><?php echo WT_I18N::translate('no'); ?> </option> <option value="yes" <?php if ($details) { echo " selected=\"selected\""; } ?> ><?php echo WT_I18N::translate('yes'); ?> </option> </select> </td> </tr> <tr> <td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Individual'); ?> </td> <td class="optionbox"> <input data-autocomplete-type="INDI" type="text" name="pid" id="pid" value="<?php echo $pid; ?> " size="5"> <?php echo print_findindi_link('pid'); $root = WT_Individual::getInstance($pid); if ($root) { echo ' <span class="list_item">', $root->getFullName(), $root->format_first_major_fact(WT_EVENTS_BIRT, 1), '</span>'; } ?> </td> </tr> <?php require_once WT_ROOT . 'includes/functions/functions_edit.php'; $block = get_block_setting($block_id, 'block', false); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('block', $block); echo '</td></tr>'; }
function addNewFact($fact) { global $ADVANCED_PLAC_FACTS; $FACT = WT_Filter::post($fact); $DATE = WT_Filter::post("{$fact}_DATE"); $PLAC = WT_Filter::post("{$fact}_PLAC"); if ($DATE || $PLAC || $FACT && $FACT != 'Y') { if ($FACT && $FACT != 'Y') { $gedrec = "\n1 {$fact} {$FACT}"; } else { $gedrec = "\n1 {$fact}"; } if ($DATE) { $gedrec .= "\n2 DATE {$DATE}"; } if ($PLAC) { $gedrec .= "\n2 PLAC {$PLAC}"; if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $ADVANCED_PLAC_FACTS, $match)) { foreach ($match[1] as $tag) { $TAG = WT_Filter::post("{$fact}_{$tag}"); if ($TAG) { $gedrec .= "\n3 {$tag} {$TAG}"; } } } $LATI = WT_Filter::post("{$fact}_LATI"); $LONG = WT_Filter::post("{$fact}_LONG"); if ($LATI || $LONG) { $gedrec .= "\n3 MAP\n4 LATI {$LATI}\n4 LONG {$LONG}"; } } if (WT_Filter::postBool("SOUR_{$fact}")) { return updateSOUR($gedrec, 2); } else { return $gedrec; } } elseif ($FACT == 'Y') { if (WT_Filter::postBool("SOUR_{$fact}")) { return updateSOUR("\n1 {$fact} Y", 2); } else { return "\n1 {$fact} Y"; } } else { return ''; } }
$ged = WT_Filter::post('ged'); // Extract form variables $realname = WT_Filter::post('realname'); $pass1 = WT_Filter::post('pass1', WT_REGEX_PASSWORD); $pass2 = WT_Filter::post('pass2', WT_REGEX_PASSWORD); $emailaddress = WT_Filter::postEmail('emailaddress'); $user_theme = WT_Filter::post('user_theme', implode('|', $ALL_THEME_DIRS)); $user_language = WT_Filter::post('user_language', implode('|', array_keys(WT_I18N::installed_languages())), WT_LOCALE); $new_contact_method = WT_Filter::post('new_contact_method'); $new_comment = WT_Filter::post('new_comment'); $new_auto_accept = WT_Filter::postBool('new_auto_accept'); $canadmin = WT_Filter::postBool('canadmin'); $visibleonline = WT_Filter::postBool('visibleonline'); $editaccount = WT_Filter::postBool('editaccount'); $verified = WT_Filter::postBool('verified'); $verified_by_admin = WT_Filter::postBool('verified_by_admin'); switch ($action) { case 'loadrows': // Generate an AJAX/JSON response for datatables to load a block of rows $search = WT_Filter::get('search'); $search = $search['value']; $start = WT_Filter::getInteger('start'); $length = WT_Filter::getInteger('length'); $WHERE = " WHERE u.user_id>0"; $ARGS = array(); if ($search) { $WHERE .= " AND (" . " user_name LIKE CONCAT('%', ?, '%') OR " . " real_name LIKE CONCAT('%', ?, '%') OR " . " email LIKE CONCAT('%', ?, '%'))"; $ARGS = array($search, $search, $search); } Auth::user()->setSetting('admin_users_page_size', $length); if ($length > 0) {
private function admin() { $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle($this->getTitle())->pageHeader(); // Save the updated preferences if (WT_Filter::post('action') == 'save') { foreach (WT_Tree::getAll() as $tree) { set_gedcom_setting($tree->tree_id, 'include_in_sitemap', WT_Filter::postBool('include' . $tree->tree_id)); } // Clear cache and force files to be regenerated WT_DB::prepare("DELETE FROM `##module_setting` WHERE setting_name LIKE 'sitemap%'")->execute(); } $include_any = false; echo '<h3>', $this->getTitle(), '</h3>', '<p>', WT_I18N::translate('Sitemaps are a way for webmasters to tell search engines about the pages on a website that are available for crawling. All major search engines support sitemaps. For more information, see <a href="http://www.sitemaps.org/">www.sitemaps.org</a>.') . '</p>', '<p>', WT_I18N::translate('Which family trees should be included in the sitemaps?'), '</p>', '<form method="post" action="module.php?mod=' . $this->getName() . '&mod_action=admin">', '<input type="hidden" name="action" value="save">'; foreach (WT_Tree::getAll() as $tree) { echo '<p><input type="checkbox" name="include', $tree->tree_id, '"'; if (get_gedcom_setting($tree->tree_id, 'include_in_sitemap')) { echo ' checked="checked"'; $include_any = true; } echo '>', $tree->tree_title_html, '</p>'; } echo '<input type="submit" value="', WT_I18N::translate('save'), '">', '</form>', '<hr>'; if ($include_any) { $site_map_url1 = WT_SERVER_NAME . WT_SCRIPT_PATH . 'module.php?mod=' . $this->getName() . '&mod_action=generate&file=sitemap.xml'; $site_map_url2 = rawurlencode(WT_SERVER_NAME . WT_SCRIPT_PATH . 'module.php?mod=' . $this->getName() . '&mod_action=generate&file=sitemap.xml'); echo '<p>', WT_I18N::translate('To tell search engines that sitemaps are available, you should add the following line to your robots.txt file.'), '</p>'; echo '<pre>Sitemap: ', $site_map_url1, '</pre>', '<hr>', '<p>', WT_I18N::translate('To tell search engines that sitemaps are available, you can use the following links.'), '</p>', '<ul>', '<li><a target="_blank" href="http://www.bing.com/webmaster/ping.aspx?siteMap=' . $site_map_url2 . '">Bing</a></li>', '<li><a target="_blank" href="http://www.google.com/webmasters/tools/ping?sitemap=' . $site_map_url2 . '">Google</a></li>', '</ul>'; } }