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, '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, '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, '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>'; }
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>'; }
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>'; }
case 'replace_upload': $gedcom_id = WT_Filter::postInteger('gedcom_id'); // Make sure the gedcom still exists if (WT_Filter::checkCsrf() && get_gedcom_from_id($gedcom_id)) { 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) {
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>'; }
$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); } // Change other settings
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, 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>'; }
private function fetchFriendList() { global $WT_SESSION, $controller; $controller = new WT_Controller_Page(); $controller->addInlineJavaScript("\n \$('head').append('<link rel=\"stylesheet\" href=\"" . WT_MODULES_DIR . $this->getName() . "/facebook.css?v=" . WT_FACEBOOK_VERSION . "\" />');", WT_Controller_Page::JS_PRIORITY_LOW); $preApproved = unserialize($this->getSetting('preapproved')); if (WT_Filter::postArray('preApproved') && WT_Filter::checkCsrf()) { $roleRows = WT_Filter::postArray('preApproved'); $fbUsernames = WT_Filter::postArray('facebook_username', WT_REGEX_USERNAME); foreach ($fbUsernames as $facebook_username) { $facebook_username = $this->cleanseFacebookUsername($facebook_username); $this->appendPreapproved($preApproved, $facebook_username, $roleRows); } $this->setSetting('preapproved', serialize($preApproved)); WT_FlashMessages::addMessage(WT_I18N::translate('Users successfully imported from Facebook')); header("Location: module.php?mod=" . $this->getName() . "&mod_action=admin"); exit; } if (empty($WT_SESSION->facebook_access_token)) { $this->error_page(WT_I18N::translate("You must <a href='%s'>login to the site via Facebook</a> in order to import friends from Facebook", "index.php?logout=1")); } $graph_url = "https://graph.facebook.com/" . self::api_dir . "me/friends?fields=first_name,last_name,name,username&access_token=" . $WT_SESSION->facebook_access_token; $friendsResponse = $this->fetch_url($graph_url); if ($friendsResponse === FALSE) { $this->error_page(WT_I18N::translate("Could not fetch your friends from Facebook. Note that this feature won't work for Facebook Apps created after 2014-04-30 due to a Facebook policy change.")); } $controller->restrictAccess(\WT\Auth::isAdmin())->setPageTitle($this->getTitle())->pageHeader(); $friends = json_decode($friendsResponse); if (empty($friends->data)) { $this->error_page(WT_I18N::translate("No friend data")); return; } function nameSort($a, $b) { return strcmp($a->last_name . " " . $a->first_name, $b->last_name . " " . $b->first_name); } usort($friends->data, "nameSort"); echo "<form id='facebook_friend_list' method='post' action=''>"; require_once WT_ROOT . 'includes/functions/functions_edit.php'; // for select_edit_control $index = 0; foreach (WT_Tree::getAll() as $tree) { $class = $index++ % 2 ? 'odd' : 'even'; echo "<label>" . $tree->tree_name_html . " - " . WT_I18N::translate('Role') . help_link('role') . ": " . select_edit_control('preApproved[' . $tree->tree_id . '][canedit]', $this->get_edit_options(), NULL, NULL) . "</label>"; } foreach ($friends->data as $friend) { $facebook_username = $this->cleanseFacebookUsername(isset($friend->username) ? $friend->username : $friend->id); // Exclude friends who are already pre-approved or are current users if (isset($preApproved[$facebook_username]) || $this->get_user_id_from_facebook_username($facebook_username)) { continue; } echo "<label><input name='facebook_username[]' type='checkbox' value='" . $facebook_username . "'/>" . $friend->name . "</label>"; } echo WT_Filter::getCsrf(); echo "<button>Select Friends</button></form>"; }
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; } }
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>'; }
list($latest_version, $earliest_version, $download_url) = explode('|', $latest_version_txt); } else { // Cannot determine the latest version list($latest_version, $earliest_version, $download_url) = explode('|', '||'); } $latest_version_html = '<span dir="ltr">' . $latest_version . '</span>'; $download_url_html = '<b dir="auto"><a href="' . WT_Filter::escapeHtml($download_url) . '">' . WT_Filter::escapeHtml($download_url) . '</a></b>'; // Show a friendly message while the site is being upgraded $lock_file = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'offline.txt'; $lock_file_html = '<span dir="ltr">' . WT_Filter::escapeHtml($lock_file) . '</span>'; $lock_file_text = WT_I18N::translate('This site is being upgraded. Try again in a few minutes.') . PHP_EOL . format_timestamp(WT_TIMESTAMP) . WT_I18N::translate('UTC'); // Success/failure indicators $icon_success = '<i class="icon-yes"></i>'; $icon_failure = '<i class="icon-failure"></i>'; // Need confirmation for various actions $continue = WT_Filter::post('continue', '1') && WT_Filter::checkCsrf(); $modules_action = WT_Filter::post('modules', 'ignore|disable'); $themes_action = WT_Filter::post('themes', 'ignore|disable'); $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Upgrade wizard'))->pageHeader(); // Flush output as it happens - only effective on some webserver configurations. ob_implicit_flush(true); if (ob_get_level()) { ob_end_flush(); } echo '<h2>', $controller->getPageTitle(), '</h2>'; if ($latest_version == '') { echo '<p>', WT_I18N::translate('No upgrade information is available.'), '</p>'; exit; } if (version_compare(WT_VERSION, $latest_version) >= 0) {
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>'; }
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>'; }
$controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader()->addInlineJavascript(' jQuery("#sidebars_table").sortable({items: ".sortme", forceHelperSize: true, forcePlaceholderSize: true, opacity: 0.7, cursor: "move", axis: "y"}); //-- update the order numbers after drag-n-drop sorting is complete jQuery("#sidebars_table").bind("sortupdate", function(event, ui) { jQuery("#"+jQuery(this).attr("id")+" input").each( function (index, value) { value.value = index+1; } ); }); '); $modules = WT_Module::getActiveSidebars(WT_GED_ID, WT_PRIV_HIDE); $action = WT_Filter::post('action'); if ($action == 'update_mods' && WT_Filter::checkCsrf()) { foreach ($modules as $module_name => $module) { foreach (WT_Tree::getAll() as $tree) { $access_level = WT_Filter::post("sidebaraccess-{$module_name}-{$tree->tree_id}", WT_REGEX_INTEGER, $module->defaultAccessLevel()); WT_DB::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'sidebar', ?)")->execute(array($module_name, $tree->tree_id, $access_level)); } $order = WT_Filter::post('sidebarorder-' . $module_name); WT_DB::prepare("UPDATE `##module` SET sidebar_order=? WHERE module_name=?")->execute(array($order, $module_name)); $module->order = $order; // Make the new order take effect immediately } uasort($modules, function ($x, $y) { return $x->order - $y->order; }); } ?>
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; } }
echo '<dd><a href="#" onclick="modalDialog(\'index_edit.php?user_id=' . $user_id . '\', \'', WT_I18N::translate('Change the blocks on this page'), '\');">', WT_I18N::translate('Change the blocks on this page'), '</a></dd>'; // Masquerade as others users - but not other administrators if (!Auth::isAdmin($user)) { echo '<dt>', WT_I18N::translate('Masquerade as this user'), '</dt>'; echo '<dd><a href="#" onclick="return masquerade(', $user_id, ')">', WT_I18N::translate('masquerade'), '</a></dd>'; } echo '</dl>'; // Column One - details echo '<div id="access">', '<h2>', WT_I18N::translate('Family tree access and settings'), '</h2>', '<table><tr>', '<th>', WT_I18N::translate('Family tree'), '</th>', '<th>', WT_I18N::translate('Default individual'), help_link('default_individual'), '</th>', '<th>', WT_I18N::translate('Individual record'), help_link('useradmin_gedcomid'), '</th>', '<th>', WT_I18N::translate('Role'), help_link('role'), '</th>', '<th>', WT_I18N::translate('Restrict to immediate family'), help_link('RELATIONSHIP_PATH_LENGTH'), '</th>', '</tr>'; foreach (WT_Tree::getAll() as $tree) { echo '<tr><td>', $tree->tree_title_html, '</td><td>', edit_field_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-rootid', $tree->userPreference($user_id, 'rootid')), '</td><td>', edit_field_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-gedcomid', $tree->userPreference($user_id, 'gedcomid')), '</td><td>', select_edit_control_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-canedit', $ALL_EDIT_OPTIONS, null, $tree->userPreference($user_id, 'canedit')), '</td><td>', select_edit_control_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-RELATIONSHIP_PATH_LENGTH', array(0 => WT_I18N::translate('no'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10), null, $tree->userPreference($user_id, 'RELATIONSHIP_PATH_LENGTH')), '</td></tr>'; } echo '</table>'; exit; case 'createuser': if (!WT_Filter::checkCsrf()) { $action = 'createform'; } elseif (User::findByIdentifier($username)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.')); $action = 'createform'; } elseif (User::findByIdentifier($emailaddress)) { WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address. A user with that email already exists.')); $action = 'createform'; } elseif ($pass1 != $pass2) { WT_FlashMessages::addMessage(WT_I18N::translate('Passwords do not match.')); $action = 'createform'; } else { $user = User::create($username, $realname, $emailaddress, $pass1); $user->setSetting('reg_timestamp', date('U'))->setSetting('sessiontime', '0')->setSetting('theme', $user_theme)->setSetting('language', $user_language)->setSetting('contactmethod', $new_contact_method)->setSetting('comment', $new_comment)->setSetting('auto_accept', $new_auto_accept)->setSetting('canadmin', $canadmin)->setSetting('visibleonline', $visibleonline)->setSetting('editaccount', $editaccount)->setSetting('verified', $verified)->setSetting('verified_by_admin', $verified_by_admin); foreach (WT_Tree::getAll() as $tree) { $tree->userPreference($user->getUserId(), 'gedcomid', WT_Filter::post('gedcomid' . $tree->tree_id, WT_REGEX_XREF));
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>'; }