/** * get edit menu */ function getEditMenu() { if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-note'); if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Edit note'), '#', 'menu-note-edit'); $submenu->addOnclick('return edit_note(\'' . $this->record->getXref() . '\');'); $menu->addSubmenu($submenu); } // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-note-del'); $submenu->addOnclick("return delete_note('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-note-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; }
/** * get edit menu */ function getEditMenu() { $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD'); if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-obje'); if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Edit media object'), '#', 'menu-obje-edit'); $submenu->addOnclick("window.open('addmedia.php?action=editmedia&pid={$this->record->getXref()}', '_blank', edit_window_specs)"); $menu->addSubmenu($submenu); // main link displayed on page if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Manage links'), '#', 'menu-obje-link'); $submenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','manage');"); } else { $submenu = new WT_Menu(WT_I18N::translate('Set link'), '#', 'menu-obje-link'); $ssubmenu = new WT_Menu(WT_I18N::translate('To individual'), '#', 'menu-obje-link-indi'); $ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','person');"); $submenu->addSubMenu($ssubmenu); $ssubmenu = new WT_Menu(WT_I18N::translate('To family'), '#', 'menu-obje-link-fam'); $ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','family');"); $submenu->addSubMenu($ssubmenu); $ssubmenu = new WT_Menu(WT_I18N::translate('To source'), '#', 'menu-obje-link-sour'); $ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','source');"); $submenu->addSubMenu($ssubmenu); } $menu->addSubmenu($submenu); } // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-obje-del'); $submenu->addOnclick("return delete_media('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // edit raw if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) { $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-obje-editraw'); $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-obje-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; }
public function __construct() { parent::__construct(); // Load any local user translations if (is_dir(WT_MODULES_DIR . $this->getName() . '/language')) { if (file_exists(WT_MODULES_DIR . $this->getName() . '/language/' . WT_LOCALE . '.mo')) { $tr = new Zend_Translate('gettext', WT_MODULES_DIR . $this->getName() . '/language/' . WT_LOCALE . '.mo', WT_LOCALE); Zend_Registry::get('Zend_Translate')->addTranslation($tr); } } }
/** * get edit menu */ function getEditMenu() { $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD'); if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-repo'); if (WT_USER_CAN_EDIT) { $fact = $this->record->getFirstFact('NAME'); $submenu = new WT_Menu(WT_I18N::translate('Edit repository'), '#', 'menu-repo-edit'); if ($fact) { // Edit existing name $submenu->addOnclick('return edit_record(\'' . $this->record->getXref() . '\', \'' . $fact->getFactId() . '\');'); } else { // Add new name $submenu->addOnclick('return add_fact(\'' . $this->record->getXref() . '\', \'NAME\');'); } $menu->addSubmenu($submenu); } // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-repo-del'); $submenu->addOnclick("return delete_repository('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // edit raw if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) { $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-repo-editraw'); $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-repo-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; }
/** * get edit menu */ function getEditMenu() { $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD'); if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-note'); if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Edit note'), '#', 'menu-note-edit'); $submenu->addOnclick('return edit_note(\'' . $this->record->getXref() . '\');'); $menu->addSubmenu($submenu); } // edit raw /* Does not currently work - NOTE records do not contain nice level 1 facts if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) { $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-note-editraw'); $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } */ // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-note-del'); $submenu->addOnclick("return delete_note('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-note-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; }
public function createMap($placelevels) { global $level, $levelm, $plzoom, $controller; // *** ENABLE STREETVIEW *** (boolean) ========================================================= $STREETVIEW = $this->getSetting('GM_USE_STREETVIEW'); // ============================================================================================= $parent = WT_Filter::get('parent'); // create the map echo '<table style="margin:20px auto 0 auto;"><tr valign="top"><td>'; //<!-- start of map display --> echo '<table><tr valign="top">'; echo '<td class="center" width="200px">'; $levelm = $this->set_levelm($level, $parent); $latlng = WT_DB::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($levelm))->fetch(PDO::FETCH_ASSOC); if ($STREETVIEW && $level != 0) { echo '<div id="place_map" style="margin-top:20px; border:1px solid gray; width: ', $this->getSetting('GM_PH_XSIZE'), 'px; height: ', $this->getSetting('GM_PH_YSIZE'), 'px; '; } else { echo '<div id="place_map" style="border:1px solid gray; width:', $this->getSetting('GM_PH_XSIZE'), 'px; height:', $this->getSetting('GM_PH_YSIZE'), 'px; '; } echo "\"><i class=\"icon-loading-large\"></i></div>"; echo '<script src="', $this->googleMapsScript(), '"></script>'; echo '</td>'; $plzoom = $latlng['pl_zoom']; // Map zoom level if (Auth::isAdmin()) { $placecheck_url = 'module.php?mod=googlemap&mod_action=admin_placecheck'; if ($parent && isset($parent[0])) { $placecheck_url .= '&country=' . $parent[0]; if (isset($parent[1])) { $placecheck_url .= '&state=' . $parent[1]; } } $adminplaces_url = 'module.php?mod=googlemap&mod_action=admin_places'; if ($latlng && isset($latlng['pl_id'])) { $adminplaces_url .= '&parent=' . $latlng['pl_id']; } echo '</tr><tr><td>'; echo '<a href="module.php?mod=googlemap&mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>'; echo ' | '; echo '<a href="' . $adminplaces_url . '">', WT_I18N::translate('Geographic data'), '</a>'; echo ' | '; echo '<a href="' . $placecheck_url . '">', WT_I18N::translate('Place check'), '</a>'; if (array_key_exists('batch_update', WT_Module::getActiveModules())) { $placelevels = preg_replace('/, ' . WT_I18N::translate('unknown') . '/', ', ', $placelevels); // replace ", unknown" with ", " $placelevels = substr($placelevels, 2); // remove the leading ", " if ($placelevels) { $batchupdate_url = 'module.php?mod=batch_update&mod_action=admin_batch_update&plugin=search_replace_bu_plugin&method=exact&ged=' . WT_GEDCOM . '&search=' . urlencode($placelevels); // exact match echo ' | '; echo '<a href="' . $batchupdate_url . '">', WT_I18N::translate('Batch update'), '</a>'; } } } echo '</td></tr></table>'; echo '</td>'; echo '<td style="margin-left:15px; float:right;">'; if ($STREETVIEW) { $controller->addInlineJavascript(' function update_sv_params(placeid) { var svlati = document.getElementById("sv_latiText").value.slice(0, -1); var svlong = document.getElementById("sv_longText").value.slice(0, -1); var svbear = document.getElementById("sv_bearText").value.slice(0, -1); var svelev = document.getElementById("sv_elevText").value.slice(0, -1); var svzoom = document.getElementById("sv_zoomText").value; win03 = window.open("module.php?mod=googlemap&mod_action=places_edit&action=update_sv_params&placeid="+placeid+"&svlati="+svlati+"&svlong="+svlong+"&svbear="+svbear+"&svelev="+svelev+"&svzoom="+svzoom, "win03", indx_window_specs); if (window.focus) {win03.focus();} } '); global $pl_lati, $pl_long; if ($level >= 1) { $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']); // WT_placelocation lati $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']); // WT_placelocation long // Check if Streetview location parameters are stored in database $placeid = $latlng['pl_id']; // Placelocation place id $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North) $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up) $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3) // Check if Street View Lati/Long are the default of 0 or null, if so use regular Place Lati/Long to set an initial location for the panda ------------ if ($latlng['sv_lati'] == null && $latlng['sv_long'] == null || $latlng['sv_lati'] == 0 && $latlng['sv_long'] == 0) { $sv_lat = $pl_lati; $sv_lng = $pl_long; } // Set Street View parameters to numeric value if NULL (avoids problem with Google Street View™ Pane not rendering) if ($sv_dir == null) { $sv_dir = 0; } if ($sv_pitch == null) { $sv_pitch = 0; } if ($sv_zoom == null) { $sv_zoom = 1; } ?> <div> <iframe style="background: transparent; margin-top: -3px; margin-left: 2px; width: 530px; height: 405px; padding: 0; border: 0;" src="module.php?mod=googlemap&mod_action=wt_street_view&x=<?php echo $sv_lng; ?> &y=<?php echo $sv_lat; ?> &z=18&t=2&c=1&s=1&b=<?php echo $sv_dir; ?> &p=<?php echo $sv_pitch; ?> &m=<?php echo $sv_zoom; ?> &j=1&k=1&v=1" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe> </div> <?php $list_latlon = WT_Gedcom_Tag::getLabel('LATI') . "<input name='sv_latiText' id='sv_latiText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lat . "'>" . WT_Gedcom_Tag::getLabel('LONG') . "<input name='sv_longText' id='sv_longText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lng . "'>" . WT_I18N::translate('Bearing') . "<input name='sv_bearText' id='sv_bearText' type='text' style='width:46px; background:none; border:none;' value='" . $sv_dir . "'>" . WT_I18N::translate('Elevation') . "<input name='sv_elevText' id='sv_elevText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_pitch . "'>" . WT_I18N::translate('Zoom') . "<input name='sv_zoomText' id='sv_zoomText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_zoom . "'>\n\t\t\t\t"; if (Auth::isAdmin()) { echo "<table align=\"center\" style=\"margin-left:6px; border:solid 1px black; width:522px; margin-top:-28px; background:#cccccc; \">"; } else { echo "<table align=\"center\" style=\"display:none; \">"; } echo "<tr><td>"; echo "<form style=\"text-align:left; margin-left:5px; font:11px verdana; color:blue;\" method=\"post\" action=\"\">"; echo $list_latlon; echo "<input type=\"submit\" name=\"Submit\" onclick=\"update_sv_params({$placeid});\" value=\"", WT_I18N::translate('save'), "\">"; echo "</form>"; echo "</td></tr>"; echo "</table>"; } // Next line puts Place hierarchy on new row ----- echo '</td></tr><tr>'; } // End Streetview window =================================================================== }
jQuery(e.target).css("visibility", "visible"); // prevent FOUC } }); '); $linked_indi = $controller->record->linkedIndividuals('NOTE'); $linked_fam = $controller->record->linkedFamilies('NOTE'); $linked_obje = $controller->record->linkedMedia('NOTE'); $linked_sour = $controller->record->linkedSources('NOTE'); $facts = array(); foreach ($controller->record->getFacts() as $fact) { if ($fact->getTag() != 'CONT') { $facts[] = $fact; } } // Legacy formatting, created by the census assistant if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $text = GEDFact_assistant_WT_Module::formatCensusNote($controller->record); } else { $text = WT_Filter::formatText($controller->record->getNote(), $WT_TREE); } ?> <div id="note-details"> <h2><?php echo $controller->record->getFullName(); ?> </h2> <div id="note-tabs"> <ul> <li> <a href="#note-edit"> <span><?php
require 'includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $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; });
public static function create($tree_name) { try { // Create a new tree WT_DB::prepare("INSERT INTO `##gedcom` (gedcom_name) VALUES (?)")->execute(array($tree_name)); $tree_id = WT_DB::prepare("SELECT LAST_INSERT_ID()")->fetchOne(); } catch (PDOException $ex) { // A tree with that name already exists? return; } // Update the list of trees - to include this new one self::$trees = null; // Module privacy WT_Module::setDefaultAccess($tree_id); // Gedcom and privacy settings set_gedcom_setting($tree_id, 'ADVANCED_NAME_FACTS', 'NICK,_AKA'); set_gedcom_setting($tree_id, 'ADVANCED_PLAC_FACTS', ''); set_gedcom_setting($tree_id, 'ALLOW_THEME_DROPDOWN', true); set_gedcom_setting($tree_id, 'CALENDAR_FORMAT', 'gregorian'); set_gedcom_setting($tree_id, 'CHART_BOX_TAGS', ''); set_gedcom_setting($tree_id, 'COMMON_NAMES_ADD', ''); set_gedcom_setting($tree_id, 'COMMON_NAMES_REMOVE', ''); set_gedcom_setting($tree_id, 'COMMON_NAMES_THRESHOLD', '40'); set_gedcom_setting($tree_id, 'CONTACT_USER_ID', WT_USER_ID); set_gedcom_setting($tree_id, 'DEFAULT_PEDIGREE_GENERATIONS', '4'); set_gedcom_setting($tree_id, 'EXPAND_RELATIVES_EVENTS', false); set_gedcom_setting($tree_id, 'EXPAND_SOURCES', false); set_gedcom_setting($tree_id, 'FAM_FACTS_ADD', 'CENS,MARR,RESI,SLGS,MARR_CIVIL,MARR_RELIGIOUS,MARR_PARTNERS,RESN'); set_gedcom_setting($tree_id, 'FAM_FACTS_QUICK', 'MARR,DIV,_NMR'); set_gedcom_setting($tree_id, 'FAM_FACTS_UNIQUE', 'NCHI,MARL,DIV,ANUL,DIVF,ENGA,MARB,MARC,MARS'); set_gedcom_setting($tree_id, 'FAM_ID_PREFIX', 'F'); set_gedcom_setting($tree_id, 'FORMAT_TEXT', 'markdown'); set_gedcom_setting($tree_id, 'FULL_SOURCES', false); set_gedcom_setting($tree_id, 'GEDCOM_ID_PREFIX', 'I'); set_gedcom_setting($tree_id, 'GEDCOM_MEDIA_PATH', ''); set_gedcom_setting($tree_id, 'GENERATE_UIDS', false); set_gedcom_setting($tree_id, 'HIDE_GEDCOM_ERRORS', true); set_gedcom_setting($tree_id, 'HIDE_LIVE_PEOPLE', true); set_gedcom_setting($tree_id, 'INDI_FACTS_ADD', 'AFN,BIRT,DEAT,BURI,CREM,ADOP,BAPM,BARM,BASM,BLES,CHRA,CONF,FCOM,ORDN,NATU,EMIG,IMMI,CENS,PROB,WILL,GRAD,RETI,DSCR,EDUC,IDNO,NATI,NCHI,NMR,OCCU,PROP,RELI,RESI,SSN,TITL,BAPL,CONL,ENDL,SLGC,_MILI,ASSO,RESN'); set_gedcom_setting($tree_id, 'INDI_FACTS_QUICK', 'BIRT,BURI,BAPM,CENS,DEAT,OCCU,RESI'); set_gedcom_setting($tree_id, 'INDI_FACTS_UNIQUE', ''); set_gedcom_setting($tree_id, 'KEEP_ALIVE_YEARS_BIRTH', ''); set_gedcom_setting($tree_id, 'KEEP_ALIVE_YEARS_DEATH', ''); set_gedcom_setting($tree_id, 'LANGUAGE', WT_LOCALE); // Default to the current admin’s language set_gedcom_setting($tree_id, 'MAX_ALIVE_AGE', 120); set_gedcom_setting($tree_id, 'MAX_DESCENDANCY_GENERATIONS', '15'); set_gedcom_setting($tree_id, 'MAX_PEDIGREE_GENERATIONS', '10'); set_gedcom_setting($tree_id, 'MEDIA_DIRECTORY', 'media/'); set_gedcom_setting($tree_id, 'MEDIA_ID_PREFIX', 'M'); set_gedcom_setting($tree_id, 'MEDIA_UPLOAD', WT_PRIV_USER); set_gedcom_setting($tree_id, 'META_DESCRIPTION', ''); set_gedcom_setting($tree_id, 'META_TITLE', WT_WEBTREES); set_gedcom_setting($tree_id, 'NOTE_FACTS_ADD', 'SOUR,RESN'); set_gedcom_setting($tree_id, 'NOTE_FACTS_QUICK', ''); set_gedcom_setting($tree_id, 'NOTE_FACTS_UNIQUE', ''); set_gedcom_setting($tree_id, 'NOTE_ID_PREFIX', 'N'); set_gedcom_setting($tree_id, 'NO_UPDATE_CHAN', false); set_gedcom_setting($tree_id, 'PEDIGREE_FULL_DETAILS', true); set_gedcom_setting($tree_id, 'PEDIGREE_LAYOUT', true); set_gedcom_setting($tree_id, 'PEDIGREE_ROOT_ID', ''); set_gedcom_setting($tree_id, 'PEDIGREE_SHOW_GENDER', false); set_gedcom_setting($tree_id, 'PREFER_LEVEL2_SOURCES', '1'); set_gedcom_setting($tree_id, 'QUICK_REQUIRED_FACTS', 'BIRT,DEAT'); set_gedcom_setting($tree_id, 'QUICK_REQUIRED_FAMFACTS', 'MARR'); set_gedcom_setting($tree_id, 'REPO_FACTS_ADD', 'PHON,EMAIL,FAX,WWW,NOTE,SHARED_NOTE,RESN'); set_gedcom_setting($tree_id, 'REPO_FACTS_QUICK', ''); set_gedcom_setting($tree_id, 'REPO_FACTS_UNIQUE', 'NAME,ADDR'); set_gedcom_setting($tree_id, 'REPO_ID_PREFIX', 'R'); set_gedcom_setting($tree_id, 'REQUIRE_AUTHENTICATION', false); set_gedcom_setting($tree_id, 'SAVE_WATERMARK_IMAGE', false); set_gedcom_setting($tree_id, 'SAVE_WATERMARK_THUMB', false); set_gedcom_setting($tree_id, 'SHOW_AGE_DIFF', false); set_gedcom_setting($tree_id, 'SHOW_COUNTER', true); set_gedcom_setting($tree_id, 'SHOW_DEAD_PEOPLE', WT_PRIV_PUBLIC); set_gedcom_setting($tree_id, 'SHOW_EST_LIST_DATES', false); set_gedcom_setting($tree_id, 'SHOW_FACT_ICONS', true); set_gedcom_setting($tree_id, 'SHOW_GEDCOM_RECORD', false); set_gedcom_setting($tree_id, 'SHOW_HIGHLIGHT_IMAGES', true); set_gedcom_setting($tree_id, 'SHOW_LDS_AT_GLANCE', false); set_gedcom_setting($tree_id, 'SHOW_LEVEL2_NOTES', true); set_gedcom_setting($tree_id, 'SHOW_LIVING_NAMES', WT_PRIV_USER); set_gedcom_setting($tree_id, 'SHOW_MEDIA_DOWNLOAD', false); set_gedcom_setting($tree_id, 'SHOW_NO_WATERMARK', WT_PRIV_USER); set_gedcom_setting($tree_id, 'SHOW_PARENTS_AGE', true); set_gedcom_setting($tree_id, 'SHOW_PEDIGREE_PLACES', '9'); set_gedcom_setting($tree_id, 'SHOW_PEDIGREE_PLACES_SUFFIX', false); set_gedcom_setting($tree_id, 'SHOW_PRIVATE_RELATIONSHIPS', true); set_gedcom_setting($tree_id, 'SHOW_RELATIVES_EVENTS', '_BIRT_CHIL,_BIRT_SIBL,_MARR_CHIL,_MARR_PARE,_DEAT_CHIL,_DEAT_PARE,_DEAT_GPAR,_DEAT_SIBL,_DEAT_SPOU'); set_gedcom_setting($tree_id, 'SHOW_STATS', false); set_gedcom_setting($tree_id, 'SOURCE_ID_PREFIX', 'S'); set_gedcom_setting($tree_id, 'SOUR_FACTS_ADD', 'NOTE,REPO,SHARED_NOTE,RESN'); set_gedcom_setting($tree_id, 'SOUR_FACTS_QUICK', 'TEXT,NOTE,REPO'); set_gedcom_setting($tree_id, 'SOUR_FACTS_UNIQUE', 'AUTH,ABBR,TITL,PUBL,TEXT'); set_gedcom_setting($tree_id, 'SUBLIST_TRIGGER_I', '200'); set_gedcom_setting($tree_id, 'SURNAME_LIST_STYLE', 'style2'); switch (WT_LOCALE) { case 'es': set_gedcom_setting($tree_id, 'SURNAME_TRADITION', 'spanish'); break; case 'is': set_gedcom_setting($tree_id, 'SURNAME_TRADITION', 'icelandic'); break; case 'lt': set_gedcom_setting($tree_id, 'SURNAME_TRADITION', 'lithuanian'); break; case 'pl': set_gedcom_setting($tree_id, 'SURNAME_TRADITION', 'polish'); break; case 'pt': case 'pt-BR': set_gedcom_setting($tree_id, 'SURNAME_TRADITION', 'portuguese'); break; default: set_gedcom_setting($tree_id, 'SURNAME_TRADITION', 'paternal'); break; } set_gedcom_setting($tree_id, 'THEME_DIR', 'webtrees'); set_gedcom_setting($tree_id, 'THUMBNAIL_WIDTH', '100'); set_gedcom_setting($tree_id, 'USE_RIN', false); set_gedcom_setting($tree_id, 'USE_SILHOUETTE', true); set_gedcom_setting($tree_id, 'WATERMARK_THUMB', false); set_gedcom_setting($tree_id, 'WEBMASTER_USER_ID', WT_USER_ID); set_gedcom_setting($tree_id, 'WEBTREES_EMAIL', ''); set_gedcom_setting($tree_id, 'WORD_WRAPPED_NOTES', false); set_gedcom_setting($tree_id, 'imported', 0); set_gedcom_setting($tree_id, 'title', WT_I18N::translate('My family tree')); // Default restriction settings $statement = WT_DB::prepare("INSERT INTO `##default_resn` (gedcom_id, xref, tag_type, resn) VALUES (?, NULL, ?, ?)"); $statement->execute(array($tree_id, 'SSN', 'confidential')); $statement->execute(array($tree_id, 'SOUR', 'privacy')); $statement->execute(array($tree_id, 'REPO', 'privacy')); $statement->execute(array($tree_id, 'SUBM', 'confidential')); $statement->execute(array($tree_id, 'SUBN', 'confidential')); // Genealogy data // It is simpler to create a temporary/unimported GEDCOM than to populate all the tables... $john_doe = WT_I18N::translate('John /DOE/'); $note = WT_I18N::translate('Edit this individual and replace their details with your own'); WT_DB::prepare("INSERT INTO `##gedcom_chunk` (gedcom_id, chunk_data) VALUES (?, ?)")->execute(array($tree_id, "0 HEAD\n1 CHAR UTF-8\n0 @I1@ INDI\n1 NAME {$john_doe}\n1 SEX M\n1 BIRT\n2 DATE 01 JAN 1850\n2 NOTE {$note}\n0 TRLR\n")); // Set the initial blocks WT_DB::prepare("INSERT INTO `##block` (gedcom_id, location, block_order, module_name)" . " SELECT ?, location, block_order, module_name" . " FROM `##block`" . " WHERE gedcom_id=-1")->execute(array($tree_id)); // Update the list of trees - to include the new configuration settings self::$trees = null; }
function print_main_notes(WT_Fact $fact, $level) { global $WT_TREE, $SHOW_FACT_ICONS; $factrec = $fact->getGedcom(); $fact_id = $fact->getFactId(); $parent = $fact->getParent(); $pid = $parent->getXref(); if ($fact->isNew()) { $styleadd = ' new'; $can_edit = $level == 1 && $fact->canEdit(); } elseif ($fact->isOld()) { $styleadd = ' old'; $can_edit = false; } else { $styleadd = ''; $can_edit = $level == 1 && $fact->canEdit(); } $ct = preg_match_all("/{$level} NOTE (.*)/", $factrec, $match, PREG_SET_ORDER); for ($j = 0; $j < $ct; $j++) { // Note object, or inline note? if (preg_match("/{$level} NOTE @(.*)@/", $match[$j][0], $nmatch)) { $note = WT_Note::getInstance($nmatch[1]); if ($note && !$note->canShow()) { continue; } } else { $note = null; } if ($level >= 2) { echo '<tr class="row_note2"><td class="descriptionbox rela ', $styleadd, ' width20">'; } else { echo '<tr><td class="descriptionbox ', $styleadd, ' width20">'; } if ($can_edit) { echo '<a onclick="return edit_record(\'', $pid, '\', \'', $fact_id, '\');" href="#" title="', WT_I18N::translate('Edit'), '">'; if ($level < 2) { if ($SHOW_FACT_ICONS) { echo '<i class="icon-note"></i> '; } if ($note) { echo WT_Gedcom_Tag::getLabel('SHARED_NOTE'); } else { echo WT_Gedcom_Tag::getLabel('NOTE'); } echo '</a>'; echo '<div class="editfacts">'; echo "<div class=\"editlink\"><a class=\"editicon\" onclick=\"return edit_record('{$pid}', '{$fact_id}');\" href=\"#\" title=\"" . WT_I18N::translate('Edit') . "\"><span class=\"link_text\">" . WT_I18N::translate('Edit') . "</span></a></div>"; echo '<div class="copylink"><a class="copyicon" href="#" onclick="return copy_fact(\'', $pid, '\', \'', $fact_id, '\');" title="' . WT_I18N::translate('Copy') . '"><span class="link_text">' . WT_I18N::translate('Copy') . '</span></a></div>'; echo "<div class=\"deletelink\"><a class=\"deleteicon\" onclick=\"return delete_fact('" . WT_I18N::translate('Are you sure you want to delete this fact?') . "', '{$pid}', '{$fact_id}');\" href=\"#\" title=\"" . WT_I18N::translate('Delete') . "\"><span class=\"link_text\">" . WT_I18N::translate('Delete') . "</span></a></div>"; if ($note) { echo '<a class="icon-note" href="', $note->getHtmlUrl(), '" title="' . WT_I18N::translate('View') . '"><span class="link_text">' . WT_I18N::translate('View') . '</span></a>'; } echo '</div>'; } } else { if ($level < 2) { if ($SHOW_FACT_ICONS) { echo '<i class="icon-note"></i> '; } if ($note) { echo WT_Gedcom_Tag::getLabel('SHARED_NOTE'); } else { echo WT_Gedcom_Tag::getLabel('NOTE'); } } $factlines = explode("\n", $factrec); // 1 BIRT Y\n2 NOTE ... $factwords = explode(" ", $factlines[0]); // 1 BIRT Y $factname = $factwords[1]; // BIRT $parent = WT_GedcomRecord::getInstance($pid); if ($factname == 'EVEN' || $factname == 'FACT') { // Add ' EVEN' to provide sensible output for an event with an empty TYPE record $ct = preg_match("/2 TYPE (.*)/", $factrec, $ematch); if ($ct > 0) { $factname = trim($ematch[1]); echo $factname; } else { echo WT_Gedcom_Tag::getLabel($factname, $parent); } } else { if ($factname != 'NOTE') { // Note is already printed echo WT_Gedcom_Tag::getLabel($factname, $parent); if ($note) { echo '<div class="editfacts"><a class="icon-note" href="', $note->getHtmlUrl(), '" title="' . WT_I18N::translate('View') . '"><span class="link_text">' . WT_I18N::translate('View') . '</span></a></div>'; } } } } echo '</td>'; if ($note) { // Note objects if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { // If Census assistant installed, allow it to format the note $text = GEDFact_assistant_WT_Module::formatCensusNote($note); } else { $text = WT_Filter::formatText($note->getNote(), $WT_TREE); } } else { // Inline notes $nrec = get_sub_record($level, "{$level} NOTE", $factrec, $j + 1); $text = $match[$j][1] . get_cont($level + 1, $nrec); $text = WT_Filter::formatText($text, $WT_TREE); } echo '<td class="optionbox', $styleadd, ' wrap">'; echo $text; if (!empty($noterec)) { echo print_fact_sources($noterec, 1); } // 2 RESN tags. Note, there can be more than one, such as "privacy" and "locked" if (preg_match_all("/\n2 RESN (.+)/", $factrec, $matches)) { foreach ($matches[1] as $match) { echo '<br><span class="label">', WT_Gedcom_Tag::getLabel('RESN'), ':</span> <span class="field">'; switch ($match) { case 'none': // Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it. // However, webtrees privacy rules will interpret it as "show an otherwise private fact to public". echo '<i class="icon-resn-none"></i> ', WT_I18N::translate('Show to visitors'); break; case 'privacy': echo '<i class="icon-resn-privacy"></i> ', WT_I18N::translate('Show to members'); break; case 'confidential': echo '<i class="icon-resn-confidential"></i> ', WT_I18N::translate('Show to managers'); break; case 'locked': echo '<i class="icon-resn-locked"></i> ', WT_I18N::translate('Only managers can edit'); break; default: echo $match; break; } echo '</span>'; } } echo '</td></tr>'; } }
function media_object_info(WT_Media $media) { $xref = $media->getXref(); $gedcom = WT_Tree::getNameFromId($media->getGedcomId()); $name = $media->getFullName(); $html = '<b>' . $name . '</b>' . '<div><i>' . WT_Filter::escapeHtml($media->getNote()) . '</i></div>' . '<br>' . '<a href="' . $media->getHtmlUrl() . '">' . WT_I18N::translate('View') . '</a>'; $html .= ' - ' . '<a onclick="window.open(\'addmedia.php?action=editmedia&pid=' . $xref . '&ged=' . WT_Filter::escapeJs($gedcom) . '\', \'_blank\', edit_window_specs)" href="#">' . WT_I18N::Translate('Edit') . '</a>' . ' - ' . '<a onclick="return delete_media(\'' . WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($media->getFullName()))) . '\', \'' . $media->getXref() . '\', \'' . WT_Filter::escapeJs($gedcom) . '\');" href="#">' . WT_I18N::Translate('Delete') . '</a>' . ' - '; if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $html .= '<a onclick="return ilinkitem(\'' . $xref . '\', \'manage\', \'' . $gedcom . '\')" href="#">' . WT_I18N::Translate('Manage links') . '</a>'; } else { global $TEXT_DIRECTION; $classSuffix = $TEXT_DIRECTION == 'rtl' ? '_rtl' : ''; $menu = new WT_Menu(); $menu->addLabel(WT_I18N::translate('Set link')); $menu->addClass('', 'submenu'); $submenu = new WT_Menu(WT_I18N::translate('To individual')); $submenu->addClass("submenuitem" . $classSuffix); $submenu->addOnClick("return ilinkitem('{$xref}', 'person', '{$gedcom}')"); $menu->addSubMenu($submenu); $submenu = new WT_Menu(WT_I18N::translate('To family')); $submenu->addClass("submenuitem" . $classSuffix); $submenu->addOnClick("return ilinkitem('{$xref}', 'family', '{$gedcom}')"); $menu->addSubMenu($submenu); $submenu = new WT_Menu(WT_I18N::translate('To source')); $submenu->addClass("submenuitem" . $classSuffix); $submenu->addOnClick("return ilinkitem('{$xref}', 'source', '{$gedcom}')"); $menu->addSubMenu($submenu); $html .= '<div style="display:inline-block;">' . $menu->getMenu() . '</div>'; } $html .= '<br><br>'; $linked = array(); foreach ($media->linkedIndividuals('OBJE') as $link) { $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } foreach ($media->linkedFamilies('OBJE') as $link) { $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } foreach ($media->linkedSources('OBJE') as $link) { $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } foreach ($media->linkedNotes('OBJE') as $link) { // Invalid GEDCOM - you cannot link a NOTE to an OBJE $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } foreach ($media->linkedRepositories('OBJE') as $link) { // Invalid GEDCOM - you cannot link a REPO to an OBJE $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } if ($linked) { $html .= '<ul>'; foreach ($linked as $link) { $html .= '<li>' . $link . '</li>'; } $html .= '</ul>'; } else { $html .= '<div class="error">' . WT_I18N::translate('This media object is not linked to any other record.') . '</div>'; } return $html; }
public static function getFavoritesMenu() { global $REQUIRE_AUTHENTICATION, $controller, $SEARCH_SPIDER; $show_user_favs = WT_USER_ID && array_key_exists('user_favorites', WT_Module::getActiveModules()); $show_gedc_favs = !$REQUIRE_AUTHENTICATION && array_key_exists('gedcom_favorites', WT_Module::getActiveModules()); if ($show_user_favs && !$SEARCH_SPIDER) { if ($show_gedc_favs && !$SEARCH_SPIDER) { $favorites = array_merge(gedcom_favorites_WT_Module::getFavorites(WT_GED_ID), user_favorites_WT_Module::getFavorites(WT_USER_ID)); } else { $favorites = user_favorites_WT_Module::getFavorites(WT_USER_ID); } } else { if ($show_gedc_favs && !$SEARCH_SPIDER) { $favorites = gedcom_favorites_WT_Module::getFavorites(WT_GED_ID); } else { return null; } } // Sort $favorites alphabetically? $menu = new WT_Menu(WT_I18N::translate('Favorites'), '#', 'menu-favorites'); foreach ($favorites as $favorite) { switch ($favorite['type']) { case 'URL': $submenu = new WT_Menu($favorite['title'], $favorite['url']); $menu->addSubMenu($submenu); break; case 'INDI': case 'FAM': case 'SOUR': case 'OBJE': case 'NOTE': $obj = WT_GedcomRecord::getInstance($favorite['gid']); if ($obj && $obj->canShowName()) { $submenu = new WT_Menu($obj->getFullName(), $obj->getHtmlUrl()); $menu->addSubMenu($submenu); } break; } } if ($show_user_favs) { if (isset($controller->record) && $controller->record instanceof WT_GedcomRecord) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $controller->record->getXref() . "'},function(){location.reload();})"); $menu->addSubMenu($submenu); } } return $menu; }
public function getTabContent() { global $EXPAND_RELATIVES_EVENTS, $controller; $EXPAND_HISTO_EVENTS = false; $indifacts = array(); // The individual’s own facts foreach ($controller->record->getFacts() as $fact) { switch ($fact->getTag()) { case 'SEX': case 'NAME': case 'SOUR': case 'OBJE': case 'NOTE': case 'FAMC': case 'FAMS': break; default: if (!array_key_exists('extra_info', WT_Module::getActiveSidebars()) || !extra_info_WT_Module::showFact($fact)) { $indifacts[] = $fact; } break; } } // Add spouse-family facts foreach ($controller->record->getSpouseFamilies() as $family) { foreach ($family->getFacts() as $fact) { switch ($fact->getTag()) { case 'SOUR': case 'NOTE': case 'OBJE': case 'CHAN': case '_UID': case 'RIN': case 'HUSB': case 'WIFE': case 'CHIL': break; default: $indifacts[] = $fact; break; } } $spouse = $family->getSpouse($controller->record); if ($spouse) { foreach (self::spouse_facts($controller->record, $spouse) as $fact) { $indifacts[] = $fact; } } foreach (self::child_facts($controller->record, $family, '_CHIL', '') as $fact) { $indifacts[] = $fact; } } foreach (self::parent_facts($controller->record, 1) as $fact) { $indifacts[] = $fact; } foreach (self::historical_facts($controller->record) as $fact) { $indifacts[] = $fact; } foreach (self::associate_facts($controller->record) as $fact) { $indifacts[] = $fact; } sort_facts($indifacts); ob_start(); echo '<table class="facts_table">'; echo '<tbody>'; if (!$indifacts) { echo '<tr><td colspan="2" class="facts_value">', WT_I18N::translate('There are no facts for this individual.'), '</td></tr>'; } echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox"'; if ($EXPAND_RELATIVES_EVENTS) { echo ' checked="checked"'; } echo ' onclick="jQuery(\'tr.rela\').toggle();"><label for="checkbox_rela_facts">', WT_I18N::translate('Events of close relatives'), '</label>'; if (file_exists(WT_Site::preference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) { echo ' <input id="checkbox_histo" type="checkbox"'; if ($EXPAND_HISTO_EVENTS) { echo ' checked="checked"'; } echo ' onclick="jQuery(\'tr.histo\').toggle();"><label for="checkbox_histo">', WT_I18N::translate('Historical facts'), '</label>'; } echo '</form></td></tr>'; foreach ($indifacts as $fact) { print_fact($fact, $controller->record); } //-- new fact link if ($controller->record->canEdit()) { print_add_new_fact($controller->record->getXref(), $indifacts, 'INDI'); } echo '</tbody>'; echo '</table>'; if (!$EXPAND_RELATIVES_EVENTS) { echo '<script>jQuery("tr.rela").toggle();</script>'; } if (!$EXPAND_HISTO_EVENTS) { echo '<script>jQuery("tr.histo").toggle();</script>'; } return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; }
require 'includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader()->addInlineJavascript(' jQuery("#menus_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("#menus_table").bind("sortupdate", function(event, ui) { jQuery("#"+jQuery(this).attr("id")+" input").each( function (index, value) { value.value = index+1; } ); }); '); $modules = WT_Module::getActiveMenus(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("menuaccess-{$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 (?, ?, 'menu', ?)")->execute(array($module_name, $tree->tree_id, $access_level)); } $order = WT_Filter::post('menuorder-' . $module_name); WT_DB::prepare("UPDATE `##module` SET menu_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; });
// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'admin_module_reports.php'); require 'includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader(); $modules = WT_Module::getActiveReports(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) { $value = WT_Filter::post("reportaccess-{$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 (?, ?, 'report', ?)")->execute(array($module_name, $tree->tree_id, $value)); } } } ?> <div id="reports" align="center"> <form method="post" action="<?php echo WT_SCRIPT_NAME; ?> ">
/** * Generate both the HTML and PNG components of the fan chart * * The HTML and PNG components both require the same co-ordinate calculations, * so we generate them using the same code, but we send them in separate * HTTP requests. * * @param string $what "png" or "html" * @param string[] $fanChart Presentation parameters, provided by the theme. * * @return string */ public function generate_fan_chart($what, $fanChart) { $treeid = ancestry_array($this->root->getXref(), $this->generations); $fanw = 640 * $this->fan_width / 100; $fandeg = 90 * $this->fan_style; $html = ''; $treesize = count($treeid); // generations count $gen = log($treesize) / log(2) - 1; $sosa = $treesize - 1; // fan size if ($fandeg == 0) { $fandeg = 360; } $fandeg = min($fandeg, 360); $fandeg = max($fandeg, 90); $cx = $fanw / 2 - 1; // center x $cy = $cx; // center y $rx = $fanw - 1; $rw = $fanw / ($gen + 1); $fanh = $fanw; // fan height if ($fandeg == 180) { $fanh = round($fanh * ($gen + 1) / ($gen * 2)); } if ($fandeg == 270) { $fanh = round($fanh * 0.86); } $scale = $fanw / 640; // image init $image = ImageCreate($fanw, $fanh); $white = ImageColorAllocate($image, 0xff, 0xff, 0xff); ImageFilledRectangle($image, 0, 0, $fanw, $fanh, $white); ImageColorTransparent($image, $white); $color = ImageColorAllocate($image, hexdec(substr($fanChart['color'], 1, 2)), hexdec(substr($fanChart['color'], 3, 2)), hexdec(substr($fanChart['color'], 5, 2))); $bgcolor = ImageColorAllocate($image, hexdec(substr($fanChart['bgColor'], 1, 2)), hexdec(substr($fanChart['bgColor'], 3, 2)), hexdec(substr($fanChart['bgColor'], 5, 2))); $bgcolorM = ImageColorAllocate($image, hexdec(substr($fanChart['bgMColor'], 1, 2)), hexdec(substr($fanChart['bgMColor'], 3, 2)), hexdec(substr($fanChart['bgMColor'], 5, 2))); $bgcolorF = ImageColorAllocate($image, hexdec(substr($fanChart['bgFColor'], 1, 2)), hexdec(substr($fanChart['bgFColor'], 3, 2)), hexdec(substr($fanChart['bgFColor'], 5, 2))); // imagemap $imagemap = '<map id="fanmap" name="fanmap">'; // loop to create fan cells while ($gen >= 0) { // clean current generation area $deg2 = 360 + ($fandeg - 180) / 2; $deg1 = $deg2 - $fandeg; ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bgcolor, IMG_ARC_PIE); $rx -= 3; // calculate new angle $p2 = pow(2, $gen); $angle = $fandeg / $p2; $deg2 = 360 + ($fandeg - 180) / 2; $deg1 = $deg2 - $angle; // special case for rootid cell if ($gen == 0) { $deg1 = 90; $deg2 = 360 + $deg1; } // draw each cell while ($sosa >= $p2) { $pid = $treeid[$sosa]; $person = WT_Individual::getInstance($pid); if ($person) { $name = $person->getFullName(); $addname = $person->getAddName(); $text = WT_I18N::reverseText($name); if ($addname) { $text .= "\n" . WT_I18N::reverseText($addname); } $text .= "\n" . WT_I18N::reverseText($person->getLifeSpan()); switch ($person->getSex()) { case 'M': $bg = $bgcolorM; break; case 'F': $bg = $bgcolorF; break; case 'U': $bg = $bgcolor; break; } ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE); // split and center text by lines $wmax = (int) ($angle * 7 / $fanChart['size'] * $scale); $wmax = min($wmax, 35 * $scale); if ($gen == 0) { $wmax = min($wmax, 17 * $scale); } $text = $this->split_align_text($text, $wmax); // text angle $tangle = 270 - ($deg1 + $angle / 2); if ($gen == 0) { $tangle = 0; } // calculate text position $deg = $deg1 + 0.44; if ($deg2 - $deg1 > 40) { $deg = $deg1 + ($deg2 - $deg1) / 11; } if ($deg2 - $deg1 > 80) { $deg = $deg1 + ($deg2 - $deg1) / 7; } if ($deg2 - $deg1 > 140) { $deg = $deg1 + ($deg2 - $deg1) / 4; } if ($gen == 0) { $deg = 180; } $rad = deg2rad($deg); $mr = ($rx - $rw / 4) / 2; if ($gen > 0 && $deg2 - $deg1 > 80) { $mr = $rx / 2; } $tx = $cx + $mr * cos($rad); $ty = $cy - $mr * -sin($rad); if ($sosa == 1) { $ty -= $mr / 2; } // print text ImageTtfText($image, (double) $fanChart['size'], $tangle, $tx, $ty, $color, $fanChart['font'], $text); $imagemap .= '<area shape="poly" coords="'; // plot upper points $mr = $rx / 2; $deg = $deg1; while ($deg <= $deg2) { $rad = deg2rad($deg); $tx = round($cx + $mr * cos($rad)); $ty = round($cy - $mr * -sin($rad)); $imagemap .= "{$tx},{$ty},"; $deg += ($deg2 - $deg1) / 6; } // plot lower points $mr = ($rx - $rw) / 2; $deg = $deg2; while ($deg >= $deg1) { $rad = deg2rad($deg); $tx = round($cx + $mr * cos($rad)); $ty = round($cy - $mr * -sin($rad)); $imagemap .= "{$tx},{$ty},"; $deg -= ($deg2 - $deg1) / 6; } // join first point $mr = $rx / 2; $deg = $deg1; $rad = deg2rad($deg); $tx = round($cx + $mr * cos($rad)); $ty = round($cy - $mr * -sin($rad)); $imagemap .= "{$tx},{$ty}"; // add action url $imagemap .= '" href="#' . $pid . '"'; $tempURL = 'fanchart.php?rootid=' . $pid . '&generations=' . $this->generations . '&fan_width=' . $this->fan_width . '&fan_style=' . $this->fan_style . '&ged=' . WT_GEDURL; $html .= '<div id="' . $pid . '" class="fan_chart_menu">'; $html .= '<div class="person_box"><div class="details1">'; $html .= '<a href="' . $person->getHtmlUrl() . '" class="name1">' . $name; if ($addname) { $html .= $addname; } $html .= '</a>'; $html .= '<ul class="charts">'; $html .= "<li><a href=\"pedigree.php?rootid={$pid}&amp;ged=" . WT_GEDURL . "\" >" . WT_I18N::translate('Pedigree') . "</a></li>"; if (array_key_exists('googlemap', WT_Module::getActiveModules())) { $html .= "<li><a href=\"module.php?mod=googlemap&mod_action=pedigree_map&rootid=" . $pid . "&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Pedigree map') . "</a></li>"; } if (WT_USER_GEDCOM_ID && WT_USER_GEDCOM_ID != $pid) { $html .= "<li><a href=\"relationship.php?pid1=" . WT_USER_GEDCOM_ID . "&pid2={$pid}&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Relationship to me') . "</a></li>"; } $html .= "<li><a href=\"descendancy.php?rootid={$pid}&ged=" . WT_GEDURL . "\" >" . WT_I18N::translate('Descendants') . "</a></li>"; $html .= "<li><a href=\"ancestry.php?rootid={$pid}&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Ancestors') . "</a></li>"; $html .= "<li><a href=\"compact.php?rootid={$pid}&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Compact tree') . "</a></li>"; $html .= "<li><a href=\"" . $tempURL . "\">" . WT_I18N::translate('Fan chart') . "</a></li>"; $html .= "<li><a href=\"hourglass.php?rootid={$pid}&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Hourglass chart') . "</a></li>"; if (array_key_exists('tree', WT_Module::getActiveModules())) { $html .= '<li><a href="module.php?mod=tree&mod_action=treeview&ged=' . WT_GEDURL . '&rootid=' . $pid . '">' . WT_I18N::translate('Interactive tree') . '</a></li>'; } $html .= '</ul>'; // spouse(s) and children foreach ($person->getSpouseFamilies() as $family) { $spouse = $family->getSpouse($person); if ($spouse) { $html .= '<a href="' . $spouse->getHtmlUrl() . '" class="name1">' . $spouse->getFullName() . '</a>'; $kids = $family->getChildren(); if ($kids) { $html .= '<ul class="children">'; foreach ($kids as $child) { $html .= '<li><a href="' . $child->getHtmlUrl() . '" class="name1">' . $child->getFullName() . '</a></li>'; } $html .= '</ul>'; } } } // siblings foreach ($person->getChildFamilies() as $family) { $children = $family->getChildren(); if ($children) { $html .= '<div class="name1">' . WT_I18N::plural('Sibling', 'Siblings', count($children) - 1) . '</div>'; $html .= '<ul class="siblings">'; foreach ($children as $sibling) { if ($sibling !== $person) { $html .= '<li><a href="' . $sibling->getHtmlUrl() . '" class="name1"> ' . $sibling->getFullName() . '</a></li>'; } } $html .= '</ul>'; } } $html .= '</div></div>'; $html .= '</div>'; $imagemap .= ' alt="' . strip_tags($person->getFullName()) . '" title="' . strip_tags($person->getFullName()) . '">'; } $deg1 -= $angle; $deg2 -= $angle; $sosa--; } $rx -= $rw; $gen--; } $imagemap .= '</map>'; switch ($what) { case 'html': $image_title = WT_I18N::translate('Fan chart of %s', strip_tags($person->getFullName())); return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->rootid . '&fan_style=' . $this->fan_style . '&generations=' . $this->generations . '&fan_width=' . $this->fan_width . '&img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . $image_title . '" title="' . $image_title . '" usemap="#fanmap"></div>'; case 'png': header('Content-Type: image/png'); ImageStringUp($image, 1, $fanw - 10, $fanh / 3, WT_SERVER_NAME . WT_SCRIPT_PATH, $color); ImagePng($image); ImageDestroy($image); } }
/** * add a new tag input field * * called for each fact to be edited on a form. * Fact level=0 means a new empty form : data are POSTed by name * else data are POSTed using arrays : * glevels[] : tag level * islink[] : tag is a link * tag[] : tag name * text[] : tag value * * @param string $tag fact record to edit (eg 2 DATE xxxxx) * @param string $upperlevel optional upper level tag (eg BIRT) * @param string $label An optional label to echo instead of the default * @param string $extra optional text to display after the input field * @param WT_Individual $person For male/female translations * * @return string */ function add_simple_tag($tag, $upperlevel = '', $label = '', $extra = null, WT_Individual $person = null) { global $tags, $emptyfacts, $main_fact, $FILE_FORM_accept, $xref, $bdm, $action; global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $PREFER_LEVEL2_SOURCES; $subnamefacts = array("NPFX", "GIVN", "SPFX", "SURN", "NSFX", "_MARNM_SURN"); preg_match('/^(?:(\\d+) (' . WT_REGEX_TAG . ') ?(.*))/', $tag, $match); list(, $level, $fact, $value) = $match; // element name : used to POST data if ($level == 0) { if ($upperlevel) { $element_name = $upperlevel . '_' . $fact; } else { $element_name = $fact; } // ex: OCCU } else { $element_name = "text[]"; } if ($level == 1) { $main_fact = $fact; } // element id : used by javascript functions if ($level == 0) { $element_id = $fact; } else { $element_id = $fact . Uuid::uuid4(); } if ($upperlevel) { $element_id = $upperlevel . '_' . $fact . Uuid::uuid4(); } // field value $islink = substr($value, 0, 1) === '@' && substr($value, 0, 2) != '@#'; if ($islink) { $value = trim(trim(substr($tag, strlen($fact) + 3)), " @\r"); } else { $value = trim(substr($tag, strlen($fact) + 3)); } if ($fact == 'REPO' || $fact == 'SOUR' || $fact == 'OBJE' || $fact == 'FAMC') { $islink = true; } if ($fact == 'SHARED_NOTE_EDIT' || $fact == 'SHARED_NOTE') { $islink = 1; $fact = "NOTE"; } // label echo "<tr id=\"", $element_id, "_tr\" "; if ($fact == "MAP" || ($fact == "LATI" || $fact == "LONG") && $value == '') { echo " style=\"display:none;\""; } echo " >"; if (in_array($fact, $subnamefacts) || $fact == "LATI" || $fact == "LONG") { echo "<td class=\"optionbox wrap width25\">"; } else { echo "<td class=\"descriptionbox wrap width25\">"; } if (WT_DEBUG) { echo $element_name, "<br>"; } // tag name if ($label) { echo $label; } elseif ($upperlevel) { echo WT_Gedcom_Tag::getLabel($upperlevel . ':' . $fact); } else { echo WT_Gedcom_Tag::getLabel($fact); } // help link // If using GEDFact-assistant window if ($action == "addnewnote_assisted") { // Do not print on GEDFact Assistant window } else { // Not all facts have help text. switch ($fact) { case 'FORM': if ($upperlevel != 'OBJE') { echo help_link($fact); } break; case 'NOTE': if ($islink) { echo help_link('edit_add_SHARED_NOTE'); } else { echo help_link($fact); } break; case 'NAME': if ($upperlevel != 'REPO') { echo help_link($fact); } break; case 'ASSO': case '_ASSO': // Some apps (including webtrees) use "2 _ASSO", since "2 ASSO" is not strictly valid GEDCOM if ($level == 1) { echo help_link('ASSO_1'); } else { echo help_link('ASSO_2'); } break; case 'ADDR': case 'AGNC': case 'CAUS': case 'DATE': case 'EMAI': case 'EMAIL': case 'EMAL': case '_EMAIL': case 'FAX': case 'OBJE': case 'PAGE': case 'PEDI': case 'PHON': case 'PLAC': case 'RELA': case 'RESN': case 'ROMN': case 'SEX': case 'SOUR': case 'STAT': case 'SURN': case 'TEMP': case 'TEXT': case 'TIME': case 'URL': case '_HEB': case '_PRIM': echo help_link($fact); break; } } // tag level if ($level > 0) { if ($fact == 'TEXT' && $level > 1) { echo "<input type=\"hidden\" name=\"glevels[]\" value=\"", $level - 1, "\">"; echo "<input type=\"hidden\" name=\"islink[]\" value=\"0\">"; echo "<input type=\"hidden\" name=\"tag[]\" value=\"DATA\">"; //-- leave data text[] value empty because the following TEXT line will //--- cause the DATA to be added echo "<input type=\"hidden\" name=\"text[]\" value=\"\">"; } echo "<input type=\"hidden\" name=\"glevels[]\" value=\"", $level, "\">"; echo "<input type=\"hidden\" name=\"islink[]\" value=\"", $islink, "\">"; echo "<input type=\"hidden\" name=\"tag[]\" value=\"", $fact, "\">"; } echo "</td>"; // value echo "<td class=\"optionbox wrap\">"; if (WT_DEBUG) { echo $tag, "<br>"; } // retrieve linked NOTE if ($fact == "NOTE" && $islink) { $note1 = WT_Note::getInstance($value); if ($note1) { $noterec = $note1->getGedcom(); preg_match("/{$value}/i", $noterec, $notematch); $value = $notematch[0]; } } if (in_array($fact, $emptyfacts) && ($value == '' || $value == 'Y' || $value == 'y')) { echo "<input type=\"hidden\" id=\"", $element_id, "\" name=\"", $element_name, "\" value=\"", $value, "\">"; if ($level <= 1) { echo '<input type="checkbox" '; if ($value) { echo ' checked="checked"'; } echo " onclick=\"if (this.checked) ", $element_id, ".value='Y'; else ", $element_id, ".value='';\">"; echo WT_I18N::translate('yes'); } } else { if ($fact == "TEMP") { echo select_edit_control($element_name, WT_Gedcom_Code_Temp::templeNames(), WT_I18N::translate('No temple - living ordinance'), $value); } else { if ($fact == "ADOP") { echo edit_field_adop($element_name, $value, '', $person); } else { if ($fact == "PEDI") { echo edit_field_pedi($element_name, $value, '', $person); } else { if ($fact == 'STAT') { echo select_edit_control($element_name, WT_Gedcom_Code_Stat::statusNames($upperlevel), '', $value); } else { if ($fact == 'RELA') { echo edit_field_rela($element_name, strtolower($value)); } else { if ($fact == 'QUAY') { echo select_edit_control($element_name, WT_Gedcom_Code_Quay::getValues(), '', $value); } else { if ($fact == '_WT_USER') { echo edit_field_username($element_name, $value); } else { if ($fact == 'RESN') { echo edit_field_resn($element_name, $value); } else { if ($fact == '_PRIM') { echo '<select id="', $element_id, '" name="', $element_name, '" >'; echo '<option value=""></option>'; echo '<option value="Y"'; if ($value == 'Y') { echo ' selected="selected"'; } echo '>', WT_I18N::translate('yes'), '</option>'; echo '<option value="N"'; if ($value == 'N') { echo ' selected="selected"'; } echo '>', WT_I18N::translate('no'), '</option>'; echo '</select>'; } else { if ($fact == 'SEX') { echo '<select id="', $element_id, '" name="', $element_name, '"><option value="M"'; if ($value == 'M') { echo ' selected="selected"'; } echo '>', WT_I18N::translate('Male'), '</option><option value="F"'; if ($value == 'F') { echo ' selected="selected"'; } echo '>', WT_I18N::translate('Female'), '</option><option value="U"'; if ($value == 'U' || empty($value)) { echo ' selected="selected"'; } echo '>', WT_I18N::translate_c('unknown gender', 'Unknown'), '</option></select>'; } else { if ($fact == 'TYPE' && $level == '3') { //-- Build the selector for the Media 'TYPE' Fact echo '<select name="text[]"><option selected="selected" value="" ></option>'; $selectedValue = strtolower($value); if (!array_key_exists($selectedValue, WT_Gedcom_Tag::getFileFormTypes())) { echo '<option selected="selected" value="', WT_Filter::escapeHtml($value), '" >', WT_Filter::escapeHtml($value), '</option>'; } foreach (WT_Gedcom_Tag::getFileFormTypes() as $typeName => $typeValue) { echo '<option value="', $typeName, '"'; if ($selectedValue == $typeName) { echo ' selected="selected"'; } echo '>', $typeValue, '</option>'; } echo '</select>'; } else { if ($fact == 'NAME' && $upperlevel != 'REPO' || $fact == '_MARNM') { // Populated in javascript from sub-tags echo "<input type=\"hidden\" id=\"", $element_id, "\" name=\"", $element_name, "\" onchange=\"updateTextName('", $element_id, "');\" value=\"", WT_Filter::escapeHtml($value), "\" class=\"", $fact, "\">"; echo '<span id="', $element_id, '_display" dir="auto">', WT_Filter::escapeHtml($value), '</span>'; echo ' <a href="#edit_name" onclick="convertHidden(\'', $element_id, '\'); return false;" class="icon-edit_indi" title="' . WT_I18N::translate('Edit name') . '"></a>'; } else { // textarea if ($fact == 'TEXT' || $fact == 'ADDR' || $fact == 'NOTE' && !$islink) { echo "<textarea id=\"", $element_id, "\" name=\"", $element_name, "\" dir=\"auto\">", WT_Filter::escapeHtml($value), "</textarea><br>"; } else { // text // If using GEDFact-assistant window if ($action == "addnewnote_assisted") { echo "<input type=\"text\" id=\"", $element_id, "\" name=\"", $element_name, "\" value=\"", WT_Filter::escapeHtml($value), "\" style=\"width:4.1em;\" dir=\"ltr\""; } else { echo "<input type=\"text\" id=\"", $element_id, "\" name=\"", $element_name, "\" value=\"", WT_Filter::escapeHtml($value), "\" dir=\"ltr\""; } echo " class=\"{$fact}\""; if (in_array($fact, $subnamefacts)) { echo " onblur=\"updatewholename();\" onkeyup=\"updatewholename();\""; } // Extra markup for specific fact types switch ($fact) { case 'DATE': echo " onblur=\"valid_date(this);\" onmouseout=\"valid_date(this);\""; break; case 'GIVN': echo ' autofocus data-autocomplete-type="GIVN"'; break; case 'LATI': echo " onblur=\"valid_lati_long(this, 'N', 'S');\" onmouseout=\"valid_lati_long(this, 'N', 'S');\""; break; case 'LONG': echo " onblur=\"valid_lati_long(this, 'E', 'W');\" onmouseout=\"valid_lati_long(this, 'E', 'W');\""; break; case 'NOTE': // Shared notes. Inline notes are handled elsewhere. echo ' data-autocomplete-type="NOTE"'; break; case 'OBJE': echo ' data-autocomplete-type="OBJE"'; break; case 'PLAC': echo ' data-autocomplete-type="PLAC"'; break; case 'REPO': echo ' data-autocomplete-type="REPO"'; break; case 'SOUR': echo ' data-autocomplete-type="SOUR"'; break; case 'SURN': case '_MARNM_SURN': echo ' data-autocomplete-type="SURN"'; break; } echo '>'; } $tmp_array = array('TYPE', 'TIME', 'NOTE', 'SOUR', 'REPO', 'OBJE', 'ASSO', '_ASSO', 'AGE'); // split PLAC if ($fact == 'PLAC') { echo "<div id=\"", $element_id, "_pop\" style=\"display: inline;\">"; echo print_specialchar_link($element_id), ' ', print_findplace_link($element_id); echo '<span onclick="jQuery(\'tr[id^=', $upperlevel, '_LATI],tr[id^=', $upperlevel, '_LONG],tr[id^=LATI],tr[id^=LONG]\').toggle(\'fast\'); return false;" class="icon-target" title="', WT_Gedcom_Tag::getLabel('LATI'), ' / ', WT_Gedcom_Tag::getLabel('LONG'), '"></span>'; echo '</div>'; if (array_key_exists('places_assistant', WT_Module::getActiveModules())) { places_assistant_WT_Module::setup_place_subfields($element_id); places_assistant_WT_Module::print_place_subfields($element_id); } } elseif (!in_array($fact, $tmp_array)) { echo print_specialchar_link($element_id); } } } } } } } } } } } } } } // MARRiage TYPE : hide text field and show a selection list if ($fact == 'TYPE' && $level == 2 && $tags[0] == 'MARR') { echo '<script>'; echo "document.getElementById('", $element_id, "').style.display='none'"; echo '</script>'; echo "<select id=\"", $element_id, "_sel\" onchange=\"document.getElementById('", $element_id, "').value=this.value;\" >"; foreach (array("Unknown", "Civil", "Religious", "Partners") as $key) { if ($key == "Unknown") { echo "<option value=\"\""; } else { echo "<option value=\"", $key, "\""; } $a = strtolower($key); $b = strtolower($value); if (@strpos($a, $b) !== false || @strpos($b, $a) !== false) { echo ' selected="selected"'; } $tmp = "MARR_" . strtoupper($key); echo ">", WT_Gedcom_Tag::getLabel($tmp), "</option>"; } echo "</select>"; } else { if ($fact == 'TYPE' && $level == 0) { $onchange = 'onchange="document.getElementById(\'' . $element_id . '\').value=this.value;"'; echo edit_field_name_type($element_name, $value, $onchange, $person); echo '<script>'; echo "document.getElementById('", $element_id, "').style.display='none';"; echo '</script>'; } } // popup links switch ($fact) { case 'DATE': echo print_calendar_popup($element_id); // Allow the GEDFact_assistant module to show a census-date selector if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { echo GEDFact_assistant_WT_Module::censusDateSelector($action, $upperlevel, $element_id); } break; case 'FAMC': case 'FAMS': echo print_findfamily_link($element_id); break; case 'ASSO': case '_ASSO': echo print_findindi_link($element_id, $element_id . '_description'); break; case 'FILE': print_findmedia_link($element_id, "0file"); break; case 'SOUR': echo print_findsource_link($element_id, $element_id . '_description'), ' ', print_addnewsource_link($element_id); //-- checkboxes to apply '1 SOUR' to BIRT/MARR/DEAT as '2 SOUR' if ($level == 1) { echo '<br>'; if ($PREFER_LEVEL2_SOURCES === '0') { $level1_checked = ''; $level2_checked = ''; } else { if ($PREFER_LEVEL2_SOURCES === '1' || $PREFER_LEVEL2_SOURCES === true) { $level1_checked = ''; $level2_checked = ' checked="checked"'; } else { $level1_checked = ' checked="checked"'; $level2_checked = ''; } } if (strpos($bdm, 'B') !== false) { echo ' <input type="checkbox" name="SOUR_INDI" ', $level1_checked, ' value="1">'; echo WT_I18N::translate('Individual'); if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { foreach ($matches[1] as $match) { if (!in_array($match, explode('|', WT_EVENTS_DEAT))) { echo ' <input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">'; echo WT_Gedcom_Tag::getLabel($match); } } } } if (strpos($bdm, 'D') !== false) { if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { foreach ($matches[1] as $match) { if (in_array($match, explode('|', WT_EVENTS_DEAT))) { echo ' <input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">'; echo WT_Gedcom_Tag::getLabel($match); } } } } if (strpos($bdm, 'M') !== false) { echo ' <input type="checkbox" name="SOUR_FAM" ', $level1_checked, ' value="1">'; echo WT_I18N::translate('Family'); if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) { foreach ($matches[1] as $match) { echo ' <input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">'; echo WT_Gedcom_Tag::getLabel($match); } } } } break; case 'REPO': echo print_findrepository_link($element_id), ' ', print_addnewrepository_link($element_id); break; case 'NOTE': // Shared Notes Icons ======================================== if ($islink) { // Print regular Shared Note icons --------------------------- echo ' ', print_findnote_link($element_id, $element_id . '_description'), ' ', print_addnewnote_link($element_id); if ($value) { echo ' ', print_editnote_link($value); } // Allow the GEDFact_assistant module to create a formatted shared note. if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { echo GEDFact_assistant_WT_Module::print_addnewnote_assisted_link($element_id, $xref, $action); } } break; case 'OBJE': echo print_findmedia_link($element_id, '1media'); if (!$value) { echo ' ', print_addnewmedia_link($element_id); $value = 'new'; } break; } echo '<div id="' . $element_id . '_description">'; // current value if ($fact == 'DATE') { $date = new WT_Date($value); echo $date->Display(false); } if ($value && $value != 'new' && $islink) { switch ($fact) { case 'ASSO': case '_ASSO': $tmp = WT_Individual::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; case 'SOUR': $tmp = WT_Source::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; case 'NOTE': $tmp = WT_Note::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; case 'OBJE': $tmp = WT_Media::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; case 'REPO': $tmp = WT_Repository::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; } } // pastable values if ($fact == 'FORM' && $upperlevel == 'OBJE') { print_autopaste_link($element_id, $FILE_FORM_accept); } echo '</div>', $extra, '</td></tr>'; return $element_id; }
} echo '</h2>'; if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { $linklevels = ''; $placelevels = ''; $place_names = array(); for ($j = 0; $j < $level; $j++) { $linklevels .= '&parent[' . $j . ']=' . rawurlencode($parent[$j]); if ($parent[$j] == '') { $placelevels = ', ' . WT_I18N::translate('unknown') . $placelevels; } else { $placelevels = ', ' . $parent[$j] . $placelevels; } } $gm_module->create_map($placelevels); } elseif (array_key_exists('places_assistant', WT_Module::getActiveModules())) { // Places Assistant is a custom/add-on module that was once part of the core code. places_assistant_WT_Module::display_map($level, $parent); } // -- echo the array foreach ($child_places as $n => $child_place) { if ($n == 0) { echo '<table id="place_hierarchy" class="list_table"><tr><td class="list_label" '; if ($numfound > 20) { echo 'colspan="3"'; } elseif ($numfound > 4) { echo 'colspan="2"'; } echo '><i class="icon-place"></i> '; if ($place_id) { echo WT_I18N::translate('Places in %s', $place->getPlaceName());
// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'admin_module_blocks.php'); require 'includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader(); $modules = WT_Module::getActiveBlocks(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) { $value = WT_Filter::post("blockaccess-{$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 (?, ?, 'block', ?)")->execute(array($module_name, $tree->tree_id, $value)); } } } ?> <div id="blocks" align="center"> <form method="post" action="<?php echo WT_SCRIPT_NAME; ?> ">
if ($changes) { echo '<br>', WT_I18N::translate('You should accept or reject all pending changes before upgrading.'), $icon_failure; echo '<br><button onclick="window.open(\'edit_changes.php\',\'_blank\', chan_window_specs); return false;"">', WT_I18N::translate('Pending changes'), '</button>'; echo '</li></ul></form>'; exit; } else { echo '<br>', WT_I18N::translate('There are no pending changes.'), $icon_success; } echo '</li>'; flush(); //////////////////////////////////////////////////////////////////////////////// // Custom modules may not work with the new version. //////////////////////////////////////////////////////////////////////////////// echo '<li>', WT_I18N::translate('Check for custom modules…'); $custom_modules = false; foreach (WT_Module::getActiveModules() as $module) { switch ($module->getName()) { case 'GEDFact_assistant': case 'ahnentafel_report': case 'batch_update': case 'bdm_report': case 'birth_report': case 'cemetery_report': case 'change_report': case 'charts': case 'ckeditor': case 'clippings': case 'death_report': case 'descendancy': case 'descendancy_report': case 'extra_info':
/** * print a note record * * @param string $text * @param int $nlevel the level of the note record * @param string $nrec the note record to print * @param bool $textOnly Don't print the "Note: " introduction * * @return boolean */ function print_note_record($text, $nlevel, $nrec, $textOnly = false) { global $WT_TREE; $text .= get_cont($nlevel, $nrec); // Check if shared note (we have already checked that it exists) if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ NOTE/', $nrec, $match)) { $note = WT_Note::getInstance($match[1]); $label = 'SHARED_NOTE'; // If Census assistant installed, allow it to format the note if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $html = GEDFact_assistant_WT_Module::formatCensusNote($note); } else { $html = WT_Filter::formatText($note->getNote(), $WT_TREE); } } else { $note = null; $label = 'NOTE'; $html = WT_Filter::formatText($text, $WT_TREE); } if ($textOnly) { return strip_tags($text); } if (strpos($text, "\n") === false) { // A one-line note? strip the block-level tags, so it displays inline return WT_Gedcom_Tag::getLabelValue($label, strip_tags($html, '<a><strong><em>')); } elseif ($WT_TREE->preference('EXPAND_NOTES')) { // A multi-line note, and we're expanding notes by default return WT_Gedcom_Tag::getLabelValue($label, $html); } else { // A multi-line note, with an expand/collapse option $element_id = Uuid::uuid4(); // NOTE: class "note-details" is (currently) used only by some third-party themes if ($note) { $first_line = '<a href="' . $note->getHtmlUrl() . '">' . $note->getFullName() . '</a>'; } else { list($first_line) = explode("\n", $text); } return '<div class="fact_NOTE"><span class="label">' . '<a href="#" onclick="expand_layer(\'' . $element_id . '\'); return false;"><i id="' . $element_id . '_img" class="icon-plus"></i></a> ' . WT_Gedcom_Tag::getLabel($label) . ':</span> ' . '<span id="' . $element_id . '-alt">' . $first_line . '</span>' . '</div>' . '<div class="note-details" id="' . $element_id . '" style="display:none">' . $html . '</div>'; } }
// Define all the icons we're going to use $IconUarrow = 'icon-uarrow'; $IconDarrow = 'icon-darrow'; if ($TEXT_DIRECTION == 'ltr') { $IconRarrow = 'icon-rarrow'; $IconLarrow = 'icon-larrow'; $IconRDarrow = 'icon-rdarrow'; $IconLDarrow = 'icon-ldarrow'; } else { $IconRarrow = 'icon-larrow'; $IconLarrow = 'icon-rarrow'; $IconRDarrow = 'icon-ldarrow'; $IconLDarrow = 'icon-rdarrow'; } $all_blocks = array(); foreach (WT_Module::getActiveBlocks() as $name => $block) { if ($user_id && $block->isUserBlock() || $gedcom_id && $block->isGedcomBlock()) { $all_blocks[$name] = $block; } } if ($user_id) { $blocks = get_user_blocks($user_id); } elseif ($gedcom_id) { $blocks = get_gedcom_blocks($gedcom_id); } if ($action == 'update') { Zend_Session::writeClose(); foreach (array('main', 'side') as $location) { if ($location == 'main') { $new_blocks = $main; } else {
} break; default: break; } } } $vars = $newvars; unset($newvars); foreach ($varnames as $name) { if (!isset($vars[$name])) { $vars[$name]['id'] = ''; } } $reports = array(); foreach (WT_Module::getActiveReports() as $rep) { foreach ($rep->getReportMenus() as $menu) { if (preg_match('/report=(' . preg_quote(WT_MODULES_DIR, '/') . '[a-z0-9_]+\\/[a-z0-9_]+\\.xml)/', $menu->link, $match)) { $reports[$match[1]] = $menu->label; } } } if (!empty($report)) { if (!array_key_exists($report, $reports)) { $action = 'choose'; } } //-- choose a report to run if ($action == 'choose') { $controller->setPageTitle(WT_I18N::translate('Choose a report to run')); $controller->pageHeader();
// " collation VARCHAR(16) NOT NULL,". // " language_name VARCHAR(64) NOT NULL,". // " language_name_base VARCHAR(64) NOT NULL,". // " enabled ENUM ('yes', 'no') DEFAULT 'yes' NOT NULL,". // " PRIMARY KEY (language_tag),". // " INDEX (language_name_base, language_name)". // ") COLLATE utf8_unicode_ci ENGINE=InnoDB" //); WT_DB::exec("CREATE TABLE IF NOT EXISTS `##site_access_rule` (" . " site_access_rule_id INTEGER NOT NULL AUTO_INCREMENT," . " ip_address_start INTEGER UNSIGNED NOT NULL DEFAULT 0," . " ip_address_end INTEGER UNSIGNED NOT NULL DEFAULT 4294967295," . " user_agent_pattern VARCHAR(255) NOT NULL," . " rule ENUM('allow', 'deny', 'robot', 'unknown') NOT NULL DEFAULT 'unknown'," . " comment VARCHAR(255) NOT NULL," . " updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," . " PRIMARY KEY (site_access_rule_id)," . " UNIQUE KEY `##site_access_rule_ix1` (ip_address_end, ip_address_start, user_agent_pattern, rule)," . " KEY `##site_access_rule_ix2` (rule)" . ") ENGINE=InnoDB COLLATE=utf8_unicode_ci"); WT_DB::exec("INSERT IGNORE INTO `##site_access_rule` (user_agent_pattern, rule, comment) VALUES" . " ('Mozilla/5.0 (%) Gecko/% %/%', 'allow', 'Gecko-based browsers')," . " ('Mozilla/5.0 (%) AppleWebKit/% (KHTML, like Gecko)%', 'allow', 'WebKit-based browsers')," . " ('Opera/% (%) Presto/% Version/%', 'allow', 'Presto-based browsers')," . " ('Mozilla/% (compatible; MSIE %', 'allow', 'Trident-based browsers')," . " ('Mozilla/% (Windows%; Trident%; rv:%) like Gecko', 'allow', 'Modern Internet Explorer')," . " ('Mozilla/5.0 (compatible; Konqueror/%', 'allow', 'Konqueror browser')"); WT_DB::prepare("INSERT IGNORE INTO `##gedcom` (gedcom_id, gedcom_name) VALUES " . " (-1, 'DEFAULT_TREE')")->execute(); WT_DB::prepare("INSERT IGNORE INTO `##user` (user_id, user_name, real_name, email, password) VALUES " . " (-1, 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER'), (1, ?, ?, ?, ?)")->execute(array($_POST['wtuser'], $_POST['wtname'], $_POST['wtemail'], password_hash($_POST['wtpass'], PASSWORD_DEFAULT))); WT_DB::prepare("INSERT IGNORE INTO `##user_setting` (user_id, setting_name, setting_value) VALUES " . " (1, 'canadmin', ?)," . " (1, 'language', ?)," . " (1, 'verified', ?)," . " (1, 'verified_by_admin', ?)," . " (1, 'editaccount', ?)," . " (1, 'auto_accept', ?)," . " (1, 'visibleonline', ?)")->execute(array(1, WT_LOCALE, 1, 1, 1, 0, 1)); WT_DB::prepare("INSERT IGNORE INTO `##site_setting` (setting_name, setting_value) VALUES " . "('WT_SCHEMA_VERSION', '-2')," . "('INDEX_DIRECTORY', 'data/')," . "('USE_REGISTRATION_MODULE', '1')," . "('REQUIRE_ADMIN_AUTH_REGISTRATION', '1')," . "('ALLOW_USER_THEMES', '1')," . "('ALLOW_CHANGE_GEDCOM', '1')," . "('SESSION_TIME', '7200')," . "('SMTP_ACTIVE', 'internal')," . "('SMTP_HOST', 'localhost')," . "('SMTP_PORT', '25')," . "('SMTP_AUTH', '1')," . "('SMTP_AUTH_USER', '')," . "('SMTP_AUTH_PASS', '')," . "('SMTP_SSL', 'none')," . "('SMTP_HELO', ?)," . "('SMTP_FROM_NAME', ?)")->execute(array($_SERVER['SERVER_NAME'], $_SERVER['SERVER_NAME'])); // Search for all installed modules, and enable them. WT_Module::getInstalledModules('enabled'); // Create the default settings for new users/family trees WT_DB::prepare("INSERT INTO `##block` (user_id, location, block_order, module_name) VALUES (-1, 'main', 1, 'todays_events'), (-1, 'main', 2, 'user_messages'), (-1, 'main', 3, 'user_favorites'), (-1, 'side', 1, 'user_welcome'), (-1, 'side', 2, 'random_media'), (-1, 'side', 3, 'upcoming_events'), (-1, 'side', 4, 'logged_in')")->execute(); WT_DB::prepare("INSERT INTO `##block` (gedcom_id, location, block_order, module_name) VALUES (-1, 'main', 1, 'gedcom_stats'), (-1, 'main', 2, 'gedcom_news'), (-1, 'main', 3, 'gedcom_favorites'), (-1, 'main', 4, 'review_changes'), (-1, 'side', 1, 'gedcom_block'), (-1, 'side', 2, 'random_media'), (-1, 'side', 3, 'todays_events'), (-1, 'side', 4, 'logged_in')")->execute(); // Create the blocks for the admin user WT_DB::prepare("INSERT INTO `##block` (user_id, location, block_order, module_name)" . " SELECT 1, location, block_order, module_name" . " FROM `##block`" . " WHERE user_id=-1")->execute(); // Write the config file. We already checked that this would work. $config_ini_php = '; <' . '?php exit; ?' . '> DO NOT DELETE THIS LINE' . PHP_EOL . 'dbhost="' . addcslashes($_POST['dbhost'], '"') . '"' . PHP_EOL . 'dbport="' . addcslashes($_POST['dbport'], '"') . '"' . PHP_EOL . 'dbuser="******"') . '"' . PHP_EOL . 'dbpass="******"') . '"' . PHP_EOL . 'dbname="' . addcslashes($_POST['dbname'], '"') . '"' . PHP_EOL . 'tblpfx="' . addcslashes($_POST['tblpfx'], '"') . '"' . PHP_EOL; file_put_contents(WT_DATA_DIR . 'config.ini.php', $config_ini_php); // Done - start using webtrees echo '<script>document.location=document.location;</script>', '</form></body></html>'; exit; } catch (PDOException $ex) { echo '<p class="bad">', WT_I18N::translate('An unexpected database error occurred.'), '</p>', '<pre>', $ex->getMessage(), '</pre>', '<p class="info">', WT_I18N::translate('The webtrees developers would be very interested to learn about this error. If you contact them, they will help you resolve the problem.'), '</p>'; } echo '</form>';
define('WT_THEME_URL', WT_STATIC_URL . WT_THEME_DIR); require WT_ROOT . WT_THEME_DIR . 'theme.php'; // Page hit counter - load after theme, as we need theme formatting if ($WT_TREE && $WT_TREE->preference('SHOW_COUNTER') && !$SEARCH_SPIDER) { require WT_ROOT . 'includes/hitcount.php'; } else { $hitCount = ''; } // define constants to be used when setting permissions after creating files/directories if (substr(PHP_SAPI, 0, 3) == 'cgi') { // cgi-mode, should only be writable by owner define('WT_PERM_EXE', 0755); // to be used on directories, php files, etc. define('WT_PERM_FILE', 0644); // to be used on images, text files, etc. } else { // mod_php mode, should be writable by everyone define('WT_PERM_EXE', 0777); define('WT_PERM_FILE', 0666); } // Lightbox needs custom integration in many places. Only check for the module once. define('WT_USE_LIGHTBOX', !$SEARCH_SPIDER && array_key_exists('lightbox', WT_Module::getActiveModules())); // Search engines are only allowed to see certain pages. if ($SEARCH_SPIDER && !in_array(WT_SCRIPT_NAME, array('index.php', 'indilist.php', 'module.php', 'mediafirewall.php', 'individual.php', 'family.php', 'mediaviewer.php', 'note.php', 'repo.php', 'source.php'))) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); $controller = new WT_Controller_Page(); $controller->setPageTitle(WT_I18N::translate('Search engine')); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('You do not have permission to view this page.'), '</p>'; exit; }
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>'; }
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; } }
// RFC2616 requires an absolute URL, but we don’t have it here. header('Location: site-php-version.php'); } define('WT_SCRIPT_NAME', 'index.php'); require './includes/session.php'; // The only option for action is "ajax" $action = WT_Filter::get('action'); // The default view depends on whether we are logged in $ctype = WT_Filter::get('ctype', 'gedcom|user', WT_USER_ID ? 'user' : 'gedcom'); // Get the blocks list if (WT_USER_ID && $ctype == 'user') { $blocks = get_user_blocks(WT_USER_ID); } else { $blocks = get_gedcom_blocks(WT_GED_ID); } $all_blocks = WT_Module::getActiveBlocks(); // The latest version is shown on the administration page. This updates it every day. // TODO: send an email notification to the admin when new versions are available. fetch_latest_version(); // We generate individual blocks using AJAX if ($action == 'ajax') { $controller = new WT_Controller_Ajax(); $controller->pageHeader(); // Check we’re displaying an allowable block. $block_id = WT_Filter::getInteger('block_id'); if (array_key_exists($block_id, $blocks['main'])) { $module_name = $blocks['main'][$block_id]; } elseif (array_key_exists($block_id, $blocks['side'])) { $module_name = $blocks['side'][$block_id]; } else { exit;
public function getSideBarContent() { global $controller; $html = ''; $active = 0; $n = 0; foreach (WT_Module::getActiveSidebars() as $mod) { if ($mod->hasSidebarContent()) { $html .= '<h3 id="' . $mod->getName() . '"><a href="#">' . $mod->getTitle() . '</a></h3>'; $html .= '<div id="sb_content_' . $mod->getName() . '">' . $mod->getSidebarContent() . '</div>'; // The family navigator should be opened by default if ($mod->getName() == 'family_nav') { $active = $n; } ++$n; } } if ($html) { $controller->addInlineJavascript(' jQuery("#sidebarAccordion").accordion({ active:' . $active . ', heightStyle: "content", collapsible: true, }); '); return '<div id="sidebar"><div id="sidebarAccordion">' . $html . '</div></div>'; } else { return ''; } }
// New format: array(ip, comment) $statement->execute(array($value[0], 'search-engine', $value[1])); } else { // Old format: string(ip) $statement->execute(array($value, 'search-engine', '')); } } catch (PDOException $ex) { echo $ex, '<br>'; } } } } } //////////////////////////////////////////////////////////////////////////////// foreach ($GEDCOMS as $GED_DATA) { WT_Module::setDefaultAccess($GED_DATA['id']); } echo '<p>pgv_site_setting => wt_module_setting ...</p>'; ob_flush(); flush(); usleep(50000); WT_DB::prepare("REPLACE INTO `##module_setting` (module_name, setting_name, setting_value)" . " SELECT 'googlemap', site_setting_name, site_setting_value FROM `{$DBNAME}`.`{$TBLPREFIX}site_setting`" . " WHERE site_setting_name LIKE 'GM_%'")->execute(); WT_DB::prepare("REPLACE INTO `##module_setting` (module_name, setting_name, setting_value)" . " SELECT 'lightbox', site_setting_name, site_setting_value FROM `{$DBNAME}`.`{$TBLPREFIX}site_setting`" . " WHERE site_setting_name LIKE 'LB_%'")->execute(); //////////////////////////////////////////////////////////////////////////////// echo '<p>pgv_favorites => wt_favorite ...</p>'; ob_flush(); flush(); usleep(50000); try { WT_DB::prepare("REPLACE INTO `##favorite` (favorite_id, user_id, gedcom_id, xref, favorite_type, url, title, note)" . " SELECT fv_id, u.user_id, g.gedcom_id, fv_gid, fv_type, fv_url, fv_title, fv_note" . " FROM `{$DBNAME}`.`{$TBLPREFIX}favorites` f" . " LEFT JOIN `##gedcom` g ON (f.fv_username=g.gedcom_name)" . " LEFT JOIN `##user` u ON (f.fv_username=u.user_name)")->execute(); } catch (PDOException $ex) {