function popup($text, $show_data = true) { global $dbh, $tree_id, $lang, $number, $c, $tree_prefix_quoted; $person = $text; $text = ''; include_once "../include/person_cls.php"; include_once "../include/marriage_cls.php"; //$person_man=$dbh->query("SELECT * FROM ".safe_text($_SESSION['tree_prefix'])."person WHERE pers_gedcomnumber='".safe_text($person)."'"); $person_man = $dbh->query("SELECT * FROM humo_persons\n\t\tWHERE pers_tree_id='" . $tree_id . "' AND pers_gedcomnumber='" . safe_text($person) . "'"); @($person_manDb = $person_man->fetch(PDO::FETCH_OBJ)); //*** Use class to show person *** $man_cls = new person_cls(); $man_cls->construct($person_manDb); $man_privacy = $man_cls->privacy; $name = $man_cls->person_name($person_manDb); if ($person_manDb->pers_sexe == "M") { $text .= '<li><img src="../images/man.gif" class="ui-li-icon">'; } elseif ($person_manDb->pers_sexe == "F") { $text .= '<li><img src="../images/woman.gif" class="ui-li-icon">'; } else { $text .= '<li><img src="../images/unknown.gif" class="ui-li-icon">'; } $number_text = ''; if ($number == 1) { $number_text = $c + 1 . ' '; } $text .= '<p>' . $number_text . '<a href="family.php?id=' . $person_manDb->pers_gedcomnumber . '">' . $name["index_name"] . '</a><br>'; if ($show_data == true) { if ($man_privacy) { $text .= __(' PRIVACY FILTER'); } else { // no privacy set if ($person_manDb->pers_birth_date or $person_manDb->pers_birth_place) { $text .= ucfirst(__('*')) . ' ' . date_place($person_manDb->pers_birth_date, $person_manDb->pers_birth_place) . '<br>'; } elseif ($person_manDb->pers_bapt_date or $person_manDb->pers_bapt_place) { $text .= ucfirst(__('~')) . ' ' . date_place($person_manDb->pers_bapt_date, $person_manDb->pers_bapt_place) . '<br>'; } if ($person_manDb->pers_death_date or $person_manDb->pers_death_place) { $text .= ucfirst(__('†')) . ' ' . date_place($person_manDb->pers_death_date, $person_manDb->pers_death_place) . '<br>'; } elseif ($person_manDb->pers_buried_date or $person_manDb->pers_buried_place) { if ($person_manDb->pers_cremation) { $var .= ucfirst(__('crem.')) . ' '; } else { $var .= ucfirst(__('buried')) . ' '; } $var .= date_place($person_manDb->pers_buried_date, $person_manDb->pers_buried_place) . '<br>'; } else { $text .= '</p></li>'; } } } return $text; }
function show_tree_text($tree_prefix, $selected_language) { global $dbh, $dataDb; // *** Standard tree text values *** $treetext_array['name'] = __('NO NAME'); $treetext_array['mainmenu_text'] = ''; $treetext_array['mainmenu_source'] = ''; //$treetext_array['family_top']='Family page'; $treetext_array['family_top'] = ''; $treetext_array['family_footer'] = ''; $found_text = false; // *** NEW: Default tree texts *** $sql = "SELECT * FROM humo_trees LEFT JOIN humo_tree_texts\r\n\t\tON humo_trees.tree_id=humo_tree_texts.treetext_tree_id\r\n\t\tAND treetext_language='default' WHERE tree_prefix='" . safe_text($tree_prefix) . "'"; $datasql = $dbh->query($sql); @($dataDb = $datasql->fetch(PDO::FETCH_OBJ)); if (isset($dataDb->treetext_name)) { $treetext_array['id'] = $dataDb->treetext_id; $treetext_array['name'] = $dataDb->treetext_name; $treetext_array['mainmenu_text'] = $dataDb->treetext_mainmenu_text; $treetext_array['mainmenu_source'] = $dataDb->treetext_mainmenu_source; $treetext_array['family_top'] = $dataDb->treetext_family_top; $treetext_array['family_footer'] = $dataDb->treetext_family_footer; $found_text = true; } // *** Check for tree texts in selected language *** $sql = "SELECT * FROM humo_trees LEFT JOIN humo_tree_texts\r\n\t\tON humo_trees.tree_id=humo_tree_texts.treetext_tree_id\r\n\t\tAND treetext_language='" . $selected_language . "' WHERE tree_prefix='" . safe_text($tree_prefix) . "'"; $datasql = $dbh->query($sql); @($dataDb = $datasql->fetch(PDO::FETCH_OBJ)); if (isset($dataDb->treetext_name)) { $treetext_array['id'] = $dataDb->treetext_id; $treetext_array['name'] = $dataDb->treetext_name; $treetext_array['mainmenu_text'] = $dataDb->treetext_mainmenu_text; $treetext_array['mainmenu_source'] = $dataDb->treetext_mainmenu_source; $treetext_array['family_top'] = $dataDb->treetext_family_top; $treetext_array['family_footer'] = $dataDb->treetext_family_footer; $found_text = true; } if ($found_text === false) { // *** Final try to show some texts *** $sql = "SELECT * FROM humo_trees LEFT JOIN humo_tree_texts\r\n\t\t\tON humo_trees.tree_id=humo_tree_texts.treetext_tree_id\r\n\t\t\tAND treetext_name LIKE '_%'\r\n\t\t\tWHERE tree_prefix='" . safe_text($tree_prefix) . "'"; @($datasql = $dbh->query($sql)); @($dataDb = $datasql->fetch(PDO::FETCH_OBJ)); if (isset($dataDb->treetext_name)) { $treetext_array['id'] = $dataDb->treetext_id; $treetext_array['name'] = $dataDb->treetext_name; $treetext_array['mainmenu_text'] = $dataDb->treetext_mainmenu_text; $treetext_array['mainmenu_source'] = $dataDb->treetext_mainmenu_source; $treetext_array['family_top'] = $dataDb->treetext_family_top; $treetext_array['family_footer'] = $dataDb->treetext_family_footer; } } return $treetext_array; }
} // *** Remove user *** if (isset($_GET['remove_user'])) { echo '<div class="confirm">'; echo __('Are you sure you want to delete this user?'); echo ' <form method="post" action="' . $_SERVER['PHP_SELF'] . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $_GET['page'] . '">'; echo '<input type="hidden" name="remove_user" value="' . $_GET['remove_user'] . '">'; echo ' <input type="Submit" name="remove_user2" value="' . __('Yes') . '" style="color : red; font-weight: bold;">'; echo ' <input type="Submit" name="submit" value="' . __('No') . '" style="color : blue; font-weight: bold;">'; echo '</form>'; echo '</div>'; } if (isset($_POST['remove_user2'])) { // *** Delete source connection *** $sql = "DELETE FROM humo_users WHERE user_id='" . safe_text($_POST['remove_user']) . "'"; $result = $dbh->query($sql); } // ************* // *** Users *** // ************* if (CMS_SPECIFIC == "Joomla") { echo "<form method=\"POST\" action=\"index.php?option=com_humo-gen&task=admin&page=users\">\n"; } else { echo "<form method=\"POST\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n"; } echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<br><table class="humo standard" border="1" style="width:95%;">'; echo '<tr class="table_header_large"><th>' . __('User') . '</th>'; echo '<th>' . __('E-mail address') . '</th>'; echo '<th>' . __('Change password') . '</th>';
function edit_category($ID, $cat) { global $scdb; if (intval($ID) != $ID || $ID < 1 || !isset($cat['category'][2])) { $this->category->message = 'Error: You must call $scadmin->edit_category() with an associative array, with at least the "category" value being set.'; return false; } $ID = (int) $ID; $category = safe_text($cat['category'], 50); $nicename = nicename($cat['nicename']); $info = isset($cat['info']) ? safe_text($cat['info'], 200) : ''; $oldcat = $scdb->get_row("SELECT * FROM `{$scdb->categories}` WHERE `ID` = '{$ID}' LIMIT 1"); if ($scdb->num_rows != 1) { $this->category->message = "Can't find category with `ID` = '{$ID}'"; $scdb->debug(); return false; } if (!$scdb->query("UPDATE `{$scdb->categories}` SET `category`='{$category}', `nicename`='{$nicename}', `info`='{$info}' WHERE `ID` = '{$ID}' LIMIT 1")) { $this->category->message = 'Error Updating Category!'; $scdb->debug(); return false; } $folder = IMG_FOLDER . $oldcat->nicename; if (is_dir($folder)) { rename($folder, IMG_FOLDER . $nicename); } else { $this->category->message = 'Error: Category Folder ' . IMG_FOLDER . $oldcat->nicename . ' can't be found!'; return false; } $this->category->message = 'Succesfully Edited Category!'; return true; }
<?php include 'db.php'; include 'init.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST)) { $_POST = json_decode(file_get_contents('php://input'), true); } $name = $email = $phone = $address = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = safe_text($_POST['name']); $email = safe_text($_POST['email']); $phone = safe_text($_POST['phone']); $address = safe_text($_POST['address']); $stmt = $conn->prepare('INSERT INTO members(name, email, phone, address) VALUES(:name, :email, :phone, :address)'); $stmt->execute(array(':name' => $name, ':email' => $email, ':phone' => $phone, ':address' => $address)); $results = $conn->query('SELECT * FROM members'); $results = json_encode($results->fetchAll()); print_r($results); }
function name_qry($search_name, $search_part) { $text = "LIKE '%" . safe_text($search_name) . "%'"; // *** Default value: "contains" *** if ($search_part == 'equals') { $text = "='" . safe_text($search_name) . "'"; } if ($search_part == 'starts_with') { $text = "LIKE '" . safe_text($search_name) . "%'"; } return $text; }
function process_text($text_process, $text_sort = 'standard') { global $dbh, $tree_id, $user, $tree_prefix_quoted; global $screen_mode, $text_presentation; if ($text_presentation != 'hide') { //1 NOTE Text by person#werktekst# //2 CONT 2e line text persoon#2e werktekst# //2 CONT 3e line #3e werktekst# tekst persoon // *** If multiple texts are read, a | seperator character is added *** // *** Split the text, and check for @Nxx@ texts *** $text_pieces = explode("|", $text_process); $text_result = ''; for ($i = 0; $i <= count($text_pieces) - 1; $i++) { // *** Search for Aldfaer texts *** if (substr($text_pieces[$i], 0, 1) == '@') { $text_check = substr($text_pieces[$i], 1, -1); //$search_text=$dbh->query("SELECT * FROM ".$tree_prefix_quoted."texts // WHERE text_gedcomnr='".safe_text($text_check)."'"); $search_text = $dbh->query("SELECT * FROM humo_texts\r\n\t\t\t\t\tWHERE text_tree_id='" . $tree_id . "' AND text_gedcomnr='" . safe_text($text_check) . "'"); $search_textDb = $search_text->fetch(PDO::FETCH_OBJ); if ($text_result) { $text_result .= '<br>'; } $text_result .= @$search_textDb->text_text; } else { if ($text_result) { $text_result .= '<br>'; } $text_result .= $text_pieces[$i]; } } if ($text_result) { $text_process = $text_result; } // *** If needed strip worktext (used in Haza-Data) *** if ($user['group_work_text'] == 'n') { // *** Added a '!' sign to prevent '0' detection. The routine will stop then! *** $text_process = "!" . $text_process; while (strpos($text_process, '#') > 0) { $first = strpos($text_process, '#'); $text1 = substr($text_process, 0, $first); $text_process = substr($text_process, $first + 1); $second = strpos($text_process, '#'); $text2 = substr($text_process, $second + 1); $text_process = $text1 . $text2; } // *** Strip added '!' sign *** $text_process = substr($text_process, 1); } // *** Convert all url's in a text to clickable links *** $text_process = preg_replace("#(^|[ \n\r\t])www.([a-z\\-0-9]+).([a-z]{2,4})(\$|[ \n\r\t])#mi", "\\1<a href=\"http://www.\\2.\\3\" target=\"_blank\">www.\\2.\\3</a>\\4", $text_process); //$text_process = preg_replace("#(^|[ \n\r\t])(((ftp://)|(http://)|(https://))([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+))#mi", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $text_process); $text_process = preg_replace("#(^|[ \n\r\t])(((http://)|(https://))([a-z0-9\\-\\.,\\?!%\\*_\\#:;~\\&\$@\\/=\\+]+))#mi", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $text_process); if ($text_process) { $text_process = nl2br($text_process); } if ($text_process) { if ($screen_mode == 'RTF') { $text_process = '<i>' . $text_process . '</i>'; } else { $text_process = '<span class="text">' . $text_process . '</span>'; } } // *** Show tekst in popup screen *** if ($text_presentation == 'popup' and $screen_mode != 'PDF' and $screen_mode != 'RTF' and $text_process) { global $rtlmarker, $family_id, $main_person, $alignmarker, $text_nr; if (isset($text_nr)) { $text_nr++; } else { $text_nr = 1; } $text = '<div class="' . $rtlmarker . 'sddm" style="left:10px;top:10px;display:inline;">'; $text .= '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $family_id . '&main_person=' . $main_person . '"'; $text .= ' style="display:inline" '; $text .= 'onmouseover="mopen(event,\'show_text' . $text_nr . '\',0,0)"'; $text .= 'onmouseout="mclosetime()">'; if ($text_sort == 'standard') { $text .= '[' . lcfirst(__('Text')) . ']'; } else { $text .= '<b>[' . __('Text') . ']</b>'; } $text .= '</a>'; if (substr_count($text_process, '<br>') > 10 or substr_count($text_process, '<br />') > 10) { $text .= '<div class="sddm_fixed" style="z-index:10; padding:4px; text-align:' . $alignmarker . '; direction:' . $rtlmarker . '; height:300px; width:80%; overflow-y: scroll;" id="show_text' . $text_nr . '" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">'; } else { $text .= '<div class="sddm_fixed" style="z-index:10; padding:4px; text-align:' . $alignmarker . '; direction:' . $rtlmarker . ';" id="show_text' . $text_nr . '" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">'; } // *** Show a correct website link in text *** $text_process = str_ireplace('<a href', '<a style="display:inline" href', $text_process); $text .= $text_process; $text .= '</div>'; $text .= '</div>'; $text_process = $text; } } else { $text_process = ''; } return $text_process; }
$hide_tree = false; if (in_array(@$dataDb->tree_id, $hide_tree_array)) { $hide_tree = true; } $_SESSION['tree_id'] = ''; $tree_id = ''; if ($hide_tree) { $_SESSION['tree_prefix'] = ''; $_SESSION['tree_id'] = ''; $tree_id = ''; } elseif (isset($dataDb->tree_id)) { $_SESSION['tree_id'] = $dataDb->tree_id; $tree_id = $dataDb->tree_id; } // *** Set variabele for queries *** $tree_prefix_quoted = safe_text($_SESSION['tree_prefix']); /* // ***************************************************************** // Use these lines to show a background picture for EACH FAMILY TREE // ***************************************************************** print '<style type="text/css">'; $picture= "pictures/".$_SESSION['tree_prefix'].".jpg"; print " body { background-image: url($picture);}"; print "</style>"; */ //echo '<script type="text/javascript" src="'.CMS_ROOTPATH.'include/sliderbar/slider.js"></script>'; if (strpos($_SERVER['REQUEST_URI'], "STAR") !== false or strpos($_SERVER['REQUEST_URI'], "maps") !== false or strpos($_SERVER['REQUEST_URI'], "HOUR") !== false or $user['group_pictures'] == 'j') { // if lightbox activated or descendant chart or hourglass chart or google maps is used --> load jquery echo ' <script src="' . CMS_ROOTPATH . 'include/jqueryui/js/jquery-1.8.0.min.js"></script> '; } if (strpos($_SERVER['REQUEST_URI'], "STAR") !== false or strpos($_SERVER['REQUEST_URI'], "HOUR") !== false or strpos($_SERVER['REQUEST_URI'], "maps") !== false) {
/** * Used to update a thread informations * @global type $input * @return boolean */ function thread_edit() { global $input; $thread_id = $input['thread_id']; $thread_message = surround_url($input['thread_message'] . edited_on()); $thread_timecode = intval($input['thread_timecode']); $thread_title = htmlspecialchars($input['thread_title']); $album = $input['thread_album']; $asset = $input['thread_asset']; $_SESSION['current_thread '] = $thread_id; // remove php and javascript tags $thread_message = safe_text($thread_message); thread_update($thread_id, $thread_title, $thread_message, $thread_timecode, $album, $_SESSION['user_full_name']); cache_asset_threads_unset($album, $asset); cache_album_threads_unset($album); trace_append(array('3', 'thread_edit', $album, $asset, $thread_timecode, $thread_id)); return thread_details_update(); }
<?php $user["user_name"] = ""; if (isset($_SESSION["user_name"])) { $user["user_name"] = $_SESSION["user_name"]; $account = "SELECT * FROM humo_users WHERE user_id=" . safe_text($_SESSION["user_id"]); } else { // *** For guest account ("gast" is only used for backward compatibility) *** $account = "SELECT * FROM humo_users WHERE user_name='gast' OR user_name='guest'"; } $accountqry = $dbh->query($account); try { @($accountDb = $accountqry->fetch(PDO::FETCH_OBJ)); } catch (PDOException $e) { echo "No valid user / Geen geldige gebruiker."; } $groupsql = $dbh->query("SELECT * FROM humo_groups WHERE group_id='" . $accountDb->user_group_id . "'"); try { @($groupDb = $groupsql->fetch(PDO::FETCH_OBJ)); } catch (PDOException $e) { echo "No valid usergroup / Geen geldige gebruikersgroup."; } if (!isset($groupDb->group_statistics)) { $user['group_statistics'] = 'j'; } else { $user['group_statistics'] = $groupDb->group_statistics; } if (!isset($groupDb->group_birthday_rss)) { $user['group_birthday_rss'] = 'j'; } else { $user['group_birthday_rss'] = $groupDb->group_birthday_rss;
<?php if (basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME'])) { exit(header('Location: index.php')); } if (isset($_POST['submit'])) { $conf = file_get_contents('../config.php'); $host = safe_text($_POST['host']); $user = safe_text($_POST['user']); $pass = safe_text($_POST['pass']); $name = safe_text($_POST['name']); $pref = safe_text($_POST['prefix']); $conf = preg_replace("/define\\('DB_HOST', '(.+)?'\\);/", "define('DB_HOST', '" . $host . "');", $conf, 1); $conf = preg_replace("/define\\('DB_USER', '(.+)?'\\);/", "define('DB_USER', '" . $user . "');", $conf, 1); if (isset($_POST['change'])) { if ($_POST['pass'] != $_POST['pass2']) { echo "<p class=\"message\">You're passwords do not match!</p>"; } else { $conf = preg_replace("/define\\('DB_PASS', '(.+)?'\\);/", "define('DB_PASS', '" . $_POST['pass'] . "');", $conf, 1); } } $conf = preg_replace("/define\\('DB_NAME', '(.+)?'\\);/", "define('DB_NAME', '" . $name . "');", $conf, 1); $conf = preg_replace("/define\\('DB_TABLE_PREFIX', '(.+)?'\\);/", "define('DB_NAME', '" . $pref . "');", $conf, 1); echo '<pre>', strtr($conf, array('<?php' => '<php', '?>' => '?>')), '</pre>'; } ?> <h3>Setup Options</h3> <form action="index.php?page=options&option=mysql" method="post" class="jNice"> <fieldset>
if (file_exists('update/temp_update_check.php')) { unlink('update/temp_update_check.php'); } } else { $update_text = ' ' . __('Online version check unavailable.'); //$update_text.= ' <a href="'.$path_tmp.'page=install_update&update_check=1">'.__('Update options').'</a>'; if (!function_exists('curl_exec')) { $update_text .= ' Extension php_curl.dll is disabled.'; } elseif (!is_writable('update')) { $update_text .= ' Folder admin/update/ is read only.'; } // *** Update settings, only check for update once a day *** $update_last_check = date("Y-m-d"); $result = $dbh->query("UPDATE humo_settings\n\t\t\t\t\t\tSET setting_value='" . safe_text($update_last_check) . "'\n\t\t\t\t\t\tWHERE setting_variable='update_last_check'"); } $result = $dbh->query("UPDATE humo_settings\n\t\t\t\t\tSET setting_value='" . safe_text($update_text) . "'\n\t\t\t\t\tWHERE setting_variable='update_text'"); $update_text .= ' *'; } else { // No online check now, use saved text... $update_text = $humo_option["update_text"]; } echo $update_text; } } // ****************** // *** START MENU *** // ****************** if ($page != 'login' and $page != 'update') { if (isset($_GET['page'])) { $page = $_GET['page']; }
$page_qry = $dbh->query("SELECT * FROM humo_cms_pages WHERE page_menu_id='0' AND page_status!='' ORDER BY page_order"); while ($cms_pagesDb = $page_qry->fetch(PDO::FETCH_OBJ)) { echo '<a href="' . CMS_ROOTPATH . 'cms_pages.php?select_page=' . $cms_pagesDb->page_id . '">' . $cms_pagesDb->page_title . '</a><br>'; } $qry = $dbh->query("SELECT * FROM humo_cms_menu ORDER BY menu_order"); while ($cmsDb = $qry->fetch(PDO::FETCH_OBJ)) { echo '<p><b>' . $cmsDb->menu_name . '</b><br>'; $page_qry = $dbh->query("SELECT * FROM humo_cms_pages WHERE page_menu_id='" . $cmsDb->menu_id . "' AND page_status!='' ORDER BY page_order"); while ($cms_pagesDb = $page_qry->fetch(PDO::FETCH_OBJ)) { echo '<a href="' . CMS_ROOTPATH . 'cms_pages.php?select_page=' . $cms_pagesDb->page_id . '">' . $cms_pagesDb->page_title . '</a><br>'; } } echo '</div>'; echo '<div id="mainmenu_center_alt" style="text-align:left;">'; if (isset($_GET['select_page'])) { $select_page = safe_text($_GET['select_page']); } else { $page_qry = $dbh->query("SELECT * FROM humo_cms_pages WHERE page_status!='' ORDER BY page_menu_id, page_order ASC LIMIT 0,1"); $cms_pagesDb = $page_qry->fetch(PDO::FETCH_OBJ); $select_page = $cms_pagesDb->page_id; } // *** Show page *** $page_qry = $dbh->query("SELECT * FROM humo_cms_pages WHERE page_id='" . $select_page . "' AND page_status!=''"); $cms_pagesDb = $page_qry->fetch(PDO::FETCH_OBJ); echo $cms_pagesDb->page_text; // *** Raise page counter *** // Only count page once every session $session_counter[] = ''; //@$itemteller=$cms_pagesDb->page_counter; $visited = 0; if (isset($_SESSION["opslag_sessieteller"])) {
function fams_add($personnr, $familynr) { global $dbh, $tree_id, $tree_prefix, $gedcom_date, $gedcom_time; // *** Add marriage to person records *** $person_qry = "SELECT * FROM humo_persons WHERE pers_tree_id='" . $tree_id . "' AND pers_gedcomnumber='" . safe_text($personnr) . "'"; $person_result = $dbh->query($person_qry); $person_db = $person_result->fetch(PDO::FETCH_OBJ); if (@$person_db->pers_gedcomnumber) { $fams = $person_db->pers_fams; if ($fams) { $fams1 = explode(";", $fams); $pers_indexnr = $fams1[0]; $fams .= ';' . $familynr; } else { $pers_indexnr = $familynr; $fams = $familynr; } $sql = "UPDATE humo_persons SET\n\t\t\tpers_fams='" . $fams . "',\n\t\t\tpers_indexnr='" . $pers_indexnr . "',\n\t\t\tpers_changed_date='" . $gedcom_date . "',\n\t\t\tpers_changed_time='" . $gedcom_time . "'\n\t\t\tWHERE pers_id='" . $person_db->pers_id . "'"; $result = $dbh->query($sql); } }
if ($page_nr != '1') { echo ' <a href="index.php?page=' . $page . '&page_up=' . $previous_page . '&select_page=' . $cms_pagesDb->page_id . '"><img src="' . CMS_ROOTPATH_ADMIN . 'images/arrow_up.gif" border="0" alt="up"></a>'; } //if ($cms_pagesDb->page_order!=$count_pages){ if ($page_nr != $count_pages) { echo ' <a href="index.php?page=' . $page . '&page_down=' . $cms_pagesDb->page_order . '&select_page=' . $cms_pagesDb->page_id . '&menu_id=' . $cms_pagesDb->page_menu_id . '"><img src="' . CMS_ROOTPATH_ADMIN . 'images/arrow_down.gif" border="0" alt="down"></a>'; } echo '</td><td>'; echo ' <a href="index.php?page=' . $page . '&select_page=' . $cms_pagesDb->page_id . '">' . $cms_pagesDb->page_title . '</a><br>'; echo '</td></tr>'; $previous_page = $cms_pagesDb->page_id; } echo '</table>'; echo '</td><td valign="top">'; if (isset($_GET["select_page"])) { $sql = "SELECT * FROM humo_cms_pages WHERE page_id=" . safe_text($_GET["select_page"]); $qry = $dbh->query($sql); $cms_pagesDb = $qry->fetch(PDO::FETCH_OBJ); //if ($memosoort2Db->website_id==$memosoortDb->menu_website_id){ // echo '<a href="index.php?page='.$page.'&select_page='.$cms_pagesDb->page_id.'">'.$cms_pagesDb->page_title.'</a><br>'; $page_id = $cms_pagesDb->page_id; $page_text = $cms_pagesDb->page_text; $page_status = $cms_pagesDb->page_status; $page_title = $cms_pagesDb->page_title; $page_menu_id = $cms_pagesDb->page_menu_id; $page_counter = $cms_pagesDb->page_counter; $page_edit = 'change'; } else { // *** Add new page *** $page_id = ''; $page_text = '';
while ($qryDb = $qry->fetch(PDO::FETCH_OBJ)) { $gebeurtsql = "INSERT INTO humo_unprocessed_tags SET\r\n\t\t\t\t\ttag_tree_id='" . $qryDb->address_tree_id . "',\r\n\t\t\t\t\ttag_address_id='" . $qryDb->address_id . "',\r\n\t\t\t\t\ttag_tag='" . safe_text($qryDb->address_unprocessed_tags) . "'"; $result = $dbh->query($gebeurtsql); } // *** Commit data in database *** $dbh->commit(); // *** Remove tags from addresses table *** $qry = "ALTER TABLE humo_addresses DROP address_unprocessed_tags;"; $result = $dbh->query($qry); // *** Copy tags from events to tag table *** // *** Batch processing *** $dbh->beginTransaction(); $sql = "SELECT event_id, event_tree_id, event_unprocessed_tags\r\n\t\t\t\tFROM humo_events WHERE event_unprocessed_tags LIKE '_%'"; $qry = $dbh->query($sql); while ($qryDb = $qry->fetch(PDO::FETCH_OBJ)) { $gebeurtsql = "INSERT INTO humo_unprocessed_tags SET\r\n\t\t\t\t\ttag_tree_id='" . $qryDb->event_tree_id . "',\r\n\t\t\t\t\ttag_event_id='" . $qryDb->event_id . "',\r\n\t\t\t\t\ttag_tag='" . safe_text($qryDb->event_unprocessed_tags) . "'"; $result = $dbh->query($gebeurtsql); } // *** Commit data in database *** $dbh->commit(); // *** Remove tags from events table *** $qry = "ALTER TABLE humo_events DROP event_unprocessed_tags;"; $result = $dbh->query($qry); // *** Update "update_status" to number 8 *** $result = $dbh->query("UPDATE humo_settings SET setting_value='8'\r\n\t\t\tWHERE setting_variable='update_status'"); echo ' Database updated!'; echo '</td></tr>'; } /* END OF UPDATE SCRIPT *** VERY IMPORTANT REMARKS FOR PROGRAMMERS *** * Change update_status in install.php
} break; // grab inital config info // grab inital config info case 2: if (!isset($_SESSION['step']) || $_SESSION['step'] != 2) { } if (isset($_POST['submit'])) { $conf = file_get_contents('../config.php'); $name = safe_text($_POST['name']); $domain = safe_text($_POST['domain']); $root = safe_text($_POST['doc_root']); $images = safe_text($_POST['images']); $img_folder = safe_text($_POST['img_folder']); $themes_url = safe_text($_POST['themes_url']); $theme = safe_text($_POST['theme']); $conf = preg_replace("/define\\('SITE_NAME', '(.+)'\\);/", "define('SITE_NAME', '" . $name . "');", $conf, 1); $conf = preg_replace("/define\\('DOMAIN', '(.+)'\\);/", "define('DOMAIN', '" . $domain . "');", $conf, 1); $conf = preg_replace("/define\\('ROOT', '(.+)'\\);/", "define('ROOT', '" . $root . "');", $conf, 1); $conf = preg_replace("/define\\('IMAGES', '(.+)'\\);/", "define('IMAGES', '" . $images . "');", $conf, 1); $conf = preg_replace("/define\\('IMG_FOLDER', '(.+)'\\);/", "define('IMG_FOLDER', '" . $img_folder . "');", $conf, 1); $conf = preg_replace("/define\\('THEMES_URL', '(.+)'\\);/", "define('THEMES_URL', '" . $themes_url . "');", $conf, 1); $conf = preg_replace("/define\\('THEME', '(.+)'\\);/", "define('THEME', '" . $theme . "');", $conf, 1); file_put_contents('../config.php', $conf); exit(header('Location: ' . $_SERVER['REQUEST_URI'])); } ?> <h3>Setup Options</h3> <form action="install.php?step=2" method="post" class="jNice"> <fieldset>
function person_popup_menu($personDb, $extended = false, $replacement_text = '', $extra_popup_text = '') { global $dbh, $tree_prefix_quoted, $db_functions, $bot_visit, $humo_option, $uri_path, $user, $language; global $screen_mode, $dirmark1, $dirmark2, $rtlmarker; global $selected_language, $hourglass; $text = ''; $privacy = $this->privacy; // *** Show pop-up menu *** if (!$bot_visit and $screen_mode != "PDF" and $screen_mode != "RTF") { // *** Family tree for search in multiple family trees *** $tree_prefix = safe_text($personDb->pers_tree_prefix); $db_functions->set_tree_prefix($tree_prefix); if (CMS_SPECIFIC == 'Joomla') { $start_url = 'index.php?option=com_humo-gen&task=family&database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber; } elseif ($humo_option["url_rewrite"] == "j") { // *** $uri_path made in header.php *** $start_url = $uri_path . 'family/' . $tree_prefix . '/' . $personDb->pers_indexnr . '/' . $personDb->pers_gedcomnumber . '/'; } else { $start_url = CMS_ROOTPATH . 'family.php?database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber; } $family_url = $start_url; // *** Change start url for a person in a graphical ancestor report *** if ($screen_mode == 'ancestor_chart' and $hourglass === false) { if (CMS_SPECIFIC == 'Joomla') { $start_url = 'index.php?option=com_humo-gen&task=ancestor&database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber . '&screen_mode=ancestor_chart'; } else { $start_url = CMS_ROOTPATH . 'report_ancestor.php?database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber . '&screen_mode=ancestor_chart'; } } // *** Change start url for a person in a graphical descendant report *** if (($screen_mode == 'STAR' or $screen_mode == 'STARSIZE') and $hourglass === false) { if (CMS_SPECIFIC == 'Joomla') { $start_url = 'index.php?option=com_humo-gen&task=family&database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=STAR'; } else { $start_url = CMS_ROOTPATH . 'family.php?database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=STAR'; } } // *** Change start url for a person in an hourglass chart *** if (($screen_mode == 'STAR' or $screen_mode == 'STARSIZE' or $screen_mode == 'ancestor_chart') and $hourglass === true) { if (CMS_SPECIFIC == 'Joomla') { $start_url = 'index.php?option=com_humo-gen&task=hourglass&database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=HOUR'; } else { $start_url = CMS_ROOTPATH . 'hourglass.php?database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=HOUR'; } } $text .= '<div class="' . $rtlmarker . 'sddm" style="display:inline;">' . "\n"; $text .= '<a href="' . $start_url . '"'; if ($extended) { //$text.= ' class="nam" style="font-size:9px; text-align:center; display:block; width:100%; height:100%" '; $text .= ' class="nam" style="z-index:100;font-size:10px; display:block; width:100%; height:100%" '; } $random_nr = rand(); // *** Generate a random number to avoid double numbers *** $text .= ' onmouseover="mopen(event,\'m1' . $random_nr . $personDb->pers_gedcomnumber . '\',0,0)"'; $text .= ' onmouseout="mclosetime()">'; if ($replacement_text) { $text .= $replacement_text; } else { $text .= '<img src="' . CMS_ROOTPATH . 'images/reports.gif" border="0" alt="reports">'; } $text .= '</a>'; // *** Remove standard background color from links *** //echo ' //<style> //.ltrsddm div a{ background:none; } //</style> //'; // *** Added style="z-index:40;" for ancestor and descendant report *** $text .= '<div style="z-index:40; border:1px solid #999999;" id="m1' . $random_nr . $personDb->pers_gedcomnumber . '" class="sddm_fixed person_popup" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">'; $name = $this->person_name($personDb); //$text.=$dirmark2.'<span style="font-size:14px; font-weight:bold; color:blue;">'.$name["standard_name"].$name["colour_mark"].'</span><br>'; $text .= $dirmark2 . '<span style="font-size:13px; font-weight:bold; color:blue;">' . $name["standard_name"] . $name["colour_mark"] . '</span><br>'; if ($extended) { $text .= '<table><tr><td style="width:auto; border: solid 0px; border-right:solid 1px #999999;">'; } $text .= '<b>' . __('Text reports') . ':</b>'; $text .= $dirmark1 . '<a href="' . $family_url . '"><img src="' . CMS_ROOTPATH . 'images/family.gif" border="0" alt="' . __('Family group sheet') . '"> ' . __('Family group sheet') . '</a>'; if ($user['group_gen_protection'] == 'n' and $personDb->pers_fams != '') { // *** Only show a descendant_report icon if there are children *** $check_children = false; $check_family = explode(";", $personDb->pers_fams); for ($i = 0; $i <= substr_count($personDb->pers_fams, ";"); $i++) { //@$check_childrenDb=$db_functions->get_family($check_family[$i]); @($check_childrenDb = $db_functions->get_family($check_family[$i])); if ($check_childrenDb->fam_children) { $check_children = true; } } if ($check_children) { if (CMS_SPECIFIC == 'Joomla') { $path_tmp = 'index.php?option=com_humo-gen&task=family&database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&descendant_report=1'; } else { $path_tmp = CMS_ROOTPATH . 'family.php?database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&descendant_report=1'; } $text .= '<a href="' . $path_tmp . '"><img src="' . CMS_ROOTPATH . 'images/descendant.gif" border="0" alt="' . __('Descendant report') . '"> ' . __('Descendant report') . '</a>'; if (CMS_SPECIFIC == 'Joomla') { $path_tmp = 'index.php?option=com_humo-gen&task=outline&database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&descendant_report=1'; } else { $path_tmp = CMS_ROOTPATH . 'report_outline.php?database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber; } $text .= '<a href="' . $path_tmp . '"><img src="' . CMS_ROOTPATH . 'images/outline.gif" border="0" alt="' . __('Outline report') . '"> ' . __('Outline report') . '</a>'; } } if ($user['group_gen_protection'] == 'n' and $personDb->pers_famc != '') { // == Ancestor report: link & icons by Klaas de Winkel (www.dewinkelwaar.tk) == if (CMS_SPECIFIC == 'Joomla') { $path_tmp = 'index.php?option=com_humo-gen&task=ancestor&database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber; } else { $path_tmp = CMS_ROOTPATH . 'report_ancestor.php?database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber; } $text .= '<a href="' . $path_tmp . '"><img src="' . CMS_ROOTPATH . 'images/ancestor_report.gif" border="0" alt="' . __('Ancestor report') . '"> ' . __('Ancestor report') . '</a>'; $text .= '<a href="' . $path_tmp . '&screen_mode=ancestor_sheet"><img src="' . CMS_ROOTPATH . 'images/ancestor_chart.gif" border="0" alt="' . __('Ancestor sheet') . '"> ' . __('Ancestor sheet') . '</a>'; } if ($user['group_gen_protection'] == 'n' and ($personDb->pers_famc != '' or $personDb->pers_fams != '')) { $text .= '<b>' . __('Charts') . ':</b>'; } if ($user['group_gen_protection'] == 'n' and $personDb->pers_famc != '') { // == added by Yossi Beck - FANCHART if (CMS_SPECIFIC == 'Joomla') { $path_tmp = 'index.php?option=com_humo-gen&task=fanchart&database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber; } else { $path_tmp = CMS_ROOTPATH . 'fanchart.php?database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber; } $text .= '<a href="' . $path_tmp . '"><img src="' . CMS_ROOTPATH . 'images/fanchart.gif" border="0" alt="Fanchart"> ' . __('Fanchart') . '</a>'; if (CMS_SPECIFIC == 'Joomla') { $path_tmp = 'index.php?option=com_humo-gen&task=ancestor&database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber . '&screen_mode=ancestor_chart'; } else { $path_tmp = CMS_ROOTPATH . 'report_ancestor.php?database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber . '&screen_mode=ancestor_chart'; } $text .= '<a href="' . $path_tmp . '"><img src="' . CMS_ROOTPATH . 'images/ancestor_report.gif" border="0" alt="' . __('Ancestor chart') . '"> ' . __('Ancestor chart') . '</a>'; } if ($user['group_gen_protection'] == 'n' and $personDb->pers_fams != '') { if ($check_children) { if (CMS_SPECIFIC == 'Joomla') { $path_tmp = 'index.php?option=com_humo-gen&task=family&database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=STAR'; } else { $path_tmp = CMS_ROOTPATH . 'family.php?database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=STAR'; } $text .= '<a href="' . $path_tmp . '"><img src="' . CMS_ROOTPATH . 'images/descendant.gif" border="0" alt="' . __('Descendant chart') . '"> ' . __('Descendant chart') . '</a>'; } } // DNA charts if ($user['group_gen_protection'] == 'n' and ($personDb->pers_famc != "" or $personDb->pers_fams != "" and $check_children)) { //if ($check_children){ //if($personDb->pers_sexe=="M") $charttype="ydnamark"; //else $charttype="mtdnamark"; if ($personDb->pers_sexe == "M") { $charttype = "ydna"; } else { $charttype = "mtdna"; } if (CMS_SPECIFIC == 'Joomla') { $path_tmp = 'index.php?option=com_humo-gen&task=family&database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=STAR&dnachart=' . $charttype; } else { $path_tmp = CMS_ROOTPATH . 'family.php?database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=STAR&dnachart=' . $charttype; } $text .= '<a href="' . $path_tmp . '"><img src="' . CMS_ROOTPATH . 'images/dna.png" border="0" alt="' . __('DNA Charts') . '"> ' . __('DNA Charts') . '</a>'; //} } if ($user['group_gen_protection'] == 'n' and $personDb->pers_famc != '' and $personDb->pers_fams != '' and $check_children) { // hourglass only if there is at least one generation of ancestors and of children. if (CMS_SPECIFIC == 'Joomla') { //$path_tmp='index.php?option=com_humo-gen&task=hourglass&database='.$tree_prefix.'&id='.$personDb->pers_gedcomnumber; $path_tmp = 'index.php?option=com_humo-gen&task=hourglass&database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=HOUR'; } else { //$path_tmp=CMS_ROOTPATH.'hourglass.php?database='.$tree_prefix.'&id='.$personDb->pers_gedcomnumber; $path_tmp = CMS_ROOTPATH . 'hourglass.php?database=' . $tree_prefix . '&id=' . $personDb->pers_indexnr . '&main_person=' . $personDb->pers_gedcomnumber . '&screen_mode=HOUR'; } $text .= '<a href="' . $path_tmp . '"><img src="' . CMS_ROOTPATH . 'images/hourglass.gif" border="0" alt="' . __('Hourglass chart') . '"> ' . __('Hourglass chart') . '</a>'; } // check for timeline folder and tml files if ($privacy == '') { $tmlcounter = 0; $tmldir = CMS_ROOTPATH . "languages/" . $selected_language . "/timelines"; if (file_exists($tmldir)) { $dh = opendir(CMS_ROOTPATH . "languages/" . $selected_language . "/timelines"); while (false !== ($filename = readdir($dh))) { if (strtolower(substr($filename, -3)) == "txt") { $tmlcounter++; } } } $tmldates = 0; if ($personDb->pers_birth_date or $personDb->pers_bapt_date or $personDb->pers_death_date or $personDb->pers_buried_date or $personDb->pers_fams) { $tmldates = 1; } if ($user['group_gen_protection'] == 'n' and $tmlcounter > 0 and $tmldates == 1) { if (CMS_SPECIFIC == 'Joomla') { $path_tmp = 'index.php?option=com_humo-gen&task=timelines&database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber; } else { $path_tmp = CMS_ROOTPATH . 'timelines.php?database=' . $tree_prefix . '&id=' . $personDb->pers_gedcomnumber; } $text .= '<a href="' . $path_tmp . '">'; $text .= '<img src="' . CMS_ROOTPATH . 'images/timeline.gif" border="0" alt="' . __('Timeline') . '"> ' . __('Timeline') . '</a>'; } } // *** Editor link *** //if ($user['group_editor']=='j' OR $user['group_admin']=='j') { if ($user['group_edit_trees'] or $user['group_admin'] == 'j') { $edit_tree_array = explode(";", $user['group_edit_trees']); // *** Administrator can always edit in all family trees *** if ($user['group_admin'] == 'j' or in_array($_SESSION['tree_id'], $edit_tree_array)) { $text .= '<b>' . __('Admin') . ':</b>'; $path_tmp = CMS_ROOTPATH . 'admin/index.php?page=editor&tree=' . $tree_prefix . '&person=' . $personDb->pers_gedcomnumber; $text .= '<a href="' . $path_tmp . '" target="_blank">'; $text .= '<img src="' . CMS_ROOTPATH . 'images/person_edit.gif" border="0" alt="' . __('Timeline') . '"> ' . __('Editor') . '</a>'; } } // *** Show person picture and person data at right side of the pop-up box *** if ($extended) { $text .= '</td><td style="width:auto; border: solid 0px; font-size: 10px;" valign="top">'; // *** Show picture in pop-up box *** if (!$privacy and $user['group_pictures'] == 'j') { // *** Path can be changed per family tree *** global $dataDb; $tree_pict_path = $dataDb->tree_pict_path; $picture_qry = $db_functions->get_events_person($personDb->pers_gedcomnumber, 'picture'); // *** Only show 1st picture *** if (isset($picture_qry[0])) { $pictureDb = $picture_qry[0]; $picture = show_picture($tree_pict_path, $pictureDb->event_event, '', 120); $text .= '<img src="' . $tree_pict_path . $picture['thumb'] . $picture['picture'] . '" style="margin-left:10px; margin-top:5px;" alt="' . $pictureDb->event_text . '" height="' . $picture['height'] . '">'; $text .= '<br>'; } } // *** Pop-up tekst *** if ($privacy == '') { if ($personDb->pers_birth_date or $personDb->pers_birth_place) { $text .= __('*') . $dirmark1 . ' ' . date_place($personDb->pers_birth_date, $personDb->pers_birth_place); } elseif ($personDb->pers_bapt_date or $personDb->pers_bapt_place) { $text .= __('~') . $dirmark1 . ' ' . date_place($personDb->pers_bapt_date, $personDb->pers_bapt_place); } if ($personDb->pers_death_date or $personDb->pers_death_place) { $text .= '<br>' . __('†') . $dirmark1 . ' ' . date_place($personDb->pers_death_date, $personDb->pers_death_place); } elseif ($personDb->pers_buried_date or $personDb->pers_buried_place) { $text .= '<br>' . __('[]') . $dirmark1 . ' ' . date_place($personDb->pers_buried_date, $personDb->pers_buried_place); } // *** If needed add extra text in the pop-up box *** if ($extra_popup_text) { $text .= $extra_popup_text; } } else { $text .= ' ' . __('PRIVACY FILTER'); } $text .= '</td></tr></table>'; } // *** End of extended pop-up *** $text .= $dirmark1 . '</div>'; $text .= '</div>' . "\n"; } // end "if not pdf" return $text; }
function mapbirthplace($place) { global $dbh, $tree_id, $language, $map_max; if (isset($_GET['namestring'])) { $temparray = explode("@", $_GET['namestring']); $namestring = " ("; foreach ($temparray as $value) { //echo $value.'<br>'; //$namestring .= "pers_lastname = '".$value."' OR "; $namestring .= "CONCAT(pers_lastname,'_',LOWER(SUBSTRING_INDEX(pers_prefix,'_',1))) = '" . $value . "' OR "; } $namestring = substr($namestring, 0, -3) . ") AND "; //echo $namestring; } else { $namestring = ''; } $desc_arr = ''; $idstring = ''; if (isset($_SESSION['desc_array'])) { $desc_arr = $_SESSION['desc_array']; $idstring = ' ('; foreach ($desc_arr as $value) { $idstring .= " pers_gedcomnumber = '" . $value . "' OR "; } $idstring = substr($idstring, 0, -3) . ') AND '; } $min = 1; if ($place != "NONFOUND") { if ($_SESSION['type_birth'] == 1) { if (isset($_GET['all'])) { // the 'All birth locations' button echo '<b><u>' . __('All persons born here: ') . '</u></b><br>'; //$maplist=$dbh->query("SELECT * , CONCAT(pers_lastname,pers_firstname) AS wholename FROM ".safe_text($_SESSION['tree_prefix'])."person WHERE ".$idstring.$namestring." (pers_birth_place = '".$place."' OR (pers_birth_place = '' AND pers_bapt_place = '".$place."')) ORDER BY wholename"); $sql = "SELECT * , CONCAT(pers_lastname,pers_firstname) AS wholename\n\t\t\t\t\tFROM humo_persons WHERE pers_tree_id='" . $tree_id . "'\n\t\t\t\t\tAND " . $idstring . $namestring . " (pers_birth_place = '" . $place . "' OR (pers_birth_place = '' AND pers_bapt_place = '" . $place . "')) ORDER BY wholename"; $maplist = $dbh->query($sql); } else { // the slider echo '<b><u>' . __('Persons born here until ') . $map_max . ':</u></b><br>'; $sql = "SELECT * , CONCAT(pers_lastname,pers_firstname) AS wholename FROM humo_persons\n\t\t\t\t\tWHERE pers_tree_id='" . $tree_id . "'\n\t\t\t\t\tAND " . $idstring . $namestring . " (pers_birth_place = '" . $place . "' OR (pers_birth_place = '' AND pers_bapt_place = '" . $place . "'))\n\t\t\t\t\tAND ((SUBSTR(pers_birth_date,-LEAST(4,CHAR_LENGTH(pers_birth_date))) < " . $map_max . "\n\t\t\t\t\tAND SUBSTR(pers_birth_date,-LEAST(4,CHAR_LENGTH(pers_birth_date))) > " . $min . ")\n\t\t\t\t\tOR (pers_birth_date='' AND SUBSTR(pers_bapt_date,-LEAST(4,CHAR_LENGTH(pers_bapt_date))) < " . $map_max . "\n\t\t\t\t\t\tAND SUBSTR(pers_bapt_date,-LEAST(4,CHAR_LENGTH(pers_bapt_date))) > " . $min . "))\n\t\t\t\t\tORDER BY wholename"; $maplist = $dbh->query($sql); } } elseif ($_SESSION['type_death'] == 1) { if (isset($_GET['all'])) { // the 'All birth locations' button echo '<b><u>' . __('All persons that died here: ') . '</u></b><br>'; //$maplist=$dbh->query("SELECT * , CONCAT(pers_lastname,pers_firstname) AS wholename FROM ".safe_text($_SESSION['tree_prefix'])."person WHERE ".$idstring.$namestring." (pers_death_place = '".$place."' OR (pers_death_place = '' AND pers_buried_place = '".$place."')) ORDER BY wholename"); $sql = "SELECT * , CONCAT(pers_lastname,pers_firstname) AS wholename\n\t\t\t\t\tFROM humo_persons\n\t\t\t\t\tWHERE pers_tree_id='" . $tree_id . "'\n\t\t\t\t\tAND " . $idstring . $namestring . "\n\t\t\t\t\t(pers_death_place = '" . $place . "' OR (pers_death_place = '' AND pers_buried_place = '" . $place . "'))\n\t\t\t\t\tORDER BY wholename"; $maplist = $dbh->query($sql); } else { // the slider echo '<b><u>' . __('Persons that died here until ') . $map_max . ':</u></b><br>'; $sql = "SELECT * , CONCAT(pers_lastname,pers_firstname) AS wholename FROM humo_persons\n\t\t\t\t\tWHERE pers_tree_id='" . $tree_id . "' AND " . $idstring . $namestring . "\n\t\t\t\t\t(pers_death_place = '" . $place . "' OR (pers_death_place = '' AND pers_buried_place = '" . $place . "')) AND\n\t\t\t\t\t((SUBSTR(pers_death_date,-LEAST(4,CHAR_LENGTH(pers_death_date))) < " . $map_max . " AND SUBSTR(pers_death_date,-LEAST(4,CHAR_LENGTH(pers_death_date))) > " . $min . ") OR\n\t\t\t\t\t(pers_death_date='' AND SUBSTR(pers_buried_date,-LEAST(4,CHAR_LENGTH(pers_buried_date))) < " . $map_max . " AND SUBSTR(pers_buried_date,-LEAST(4,CHAR_LENGTH(pers_buried_date))) > " . $min . "))\n\t\t\t\t\tORDER BY wholename"; $maplist = $dbh->query($sql); } } //echo 'TEST: '.$sql; $man_cls = new person_cls(); echo '<div style="direction:ltr">'; while (@($maplistDb = $maplist->fetch(PDO::FETCH_OBJ))) { $man_cls->construct($maplistDb); $privacy_man = $man_cls->privacy; $name = $man_cls->person_name($maplistDb); if ($name["show_name"] == true) { echo '<a href=family.php?database=' . safe_text($_SESSION['tree_prefix']) . '&id=' . $maplistDb->pers_indexnr . '&main_person=' . $maplistDb->pers_gedcomnumber . ' target="blank">'; } if ($_SESSION['type_birth'] == 1) { echo $name["index_name"]; $date = $maplistDb->pers_birth_date; $sign = __('born') . ' '; if (!$maplistDb->pers_birth_date and $maplistDb->pers_bapt_date) { $date = $maplistDb->pers_bapt_date; $sign = __('baptised') . ' '; } } if ($_SESSION['type_death'] == 1) { echo $name["index_name"]; $date = $maplistDb->pers_death_date; $sign = __('died') . ' '; if (!$maplistDb->pers_death_date and $maplistDb->pers_buried_date) { $date = $maplistDb->pers_buried_date; $sign = __('buried') . ' '; } } if (!$privacy_man and $date and $name["show_name"] == true) { echo ' (' . $sign . date_place($date, '') . ')'; } if ($name["show_name"] == true) { echo '</a>'; } echo '<br>'; } echo '</div>'; } else { // Logically we can never get here echo 'No persons found'; } }
function tree_merge() { global $dbh, $data2Db, $phpself; global $page, $language, $tree_id, $menu_admin, $relatives_merge, $merge_chars; // check for stored settings and if not present set them $relatives_merge = ''; $qry = "SELECT * FROM humo_settings WHERE setting_variable = 'rel_merge_" . $data2Db->tree_prefix . "'"; $relmerge = $dbh->query($qry); if ($relmerge->rowCount() > 0) { $relmergeDb = $relmerge->fetch(PDO::FETCH_OBJ); $relatives_merge = $relmergeDb->setting_value; } else { // the rel_merge row didn't exist yet - make it, with empty value $dbh->query("INSERT INTO humo_settings (setting_variable, setting_value) VALUES ('rel_merge_" . $data2Db->tree_prefix . "', '')"); } $result = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_chars'"); // get it if ($result->rowCount() > 0) { $resultDb = $result->fetch(PDO::FETCH_OBJ); $merge_chars = $resultDb->setting_value; } else { $result = $dbh->query("INSERT INTO humo_settings (setting_variable, setting_value) VALUES ('merge_chars', '10')"); } $result = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_lastname'"); if ($result->rowCount() > 0) { $resultDb = $result->fetch(PDO::FETCH_OBJ); $merge_lastname = $resultDb->setting_value; } else { $result = $dbh->query("INSERT INTO humo_settings (setting_variable, setting_value) VALUES ('merge_lastname', 'YES')"); } $result = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_firstname'"); if ($result->rowCount() > 0) { $resultDb = $result->fetch(PDO::FETCH_OBJ); $merge_firstname = $resultDb->setting_value; } else { $result = $dbh->query("INSERT INTO humo_settings (setting_variable, setting_value) VALUES ('merge_firstname', 'YES')"); } $result = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_dates'"); if ($result->rowCount() > 0) { $resultDb = $result->fetch(PDO::FETCH_OBJ); $merge_dates = $resultDb->setting_value; } else { $result = $dbh->query("INSERT INTO humo_settings (setting_variable, setting_value) VALUES ('merge_dates', 'YES')"); } $result = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_parentsdate'"); if ($result->rowCount() > 0) { $resultDb = $result->fetch(PDO::FETCH_OBJ); $merge_parentsdate = $resultDb->setting_value; } else { $result = $dbh->query("INSERT INTO humo_settings (setting_variable, setting_value) VALUES ('merge_parentsdate', 'YES')"); } // the following creates the pages that cycle through all duplicates that are stored in the dupl_arr array // the pages themselves are presented with the "show_pair function" if (isset($_POST['duplicate_compare'])) { if (!isset($_POST['no_increase'])) { // no increase is used if "switch left and right" was chosen $nr = ++$_SESSION['present_compare_' . $data2Db->tree_prefix]; // present_compare is the pair that has to be shown next - saved to session } else { $nr = $_SESSION['present_compare_' . $data2Db->tree_prefix]; } if (isset($_POST['choice_nr'])) { // choice number is the number from the "skip to" pulldown - saved to a session $nr = $_POST['choice_nr']; $_SESSION['present_compare_' . $data2Db->tree_prefix] = $_POST['choice_nr']; } // make sure the persons in the array are still there (in case in the mean time someone was merged) // after all, one person may be compared to more than one other person! while ($_SESSION['present_compare_' . $data2Db->tree_prefix] < count($_SESSION['dupl_arr_' . $data2Db->tree_prefix])) { $comp_set = explode(';', $_SESSION['dupl_arr_' . $data2Db->tree_prefix][$nr]); $qry = "SELECT * FROM humo_persons WHERE pers_id ='" . $comp_set[0] . "'"; $res = $dbh->query($qry); $qry = "SELECT * FROM humo_persons WHERE pers_id ='" . $comp_set[1] . "'"; $res2 = $dbh->query($qry); if (!$res or !$res2) { // one or 2 persons are missing - continue with next pair $nr = ++$_SESSION['present_compare_' . $data2Db->tree_prefix]; continue; // look for next pair in array } else { // we have got a valid pair echo '<br' . __('Carefully compare these two persons. Only if you are <b>absolutely sure</b> they are identical, press "Merge right into left".<br> If you don\'t want to merge, press "SKIP" to continue to the next pair of possible duplicates') . '<br><br>'; $left = $comp_set[0]; $right = $comp_set[1]; if (isset($_POST['left'])) { $left = $_POST['left']; } if (isset($_POST['right'])) { $right = $_POST['right']; } echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" value="' . __('Back to main merge menu') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="hidden" name="no_increase" value="1">'; echo '<input type="hidden" name="left" value="' . $right . '">'; echo '<input type="hidden" name="right" value="' . $left . '">'; echo '<input type="Submit" name="duplicate_compare" value="' . __('<- Switch left and right ->') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" name="duplicate_compare" value="' . __('Skip to next') . '">'; echo '</form>'; echo ' ' . __('Skip to nr: '); echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<select style="max-width:60px" name="choice_nr">'; for ($x = 0; $x < count($_SESSION['dupl_arr_' . $data2Db->tree_prefix]); $x++) { $selected = ''; if ($x == $_SESSION['present_compare_' . $data2Db->tree_prefix]) { $selected = "SELECTED"; } echo '<option value="' . $x . '" ' . $selected . '>' . ($x + 1) . '</option>'; } echo '</select>'; echo '<input type="Submit" name="duplicate_compare" value="' . __('Go!') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="hidden" name="dupl" value="1">'; echo '<input type="Submit" name="merge" value="' . __('Merge right into left') . '">'; echo '<br><br>'; $this->show_pair($left, $right, 'duplicate'); echo '<br>'; echo '</form>'; break; // get out of the while loop. next loop will be called by skip or merge buttons } } if ($_SESSION['present_compare_' . $data2Db->tree_prefix] >= count($_SESSION['dupl_arr_' . $data2Db->tree_prefix])) { unset($_SESSION['present_compare_' . $data2Db->tree_prefix]); echo '<br><br>' . __('No more duplicates found') . '<br><br>'; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" value="' . __('Back to main merge menu') . '">'; echo '</form>'; } } elseif (isset($_POST['manual_compare'])) { // check if persons are of opposite sex - if so don't continue $qry1 = "SELECT * FROM humo_persons WHERE pers_id ='" . $_POST['left'] . "'"; // left person $per1 = $dbh->query($qry1); $per1Db = $per1->fetch(PDO::FETCH_OBJ); $qry2 = "SELECT * FROM humo_persons WHERE pers_id ='" . $_POST['right'] . "'"; // right person $per2 = $dbh->query($qry2); $per2Db = $per2->fetch(PDO::FETCH_OBJ); if ($per1Db->pers_sexe != $per2Db->pers_sexe) { // trying to merge opposite sexes echo '<br>' . __('You cannot merge persons of opposite sex. Please try again') . '.<br><br>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" name="manual" value="' . __('Choose another pair') . '">'; echo '</form>'; } elseif ($per1Db->pers_gedcomnumber == $per2Db->pers_gedcomnumber) { // trying to merge same person!! echo '<br>' . __('This is one person already - you can\'t merge! Please try again') . '<br><br>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" name="manual" value="' . __('Choose another pair') . '">'; echo '</form>'; } else { echo '<br>' . __('Carefully compare these two persons. Only if you are <b>absolutely sure</b> they are identical, press "Merge right into left"') . '.<br>'; echo __('The checked items will be the ones entered into the database for the merged person. You can change the default settings') . '<br>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" value="' . __('Back to main merge menu') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="hidden" name="left" value="' . $_POST['right'] . '">'; echo '<input type="hidden" name="right" value="' . $_POST['left'] . '">'; echo '<input type="Submit" name="manual_compare" value="' . __('<- Switch left and right ->') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" name="manual" value="' . __('Choose another pair') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="hidden" name="manu" value="1">'; echo '<input type="hidden" name="left" value="' . $_POST['left'] . '">'; echo '<input type="hidden" name="right" value="' . $_POST['right'] . '">'; echo '<input type="Submit" name="merge" value="' . __('Merge right into left') . '">'; echo '<br><br>'; $this->show_pair($_POST['left'], $_POST['right'], 'manual'); echo '<br>'; echo '</form>'; } } elseif (isset($_POST['relatives'])) { // if skip - delete pair from database string if (isset($_POST['skip_rel'])) { // remove first entry (that the admin decided not to merge) from string $relcomp = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'rel_merge_" . $data2Db->tree_prefix . "'"); $relcompDb = $relcomp->fetch(PDO::FETCH_OBJ); // database row: I23@I300;I54@I304;I34@I430; $firstsemi = strpos($relcompDb->setting_value, ';') + 1; $string = substr($relcompDb->setting_value, $firstsemi); $dbh->query("UPDATE humo_settings SET setting_value ='" . $string . "' WHERE setting_variable = 'rel_merge_" . $data2Db->tree_prefix . "'"); $relatives_merge = $string; } // merge if (isset($_POST['rela'])) { // the merge button was used $left = $_POST['left']; $right = $_POST['right']; $this->merge_them($left, $right, "relatives"); } $relcomp = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'rel_merge_" . $data2Db->tree_prefix . "'"); $relcompDb = $relcomp->fetch(PDO::FETCH_OBJ); // database row: I23@I300;I54@I304;I34@I430; if ($relcompDb->setting_value != '') { if (!isset($_POST['swap'])) { $allpairs = explode(';', $relcompDb->setting_value); // $allpairs[0]: I23@I300 $pair = explode('@', $allpairs[0]); // $pair[0]: I23; $lft = $pair[0]; // I23 $rght = $pair[1]; // I300 $leftqry = $dbh->query("SELECT * FROM humo_persons WHERE pers_tree_id='" . $tree_id . "' AND pers_gedcomnumber ='" . $lft . "'"); $leftDb = $leftqry->fetch(PDO::FETCH_OBJ); $left = $leftDb->pers_id; $rightqry = $dbh->query("SELECT * FROM humo_persons WHERE pers_tree_id='" . $tree_id . "' AND pers_gedcomnumber ='" . $rght . "'"); $rightDb = $rightqry->fetch(PDO::FETCH_OBJ); $right = $rightDb->pers_id; } else { // "switch left-right" button used" $left = $_POST['left']; $right = $_POST['right']; } echo '<br>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" value="' . __('Back to main merge menu') . '">'; echo '</form>'; // button skip echo ' <form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="hidden" name="skip_rel" value="1">'; echo '<input type="Submit" name="relatives" value="' . __('Skip to next') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="hidden" name="swap" value="1">'; echo '<input type="hidden" name="left" value="' . $right . '">'; echo '<input type="hidden" name="right" value="' . $left . '">'; echo '<input type="Submit" name="relatives" value="' . __('<- Switch left and right ->') . '">'; echo '</form>'; // button merge echo ' <form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="hidden" name="left" value="' . $left . '">'; echo '<input type="hidden" name="right" value="' . $right . '">'; echo '<input type="hidden" name="rela" value="1">'; echo '<input type="Submit" name="relatives" value="' . __('Merge right into left') . '">'; echo '<br><br>'; $this->show_pair($left, $right, 'relatives'); echo '<br>'; echo '</form>'; } else { echo '<br><br>' . __('No more surrounding relatives to check') . '.<br><br>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" value="' . __('Back to main merge menu') . '">'; echo '</form>'; } } elseif (isset($_POST['merge'])) { // do merge and allow to continue with comparing duplicates if (isset($_POST['manu'])) { $left = $_POST['left']; $right = $_POST['right']; $this->merge_them($left, $right, "man_dupl"); // merge_them is called in manual/duplicate mode } elseif (isset($_POST['dupl'])) { // duplicate merging $nr = $_SESSION['present_compare_' . $data2Db->tree_prefix]; $comp_set = explode(';', $_SESSION['dupl_arr_' . $data2Db->tree_prefix][$nr]); $left = $comp_set[0]; $right = $comp_set[1]; $this->merge_them($left, $right, "man_dupl"); // merge_them is called in manual/duplicate mode } } elseif (isset($_POST['duplicate_choices'])) { echo '<br>'; echo __('With "Duplicate merge" the program will look for all persons with a fixed set of criteria for identical data. These are: <ul><li>Same last name and same first name.<br> By default, people with blank first or last names are included. You can disable that under "Settings" in the main menu.</li> <li>Same birthdate or same deathdate.<br> By default, when one or both persons have a missing birth/death date they will still be included when the name matches. You can change that under "Settings" in the main menu.</li></ul> The found duplicates will be presented to you, one pair after the other, with their details.<br> You can then decide whether to accept the default merge, or change which details of the right person will be merged into the left.<br> If you decide not to merge this pair, you can "skip" to the next pair.<br> If after the merge there are surrounding relatives that might need merging too, you will be urged to move to "Relatives merge"<br> If you have interrupted a duplicate merge in this session (for example to move to "relatives merge"), this page will also show a "Continue duplicate merge" button so you can continue where you left off.<br> <b>Please note that generating the duplicates may take some time, depending on the size of the tree.</b>'); echo '<br><br>'; if (isset($_SESSION['dupl_arr_' . $data2Db->tree_prefix])) { echo ' <form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" style="min-width:150px" name="duplicate_compare" value="' . __('Continue duplicate merge') . '">'; echo '</form>'; } echo ' <form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" style="min-width:150px" name="duplicate" value="' . __('Generate new duplicate merge') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" value="' . __('Back to main merge menu') . '">'; echo '</form>'; } elseif (isset($_POST['duplicate'])) { echo __('Please wait while duplicate list is generated') . '<br>'; $qry = "SELECT pers_id,pers_firstname,pers_lastname, pers_birth_date, pers_death_date\n\t\t\tFROM humo_persons WHERE pers_tree_id='" . $tree_id . "' ORDER BY pers_id"; $pers = $dbh->query($qry); unset($dupl_arr); // just to make sure... while ($persDb = $pers->fetch(PDO::FETCH_OBJ)) { // the exact phrasing of the query depends on the admin settings $qry2 = "SELECT pers_id,pers_firstname,pers_lastname, pers_birth_date, pers_death_date\n\t\t\t\tFROM humo_persons WHERE pers_id > " . $persDb->pers_id; if ($merge_firstname == 'YES') { $qry2 .= " AND SUBSTR(pers_firstname,1," . $merge_chars . ") = SUBSTR('" . $persDb->pers_firstname . "',1," . $merge_chars . ")"; } else { $qry2 .= " AND pers_firstname != '' AND SUBSTR(pers_firstname,1," . $merge_chars . ") = SUBSTR('" . $persDb->pers_firstname . "',1," . $merge_chars . ")"; } if ($merge_lastname == 'YES') { $qry2 .= " AND pers_lastname ='" . $persDb->pers_lastname . "' "; } else { $qry2 .= " AND pers_lastname != '' AND pers_lastname ='" . $persDb->pers_lastname . "' "; } if ($merge_dates == "YES") { $qry2 .= " AND (pers_birth_date ='" . $persDb->pers_birth_date . "' OR pers_birth_date ='' OR '" . $persDb->pers_birth_date . "'='') "; $qry2 .= " AND (pers_death_date ='" . $persDb->pers_death_date . "' OR pers_death_date ='' OR '" . $persDb->pers_death_date . "'='') "; } else { $qry2 .= " AND (( pers_birth_date != '' AND pers_birth_date ='" . $persDb->pers_birth_date . "' AND !(pers_death_date != '" . $persDb->pers_death_date . "'))\n\t\t\t\t\tOR\n\t\t\t\t\t( pers_death_date != '' AND pers_death_date ='" . $persDb->pers_death_date . "' AND !(pers_birth_date != '" . $persDb->pers_birth_date . "')) )"; } $pers2 = $dbh->query($qry2); if ($pers2) { while ($pers2Db = $pers2->fetch(PDO::FETCH_OBJ)) { $dupl_arr[] = $persDb->pers_id . ';' . $pers2Db->pers_id; } } } if (isset($dupl_arr)) { $_SESSION['dupl_arr_' . $data2Db->tree_prefix] = $dupl_arr; $_SESSION['present_compare_' . $data2Db->tree_prefix] = -1; echo '<br>' . __('Possible duplicates found: ') . count($dupl_arr) . '<br><br>'; // possible duplicates found echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" name="duplicate_compare" value="' . __('Start comparing duplicates') . '">'; // start comparing duplicates echo '</form>'; } else { echo '<br>' . __('No duplicates found. Duplicate merge and Automatic merge won\'t result in merges!') . '<br>'; // no duplicates were found echo __('You can try one of the other merge options') . '<br><br>'; // try other options echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" value="' . __('Back to main merge menu') . '">'; echo '</form>'; } } elseif (isset($_POST['manual']) or isset($_POST["search1"]) or isset($_POST["search2"]) or isset($_POST["switch"])) { echo '<br>' . __('Pick the two persons you want to check for merging') . '.'; echo ' ' . __('You can enter names (or part of names) or gedcom no. (INDI), or leave boxes empty') . '<br>'; echo __('<b>TIP: when you click "search" with all boxes left empty you will get a list with all persons in the database. (May take a few seconds)</b>') . '<br><br>'; // ===== BEGIN SEARCH BOX SYSTEM include_once CMS_ROOTPATH . "include/person_cls.php"; $pers_cls = new person_cls(); if (!isset($_POST["search1"]) and !isset($_POST["search2"]) and !isset($_POST["manual_compare"]) and !isset($_POST["switch"])) { // no button pressed: this is a fresh entry from humogen's frontpage link: start clean search form $_SESSION["search1"] = ''; $_SESSION["search2"] = ''; $_SESSION['rel_search_firstname'] = ''; $_SESSION['rel_search_lastname'] = ''; $_SESSION['rel_search_firstname2'] = ''; $_SESSION['rel_search_lastname2'] = ''; $_SESSION['search_indi'] = ''; $_SESSION['search_indi2'] = ''; } $left = ''; if (isset($_POST["left"])) { $left = $_POST['left']; } $right = ''; if (isset($_POST["right"])) { $right = $_POST['right']; } if (isset($_POST["search1"])) { $_SESSION["search1"] = 1; } if (isset($_POST["search2"])) { $_SESSION["search2"] = 1; } if (isset($_POST["switch"])) { $temp = $_SESSION['rel_search_firstname']; $_SESSION['rel_search_firstname'] = $_SESSION['rel_search_firstname2']; $_SESSION['rel_search_firstname2'] = $temp; $temp = $_SESSION['rel_search_lastname']; $_SESSION['rel_search_lastname'] = $_SESSION['rel_search_lastname2']; $_SESSION['rel_search_lastname2'] = $temp; $temp = $_SESSION['search_indi']; $_SESSION['search_indi'] = $_SESSION['search_indi2']; $_SESSION['search_indi2'] = $temp; $temp = $left; $left = $right; $right = $temp; $temp = $_SESSION["search1"]; $_SESSION["search1"] = $_SESSION["search2"]; $_SESSION["search2"] = $temp; } // if joomla component will be continued the following line has to be adjusted for joomla echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<table class="humo" style="text-align:center; width:100%;">'; echo '<tr class="table_header"><td>'; echo ' '; echo '</td><td>'; echo __('First name') . ':'; echo '</td><td>'; echo __('Last name') . ':'; echo '</td><td>'; echo __('gedcom no. ("I43")') . ':'; echo '</td><td>'; echo __('Search'); echo '</td><td colspan=2>' . __('Pick a name from search results') . '</td><td>'; echo __('Show details'); echo '</td></tr><tr><td style="white-space:nowrap">'; $language_person = __('Person') . ' '; if (CMS_SPECIFIC == "Joomla") { $language_person = ''; } // for joomla keep it short.... echo $language_person . '1:'; echo '</td><td>'; $search_firstname = ''; if (isset($_POST["search_firstname"]) and !isset($_POST["switch"])) { $search_firstname = safe_text($_POST['search_firstname']); $_SESSION['rel_search_firstname'] = $search_firstname; } if (isset($_SESSION['rel_search_firstname'])) { $search_firstname = $_SESSION['rel_search_firstname']; } $search_lastname = ''; if (isset($_POST["search_lastname"]) and !isset($_POST["switch"])) { $search_lastname = safe_text($_POST['search_lastname']); $_SESSION['rel_search_lastname'] = $search_lastname; } if (isset($_SESSION['rel_search_lastname'])) { $search_lastname = $_SESSION['rel_search_lastname']; } $search_indi = ''; if (isset($_POST["search_indi"]) and !isset($_POST["switch"])) { $search_indi = safe_text($_POST['search_indi']); $_SESSION['search_indi'] = $search_indi; } if (isset($_SESSION['search_indi'])) { $search_indi = $_SESSION['search_indi']; } echo ' <input type="text" class="fonts relboxes" name="search_firstname" value="' . $search_firstname . '" size="15"> '; echo '</td><td>'; echo ' <input class="fonts relboxes" type="text" name="search_lastname" value="' . $search_lastname . '" size="15">'; echo '</td><td>'; echo ' <input type="text" class="fonts relboxes" name="search_indi" value="' . $search_indi . '" size="10"> '; echo '</td><td>'; echo ' <input class="fonts" type="submit" name="search1" value="' . __('Search') . '">'; echo '</td><td>'; $len = 230; // length of name pulldown box if (CMS_SPECIFIC == "Joomla") { $len = 180; } // for joomla keep it short.... if (isset($_SESSION["search1"]) and $_SESSION["search1"] == 1) { $indi_string = ""; if (isset($_SESSION["search_indi"]) and $_SESSION["search_indi"] != "") { // make sure it works with "I436", "i436" and "436" $indi = (substr($search_indi, 0, 1) == "I" or substr($search_indi, 0, 1) == "i") ? strtoupper($search_indi) : "I" . $search_indi; $indi_string = " AND pers_gedcomnumber ='" . $indi . "' "; } $search_qry = "SELECT * FROM humo_persons WHERE pers_tree_id='" . $tree_id . "' AND CONCAT(REPLACE(pers_prefix,'_',' '),pers_lastname)"; $search_qry .= " LIKE '%" . $search_lastname . "%' AND pers_firstname LIKE '%" . $search_firstname . "%' " . $indi_string . " ORDER BY pers_lastname, pers_firstname"; $search_result = $dbh->query($search_qry); if ($search_result) { if ($search_result->rowCount() > 0) { echo '<select class="fonts" size="1" name="left" style="width:' . $len . 'px">'; while ($searchDb = $search_result->fetch(PDO::FETCH_OBJ)) { $name = $pers_cls->person_name($searchDb); if ($name["show_name"]) { echo '<option'; if (isset($left)) { if ($searchDb->pers_id == $left and !(isset($_POST["search1"]) and $search_lastname == '' and $search_firstname == '')) { echo ' SELECTED'; } } echo ' value="' . $searchDb->pers_id . '">' . $name["index_name"] . ' [' . $searchDb->pers_gedcomnumber . ']</option>'; } } echo '</select>'; } else { echo '<select size="1" name="notfound" value="1" style="width:' . $len . 'px"><option>' . __('Person not found') . '</option></select>'; } } } else { echo '<select size="1" name="left" style="width:' . $len . 'px"><option></option></select>'; } echo '</td><td rowspan=2>'; echo '<input type="submit" alt="' . __('Switch persons') . '" title="' . __('Switch persons') . '" value=" " name="switch" style="background: #fff url(\'' . CMS_ROOTPATH . 'images/turn_around.gif\') top no-repeat;width:25px;height:25px">'; echo '</td><td rowspan=2>'; echo '<input type="submit" name="manual_compare" value="' . __('Show details') . '" style="font-size:115%;">'; echo '</td></tr><tr><td style="white-space:nowrap">'; // SECOND PERSON echo $language_person . '2:'; echo '</td><td>'; $search_firstname2 = ''; if (isset($_POST["search_firstname2"]) and !isset($_POST["switch"])) { $search_firstname2 = safe_text($_POST['search_firstname2']); $_SESSION['rel_search_firstname2'] = $search_firstname2; } if (isset($_SESSION['rel_search_firstname2'])) { $search_firstname2 = $_SESSION['rel_search_firstname2']; } $search_lastname2 = ''; if (isset($_POST["search_lastname2"]) and !isset($_POST["switch"])) { $search_lastname2 = safe_text($_POST['search_lastname2']); $_SESSION['rel_search_lastname2'] = $search_lastname2; } if (isset($_SESSION['rel_search_lastname2'])) { $search_lastname2 = $_SESSION['rel_search_lastname2']; } $search_indi2 = ''; if (isset($_POST["search_indi2"]) and !isset($_POST["switch"])) { $search_indi2 = safe_text($_POST['search_indi2']); $_SESSION['search_indi2'] = $search_indi2; } if (isset($_SESSION['search_indi2'])) { $search_indi2 = $_SESSION['search_indi2']; } echo ' <input type="text" class="fonts relboxes" name="search_firstname2" value="' . $search_firstname2 . '" size="15"> '; echo '</td><td>'; echo ' <input class="fonts relboxes" type="text" name="search_lastname2" value="' . $search_lastname2 . '" size="15">'; echo '</td><td>'; echo ' <input type="text" class="fonts relboxes" name="search_indi2" value="' . $search_indi2 . '" size="10"> '; echo '</td><td>'; echo ' <input class="fonts" type="submit" name="search2" value="' . __('Search') . '">'; echo '</td><td>'; if (isset($_SESSION["search2"]) and $_SESSION["search2"] == 1) { $indi_string2 = ""; if (isset($_SESSION["search_indi2"]) and $_SESSION["search_indi2"] != "") { // make sure it works with "I436", "i436" and "436" $indi2 = (substr($search_indi2, 0, 1) == "I" or substr($search_indi2, 0, 1) == "i") ? strtoupper($search_indi2) : "I" . $search_indi2; $indi_string2 = " AND pers_gedcomnumber ='" . $indi2 . "' "; } $search_qry = "SELECT * FROM humo_persons WHERE pers_tree_id='" . $tree_id . "' AND CONCAT(REPLACE(pers_prefix,'_',' '),pers_lastname)"; $search_qry .= " LIKE '%" . $search_lastname2 . "%' AND pers_firstname LIKE '%" . $search_firstname2 . "%' " . $indi_string2 . " ORDER BY pers_lastname, pers_firstname"; $search_result2 = $dbh->query($search_qry); if ($search_result2) { if ($search_result2->rowCount() > 0) { echo '<select class="fonts" size="1" name="right" style="width:' . $len . 'px">'; while ($searchDb2 = $search_result2->fetch(PDO::FETCH_OBJ)) { $name = $pers_cls->person_name($searchDb2); if ($name["show_name"]) { echo '<option'; if (isset($right)) { if ($searchDb2->pers_id == $right and !(isset($_POST["search2"]) and $search_lastname2 == '' and $search_firstname2 == '')) { echo ' SELECTED'; } } echo ' value="' . $searchDb2->pers_id . '">' . $name["index_name"] . ' [' . $searchDb2->pers_gedcomnumber . ']</option>'; } } echo '</select>'; } else { echo '<select size="1" name="notfound" value="1" style="width:' . $len . 'px"><option>' . __('Person not found') . '</option></select>'; } } } else { echo '<select size="1" name="right" style="width:' . $len . 'px"><option></option></select>'; } echo '</td></tr></table>'; echo '</form>'; // ===== END SEARCH BOX SYSTEM } elseif (isset($_POST['automatic'])) { echo '<br>'; echo __('Automatic merge will go through the entire database and merge all persons who comply with ALL the following conditions:<br> <ul><li>Both persons have a first name and a last name and they are identical</li> <li>Both persons have parents with first and last names and those names are identical</li> <li>Both persons\' parents have a marriage date and it is identical (This can be disabled under "Settings")</li> <li>Both persons have a birth date and it is identical OR both have a death date and it is identical</li></ul> <b>Please note that the automatic merge may take quite some time, depending on the size of the database and the number of merges.</b><br> You will be notified of results as the action is completed'); echo '<br><br>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" name="auto_merge" value="' . __('Perform automatic merge') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" value="' . __('Back to main merge menu') . '">'; echo '</form>'; } elseif (isset($_POST['auto_merge'])) { echo '<br>' . __('Please wait while the automatic merges are processed...') . '<br>'; $merges = 0; $qry = "SELECT pers_id, pers_lastname, pers_firstname, pers_birth_date, pers_death_date, pers_famc\n\t\t\tFROM humo_persons WHERE pers_tree_id='" . $tree_id . "' AND\n\t\t\t\tpers_lastname !='' AND\n\t\t\t\tpers_firstname !='' AND\n\t\t\t\t(pers_birth_date !='' OR pers_death_date !='') AND\n\t\t\t\tpers_famc !=''\n\t\t\t\tORDER BY pers_id"; $pers = $dbh->query($qry); while ($persDb = $pers->fetch(PDO::FETCH_OBJ)) { $qry2 = "SELECT pers_id, pers_lastname, pers_firstname, pers_birth_date, pers_death_date, pers_famc FROM humo_persons WHERE\n\t\t\t\tpers_tree_id='" . $tree_id . "' AND\n\t\t\t\tpers_id > " . $persDb->pers_id . " AND\n\t\t\t\t(pers_lastname !='' AND pers_lastname = '" . $persDb->pers_lastname . "') AND\n\t\t\t\t(pers_firstname !='' AND pers_firstname = '" . $persDb->pers_firstname . "') AND\n\t\t\t\t((pers_birth_date !='' AND pers_birth_date ='" . $persDb->pers_birth_date . "') OR\n\t\t\t\t(pers_death_date !='' AND pers_death_date ='" . $persDb->pers_death_date . "')) AND\n\t\t\t\tpers_famc !=''\n\t\t\t\tORDER BY pers_id"; $pers2 = $dbh->query($qry2); if ($pers2) { while ($pers2Db = $pers2->fetch(PDO::FETCH_OBJ)) { // get the two families $qry = "SELECT fam_man, fam_woman, fam_marr_date FROM humo_families\n\t\t\t\t\t\t\tWHERE fam_tree_id='" . $tree_id . "' AND fam_gedcomnumber='" . $persDb->pers_famc . "'"; $fam1 = $dbh->query($qry); $fam1Db = $fam1->fetch(PDO::FETCH_OBJ); $qry = "SELECT * FROM humo_families WHERE fam_tree_id='" . $tree_id . "' AND fam_gedcomnumber='" . $pers2Db->pers_famc . "'"; $fam2 = $dbh->query($qry); $fam2Db = $fam2->fetch(PDO::FETCH_OBJ); if ($fam1->rowCount() > 0 and $fam2->rowCount() > 0) { $go = 1; if ($merge_parentsdate == 'YES') { // we want to check for wedding date of parents if ($fam1Db->fam_marr_date != '' and $fam1Db->fam_marr_date == $fam2Db->fam_marr_date) { $go = 1; } else { $go = 0; // no wedding date or no match --> no merge! } } if ($go) { // no use doing all this if the marriage date doesn't match $qry = "SELECT pers_lastname, pers_firstname FROM humo_persons\n\t\t\t\t\t\t\t\t\tWHERE pers_tree_id='" . $tree_id . "' AND pers_gedcomnumber='" . $fam1Db->fam_man . "'"; $fath1 = $dbh->query($qry); $fath1Db = $fath1->fetch(PDO::FETCH_OBJ); $qry = "SELECT pers_lastname, pers_firstname FROM humo_persons\n\t\t\t\t\t\t\t\t\tWHERE pers_tree_id='" . $tree_id . "' AND pers_gedcomnumber='" . $fam1Db->fam_woman . "'"; $moth1 = $dbh->query($qry); $moth1Db = $moth1->fetch(PDO::FETCH_OBJ); $qry = "SELECT pers_lastname, pers_firstname FROM humo_persons\n\t\t\t\t\t\t\t\t\tWHERE pers_tree_id='" . $tree_id . "' AND pers_gedcomnumber='" . $fam2Db->fam_man . "'"; $fath2 = $dbh->query($qry); $fath2Db = $fath2->fetch(PDO::FETCH_OBJ); $qry = "SELECT pers_lastname, pers_firstname FROM humo_persons\n\t\t\t\t\t\t\t\t\tWHERE pers_tree_id='" . $tree_id . "' AND pers_gedcomnumber='" . $fam2Db->fam_woman . "'"; $moth2 = $dbh->query($qry); $moth2Db = $moth2->fetch(PDO::FETCH_OBJ); if ($fath1->rowCount() > 0 and $moth1->rowCount() > 0 and $fath2->rowCount() > 0 and $moth2->rowCount() > 0) { if ($fath1Db->pers_lastname != '' and $fath1Db->pers_lastname == $fath2Db->pers_lastname and $moth1Db->pers_lastname != '' and $moth1Db->pers_lastname == $moth2Db->pers_lastname and $fath1Db->pers_firstname != '' and $fath1Db->pers_firstname == $fath2Db->pers_firstname and $moth1Db->pers_firstname != '' and $moth1Db->pers_firstname == $moth2Db->pers_firstname) { // MERGE THEM !! $this->merge_them($persDb->pers_id, $pers2Db->pers_id, 'automatic'); $mergedlist[] = $persDb->pers_id; $merges++; } } } // end "if($go)" } } // end while } // end "if($pers2) } if ($merges == 0) { echo '<br>' . __('No automatic merge options were found.') . '<br><br>'; } else { echo '<br>' . __('Automatic merge completed') . ' ' . $merges . __(' merges were performed') . '<br><br>'; } if ($relatives_merge != '') { echo __('It is recommended to continue with <b>"Relatives merge"</b> to consider merging persons affected by previous merges that were performed.') . '<br><br>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" style="font-weight:bold;font-size:120%" name="relatives" value="' . __('Relatives merge') . '">'; echo '</form>'; } else { echo __('You may wish to proceed with duplicate merge or manual merge.') . '<br><br>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" name="duplicate_choices" value="' . __('Duplicate merge') . '">'; echo '</form>'; echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" name="manual" value="' . __('Manual merge') . '">'; echo '</form>'; } echo ' '; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" value="' . __('Back to main merge menu') . '">'; echo '</form>'; if (isset($mergedlist)) { // there is a list of merged persons echo '<br><br><b><u>' . __('These are the persons that were merged:') . '</u></b><br>'; for ($i = 0; $i < count($mergedlist); $i++) { $result = $dbh->query("SELECT * FROM humo_persons WHERE pers_id='" . $mergedlist[$i] . "'"); $resultDb = $result->fetch(PDO::FETCH_OBJ); echo $resultDb->pers_lastname . ', ' . $resultDb->pers_firstname . ' ' . strtolower(str_replace("_", " ", $resultDb->pers_prefix)) . ' (#' . $resultDb->pers_gedcomnumber . ')<br>'; } } } elseif (isset($_POST['settings']) or isset($_POST['reset'])) { echo '<br>'; echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; if (isset($_POST['reset'])) { // reset to default $dbh->query("UPDATE humo_settings SET setting_value ='10' WHERE setting_variable='merge_chars'"); } elseif (isset($_POST['merge_chars'])) { // the "Save" button was pressed $merge_chars = $_POST['merge_chars']; // store into variable and write to database $dbh->query("UPDATE humo_settings SET setting_value ='" . $merge_chars . "' WHERE setting_variable = 'merge_chars'"); } $chars = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_chars'"); $charsDb = $chars->fetch(PDO::FETCH_OBJ); if (isset($_POST['reset'])) { $dbh->query("UPDATE humo_settings SET setting_value ='YES' WHERE setting_variable='merge_dates'"); } elseif (isset($_POST['merge_dates'])) { $merge_dates = $_POST['merge_dates']; $dbh->query("UPDATE humo_settings SET setting_value ='" . $merge_dates . "' WHERE setting_variable = 'merge_dates'"); } $dates = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_dates'"); $datesDb = $dates->fetch(PDO::FETCH_OBJ); if (isset($_POST['reset'])) { $dbh->query("UPDATE humo_settings SET setting_value ='YES' WHERE setting_variable='merge_lastname'"); } elseif (isset($_POST['merge_lastname'])) { $merge_lastname = $_POST['merge_lastname']; $dbh->query("UPDATE humo_settings SET setting_value ='" . $merge_lastname . "' WHERE setting_variable = 'merge_lastname'"); } $lastn = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_lastname'"); $lastnDb = $lastn->fetch(PDO::FETCH_OBJ); if (isset($_POST['reset'])) { $dbh->query("UPDATE humo_settings SET setting_value ='YES' WHERE setting_variable='merge_firstname'"); } elseif (isset($_POST['merge_firstname'])) { $merge_firstname = $_POST['merge_firstname']; $dbh->query("UPDATE humo_settings SET setting_value ='" . $merge_firstname . "' WHERE setting_variable = 'merge_firstname'"); } $firstn = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_firstname'"); $firstnDb = $firstn->fetch(PDO::FETCH_OBJ); if (isset($_POST['reset'])) { $dbh->query("UPDATE humo_settings SET setting_value ='YES' WHERE setting_variable='merge_parentsdate'"); } elseif (isset($_POST['merge_parentsdate'])) { $merge_parentsdate = $_POST['merge_parentsdate']; $dbh->query("UPDATE humo_settings SET setting_value ='" . $merge_parentsdate . "' WHERE setting_variable = 'merge_parentsdate'"); } $pard = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable = 'merge_parentsdate'"); $pardDb = $pard->fetch(PDO::FETCH_OBJ); echo '<table class="humo" style="width:900px;">'; echo '<tr class="table_header"><th colspan="3">' . __('Merge filter settings') . '</th></tr>'; echo '<tr><th style="width:300px" colspan="2">' . __('Settings') . '</th><th style="width:600px">' . __('Explanation') . '</th></tr>'; echo '<tr><td style="font-weight:bold;text-align:left;vertical-align:top" colspan="3">'; echo __('General') . '</td></tr><tr><td>'; echo __('Max characters to match firstname:'); echo '</td><td>'; echo '<input type="text" name="merge_chars" value="' . $charsDb->setting_value . '"size="1">'; echo '</td><td>'; // explanation echo __('In different trees, first names may be listed differently: Thomas Julian Booth, Thomas J. Booth, Thomas Booth etc. By default a match of the first 10 characters of the first name will be considered a match. You can change this to another value. Try and find the right balance: if you set a low number of chars you will get many unwanted possible matches. If you set it too high, you may miss possible matches as in the example names above.'); echo '</td></tr><tr><td style="font-weight:bold;text-align:left;vertical-align:top" colspan="3">'; echo __('Duplicate merge'); echo '</td></tr><tr><td>' . __('include blank lastnames'); echo '</td><td>'; echo '<select size="1" name="merge_lastname">'; if ($lastnDb->setting_value == 'YES') { echo '<option value="YES" SELECTED>' . __('Yes') . '</option>'; echo '<option value="NO">' . __('No') . '</option>'; } else { echo '<option value="NO" SELECTED>' . __('No') . '</option>'; echo '<option value="YES">' . __('Yes') . '</option>'; } echo "</select>"; echo '</td><td>'; // explanation echo __('By default two persons with missing lastnames will be included as possible duplicates. Two persons called "John" without lastname will be considered a possible match. If you have many cases like this you could get a very long list of possible duplicates and you might want to disable this, so only persons with lastnames will be included.'); echo '</td></tr><tr><td>' . __('include blank firstnames'); echo '</td><td>'; echo '<select size="1" name="merge_firstname">'; if ($firstnDb->setting_value == 'YES') { echo '<option value="YES" SELECTED>' . __('Yes') . '</option>'; echo '<option value="NO">' . __('No') . '</option>'; } else { echo '<option value="NO" SELECTED>' . __('No') . '</option>'; echo '<option value="YES">' . __('Yes') . '</option>'; } echo "</select>"; echo '</td><td>'; // explanation echo __('Same as above, but for first names. When enabled (default), all persons called "Smith" without first name will be considered possible duplicates of each other. If you have many cases like this it could give you a long list and you might want to disable it.'); echo '</td></tr><tr><td>' . __('include blank dates'); echo '</td><td>'; echo '<select size="1" name="merge_dates">'; if ($datesDb->setting_value == 'YES') { echo '<option value="YES" SELECTED>' . __('Yes') . '</option>'; echo '<option value="NO">' . __('No') . '</option>'; } else { echo '<option value="NO" SELECTED>' . __('No') . '</option>'; echo '<option value="YES">' . __('Yes') . '</option>'; } echo "</select>"; echo '</td><td>'; // explanation echo __('By default, two persons with identical names, but with one or both missing birth/death dates are considered possible duplicates. In certain trees this can give a long list of possible duplicates. You can choose to disable this so only persons who both have a birth or death date and this date is identical, will be considered a possible match. This can drastically cut down the number of possible duplicates, but of course you may also miss out on pairs that actually are duplicates.'); echo '</td></tr><tr><td style="font-weight:bold;text-align:left;vertical-align:top" colspan="3">'; echo __('Automatic merge'); echo '</td></tr><tr><td>' . __('include parents marriage date:'); echo '</td><td>'; echo '<select size="1" name="merge_parentsdate">'; if ($pardDb->setting_value == 'YES') { echo '<option value="YES" SELECTED>' . __('Yes') . '</option>'; echo '<option value="NO">' . __('No') . '</option>'; } else { echo '<option value="NO" SELECTED>' . __('No') . '</option>'; echo '<option value="YES">' . __('Yes') . '</option>'; } echo "</select>"; echo '</td><td>'; // explanation echo __('Automatic merging is a dangerous business. Therefore many clauses are used to make sure the persons are indeed identical. Besides identical names, identical birth or death dates and identical names of parents, also the parents\' wedding date is included. If you consider this too much and rely on the above clauses, you can disable this.'); echo '</td></tr>'; echo '<tr><td colspan="2" style="text-align:center"><input type="Submit" name="settings" value="' . __('Save') . '">'; echo ' <input type="Submit" name="reset" value="' . __('Reset') . '"></td>'; echo '</td><td>'; echo '</tr></table><br><br><br>'; echo '</form>'; } else { echo '<br>'; echo '<table class="humo" style="width:98%;">'; echo '<tr class="table_header"><th colspan="2">' . __('Merge Options') . '</th></tr>'; echo '<tr><td colspan="2" style="padding:10px">'; echo __('<b>NOTE:</b> None of these buttons will cause immediate merging. You will first be presented with information and can then decide to make a merge.<br><br> <b>TIP:</b> Start with automatic merge to get rid of all obvious merges. (If no automatic merge options are found, try the duplicate merge option).<br> These will likely cause surrounding relatives to be found, so continue with the "Relatives merge" option.<br> Once you finish that, most needed merges will have been performed. You can then use "Duplicate merge" to see if there are duplicates left to consider for merging.<br> As a last resort you can perform manual merges.'); echo '</td></tr>'; echo '<tr><td style="vertical-align:center;text-align:center;width:200px">'; // automatic merge option button echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" style="min-width:150px" name="automatic" value="' . __('Automatic merge') . '">'; echo '</form>'; echo '</td><td>'; echo __('You will be shown the set of strict criteria used for automatic merging and then you can decide whether to continue.'); // relatives merge option button (only shown as button if previous merges created a "surrounding relatives" array) echo '</td></tr><tr><td style="vertical-align:center;text-align:center;width:200px">'; if ($relatives_merge != '') { echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" style="min-width:150px" name="relatives" value="' . __('Relatives merge') . '">'; echo '</form>'; } else { echo __('Relatives merge'); } echo '</td><td>'; echo __('This button will become available if you have made merges, and surrounding relatives (parents, children or spouses) have to be considered for merging too.<br> By pressing this button, you can then continue to check the surrounding relatives, pair by pair, and merge them if necessary. If those merges will create additional surrounding relatives to consider, they will be automatically added to the list.<br> Surrounding relatives are saved to the database and you can also return to it at a later stage.'); echo '</td></tr><tr><td style="vertical-align:center;text-align:center;width:200px">'; // duplicate merge option button echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" style="min-width:150px" name="duplicate_choices" value="' . __('Duplicate merge') . '">'; echo '</form>'; echo '</td><td>'; echo __('You will be presented, one after the other, with pairs of possible duplicates to consider for merging.<br> After a merge you can switch to "relatives merge" and after that return to duplicate search where you left off.'); echo '</td></tr><tr><td style="min-height:50px;vertical-align:center;text-align:center;width:200px">'; // manual merge option button echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" style="min-width:150px" name="manual" value="' . __('Manual merge') . '">'; echo '</form>'; echo '</td><td>'; echo __('You can pick two persons out of the database to consider for merging.'); echo '</td></tr><tr><td style="vertical-align:center;text-align:center;width:200px">'; // settings option button echo '<form method="post" action="' . $phpself . '" style="display : inline;">'; echo '<input type="hidden" name="page" value="' . $page . '">'; echo '<input type="hidden" name="tree_id" value="' . $tree_id . '">'; echo '<input type="hidden" name="menu_admin" value="' . $menu_admin . '">'; echo '<input type="Submit" style="min-width:150px" name="settings" value="' . __('Settings') . '">'; echo '</form>'; echo '</td><td>' . __('Here you can change the default filters for the different merge options.'); echo '</td></tr></table>'; } }
$_QUERY = array(); foreach(explode('&', $URL['query']) as $var) { list($q, $v) = explode('=', $var, 1); $_QUERY[$q] = $v; } } */ if (isset($_GET['form']) && $_GET['form'] == 'comment') { if (isset($_GET['p']) && is_nat($_GET['p'])) { $ID = (int) $_GET['p']; $comic->get_comic_by_permalink($ID); } elseif (preg_match('@^/(\\d+)/@', $_PATH, $ID)) { $ID = (int) (isset($ID[1]) && is_numeric($ID[1])) ? $ID[1] : 0; $comic->get_comic($ID); } elseif (preg_match('@^/(\\w+)/?(?:(\\d{1,5})/?)?@', $_PATH, $cat_ID)) { $category = safe_text(strtolower($cat_ID[1])); $cat = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->categories}` WHERE `nicename` = '{$category}' LIMIT 1"); if ($scdb->num_rows == 1) { $comic->cat = $cat; $ID = (int) (isset($cat_ID[2]) && is_numeric($cat_ID[2])) ? $cat_ID[2] : 0; $comic->get_comic($ID); } else { die; } } else { die; } if ($ID != $comic->ID) { die; } $comments->post_comment($_POST);
<?php session_start(); //error_reporting(E_ALL); if (isset($_SESSION['admin_tree_prefix'])) { if (!defined("CMS_ROOTPATH")) { define("CMS_ROOTPATH", "../../"); } $ADMIN = TRUE; // *** Override "no database" message for admin *** include_once CMS_ROOTPATH . "include/db_login.php"; // *** Database login *** include_once CMS_ROOTPATH . "include/safe.php"; $gedcom_date = strtoupper(date("d M Y")); $gedcom_time = date("H:i:s"); $tree_prefix = safe_text($_SESSION['admin_tree_prefix']); $drag_kind = safe_text($_GET["drag_kind"]); if ($drag_kind == "children") { $chldstring = safe_text($_GET['chldstring']); $sql = "UPDATE humo_families SET\r\n\t\tfam_children='" . $chldstring . "',\r\n\t\tfam_changed_date='" . $gedcom_date . "',\r\n\t\tfam_changed_time='" . $gedcom_time . "'\r\n\t\tWHERE fam_id='" . safe_text($_GET["family_id"]) . "'"; $result = $dbh->query($sql); } if ($drag_kind == "media") { $mediastring = safe_text($_GET['mediastring']); $media_arr = explode(";", $mediastring); for ($x = 0; $x < count($media_arr); $x++) { $sql = "UPDATE humo_events SET \r\n\t\t\tevent_order='" . ($x + 1) . "', \r\n\t\t\tevent_changed_date='" . $gedcom_date . "', \r\n\t\t\tevent_changed_time='" . $gedcom_time . "' \r\n\t\t\tWHERE event_id='" . $media_arr[$x] . "'"; $result = $dbh->query($sql); } } }
function show_sources2($connect_kind, $connect_sub_kind, $connect_connect_id) { global $dbh, $db_functions, $tree_id, $user, $humo_option, $language, $tree_prefix_quoted, $family_id, $url_path, $uri_path; global $main_person, $descendant_report, $pdf_source; global $source_footnotes, $screen_mode, $pdf_footnotes, $pdf; global $source_footnote_connect_id; global $source_combiner; $text = false; $source_presentation = 'title'; if (isset($_SESSION['save_source_presentation'])) { $source_presentation = $_SESSION['save_source_presentation']; } // *** Hide sources in mobile version *** if ($screen_mode == 'mobile') { $source_presentation = 'hide'; } if ($user['group_sources'] != 'n' and $source_presentation != 'hide' and $screen_mode != 'STAR') { // *** Search for all connected sources *** $connect_qry = "SELECT * FROM humo_connections WHERE connect_tree_id='" . $tree_id . "'\r\n\t\t\tAND connect_kind='" . $connect_kind . "'\r\n\t\t\tAND connect_sub_kind='" . $connect_sub_kind . "'\r\n\t\t\tAND connect_connect_id='" . $connect_connect_id . "'\r\n\t\t\tORDER BY connect_order"; $connect_sql = $dbh->query($connect_qry); while ($connectDb = $connect_sql->fetch(PDO::FETCH_OBJ)) { // *** Get extended source, and check for restriction (in source and user group) *** $source_status = 'publish'; if ($connectDb->connect_source_id) { $sourceDb = $db_functions->get_source($connectDb->connect_source_id); if ($user['group_show_restricted_source'] == 'n' and $sourceDb->source_status == 'restricted') { $source_status = 'restricted'; } } // *** PDF export, for now only EXTENDED sources are exported! *** if ($screen_mode == 'PDF' and $connectDb->connect_source_id and $source_status == 'publish') { // *** Show sources as footnotes *** if (!isset($source_footnotes)) { $source_footnotes[] = $sourceDb->source_id; $pdf_footnotes[] = $pdf->AddLink(); $pdf_source[safe_text($connectDb->connect_source_id)] = safe_text($connectDb->connect_source_id); } $source_check = false; for ($j = 0; $j <= count($source_footnotes) - 1; $j++) { if ($sourceDb->source_id == $source_footnotes[$j]) { if ($source_presentation == 'footnote') { $text .= ' (' . strtolower(__('Sources')) . ' ' . ($j + 1) . ')'; $text .= '~'; // delimiter } else { $text .= ', ' . strtolower(__('Source')) . ': '; if ($sourceDb->source_title) { $text .= " " . trim($sourceDb->source_title); } if ($sourceDb->source_date or $sourceDb->source_place) { $text .= " " . date_place($sourceDb->source_date, $sourceDb->source_place); } // append num of source in list for use with fpdf_extend.php to add the right link: $text .= "!!" . ($j + 1) . '~'; // ~ is delimiter for multiple sources } $source_check = true; } } if ($source_check != true) { if ($source_presentation == 'footnote') { $text .= ' (' . strtolower(__('Sources')) . ' ' . ($j + 1) . ')'; $text .= '~'; // delimiter } else { $text .= ', ' . strtolower(__('Source')) . ': '; if ($sourceDb->source_title) { $text .= " " . trim($sourceDb->source_title); } if ($sourceDb->source_date or $sourceDb->source_place) { $text .= " " . date_place($sourceDb->source_date, $sourceDb->source_place); } // append num of source in list as !!3 for use with fpdf_extend.php to add the right link: $text .= "!!" . ($j + 1) . '~'; // ~ is delimiter for multiple sources } $pdf_source[safe_text($connectDb->connect_source_id)] = safe_text($connectDb->connect_source_id); $pdf_footnotes[] = $pdf->AddLink(); $source_footnotes[] = $sourceDb->source_id; } } elseif ($source_presentation == 'footnote' and $source_status == 'publish') { // *** Combine footnotes with the same source including the same source role and source page... *** $combiner_check = $connectDb->connect_source_id . '_' . $connectDb->connect_role . '_' . $connectDb->connect_page . '_' . $connectDb->connect_date . ' ' . $connectDb->connect_place . ' ' . $connectDb->connect_text; $check = false; // *** Check if the source (including role and page) is allready used *** for ($j = 0; $j <= count($source_combiner) - 1; $j++) { if ($source_combiner[$j] == $combiner_check) { $check = true; $j2 = $j + 1; } } // *** Source not found in array, add new source to array *** if (!$check) { // *** Save new combined source-role-page for check *** $source_combiner[] = $combiner_check; // *** Save connect_id to show footnotes *** $source_footnote_connect_id[] = $connectDb->connect_id; // *** Number to show for footnote *** $j2 = count($source_footnote_connect_id); } // *** Test line for footnotes *** //$text.=' '.$combiner_check.' '; $text .= ' <a href="' . str_replace("&", "&", $_SERVER['REQUEST_URI']) . '#source_ref' . $j2 . '"><sup>' . $j2 . ')</sup></a>'; } else { // *** Link to extended source *** if ($connectDb->connect_source_id and $source_status == 'publish') { // *** Always show title of source, show link only after permission check *** if ($user['group_sources'] == 'j' and $connect_sub_kind != 'person_source') { $text .= ', <a href="' . $uri_path . 'source.php?database=' . $_SESSION['tree_prefix'] . '&id=' . $sourceDb->source_gedcomnr . '">' . strtolower(__('Source')); } elseif ($connect_sub_kind == 'person_source') { $text .= '. <b>' . __('Source for person') . '</b>'; $text .= '<a href="' . $uri_path . 'source.php?database=' . $_SESSION['tree_prefix'] . '&id=' . $sourceDb->source_gedcomnr . '">'; } else { $text .= ', ' . __('Source'); } // *** Quality (function show_quality can be found in script: family.php) *** if ($connectDb->connect_quality == '0' or $connectDb->connect_quality) { $quality_text = show_quality($connectDb->connect_quality); $text .= ' <i>(' . $quality_text . ')</i>'; } $text .= ': '; if ($sourceDb->source_title) { $text .= ' ' . trim($sourceDb->source_title); } if ($sourceDb->source_date or $sourceDb->source_place) { $text .= " " . date_place($sourceDb->source_date, $sourceDb->source_place); } if ($user['group_sources'] == 'j') { $text .= '</a>'; } // *** End of link *** } // *** End of extended source *** //else{ // // *** No extended source, show source text *** // if ($connectDb->connect_text){ // $text.=', '.strtolower(__('Source')).': '.nl2br($connectDb->connect_text); // } //} // *** Show (extra) source text *** if ($connectDb->connect_text and $source_status == 'publish') { $text .= ', ' . __('source text') . ': ' . nl2br($connectDb->connect_text); } } } // *** Loop multiple source *** } // *** End of show sources *** return $text; }
public function edit_comment($ID, $values) { global $scdb; if (!is_numeric($ID) || intval($ID) != $ID || $ID < 1) { $this->message = '$comments->edit_comment() must be called with a valid ID as the first parameter!'; return false; } if (!isset($values['name'][1]) || !isset($values['comment'][1])) { $this->message = '$comments->edit_comment() must be called with an associative array as the second argument with the \'name\' and \'comment\' being set!'; return false; } $query = "UPDATE `{$scdb->comments}` SET `name` = '" . safe_text($values['name'], 100) . "', `comment` = '" . safe_text($values['comment']) . "'"; if (isset($values['website']) && urltest($values['website'])) { $query .= ", `website` = '" . $values['website'] . "'"; } if (isset($values['time'][18]) && preg_match("/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\$/", $values['time'])) { $query .= ", `time` = '" . $values['time'] . "'"; } $query .= " WHERE `ID` = '{$ID}' LIMIT 1"; $scdb->query($query); if ($scdb->rows_affected != 1 && mysql_errno()) { $this->message = 'Error editing the comment with ID of ' . $ID . '.'; $scdb->debug(); return false; } $this->message = 'Updated comment with ID of ' . $ID . '.'; return true; }
<?php @set_time_limit(3000); @ini_set('memory_limit', '-1'); error_reporting(E_ALL); // *** Safety line *** if (!defined('ADMIN_PAGE')) { exit; } if (isset($_POST['tree'])) { $tree = safe_text($_POST["tree"]); } echo '<h1 align=center>' . __('User notes') . '</h1>'; echo '<table class="humo standard" style="width:800px;" border="1">'; echo '<tr class="table_header"><th colspan="2">' . __('User notes') . '</th></tr>'; echo '<tr><td>' . __('Choose family') . '</td>'; echo '<td>'; $tree_sql = "SELECT * FROM humo_trees WHERE tree_prefix!='EMPTY' ORDER BY tree_order"; $tree_result = $dbh->query($tree_sql); $onchange = ''; //if(isset($_POST['part_tree']) AND $_POST['part_tree']=='part') { // // we have to refresh so that the persons to choose from will belong to this tree! // echo '<input type="hidden" name="flag_newtree" value=\'0\'>'; // $onchange = ' onChange="this.form.flag_newtree.value=\'1\';this.form.submit();" '; //} echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="page" value="user_notes">'; echo '<select ' . $onchange . ' size="1" name="tree">'; while ($treeDb = $tree_result->fetch(PDO::FETCH_OBJ)) { $treetext = show_tree_text($treeDb->tree_prefix, $selected_language); $selected = '';
echo '</form><br><br>'; } } if (isset($_POST['loc_add'])) { // we added new location // make sure this location doesn't exist yet! otherwise we get doubles // if the location already exists do as if "change" was pressed. @($result = $dbh->query("SELECT location_location FROM humo_location WHERE location_location = '" . $_POST['add_name'] . "'")); if ($result->rowCount() == 0) { // doesn't exist yet $dbh->query("INSERT INTO humo_location (location_location, location_lat, location_lng) VALUES('" . $_POST['add_name'] . "','" . floatval($_POST['add_lat']) . "','" . floatval($_POST['add_lng']) . "') "); echo '<span style="color:red;font-weight:bold;">' . __('Added location:') . ' ' . str_replace("\\'", "'", safe_text($_POST['add_name'])) . '</span><br>'; } else { // location already exists, just update the lat/lng $dbh->query("UPDATE humo_location SET location_location ='" . $_POST['add_name'] . "', location_lat =" . floatval($_POST['add_lat']) . ", location_lng = " . floatval($_POST['add_lng']) . " WHERE location_location = '" . safe_text($_POST['add_name']) . "'"); echo '<span style="color:red;font-weight:bold;"> ' . str_replace("\\'", "'", safe_text($_POST['add_name'])) . ': Location already exists.<br>Updated lat/lng.</span><br>'; } } echo '<form method="POST" name="dbform" action="' . $_SERVER['PHP_SELF'] . '?page=google_maps" style="display : inline;">'; $loc_list = $dbh->query("SELECT * FROM humo_location ORDER BY location_location"); echo '<input type="hidden" name="flag_form" value="dummy">'; echo '<select size="1" onChange="document.dbform.submit();" name="loc_find" id="loc_find">'; $find_default = true; while ($loc_listDb = $loc_list->fetch(PDO::FETCH_OBJ)) { $selected = ''; if (isset($_POST['loc_find'])) { if ($loc_listDb->location_id == $_POST['loc_find']) { $selected = " SELECTED"; } } elseif (isset($_POST['loc_change']) or isset($_POST['yes_change']) or isset($_POST['cancel_change'])) { if ($loc_listDb->location_location == $_POST['loc_del_name']) {
function text_process($text, $long_text = false) { //$text=htmlentities($text,ENT_QUOTES,'UTF-8'); if ($long_text == true) { //$text = str_replace("\r\n", "<br>\n", $text); $text = str_replace("\r\n", "\n", $text); } $text = safe_text($text); return $text; }
$register_allowed = true; } if (isset($_POST['send_mail']) and $register_allowed == true) { $error = ''; $usersql = 'SELECT * FROM humo_users WHERE user_name="' . safe_text($_POST["register_name"]) . '"'; $user = $dbh->query($usersql); $userDb = $user->fetch(PDO::FETCH_OBJ); if (isset($userDb->user_id)) { $error = __('ERROR: username already exists'); } if ($_POST["register_password"] != $_POST["register_repeat_password"]) { $error = __('ERROR: No identical passwords'); } if ($error == false) { $user_register_date = date("Y-m-d H:i"); $sql = "INSERT INTO humo_users SET\n\t\tuser_name='" . safe_text($_POST["register_name"]) . "',\n\t\tuser_remark='" . safe_text($_POST["register_text"]) . "',\n\t\tuser_register_date='" . safe_text($user_register_date) . "',\n\t\tuser_mail='" . safe_text($_POST["register_mail"]) . "',\n\t\tuser_password='******',\n\t\tuser_group_id='" . $humo_option["visitor_registration_group"] . "';"; $result = $dbh->query($sql); echo '<h2>' . __('Registration completed') . '</h2>'; echo __('At this moment you are registered in the user-group "guest". The administrator will check your registration, and select a user-group for you.'); // *** Mail new registered user to the administrator *** //$register_address=$dataDb->tree_email; $register_address = ''; if (isset($dataDb->tree_email)) { $register_address = $dataDb->tree_email; } // Used in older HuMo-gen versions. Backwards compatible... if ($humo_option["general_email"]) { $register_address = $humo_option["general_email"]; } $register_subject = "HuMo-gen. " . __('New registered user') . ": " . $_POST['register_name'] . "\n"; // *** It's better to use plain text in the subject ***
// *** Search previous family tree *** $item = $dbh->query("SELECT * FROM humo_trees WHERE tree_order=" . ($_GET['tree_order'] - 1)); $itemDb = $item->fetch(PDO::FETCH_OBJ); // *** Raise previous family trees *** $sql = "UPDATE humo_trees SET tree_order='" . safe_text($_GET['tree_order']) . "' WHERE tree_id={$itemDb->tree_id}"; $result = $dbh->query($sql); // *** Lower tree order *** $sql = "UPDATE humo_trees SET tree_order='" . ($_GET['tree_order'] - 1) . "' WHERE tree_id=" . $_GET['id']; $result = $dbh->query($sql); } if (isset($_GET['down'])) { // *** Search next family tree *** $item = $dbh->query("SELECT * FROM humo_trees WHERE tree_order=" . ($_GET['tree_order'] + 1)); $itemDb = $item->fetch(PDO::FETCH_OBJ); // *** Lower previous family tree *** $sql = "UPDATE humo_trees SET tree_order='" . safe_text($_GET['tree_order']) . "' WHERE tree_id={$itemDb->tree_id}"; $result = $dbh->query($sql); // *** Raise tree order *** $sql = "UPDATE humo_trees SET tree_order='" . ($_GET['tree_order'] + 1) . "' WHERE tree_id=" . $_GET['id']; $result = $dbh->query($sql); } // ****************** // *** Start page *** // ****************** $language_tree = $selected_language; // Default language if (isset($_GET['language_tree'])) { $language_tree = $_GET['language_tree']; } if (isset($_POST['language_tree'])) { $language_tree = $_POST['language_tree'];
function display_result($result) { // $result holds the entire track of persons from person A to person B // this string is made up of items sperated by ";" // each items starts with "par" (parent), "chd" (child) or "spo" (spouse), followed by the gedcomnumber of the person // example: parI232;parI65;chdI2304;spoI212;parI304 // the par-chd-spo prefixes indicate if the person was called up by his parent, child or spouse so we can later create the graphical display global $person, $person2, $db_functions; echo '<div style="padding:3px;width:auto;background-color:#eeeeee"><input type="submit" name="next_path" value="' . __('Try to find another path') . '" style="font-size:115%;">'; echo ' ' . __('(With each consecutive search the path may get longer and computing time may increase!)') . '</div>'; $fampath = CMS_ROOTPATH . "family.php?"; $tree = safe_text($_SESSION['tree_prefix']); $map = array(); // array that will hold all data needed for the graphical display $tracks = explode(";", $result); // $tracks is array with each person in the trail /* initialize */ for ($x = 0; $x < count($tracks); $x++) { $map[$x][0] = "1"; /* x value in graphical display */ $map[$x][1] = "1"; /* y value in graphical display */ $map[$x][2] = "1"; /* colspan value (usually 1, turns 2 for two column parent) */ $map[$x][3] = substr($tracks[$x], 0, 3); /* call value (oar, chd, spo) */ $map[$x][4] = substr($tracks[$x], 3); /* gedcomnumber value */ } $xval = 1; $yval = 1; $miny = 1; $maxy = 1; $marrsign = array(); // fill map array for ($x = 0; $x < count($tracks); $x++) { $ged = substr($tracks[$x], 3); // gedcomnumber $cal = substr($tracks[$x], 0, 3); // par, chd, spo if ($cal == "fst") { continue; } if ($cal == "spo") { $marrsign[$xval + 1] = $yval; $xval += 2; $map[$x][0] = $xval; $map[$x][1] = $yval; } if ($cal == "chd") { $yval--; if ($yval < $miny) { $miny = $yval; } $map[$x][0] = $xval; $map[$x][1] = $yval; if (isset($map[$x + 1]) and $map[$x + 1][3] == "par") { $map[$x][2] = 2; } } if ($cal == "par") { $yval++; if ($yval > $maxy) { $maxy = $yval; } if ($map[$x - 1][3] == "chd") { $xval++; } $map[$x][0] = $xval; $map[$x][1] = $yval; } } if ($miny < 1) { for ($x = 0; $x < count($map); $x++) { $map[$x][1] += 1 + abs($miny); if ($map[$x][1] > $maxy) { $maxy = $map[$x][1]; } } if (isset($marrsign)) { foreach ($marrsign as $key => $value) { $marrsign[$key] += 1 + abs($miny); } } } // the following code displays the graphical view of the found trail echo '<br><table style="border:0px;border-collapse:separate;border-spacing:30px 1px;">'; for ($a = 1; $a <= $maxy; $a++) { echo "<tr>"; $nextline = ""; for ($b = 1; $b <= $xval; $b++) { $colsp = false; $marr = false; for ($x = 0; $x < count($map); $x++) { if ($map[$x][0] == $b and $map[$x][1] == $a) { $color = "#8ceffd"; $border = "border:1px solid #777777;"; $ancDb = $db_functions->get_person($map[$x][4]); if ($ancDb->pers_sexe == "M") { $ext_cls = "extended_man "; } else { $ext_cls = "extended_woman "; } if ($map[$x][4] == $person or $map[$x][4] == $person2) { // person A and B (first and last) get thicker border $color = "#72fe95"; $border = "border:2px solid #666666;"; } if ($map[$x][2] == 2) { $b++; echo '<td class="' . $ext_cls . '" colspan=2 style="width:200px;text-align:center;' . $border . 'padding:2px">'; $nextline .= "↑@↓@"; // up and down arrows under two column parent } elseif (isset($map[$x + 1][3]) and $map[$x + 1][3] == "par") { $nextline .= "↓@"; // down arrow echo '<td class="' . $ext_cls . '" style="width:200px;text-align:center;' . $border . 'padding:2px">'; } elseif (isset($map[$x][3]) and $map[$x][3] == "chd") { $nextline .= "↑@"; // up arrow echo '<td class="' . $ext_cls . '" style="width:200px;text-align:center;' . $border . 'padding:2px">'; } else { $nextline .= " @"; // empty box echo '<td class="' . $ext_cls . '" style="width:200px;text-align:center;' . $border . 'padding:2px">'; } $pers_cls = new person_cls(); $name = $pers_cls->person_name($ancDb); $personname = $name["name"]; echo "<a href='" . $fampath . "database=" . $tree . "&id=" . $ancDb->pers_indexnr . "&main_person=" . $ancDb->pers_gedcomnumber . "'>" . $personname . "</a>"; $colsp = true; } } if ($colsp == false) { if (isset($marrsign[$b]) and $marrsign[$b] == $a) { // display the X sign between two married people echo '<td style="font-weight:bold;font-size:130%;width:10px;text-align:center;border:0px;padding:0px">X'; } else { echo '<td style="width:10px;text-align:center;border:0px;padding:0px">'; } $nextline .= " @"; } echo "</td>"; } echo "</tr>"; // The following code places a row with arrows (or blanks) under a row with name boxes if ($a != $maxy) { echo "<tr>"; $nextline = substr($nextline, 0, -1); $next = explode("@", $nextline); foreach ($next as $value) { echo "<td style='padding:2px;color:black;width:10px;font-weight:bold;font-size:140%;text-align:center;'>" . $value . "</td>"; } echo "</tr>"; } } echo "</table>"; }