$_POST['search_quicksearch_woman'] = ''; $_POST['search_quicksearch_man'] = ''; } // ** Change marriage *** if (isset($_POST['marriage_change'])) { // *** Change i10 into I10 *** $_POST["connect_man"] = ucfirst($_POST["connect_man"]); $_POST["connect_woman"] = ucfirst($_POST["connect_woman"]); // *** Man is changed in marriage *** if ($_POST["connect_man"] != $_POST["connect_man_old"]) { fams_remove($_POST['connect_man_old'], $_POST['marriage']); fams_add($_POST['connect_man'], $_POST['marriage']); } // *** Woman is changed in marriage *** if ($_POST["connect_woman"] != $_POST["connect_woman_old"]) { fams_remove($_POST['connect_woman_old'], $_POST['marriage']); fams_add($_POST['connect_woman'], $_POST['marriage']); } $fam_div_text = ''; if (isset($_POST['fam_div_no_data'])) { $fam_div_text = 'DIVORCE'; } if ($_POST["fam_div_text"]) { $fam_div_text = $_POST["fam_div_text"]; } $sql = "UPDATE humo_families SET\n\t\tfam_kind='" . safe_text($_POST["fam_kind"]) . "',\n\t\tfam_man='" . safe_text($_POST["connect_man"]) . "',\n\t\tfam_woman='" . safe_text($_POST["connect_woman"]) . "',\n\t\tfam_relation_date='" . $editor_cls->date_process("fam_relation_date") . "',\n\t\tfam_relation_end_date='" . $editor_cls->date_process("fam_relation_end_date") . "',\n\t\tfam_relation_place='" . $editor_cls->text_process($_POST["fam_relation_place"]) . "',\n\t\tfam_relation_text='" . $editor_cls->text_process($_POST["fam_relation_text"], true) . "',\n\t\tfam_man_age='" . safe_text($_POST["fam_man_age"]) . "',\n\t\tfam_woman_age='" . safe_text($_POST["fam_woman_age"]) . "',\n\t\tfam_marr_notice_date='" . $editor_cls->date_process("fam_marr_notice_date") . "',\n\t\tfam_marr_notice_place='" . $editor_cls->text_process($_POST["fam_marr_notice_place"]) . "',\n\t\tfam_marr_notice_text='" . $editor_cls->text_process($_POST["fam_marr_notice_text"], true) . "',\n\t\tfam_marr_date='" . $editor_cls->date_process("fam_marr_date") . "',\n\t\tfam_marr_place='" . $editor_cls->text_process($_POST["fam_marr_place"]) . "',\n\t\tfam_marr_text='" . $editor_cls->text_process($_POST["fam_marr_text"], true) . "',\n\t\tfam_marr_authority='" . safe_text($_POST["fam_marr_authority"]) . "',\n\t\tfam_marr_church_date='" . $editor_cls->date_process("fam_marr_church_date") . "',\n\t\tfam_marr_church_place='" . $editor_cls->text_process($_POST["fam_marr_church_place"]) . "',\n\t\tfam_marr_church_text='" . $editor_cls->text_process($_POST["fam_marr_church_text"], true) . "',\n\t\tfam_marr_church_notice_date='" . $editor_cls->date_process("fam_marr_church_notice_date") . "',\n\t\tfam_marr_church_notice_place='" . $editor_cls->text_process($_POST["fam_marr_church_notice_place"]) . "',\n\t\tfam_marr_church_notice_text='" . $editor_cls->text_process($_POST["fam_marr_church_notice_text"], true) . "',\n\t\tfam_religion='" . safe_text($_POST["fam_religion"]) . "',\n\t\tfam_div_date='" . $editor_cls->date_process("fam_div_date") . "',\n\t\tfam_div_place='" . $editor_cls->text_process($_POST["fam_div_place"]) . "',\n\t\tfam_div_text='" . $editor_cls->text_process($fam_div_text, true) . "',\n\t\tfam_div_authority='" . safe_text($_POST["fam_div_authority"]) . "',\n\t\tfam_text='" . $editor_cls->text_process($_POST["fam_text"], true) . "',\n\t\tfam_changed_date='" . $gedcom_date . "',\n\t\tfam_changed_time='" . $gedcom_time . "'\n\t\tWHERE fam_tree_id='" . $tree_id . "' AND fam_gedcomnumber='" . safe_text($_POST['marriage']) . "'"; $result = $dbh->query($sql); family_tree_update($tree_prefix); } //} // **************************
while ($famc_adoptiveDb = $famc_adoptive_qry->fetch(PDO::FETCH_OBJ)) { $fam = $famc_adoptiveDb->event_event; // *** Remove fams number from man and woman *** $new_nr_qry = "SELECT * FROM humo_families WHERE fam_tree_id='" . $tree_id . "' AND fam_gedcomnumber='" . $fam . "'"; $new_nr_result = $dbh->query($new_nr_qry); $new_nr = $new_nr_result->fetch(PDO::FETCH_OBJ); if ($new_nr->fam_man) { $sql = "UPDATE humo_events SET\n\t\t\t\t\tevent_event='" . $new_nr->fam_man . "' WHERE event_id='" . $famc_adoptiveDb->event_id . "'"; $dbh->query($sql); fams_remove($new_nr->fam_man, $fam); } unset($fams2); if ($new_nr->fam_woman) { $sql = "UPDATE humo_events SET\n\t\t\t\t\tevent_event='" . $new_nr->fam_woman . "' WHERE event_id='" . $famc_adoptiveDb->event_id . "'"; $dbh->query($sql); fams_remove($new_nr->fam_woman, $fam); } $sql = "DELETE FROM humo_families WHERE fam_tree_id='" . $tree_id . "' AND fam_gedcomnumber='" . $fam . "'"; $result = $dbh->query($sql); } } // *** Count persons and families *** echo '<br>>>> ' . __('Counting persons and families and enter into database...') . ' '; // *** Calculate number of persons and families *** $person_qry = $dbh->query("SELECT pers_id FROM humo_persons WHERE pers_tree_id='" . $tree_id . "'"); $persons = $person_qry->rowCount(); $family_qry = $dbh->query("SELECT fam_id FROM humo_families WHERE fam_tree_id='" . $tree_id . "'"); $families = $family_qry->rowCount(); $tree_date = date("Y-m-d H:i"); $sql = "UPDATE humo_trees SET\n\ttree_persons='" . $persons . "',\n\ttree_families='" . $families . "',\n\ttree_date='" . $tree_date . "'\n\tWHERE tree_prefix='" . $_SESSION['tree_prefix'] . "'"; $dbh->query($sql);