}
// *** Add new source connection ***
if (isset($_POST['connect_add'])) {
    // *** Generate new order number ***
    $event_sql = "SELECT * FROM humo_connections\n\t\tWHERE connect_tree_id='" . $tree_id . "'\n\t\tAND connect_kind='" . safe_text($_POST['connect_kind']) . "'\n\t\tAND connect_sub_kind='" . safe_text($_POST["connect_sub_kind"]) . "'\n\t\tAND connect_connect_id='" . safe_text($_POST["connect_connect_id"]) . "'";
    $event_qry = $dbh->query($event_sql);
    $count = $event_qry->rowCount();
    $count++;
    $sql = "INSERT INTO humo_connections SET\n\t\tconnect_tree_id='" . $tree_id . "',\n\t\tconnect_order='" . $count . "',\n\t\tconnect_new_date='" . $gedcom_date . "',\n\t\tconnect_new_time='" . $gedcom_time . "',\n\t\tconnect_kind='" . safe_text($_POST['connect_kind']) . "',\n\t\tconnect_sub_kind='" . safe_text($_POST["connect_sub_kind"]) . "',\n\t\tconnect_connect_id='" . safe_text($_POST["connect_connect_id"]) . "'";
    $result = $dbh->query($sql);
}
// *** End of update sources ***
// *** Change source connection ***
if (isset($_POST['connect_change'])) {
    foreach ($_POST['connect_change'] as $key => $value) {
        $sql = "UPDATE humo_connections SET\n\t\tconnect_kind='" . safe_text($_POST['connect_kind'][$key]) . "',\n\t\tconnect_sub_kind='" . safe_text($_POST['connect_sub_kind'][$key]) . "',\n\t\tconnect_date='" . $editor_cls->date_process("connect_date", $key) . "',\n\t\tconnect_place='" . $editor_cls->text_process($_POST["connect_place"][$key]) . "',\n\t\tconnect_page='" . $editor_cls->text_process($_POST["connect_page"][$key]) . "',\n\t\tconnect_role='" . $editor_cls->text_process($_POST["connect_role"][$key]) . "',\n\t\tconnect_source_id='" . safe_text($_POST['connect_source_id'][$key]) . "',\n\t\tconnect_item_id='" . safe_text($_POST['connect_item_id'][$key]) . "',\n\t\tconnect_text='" . safe_text($_POST['connect_text'][$key]) . "',";
        if (isset($_POST['connect_quality'][$key]) and ($_POST['connect_quality'][$key] or $_POST['connect_quality'][$key] == '0')) {
            $sql .= " connect_quality='" . safe_text($_POST['connect_quality'][$key]) . "',";
        }
        $sql .= " connect_changed_date='" . $gedcom_date . "', ";
        $sql .= " connect_changed_time='" . $gedcom_time . "'";
        $sql .= " WHERE connect_id='" . safe_text($_POST["connect_change"][$key]) . "'";
        //echo $sql;
        $result = $dbh->query($sql);
    }
}
// *** Remove source/ event connection ***
if (isset($_GET['connect_drop'])) {
    echo '<div class="confirm">';
    echo __('Are you sure you want to remove this event?');
    echo ' <form method="post" action="' . $phpself2 . '" style="display : inline;">';
Example #2
0
     }
 }
 // ********************
 // *** Show sources ***
 // ********************
 if ($menu_admin == 'sources') {
     if (isset($_POST['source_add'])) {
         // *** Generate new gedcomnr, find highest gedcomnumber I100: strip I and order by numeric ***
         $new_nr_qry = "SELECT *, ABS(substring(source_gedcomnr, 2)) AS gednr\n\t\t\t\tFROM humo_sources WHERE source_tree_id='" . $tree_id . "' ORDER BY gednr DESC LIMIT 0,1";
         $new_nr_result = $dbh->query($new_nr_qry);
         $new_nr = $new_nr_result->fetch(PDO::FETCH_OBJ);
         $new_gedcomnumber = 'S1';
         if (isset($new_nr->source_gedcomnr)) {
             $new_gedcomnumber = 'S' . (substr($new_nr->source_gedcomnr, 1) + 1);
         }
         $sql = "INSERT INTO humo_sources SET\n\t\t\t\tsource_tree_id='" . $tree_id . "',\n\t\t\t\tsource_gedcomnr='" . $new_gedcomnumber . "',\n\t\t\t\tsource_status='" . $editor_cls->text_process($_POST['source_status']) . "',\n\t\t\t\tsource_title='" . $editor_cls->text_process($_POST['source_title']) . "',\n\t\t\t\tsource_date='" . safe_text($_POST['source_date']) . "',\n\t\t\t\tsource_place='" . $editor_cls->text_process($_POST['source_place']) . "',\n\t\t\t\tsource_publ='" . $editor_cls->text_process($_POST['source_publ']) . "',\n\t\t\t\tsource_refn='" . $editor_cls->text_process($_POST['source_refn']) . "',\n\t\t\t\tsource_auth='" . $editor_cls->text_process($_POST['source_auth']) . "',\n\t\t\t\tsource_subj='" . $editor_cls->text_process($_POST['source_subj']) . "',\n\t\t\t\tsource_item='" . $editor_cls->text_process($_POST['source_item']) . "',\n\t\t\t\tsource_kind='" . $editor_cls->text_process($_POST['source_kind']) . "',\n\t\t\t\tsource_repo_caln='" . $editor_cls->text_process($_POST['source_repo_caln']) . "',\n\t\t\t\tsource_repo_page='" . safe_text($_POST['source_repo_page']) . "',\n\t\t\t\tsource_repo_gedcomnr='" . $editor_cls->text_process($_POST['source_repo_gedcomnr']) . "',\n\t\t\t\tsource_text='" . $editor_cls->text_process($_POST['source_text']) . "',\n\t\t\t\tsource_new_date='" . $gedcom_date . "',\n\t\t\t\tsource_new_time='" . $gedcom_time . "'";
         $result = $dbh->query($sql);
         //$new_source_qry= "SELECT * FROM humo_sources
         //	WHERE source_tree_id='".$tree_id."' ORDER BY source_id DESC LIMIT 0,1";
         //$new_source_result = $dbh->query($new_source_qry);
         //$new_source=$new_source_result->fetch(PDO::FETCH_OBJ);
         //$_POST['source_id']=$new_source->source_id;
         $_POST['source_id'] = $dbh->lastInsertId();
     }
     if (isset($_POST['source_change'])) {
         $sql = "UPDATE humo_sources SET\n\t\t\tsource_status='" . $editor_cls->text_process($_POST['source_status']) . "',\n\t\t\tsource_title='" . $editor_cls->text_process($_POST['source_title']) . "',\n\t\t\tsource_date='" . $editor_cls->date_process('source_date') . "',\n\t\t\tsource_place='" . $editor_cls->text_process($_POST['source_place']) . "',\n\t\t\tsource_publ='" . $editor_cls->text_process($_POST['source_publ']) . "',\n\t\t\tsource_refn='" . $editor_cls->text_process($_POST['source_refn']) . "',\n\t\t\tsource_auth='" . $editor_cls->text_process($_POST['source_auth']) . "',\n\t\t\tsource_subj='" . $editor_cls->text_process($_POST['source_subj']) . "',\n\t\t\tsource_item='" . $editor_cls->text_process($_POST['source_item']) . "',\n\t\t\tsource_kind='" . $editor_cls->text_process($_POST['source_kind']) . "',\n\t\t\tsource_repo_caln='" . $editor_cls->text_process($_POST['source_repo_caln']) . "',\n\t\t\tsource_repo_page='" . $editor_cls->text_process($_POST['source_repo_page']) . "',\n\t\t\tsource_repo_gedcomnr='" . $editor_cls->text_process($_POST['source_repo_gedcomnr']) . "',\n\t\t\tsource_text='" . $editor_cls->text_process($_POST['source_text'], true) . "',\n\t\t\tsource_changed_date='" . $gedcom_date . "',\n\t\t\tsource_changed_time='" . $gedcom_time . "'\n\t\t\tWHERE source_tree_id='" . $tree_id . "' AND source_id='" . safe_text($_POST["source_id"]) . "'";
         $result = $dbh->query($sql);
         family_tree_update($tree_prefix);
     }
     if (isset($_POST['source_remove'])) {
         echo '<div class="confirm">';