Example #1
0
/**
 * 扩展函数库文件
 * $Author: pengwenfei p@simple-log.com
 * $Date: 2010-04-15
 * www.simple-log.com 
*/
function pb_mail($to, $subject, $content, $from = '*****@*****.**')
{
    $subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
    $content = process_text($content);
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
    $headers .= "From: {$from}" . "\r\n";
    mail($to, $subject, $content, $headers);
}
Example #2
0
    if (empty($comment_id)) {
        sys_message('日志评论id不能为空', $referer_url);
    }
    $sql = 'SELECT o.* , u.title FROM ' . table('comment') . ' o LEFT JOIN ' . table('blog') . ' u on o.blog_id=u.blog_id' . " WHERE comment_id='" . $comment_id . "'";
    if ($row = $db->getrow($sql)) {
        $row['content'] = unprocess_text($row['content']);
        $smarty->assign('comment', $row);
    } else {
        sys_message('读取日志评论数据失败,请返回重新修改', $referer_url);
    }
    $smarty->assign('type', 'act_edit_comment&id=' . $comment_id);
    $smarty->assign('admin_title', '编辑评论');
    $smarty->display('edit_comment.html');
} elseif ($action == 'act_edit_comment') {
    $comment_id = intval($_GET['id']);
    if (empty($comment_id)) {
        sys_message('日志评论ID不能为空', $referer_url);
    }
    $status = !empty($_POST['status']) ? $_POST['status'] : 0;
    $content = $_POST['content'];
    if (empty($content)) {
        sys_message('评论内容不能为空', $referer_url);
    }
    $content = process_text($content);
    $sql = 'UPDATE ' . table('comment') . "  SET `status` = '" . $status . "',`content` = '" . $content . "' WHERE comment_id='" . $comment_id . "'";
    if ($db->query($sql)) {
        sys_message('修改评论成功', 'admin.php?act=edit_comment&id=' . $comment_id);
    } else {
        sys_message('修改评论失败,请重新返回修改', 'admin.php?act=edit_comment&id=' . $comment_id);
    }
}
Example #3
0
 function person_data($person_kind, $id)
 {
     global $dbh, $db_functions, $tree_id, $dataDb, $user, $language, $humo_option, $family_id, $uri_path;
     global $family_expanded, $change_main_person;
     global $childnr, $screen_mode, $dirmark1, $dirmark2;
     global $templ_person;
     global $sect, $arial12;
     // *** RTF export ***
     unset($templ_person);
     $personDb = $this->personDb;
     $privacy = $this->privacy;
     // *** Settings for mobile version, show details in multiple lines ***
     if ($person_kind == "mobile") {
         $family_expanded = true;
     }
     // *** $personDb is empty by N.N. person ***
     if ($personDb) {
         $tree_prefix_quoted = $personDb->pers_tree_prefix;
         $db_functions->set_tree_prefix($tree_prefix_quoted);
         $process_text = '';
         $temp = '';
         //*** PRIVACY PART ***
         $privacy_filter = '';
         if ($privacy) {
             if ($screen_mode == "mobile") {
                 return __('PRIVACY FILTER');
             } elseif ($screen_mode != "PDF") {
                 $privacy_filter = ' ' . __('PRIVACY FILTER');
             } else {
                 return;
             }
             // makes no sense to ask for login in a pdf report.....
         } else {
             // *** Quality (function show_quality can be found in script: family.php) ***
             // Disabled because normally quality belongs to a source.
             //if ($personDb->pers_quality=='0' or $personDb->pers_quality){
             //	$quality_text=show_quality($personDb->pers_quality);
             //	$process_text.= ' <i>'.ucfirst($quality_text).'</i>';
             //}
             // *** Show extra names of BK ***
             if ($personDb->pers_gedcomnumber) {
                 $eventnr = 0;
                 $name_qry = $db_functions->get_events_person($personDb->pers_gedcomnumber, 'name');
                 foreach ($name_qry as $nameDb) {
                     $eventnr++;
                     $text = '';
                     if ($nameDb->event_gedcom == '_AKAN') {
                         $text .= __('Also known as') . ': ';
                     }
                     // *** MyHeritage Family Tree Builder ***
                     if ($nameDb->event_gedcom == '_AKA') {
                         $text .= __('Also known as') . ': ';
                     }
                     if ($nameDb->event_gedcom == 'NICK') {
                         $text .= __('Nickname') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_ALIA') {
                         $text .= __('alias name') . ': ';
                     }
                     // For Pro-Gen
                     if ($nameDb->event_gedcom == '_SHON') {
                         $text .= __('Short name (for reports)') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_ADPN') {
                         $text .= __('Adopted name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_HEBN') {
                         $text .= __('Hebrew name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_CENN') {
                         $text .= __('Census name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_MARN') {
                         $text .= __('Married name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_GERN') {
                         $text .= __('Nickname') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_FARN') {
                         $text .= __('Farm name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_BIRN') {
                         $text .= __('Birth name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_INDN') {
                         $text .= __('Indian name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_FKAN') {
                         $text .= __('Formal name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_CURN') {
                         $text .= __('Current name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_SLDN') {
                         $text .= __('Soldier name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_FRKA') {
                         $text .= __('Formerly known as') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_RELN') {
                         $text .= __('Religious name') . ': ';
                     }
                     if ($nameDb->event_gedcom == '_OTHN') {
                         $text .= __('Other name') . ': ';
                     }
                     if ($eventnr > 1) {
                         $templ_person["bknames" . $eventnr] = ', ';
                         $process_text .= ', ';
                         $text = lcfirst($text);
                     } else {
                         $templ_person["bknames" . $eventnr] = '';
                         $text = ucfirst($text);
                     }
                     $templ_person["bknames" . $eventnr] .= $text;
                     if ($templ_person["bknames" . $eventnr] != '') {
                         $temp = "bk_names" . $eventnr;
                     }
                     $process_text .= $text;
                     if ($nameDb->event_date) {
                         $templ_person["bk_date" . $eventnr] = date_place($nameDb->event_date, '') . ' ';
                         if ($templ_person["bk_date" . $eventnr] != '') {
                             $temp = "bk_date" . $eventnr;
                         }
                         $process_text .= $templ_person["bk_date" . $eventnr];
                     }
                     $templ_person["bk_event" . $eventnr] = $nameDb->event_event;
                     if ($templ_person["bk_event" . $eventnr] != '') {
                         $temp = "bk_event" . $eventnr;
                     }
                     $process_text .= $nameDb->event_event;
                     $source = show_sources2("person", "pers_event_source", $nameDb->event_id);
                     if ($source) {
                         if ($screen_mode == 'PDF') {
                             $templ_person["bk_source" . $eventnr] = $source;
                             $temp = "bk_source" . $eventnr;
                         } else {
                             $process_text .= $source;
                         }
                     }
                     if ($nameDb->event_text) {
                         $templ_person["bk_text" . $eventnr] = ' ' . $nameDb->event_text;
                         $temp = "bk_text" . $eventnr;
                         $process_text .= $templ_person["bk_text" . $eventnr];
                     }
                 }
                 unset($name_qry);
             }
             // *** Own code ***
             if ($user['group_own_code'] == 'j' and $personDb->pers_own_code) {
                 if ($temp) {
                     $templ_person[$temp] .= ", ";
                 }
                 //$templ_person["own_code"]='('.ucfirst($personDb->pers_own_code).')';
                 $templ_person["own_code"] = ucfirst($personDb->pers_own_code);
                 $temp = "own_code";
                 if (!$process_text or $family_expanded == true) {
                     $text = '<b>' . __('Own code') . ':</b> ';
                 } else {
                     $text = ', <b>' . lcfirst(__('Own code')) . ':</b> ';
                 }
                 //	if ($process_text) $process_text.=', ';
                 //$process_text.='<span class="pers_own_code">'.$templ_person["own_code"].'</span>';
                 $process_text .= '<span class="pers_own_code">' . $text . $templ_person["own_code"] . '</span>';
             }
             // ****************
             // *** BIRTH    ***
             // ****************
             $text = '';
             if ($personDb->pers_birth_date or $personDb->pers_birth_place) {
                 $templ_person["born_dateplacetime"] = date_place($personDb->pers_birth_date, $personDb->pers_birth_place);
                 if ($templ_person["born_dateplacetime"] != '') {
                     $temp = "born_dateplacetime";
                 }
                 $text = $templ_person["born_dateplacetime"];
             }
             // *** Birth time ***
             if (isset($personDb->pers_birth_time) and $personDb->pers_birth_time) {
                 $templ_person["born_dateplacetime"] = ' ' . __('at') . ' ' . $personDb->pers_birth_time . ' ' . __('hour');
                 $temp = "born_dateplacetime";
                 $text .= $templ_person["born_dateplacetime"];
             }
             if ($user["group_texts_pers"] == 'j') {
                 $work_text = process_text($personDb->pers_birth_text);
                 if ($work_text) {
                     //$templ_person["born_text"]=", ".$work_text;
                     $templ_person["born_text"] = " " . $work_text;
                     $temp = "born_text";
                     $text .= $templ_person["born_text"];
                 }
             }
             // *** Birth source ***
             $source = show_sources2("person", "pers_birth_source", $personDb->pers_gedcomnumber);
             if ($source) {
                 if ($screen_mode == 'PDF') {
                     $templ_person["born_source"] = $source;
                     $temp = "born_source";
                 } elseif ($screen_mode == 'RTF') {
                     $rtf_text = strip_tags($templ_person["born_source"], "<b><i>");
                     $sect->writeText($rtf_text, $arial12, new PHPRtfLite_ParFormat());
                 } else {
                     $text .= $dirmark1 . $source;
                 }
             }
             // *** Birth declaration/ registration ***
             if ($personDb->pers_gedcomnumber) {
                 $temp_text = witness($personDb->pers_gedcomnumber, 'birth_declaration');
                 if ($temp_text) {
                     //if($temp) { $templ_person[$temp].=" ("; }
                     $templ_person["born_witn"] = ' (' . __('birth declaration') . ': ' . $temp_text . ')';
                     $temp = "born_witn";
                     $text .= $templ_person["born_witn"];
                 }
             }
             // *** Check for birth items, if needed use a new line ***
             if ($text) {
                 if (!$process_text or $family_expanded == true) {
                     $text = '<b>' . ucfirst(__('born')) . '</b> ' . $text;
                 } else {
                     $text = ', <b>' . __('born') . '</b> ' . $text;
                 }
                 if ($process_text and $family_expanded == true) {
                     $text = '<br>' . $text;
                 }
                 $process_text .= $text;
             }
             // ***************
             // *** BAPTISE ***
             // ***************
             $text = '';
             if ($personDb->pers_bapt_date or $personDb->pers_bapt_place) {
                 $templ_person["bapt_dateplacetime"] = date_place($personDb->pers_bapt_date, $personDb->pers_bapt_place);
                 if ($templ_person["bapt_dateplacetime"] != '') {
                     $temp = "bapt_dateplacetime";
                 }
                 $text = $templ_person["bapt_dateplacetime"];
             }
             if ($user["group_texts_pers"] == 'j') {
                 $work_text = process_text($personDb->pers_bapt_text);
                 if ($work_text) {
                     //if($temp) { $templ_person[$temp].=", "; }
                     //$templ_person["bapt_text"]=$work_text;
                     $templ_person["bapt_text"] = ' ' . $work_text;
                     $temp = "bapt_text";
                     //$text.=", ".$work_text;
                     $text .= $templ_person["bapt_text"];
                 }
             }
             if ($user['group_religion'] == 'j' and $personDb->pers_religion) {
                 $templ_person["bapt_reli"] = " (" . __('religion') . ': ' . $personDb->pers_religion . ')';
                 $temp = "bapt_reli";
                 $text .= ' <span class="religion">(' . __('religion') . ': ' . $personDb->pers_religion . ')</span>';
             }
             // *** Baptise source ***
             $source = show_sources2("person", "pers_bapt_source", $personDb->pers_gedcomnumber);
             if ($source) {
                 if ($screen_mode == 'PDF') {
                     $templ_person["bapt_source"] = $source;
                     $temp = "bapt_source";
                 } else {
                     $text .= $source;
                 }
             }
             // *** Show baptise witnesses ***
             if ($personDb->pers_gedcomnumber) {
                 $temp_text = witness($personDb->pers_gedcomnumber, 'baptism_witness');
                 if ($temp_text) {
                     if ($temp) {
                         $templ_person[$temp] .= " (";
                     }
                     $templ_person["bapt_witn"] = __('baptism witness') . ': ' . $temp_text . ')';
                     $temp = "bapt_witn";
                     $text .= ' (' . __('baptism witness') . ': ' . $temp_text . ')';
                 }
             }
             // *** check for baptise items, if needed use a new line ***
             if ($text) {
                 if (!$process_text or $family_expanded == true) {
                     $text = '<b>' . ucfirst(__('baptised')) . '</b> ' . $text;
                 } else {
                     $text = ', <b>' . __('baptised') . '</b> ' . $text;
                 }
                 if ($process_text and $family_expanded == true) {
                     $text = '<br>' . $text;
                 }
                 $process_text .= $text;
             }
             // *** Show age of living person ***
             if (($personDb->pers_bapt_date or $personDb->pers_birth_date) and !$personDb->pers_death_date and $personDb->pers_alive != 'deceased') {
                 $process_age = new calculate_year_cls();
                 $age = $process_age->calculate_age($personDb->pers_bapt_date, $personDb->pers_birth_date, '');
                 $templ_person["age_liv"] = $age;
                 if ($templ_person["age_liv"] != '') {
                     $temp = "age_liv";
                 }
                 $process_text .= $dirmark1 . $age;
                 // *** komma and space already in $age
             }
             // ******************
             // *** DEATH      ***
             // ******************
             $text = '';
             if ($personDb->pers_death_date or $personDb->pers_death_place) {
                 $templ_person["dead_dateplacetime"] = date_place($personDb->pers_death_date, $personDb->pers_death_place);
                 if ($templ_person["dead_dateplacetime"] != '') {
                     $temp = "dead_dateplacetime";
                 }
                 $text = $templ_person["dead_dateplacetime"];
             }
             // *** Death time ***
             if (isset($personDb->pers_death_time) and $personDb->pers_death_time) {
                 //$templ_person["dead_dateplacetime"]=' '.$personDb->pers_death_time;
                 $templ_person["dead_dateplacetime"] = ' ' . __('at') . ' ' . $personDb->pers_death_time . ' ' . __('hour');
                 $temp = "dead_dateplacetime";
                 $text .= $templ_person["dead_dateplacetime"];
             }
             if ($user["group_texts_pers"] == 'j') {
                 $work_text = process_text($personDb->pers_death_text);
                 if ($work_text) {
                     //$text.=", ".$work_text;
                     //if($temp) { $templ_person[$temp].=", "; }
                     $templ_person["dead_text"] = ' ' . $work_text;
                     $temp = "dead_text";
                     $text .= $templ_person["dead_text"];
                 }
             }
             // *** Show age, by Yossi Beck ***
             if (($personDb->pers_bapt_date or $personDb->pers_birth_date) and $personDb->pers_death_date) {
                 $process_age = new calculate_year_cls();
                 $age = $process_age->calculate_age($personDb->pers_bapt_date, $personDb->pers_birth_date, $personDb->pers_death_date);
                 $templ_person["dead_age"] = $age;
                 if ($templ_person["dead_age"] != '') {
                     $temp = "dead_age";
                 }
                 $text .= $dirmark1 . $age;
                 // *** comma and space already in $age
             }
             $pers_death_cause = '';
             if ($personDb->pers_death_cause == 'murdered') {
                 $pers_death_cause = ', ' . __('death cause') . ': ' . __('murdered');
             }
             if ($personDb->pers_death_cause == 'drowned') {
                 $pers_death_cause = ', ' . __('death cause') . ': ' . __('drowned');
             }
             if ($personDb->pers_death_cause == 'perished') {
                 $pers_death_cause = ', ' . __('death cause') . ': ' . __('perished');
             }
             if ($personDb->pers_death_cause == 'killed in action') {
                 $pers_death_cause = ', ' . __('killed in action');
             }
             if ($personDb->pers_death_cause == 'being missed') {
                 $pers_death_cause = ', ' . __('being missed');
             }
             if ($personDb->pers_death_cause == 'committed suicide') {
                 $pers_death_cause = ', ' . __('death cause') . ': ' . __('committed suicide');
             }
             if ($personDb->pers_death_cause == 'executed') {
                 $pers_death_cause = ', ' . __('death cause') . ': ' . __('executed');
             }
             if ($personDb->pers_death_cause == 'died young') {
                 $pers_death_cause = ', ' . __('died young');
             }
             if ($personDb->pers_death_cause == 'died unmarried') {
                 $pers_death_cause = ', ' . __('died unmarried');
             }
             if ($personDb->pers_death_cause == 'registration') {
                 $pers_death_cause = ', ' . __('registration');
             }
             //2 TYPE registration?
             if ($personDb->pers_death_cause == 'declared death') {
                 $pers_death_cause = ', ' . __('declared death');
             }
             if ($pers_death_cause) {
                 $templ_person["dead_cause"] = $pers_death_cause;
                 $temp = "dead_cause";
                 $text .= $pers_death_cause;
             } else {
                 if ($personDb->pers_death_cause) {
                     if ($temp) {
                         $templ_person[$temp] .= ", ";
                     }
                     $templ_person["dead_cause"] = __('death cause') . ': ' . $personDb->pers_death_cause;
                     $temp = "dead_cause";
                     $text .= ', ' . __('death cause') . ': ' . $personDb->pers_death_cause;
                 }
             }
             // *** Death source ***
             $source = show_sources2("person", "pers_death_source", $personDb->pers_gedcomnumber);
             if ($source) {
                 if ($screen_mode == 'PDF') {
                     $templ_person["dead_source"] = $source;
                     $temp = "dead_source";
                 } else {
                     $text .= $source;
                 }
             }
             // *** Death declaration ***
             if ($personDb->pers_gedcomnumber) {
                 $temp_text = witness($personDb->pers_gedcomnumber, 'death_declaration');
                 if ($temp_text) {
                     if ($temp) {
                         $templ_person[$temp] .= " (";
                     }
                     $templ_person["dead_witn"] = __('death declaration') . ' ' . $temp_text . ')';
                     $temp = "dead_witn";
                     $text .= ' (' . __('death declaration') . ' ' . $temp_text . ')';
                 }
             }
             // *** Check for death items, if needed use a new line ***
             if ($text) {
                 if (!$process_text or $family_expanded == true) {
                     $text = '<b>' . ucfirst(__('died')) . '</b> ' . $text;
                 } else {
                     $text = ', <b>' . __('died') . '</b> ' . $text;
                 }
                 if ($process_text and $family_expanded == true) {
                     $text = '<br>' . $text;
                 }
                 $process_text .= $text;
             }
             // ****************
             // *** BURIED   ***
             // ****************
             $text = '';
             if ($personDb->pers_buried_date or $personDb->pers_buried_place) {
                 $templ_person["buri_dateplacetime"] = date_place($personDb->pers_buried_date, $personDb->pers_buried_place);
                 if ($templ_person["buri_dateplacetime"] != '') {
                     $temp = "buri_dateplacetime";
                 }
                 $text = $templ_person["buri_dateplacetime"];
             }
             if ($user["group_texts_pers"] == 'j') {
                 $work_text = process_text($personDb->pers_buried_text);
                 if ($work_text) {
                     //if($temp) { $templ_person[$temp].=", "; }
                     $templ_person["buri_text"] = ' ' . $work_text;
                     $temp = "buri_text";
                     //$text.=", ".$work_text;
                     $text .= $templ_person["buri_text"];
                 }
             }
             // *** Buried source ***
             $source = show_sources2("person", "pers_buried_source", $personDb->pers_gedcomnumber);
             if ($source) {
                 if ($screen_mode == 'PDF') {
                     $templ_person["buri_source"] = $source;
                     $temp = "buri_source";
                 } else {
                     $text .= $source;
                 }
             }
             // *** Buried witness ***
             if ($personDb->pers_gedcomnumber) {
                 $temp_text = witness($personDb->pers_gedcomnumber, 'burial_witness');
                 if ($temp_text) {
                     //$templ_person[$temp].=" (";
                     $templ_person["buri_witn"] = ' (' . __('burial witness') . ' ' . $temp_text . ')';
                     $temp = "buri_witn";
                     $text .= $templ_person["buri_witn"];
                 }
             }
             // *** Check for burial items, if needed use a new line ***
             if ($text) {
                 if ($personDb->pers_cremation) {
                     $buried_cremation = __('cremation');
                     $templ_person["flag_buri"] = 1;
                 } else {
                     $buried_cremation = __('buried');
                     $templ_person["flag_buri"] = 0;
                 }
                 if (!$process_text or $family_expanded == true) {
                     $text = '<b>' . ucfirst($buried_cremation) . '</b> ' . $text;
                 } else {
                     $text = ', <b>' . $buried_cremation . '</b> ' . $text;
                 }
                 if ($process_text and $family_expanded == true) {
                     $text = '<br>' . $text;
                 }
                 $process_text .= $text;
             }
             // *** HZ-21 ash dispersion (asverstrooiing) ***
             $name_qry = $db_functions->get_events_person($personDb->pers_gedcomnumber, 'ash dispersion');
             foreach ($name_qry as $nameDb) {
                 $process_text .= ', ' . __('ash dispersion') . ' ';
                 if ($nameDb->event_date) {
                     $process_text .= date_place($nameDb->event_date, '') . ' ';
                 }
                 $process_text .= $nameDb->event_event . ' ';
                 //SOURCE and TEXT.
                 //CHECK PDF EXPORT
             }
             // **************************
             // *** Show professions   ***
             // **************************
             if ($personDb->pers_gedcomnumber) {
                 $eventnr = 0;
                 $event_qry = $dbh->query("SELECT * FROM humo_events\n\t\t\t\tWHERE event_tree_id='" . $tree_id . "' AND event_person_id='" . $personDb->pers_gedcomnumber . "' AND event_kind='profession'\n\t\t\t\tORDER BY substring( event_date,-4 ), event_order");
                 $nr_occupations = $event_qry->rowCount();
                 while ($eventDb = $event_qry->fetch(PDO::FETCH_OBJ)) {
                     $eventnr++;
                     if ($eventnr == '1') {
                         if ($nr_occupations == '1') {
                             $occupation = __('occupation');
                             $templ_person["flag_prof"] = 0;
                         } else {
                             $occupation = __('occupations');
                             $templ_person["flag_prof"] = 1;
                         }
                         if ($family_expanded == true) {
                             $process_text .= '<br><span class="profession"><b>' . ucfirst($occupation) . ':</b> ';
                         } else {
                             if ($process_text) {
                                 $process_text .= '. <span class="profession">';
                             }
                             if ($temp) {
                                 $templ_person[$temp] .= ". ";
                             }
                             $process_text .= '<b>' . ucfirst($occupation) . ':</b> ';
                             //$templ_person["prof_exist"]=ucfirst($occupation).': ';
                             //$temp="prof_exist";
                         }
                     }
                     if ($eventnr > 1) {
                         $process_text .= ', ';
                         if ($temp) {
                             $templ_person[$temp] .= ", ";
                         }
                     }
                     if ($eventDb->event_date or $eventDb->event_place) {
                         $templ_person["prof_date" . $eventnr] = date_place($eventDb->event_date, $eventDb->event_place) . '; ';
                         $temp = "prof_date" . $eventnr;
                         $process_text .= $templ_person["prof_date" . $eventnr];
                     }
                     $process_text .= $eventDb->event_event;
                     $templ_person["prof_prof" . $eventnr] = $eventDb->event_event;
                     $temp = "prof_prof" . $eventnr;
                     if ($eventDb->event_text) {
                         $work_text = process_text($eventDb->event_text);
                         if ($work_text) {
                             //if($temp) { $templ_person[$temp].=", "; }
                             if ($temp) {
                                 $templ_person[$temp] .= " ";
                             }
                             $templ_person["prof_text" . $eventnr] = $work_text;
                             $temp = "prof_text" . $eventnr;
                             //$process_text.=", ".$work_text;
                             $process_text .= " " . $work_text;
                         }
                     }
                     // *** Profession source ***
                     $source = show_sources2("person", "pers_event_source", $eventDb->event_id);
                     if ($source) {
                         if ($screen_mode == 'PDF') {
                             $templ_person["prof_source"] = $source;
                             $temp = "prof_source";
                         } else {
                             $process_text .= $source;
                         }
                     }
                 }
                 if ($eventnr > 0) {
                     $process_text .= '</span>';
                 }
             }
             // ***********************
             // *** Show residences ***
             // ***********************
             if ($personDb->pers_gedcomnumber and $user['group_living_place'] == 'j') {
                 $text = '';
                 $eventnr = 0;
                 $event_qry = $db_functions->get_addresses_person($personDb->pers_gedcomnumber);
                 $nr_addresses = count($event_qry);
                 foreach ($event_qry as $eventDb) {
                     $eventnr++;
                     if ($eventnr == '1') {
                         if ($process_text) {
                             if ($family_expanded == true) {
                                 $text .= '<br>';
                             } else {
                                 $text .= '. ';
                             }
                         }
                         if ($nr_addresses == '1') {
                             $residence = __('residence');
                             $templ_person["flag_address"] = 0;
                         } else {
                             $residence = __('residences');
                             $templ_person["flag_address"] = 1;
                         }
                         if ($temp) {
                             $templ_person[$temp] .= ". ";
                         }
                         //$templ_person["address_exist"]=ucfirst($residence).': ';
                         //$temp="address_exist";
                         $text .= '<b>' . ucfirst($residence) . ':</b> ';
                     }
                     if ($eventnr > 1) {
                         $text .= ', ';
                         if ($temp) {
                             $templ_person[$temp] .= ", ";
                         }
                     }
                     if ($eventDb->address_date) {
                         $text .= date_place($eventDb->address_date, '') . ' ';
                         // default, without place, place is processed later.
                         $templ_person["address_date" . $eventnr] = date_place($eventDb->address_date, '') . ' ';
                         $temp = "address_date" . $eventnr;
                     }
                     if ($user['group_addresses'] == 'j' and $eventDb->address_address) {
                         $text .= ' ' . $eventDb->address_address . ' ';
                         // PDF Export?
                     }
                     if ($eventDb->address_zip) {
                         $text .= ' ' . $eventDb->address_zip . ' ';
                         // PDF Export?
                     }
                     $text .= $eventDb->address_place;
                     $templ_person["address_address" . $eventnr] = $eventDb->address_place;
                     if ($templ_person["address_address" . $eventnr] != '') {
                         $temp = "address_address" . $eventnr;
                     }
                     if ($eventDb->address_phone) {
                         $text .= ', ' . $eventDb->address_phone;
                     }
                     // *** Address text ***
                     if ($eventDb->address_text) {
                         $work_text = process_text($eventDb->address_text);
                         if ($work_text) {
                             if ($temp) {
                                 $templ_person[$temp] .= ", ";
                             }
                             $templ_person["address_text" . $eventnr] = $work_text;
                             $temp = "address_text" . $eventnr;
                             $text .= ", " . $work_text;
                         }
                     }
                     $source = show_sources2("person", "pers_address_source", $eventDb->address_id);
                     if ($source) {
                         if ($screen_mode == 'PDF') {
                             $templ_person["address_source"] = $source;
                             $temp = "address_source";
                         } else {
                             $text .= $source;
                         }
                     }
                 }
                 if ($text) {
                     $process_text .= '<span class="pers_living_place">' . $text . '</span>';
                 }
             }
             // *** Person source ***
             $source = show_sources2("person", "person_source", $personDb->pers_gedcomnumber);
             if ($source) {
                 if ($screen_mode == 'PDF') {
                     $templ_person["pers_source"] = $source;
                     $temp = "pers_source";
                 } else {
                     $process_text .= $source;
                 }
             }
             // *** Extended addresses for HuMo-gen and dutch Haza-data program (Haza-data plus version) ***
             if ($user['group_addresses'] == 'j') {
                 // *** Search for all connected addresses ***
                 $eventnr = 0;
                 $connect_sql = $db_functions->get_connections_person('person_address', $personDb->pers_gedcomnumber);
                 foreach ($connect_sql as $connectDb) {
                     $eventnr++;
                     if ($temp) {
                         $templ_person[$temp] .= ". ";
                     }
                     $templ_person["HDadres_exist" . $eventnr] = __('Address') . ': ';
                     $temp = "HDadres_exist" . $eventnr;
                     $process_text .= '. <b>' . __('Address') . ':</b> ';
                     $process_text .= '<a href="' . $uri_path . 'address.php?gedcomnumber=' . $connectDb->connect_item_id . '">';
                     $eventDb2 = $db_functions->get_address($connectDb->connect_item_id);
                     if (isset($eventDb2->address_address) and $eventDb2->address_address) {
                         $templ_person["HDadres_adres" . $eventnr] = " " . trim($eventDb2->address_address);
                         $temp = "HDadres_adres" . $eventnr;
                         $process_text .= $templ_person["HDadres_adres" . $eventnr];
                     }
                     if (isset($eventDb2->address_address) and $eventDb2->address_place) {
                         $templ_person["HDadres_place" . $eventnr] = " " . trim($eventDb2->address_place);
                         $temp = "HDadres_place" . $eventnr;
                         $process_text .= $templ_person["HDadres_place" . $eventnr];
                     }
                     $process_text .= "</a>";
                 }
             }
         }
         //*** END PRIVACY PART ***
         // *** Use a link for multiple marriages by parent2 ***
         if ($person_kind == 'parent2') {
             $marriage_array = explode(";", $personDb->pers_fams);
             if (isset($marriage_array[1])) {
                 for ($i = 0; $i <= substr_count($personDb->pers_fams, ";"); $i++) {
                     $marriagenr = $i + 1;
                     $parent2_famDb = $db_functions->get_family($marriage_array[$i]);
                     // *** Use a class for marriage ***
                     $parent2_marr_cls = new marriage_cls();
                     // *** Show standard marriage text ***
                     if ($screen_mode != "PDF") {
                         $parent2_marr_data = $parent2_marr_cls->marriage_data($parent2_famDb, $marriagenr, 'short');
                     } else {
                         $pdf_marriage = $parent2_marr_cls->marriage_data($parent2_famDb, $marriagenr, 'short');
                     }
                     if ($change_main_person == true) {
                         $parent2Db = $db_functions->get_person($parent2_famDb->fam_woman);
                     } else {
                         $parent2Db = $db_functions->get_person($parent2_famDb->fam_man);
                     }
                     if ($id == $marriage_array[$i]) {
                         if ($process_text) {
                             $process_text .= ',';
                         }
                         if (isset($parent2_marr_data)) {
                             $process_text .= ' ' . $dirmark1 . $parent2_marr_data . ' ';
                         }
                         // *** $parent2Db is empty if it is a N.N. person ***
                         if ($parent2Db) {
                             $name = $this->person_name($parent2Db);
                             $process_text .= $name["standard_name"];
                         } else {
                             $process_text .= __('N.N.');
                         }
                     } else {
                         $process_text .= ', ';
                         // *** url_rewrite ***
                         if ($humo_option["url_rewrite"] == "j") {
                             // *** $uri_path is made header.php ***
                             $process_text .= '<a href="' . $uri_path . 'family/' . $_SESSION['tree_prefix'] . '/' . $marriage_array[$i] . '/' . $personDb->pers_gedcomnumber . '/">';
                         } else {
                             $process_text .= '<a href="' . CMS_ROOTPATH . 'family.php?database=' . $_SESSION['tree_prefix'] . '&amp;id=' . $marriage_array[$i] . '&amp;main_person=' . $personDb->pers_gedcomnumber . '">';
                         }
                         if (isset($parent2_marr_data)) {
                             $process_text .= $dirmark1 . $parent2_marr_data . ' ';
                         }
                         // *** $parent2Db is empty by N.N. person ***
                         if ($parent2Db) {
                             $name = $this->person_name($parent2Db);
                             $process_text .= $name["standard_name"];
                         } else {
                             $process_text .= __('N.N.');
                         }
                         $process_text .= '</a>';
                     }
                     if ($screen_mode == "PDF") {
                         if ($parent2Db) {
                             if ($temp) {
                                 $templ_person[$temp] .= ", ";
                             }
                             $name = $this->person_name($parent2Db);
                             $templ_person["marr_more" . $marriagenr] = $pdf_marriage["relnr_rel"] . $pdf_marriage["rel_add"] . " " . $name["standard_name"];
                             $temp = "marr_more" . $marriagenr;
                         } else {
                             if ($temp) {
                                 $templ_person[$temp] .= ", ";
                             }
                             $templ_person["marr_more" . $marriagenr] = $pdf_marriage["relnr_rel"] . " " . __('N.N.');
                             $temp = "marr_more" . $marriagenr;
                         }
                     }
                 }
             }
         }
         //if ($privacy){
         if ($screen_mode == "mobile" or $privacy) {
             //
         } else {
             // *** Show media/ pictures ***
             $result = show_media($personDb, '');
             // *** This function can be found in file: show_picture.php! ***
             $process_text .= $result[0];
             if (isset($templ_person)) {
                 $templ_person = array_merge((array) $templ_person, (array) $result[1]);
             } else {
                 $templ_person = $result[1];
             }
             // *** Internet links (URL) ***
             $url_qry = $db_functions->get_events_person($personDb->pers_gedcomnumber, 'URL');
             if (count($url_qry) > 0) {
                 $process_text .= '<br>';
             }
             foreach ($url_qry as $urlDb) {
                 if ($urlDb->event_text) {
                     $process_text .= $urlDb->event_text . ': ';
                 }
                 $process_text .= '<a href="' . $urlDb->event_event . '" target="_blank">' . $urlDb->event_event . '</a>';
                 $process_text .= '<br>';
             }
             //******** Text by person **************
             if ($user["group_text_pers"] == 'j') {
                 $work_text = process_text($personDb->pers_text, 'person');
                 // *** BK: Source by person text ***
                 $source = show_sources2("person", "pers_text_source", $personDb->pers_gedcomnumber);
                 if ($source) {
                     //PDF
                     if ($screen_mode == 'PDF') {
                         //
                     } else {
                         $work_text .= $source;
                     }
                 }
                 if ($work_text) {
                     $process_text .= '<br>' . $work_text . "\n";
                     $templ_person["pers_text"] = "\n" . $work_text;
                     $temp = "pers_text";
                 }
             }
             // *** Show events ***
             if ($user['group_event'] == 'j') {
                 if ($personDb->pers_gedcomnumber) {
                     $event_qry = $db_functions->get_events_person($personDb->pers_gedcomnumber, 'event');
                     $num_rows = count($event_qry);
                     if ($num_rows > 0) {
                         $process_text .= '<span class="event">' . "\n";
                     }
                     $eventnr = 0;
                     foreach ($event_qry as $eventDb) {
                         $eventnr++;
                         $process_text .= "<br>\n";
                         $templ_person["event_start" . $eventnr] = "\n";
                         // *** Check if NCHI is 0 or higher ***
                         $event_gedcom = $eventDb->event_gedcom;
                         //$event_text=$eventDb->event_text;
                         if ($event_gedcom == 'NCHI' and trim($eventDb->event_event) == '') {
                             $event_gedcom = 'NCHI0';
                             //$event_text='';
                         }
                         $process_text .= '<b>' . language_event($event_gedcom) . '</b>';
                         $templ_person["event_ged" . $eventnr] = language_event($event_gedcom);
                         $temp = "event_ged" . $eventnr;
                         if ($eventDb->event_event) {
                             $templ_person["event_event" . $eventnr] = ' ' . $eventDb->event_event;
                             $temp = "event_event" . $eventnr;
                             $process_text .= $templ_person["event_event" . $eventnr];
                         }
                         $templ_person["event_dateplace" . $eventnr] = ' ' . date_place($eventDb->event_date, $eventDb->event_place);
                         $temp = "event_dateplace" . $eventnr;
                         $process_text .= $templ_person["event_dateplace" . $eventnr];
                         if ($eventDb->event_text) {
                             $work_text = process_text($eventDb->event_text);
                             if ($work_text) {
                                 //$process_text.=", ".$work_text;
                                 $process_text .= " " . $work_text;
                                 //if($temp) { $templ_person[$temp].=", "; }
                                 if ($temp) {
                                     $templ_person[$temp] .= " ";
                                 }
                                 $templ_person["event_text" . $eventnr] = $work_text;
                                 $temp = "event_text" . $eventnr;
                             }
                         }
                         $source = show_sources2("person", "pers_event_source", $eventDb->event_id);
                         if ($source) {
                             if ($screen_mode == 'PDF') {
                                 $templ_person["pers_event_source"] = $source;
                                 $temp = "pers_event_source";
                             } else {
                                 $process_text .= $source;
                             }
                         }
                     }
                     if ($num_rows > 0) {
                         $process_text .= "</span>\n";
                     }
                     unset($event_qry);
                 }
             }
         }
         // End of privacy
         // *** Return person data ***
         if ($screen_mode == "mobile") {
             if ($process_text) {
                 return $process_text;
             }
         } elseif ($screen_mode != "PDF") {
             if ($process_text) {
                 $div = '<div class="margin_person">';
                 if ($person_kind == 'child') {
                     $div = '<div class="margin_child">';
                 }
                 return $privacy_filter . $div . $process_text . '</div>';
             } else {
                 return $privacy_filter;
             }
         } else {
             // return array with pdf values
             if (isset($templ_person)) {
                 return $templ_person;
             }
         }
     }
     // End of check $personDb
 }
Example #4
0
    print "*** " . $beginDate . " is *after* {$endDate}\n";
    $oops = true;
}
if ($oops) {
    Usage($argv[0]);
    exit;
}
print "\n";
$_POST['AllCompanies'] = "SET";
$companies = getcompaniestable($db, $mainSearchKey);
$companiesidxmax = count($companies) - 1;
while ($j <= $companiesidxmax) {
    $text_array = array();
    $company = getcompany($db, $companies[$j]);
    $comptext = $company[9] . "\n";
    $text_array = process_text($comptext, $beginDate, $endDate);
    if (!empty($text_array)) {
        print $companies[$j] . "\n";
        for ($i = 0; $i < sizeof($text_array); $i++) {
            print $text_array[$i];
        }
        print "********************************************\n\n";
    }
    $j++;
}
function checkIsAValidDate($myDateString)
{
    return (bool) strtotime($myDateString);
}
function Usage($script_name)
{
 function marriage_data($marriageDb = '', $number = '0', $presentation = 'standard')
 {
     global $dbh, $db_functions, $tree_prefix_quoted, $url_path, $dataDb, $uri_path;
     global $language, $user, $screen_mode;
     global $templ_person;
     if ($marriageDb == '') {
         $marriageDb = $this->cls_marriage_Db;
     }
     // *** Open a person class for witnesses ***
     $person_cls = new person_cls();
     $relation_kind = '';
     $relation_check = false;
     $marriage_check = false;
     $addition = __(' to: ');
     $text = '';
     if ($marriageDb->fam_kind == 'living together') {
         $relation_check = true;
         $relation_kind = __('Living together');
     }
     if ($marriageDb->fam_kind == 'living apart together') {
         $relation_kind = __('Living apart together');
         $relation_check = true;
     }
     if ($marriageDb->fam_kind == 'intentionally unmarried mother') {
         $relation_kind = __('Intentionally unmarried mother');
         $relation_check = true;
         $addition = '';
     }
     if ($marriageDb->fam_kind == 'homosexual') {
         $relation_check = true;
         $relation_kind = __('Homosexual');
     }
     if ($marriageDb->fam_kind == 'non-marital') {
         $relation_check = true;
         $relation_kind = __('Non marital');
         $addition = '';
     }
     if ($marriageDb->fam_kind == 'extramarital') {
         $relation_check = true;
         $relation_kind = __('Extramarital');
         $addition = '';
     }
     // NOT TESTED
     if ($marriageDb->fam_kind == "PRO-GEN") {
         $relation_check = true;
         $relation_kind = __('Extramarital');
         $addition = '';
     }
     // *** Aldfaer relations ***
     if ($marriageDb->fam_kind == 'partners') {
         $relation_check = true;
         $relation_kind = __('Partner') . ' ';
     }
     if ($marriageDb->fam_kind == 'registered') {
         $relation_check = true;
         $relation_kind = __('Registered') . ' ';
     }
     if ($marriageDb->fam_kind == 'unknown') {
         $relation_check = true;
         $relation_kind = __('Unknown relation') . ' ';
     }
     // *** Living together ***
     $temp_text = '';
     $temp = '';
     if ($marriageDb->fam_relation_date or $marriageDb->fam_relation_place) {
         $templ_relation["marriage_date"] = date_place($marriageDb->fam_relation_date, $marriageDb->fam_relation_place);
         $temp = "marriage_date";
         $temp_text .= $templ_relation["marriage_date"];
     }
     if ($user["group_texts_fam"] == 'j' and process_text($marriageDb->fam_relation_text)) {
         if ($temp_text) {
             //$temp_text.= ', ';
             //if($temp) { $templ_relation[$temp].=", "; }
             $temp_text .= ' ';
             if ($temp) {
                 $templ_relation[$temp] .= ' ';
             }
         }
         $templ_relation["marriage_text"] = process_text($marriageDb->fam_relation_text);
         $temp = "marriage_text";
         $temp_text .= $templ_relation["marriage_text"];
     }
     // *** Living together source ***
     $source = show_sources2("family", "fam_relation_source", $marriageDb->fam_gedcomnumber);
     if ($source) {
         if ($screen_mode == 'PDF') {
             $templ_relation["marriage_source"] = $source;
             $temp = "marriage_source";
         } else {
             $temp_text .= $source;
         }
     }
     if ($temp_text) {
         $relation_check = true;
         $addition = __(' to: ');
         if ($text != '') {
             $text .= "<br>\n";
             $templ_relation["marriage_exist"] = "\n";
         }
         // *** Text "living together" already shown in "kind" ***
         // *** Just in case made an extra text "living together" here ***
         if (!$relation_kind) {
             $text .= '<b>' . __('Living together') . '</b>';
             if (isset($templ_relation["marriage_exist"])) {
                 $templ_relation["marriage_exist"] .= __('Living together') . " ";
             } else {
                 $templ_relation["marriage_exist"] = __('Living together') . " ";
             }
         }
         $text .= ' ' . $temp_text;
     }
     // *** End of living together. NO end place, end text or end source yet. ***
     $temp_text = '';
     $temp = '';
     $fam_relation_end_place = '';
     if ($marriageDb->fam_relation_end_date or $fam_relation_end_place) {
         $temp_text .= date_place($marriageDb->fam_relation_end_date, $fam_relation_end_place);
         $templ_relation["marriage_end"] = '';
         if (isset($templ_relation["marriage_exist"])) {
             $templ_relation["marriage_end"] = '. ';
         }
         $templ_relation["marriage_end"] .= __('End living together') . ' ' . date_place($marriageDb->fam_relation_end_date, $fam_relation_end_place);
         $temp = "marriage_end";
     }
     //if ($user["group_texts_fam"]=='j' AND isset($marriageDb->fam_relation_end_text) AND process_text($marriageDb->fam_relation_end_text)){
     //	if ($temp_text){
     //		$temp_text.= ', ';
     //		if($temp) { $templ_relation[$temp].=", "; }
     //	}
     //	$temp_text.= process_text($marriageDb->fam_relation_end_text);
     //	//$templ_relation["marriage_text"]=process_text($marriageDb->fam_relation_end_text);
     //	//$temp="marriage_text";
     //}
     // *** Living together source ***
     // no source yet...
     if ($temp_text) {
         $marriage_check = true;
         if ($text != '' or $relation_kind) {
             $text .= "<br>\n";
             //$templ_relation["marriage_exist"]="\n";
         }
         $text .= '<b>' . __('End living together') . '</b>';
         //if(isset($templ_relation["marriage_exist"])) {$templ_relation["marriage_exist"].=__('End living together')." "; }
         //else {$templ_relation["marriage_exist"]=__('End living together')." ";  }
         $text .= ' ' . $temp_text;
     }
     // *** Married Notice ***
     $temp_text = '';
     $temp = '';
     if ($marriageDb->fam_marr_notice_date or $marriageDb->fam_marr_notice_place) {
         $temp_text .= date_place($marriageDb->fam_marr_notice_date, $marriageDb->fam_marr_notice_place);
         $templ_relation["prew_date"] = date_place($marriageDb->fam_marr_notice_date, $marriageDb->fam_marr_notice_place);
         $temp = "prew_date";
     }
     if ($user["group_texts_fam"] == 'j' and process_text($marriageDb->fam_marr_notice_text)) {
         if ($temp_text) {
             //$temp_text.= ', ';
             //if($temp) { $templ_relation[$temp].=", "; }
             $temp_text .= ' ';
             if ($temp) {
                 $templ_relation[$temp] .= " ";
             }
         }
         $temp_text .= process_text($marriageDb->fam_marr_notice_text);
         $templ_relation["prew_text"] = process_text($marriageDb->fam_marr_notice_text);
         $temp = "prew_text";
     }
     // *** Married notice source ***
     $source = show_sources2("family", "fam_marr_notice_source", $marriageDb->fam_gedcomnumber);
     if ($source) {
         if ($screen_mode == 'PDF') {
             $templ_relation["prew_source"] = $source;
             $temp = "pre_source";
         } else {
             $temp_text .= $source;
         }
     }
     if ($temp_text) {
         $marriage_check = true;
         $addition = __(' to: ');
         if ($text != '') {
             $text .= "<br>\n";
             $templ_relation["prew_exist"] = "\n";
         }
         $text .= '<b>' . __('Marriage notice') . '</b> ' . $temp_text;
         if (isset($templ_relation["prew_exist"])) {
             $templ_relation["prew_exist"] .= __('Marriage notice') . ' ';
         } else {
             $templ_relation["prew_exist"] = __('Marriage notice') . ' ';
         }
     }
     // *** Marriage ***
     $temp_text = '';
     $temp = '';
     if ($marriageDb->fam_marr_date or $marriageDb->fam_marr_place) {
         $templ_relation["wedd_date"] = date_place($marriageDb->fam_marr_date, $marriageDb->fam_marr_place);
         $temp = "wedd_date";
         $temp_text .= $templ_relation["wedd_date"];
     }
     if ($marriageDb->fam_marr_authority) {
         $templ_relation["wedd_authority"] = " [" . $marriageDb->fam_marr_authority . "]";
         $temp = "wedd_authority";
         $temp_text .= $templ_relation["wedd_authority"];
     }
     if ($user["group_texts_fam"] == 'j' and process_text($marriageDb->fam_marr_text)) {
         if ($temp_text) {
             //$temp_text.= ', ';
             //if($temp) { $templ_relation[$temp].=", "; }
             $temp_text .= ' ';
             if ($temp) {
                 $templ_relation[$temp] .= " ";
             }
         }
         $templ_relation["wedd_text"] = process_text($marriageDb->fam_marr_text);
         $temp = "wedd_text";
         $temp_text .= $templ_relation["wedd_text"];
     }
     // *** Aldfaer/ HuMo-gen: show witnesses ***
     if ($marriageDb->fam_gedcomnumber) {
         $temp_text2 = witness($marriageDb->fam_gedcomnumber, 'marriage_witness', 'family');
         if ($temp_text2) {
             $temp_text .= ' (' . __('marriage witness') . ' ' . $temp_text2 . ')';
             if ($temp) {
                 $templ_relation[$temp] .= " (";
             }
             $templ_relation["wedd_witn"] = __('marriage witness') . ' ' . $temp_text2 . ')';
             $temp = "wedd_witn";
         }
     }
     // *** Marriage source ***
     $source = show_sources2("family", "fam_marr_source", $marriageDb->fam_gedcomnumber);
     if ($source) {
         if ($screen_mode == 'PDF') {
             $templ_relation["wedd_source"] = $source;
             $temp = "wedd_source";
         } else {
             $temp_text .= $source;
         }
     }
     if ($temp_text) {
         $marriage_check = true;
         $addition = __(' to: ');
         if ($text != '') {
             $text .= "<br>\n";
             $templ_relation["wedd_exist"] = "\n";
         }
         $text .= '<b>' . __('Married') . '</b> ' . $temp_text;
         if (isset($templ_relation["wedd_exist"])) {
             $templ_relation["wedd_exist"] .= __('Married') . ' ';
         } else {
             $templ_relation["wedd_exist"] = __('Married') . ' ';
         }
     } else {
         // *** Marriage without further data (date or place) ***
         if ($marriageDb->fam_kind == 'civil') {
             $marriage_check = true;
             $addition = __(' to: ');
             $text .= '<b>' . __('Married') . '</b>';
             $templ_relation["wedd_exist"] = __('Married');
         }
     }
     // *** Married church notice ***
     $temp_text = '';
     $temp = '';
     if ($marriageDb->fam_marr_church_notice_date or $marriageDb->fam_marr_church_notice_place) {
         $templ_relation["prec_date"] = date_place($marriageDb->fam_marr_church_notice_date, $marriageDb->fam_marr_church_notice_place);
         $temp = "prec_date";
         $temp_text .= $templ_relation["prec_date"];
     }
     if ($user["group_texts_fam"] == 'j' and process_text($marriageDb->fam_marr_church_notice_text)) {
         if ($temp_text) {
             //$temp_text.= ', ';
             //if($temp) { $templ_relation[$temp].=", "; }
             $temp_text .= ' ';
             if ($temp) {
                 $templ_relation[$temp] .= " ";
             }
         }
         $templ_relation["prec_text"] = process_text($marriageDb->fam_marr_church_notice_text);
         $temp = "prec_text";
         $temp_text .= $templ_relation["prec_text"];
     }
     // *** Married church notice source ***
     $source = show_sources2("family", "fam_marr_church_notice_source", $marriageDb->fam_gedcomnumber);
     if ($source) {
         if ($screen_mode == 'PDF') {
             $templ_relation["prec_source"] = $source;
             $temp = "prec_source";
         } else {
             $temp_text .= $source;
         }
     }
     if ($temp_text) {
         $marriage_check = true;
         $addition = __(' to: ');
         if ($text != '') {
             $text .= "<br>\n";
             $templ_relation["prec_exist"] = "\n";
         }
         $text .= '<b>' . __('Married notice (religious)') . '</b> ' . $temp_text;
         if (isset($templ_relation["prec_exist"])) {
             $templ_relation["prec_exist"] .= __('Married notice (religious)') . ' ';
         } else {
             $templ_relation["prec_exist"] = __('Married notice (religious)') . ' ';
         }
     }
     // *** Married church ***
     $temp_text = '';
     $temp = '';
     if ($marriageDb->fam_marr_church_date or $marriageDb->fam_marr_church_place) {
         $templ_relation["chur_date"] = date_place($marriageDb->fam_marr_church_date, $marriageDb->fam_marr_church_place);
         $temp = "chur_date";
         $temp_text .= $templ_relation["chur_date"];
     }
     if ($user["group_texts_fam"] == 'j' and process_text($marriageDb->fam_marr_church_text)) {
         if ($temp_text) {
             //$temp_text.= ', ';
             //if($temp) { $templ_relation[$temp].=", "; }
             $temp_text .= ' ';
             if ($temp) {
                 $templ_relation[$temp] .= " ";
             }
         }
         $templ_relation["chur_text"] = process_text($marriageDb->fam_marr_church_text);
         $temp = "chur_text";
         $temp_text .= $templ_relation["chur_text"];
     }
     // *** Aldfaer/ HuMo-gen show witnesses ***
     if ($marriageDb->fam_gedcomnumber) {
         $temp_text2 = witness($marriageDb->fam_gedcomnumber, 'marriage_witness_rel', 'family');
         if ($temp_text2) {
             $temp_text .= ' (' . __('marriage witness (religious)') . ' ' . $temp_text2 . ')';
             if ($temp) {
                 $templ_relation[$temp] .= " (";
             }
             $templ_relation["chur_witn"] = __('marriage witness (religious)') . ' ' . $temp_text2 . ')';
             $temp = "chur_witn";
         }
     }
     // *** Married church source ***
     $source = show_sources2("family", "fam_marr_church_source", $marriageDb->fam_gedcomnumber);
     if ($source) {
         if ($screen_mode == 'PDF') {
             $templ_relation["chur_source"] = $source;
             $temp = "chur_source";
         } else {
             $temp_text .= $source;
         }
     }
     if ($temp_text) {
         $marriage_check = true;
         $addition = __(' to: ');
         if ($text != '') {
             $text .= "<br>\n";
             $templ_relation["chur_exist"] = "\n";
         }
         $text .= '<b>' . __('Married (religious)') . '</b> ' . $temp_text;
         if (isset($templ_relation["chur_exist"])) {
             $templ_relation["chur_exist"] .= __('Married (religious)') . ' ';
         } else {
             $templ_relation["chur_exist"] = __('Married (religious)') . ' ';
         }
     }
     // *** Religion ***
     if ($user['group_religion'] == 'j' and $marriageDb->fam_religion) {
         $templ_relation["reli_reli"] = ' (' . __('religion: ') . $marriageDb->fam_religion . ')';
         $text .= ' <span class="religion">(' . __('religion: ') . $marriageDb->fam_religion . ')</span>';
     }
     // *** Divorse ***
     $temp_text = '';
     $temp = '';
     if ($marriageDb->fam_div_date or $marriageDb->fam_div_place) {
         $templ_relation["devr_date"] = date_place($marriageDb->fam_div_date, $marriageDb->fam_div_place);
         $temp = "devr_date";
         $temp_text .= $templ_relation["devr_date"];
     }
     if ($marriageDb->fam_div_authority) {
         $templ_relation["devr_authority"] = " [" . $marriageDb->fam_div_authority . "]";
         $temp = "devr_authority";
         $temp_text .= $templ_relation["devr_authority"];
     }
     if ($user["group_texts_fam"] == 'j' and $marriageDb->fam_div_text != 'DIVORCE' and process_text($marriageDb->fam_div_text)) {
         if ($temp_text) {
             //$temp_text.= ', ';
             //if($temp) { $templ_relation[$temp].=", "; }
             $temp_text .= ' ';
             if ($temp) {
                 $templ_relation[$temp] .= " ";
             }
         }
         $templ_relation["devr_text"] = process_text($marriageDb->fam_div_text);
         $temp = "devr_text";
         $temp_text .= $templ_relation["devr_text"];
     }
     // *** Divorse source ***
     $source = show_sources2("family", "fam_div_source", $marriageDb->fam_gedcomnumber);
     if ($source) {
         if ($screen_mode == 'PDF') {
             $templ_relation["devr_source"] = $source;
             $temp = "devr_source";
         } else {
             $temp_text .= $source;
         }
     }
     //if ($temp_text){
     // *** div_text "DIVORCE" is used for divorce without further data! ***
     if ($temp_text or $marriageDb->fam_div_text == 'DIVORCE') {
         $marriage_check = true;
         $addition = ' ' . __('from:') . ' ';
         if ($text != '') {
             $text .= "<br>\n";
             $templ_relation["devr_exist"] = "\n";
         }
         $text .= '<span class="divorse"><b>' . ucfirst(__('divorced')) . '</b> ' . $temp_text . '</span>';
         if (isset($templ_relation["devr_exist"])) {
             $templ_relation["devr_exist"] .= ucfirst(__('divorced')) . ' ';
         } else {
             $templ_relation["devr_exist"] = ucfirst(__('divorced')) . ' ';
         }
     }
     // *** No relation data (marriage without date), show standard text ***
     if ($relation_check == false and $marriage_check == false) {
         // *** Show standard marriage text ***
         $templ_relation["unkn_rel"] = __('Marriage/ Related') . ' ';
         $text .= '<b>' . __('Marriage/ Related') . '</b> ';
     } else {
         // *** Years of marriage ***
         if (($marriageDb->fam_marr_church_date or $marriageDb->fam_marr_date) and $marriageDb->fam_div_text != 'DIVORCE' and !($temp_text and $marriageDb->fam_div_date == '')) {
             $end_date = '';
             // *** Check death date of husband ***
             @($person_manDb = $db_functions->get_person($marriageDb->fam_man));
             if (isset($person_manDb->pers_death_date) and $person_manDb->pers_death_date) {
                 $end_date = $person_manDb->pers_death_date;
             }
             // *** Check death date of wife ***
             @($person_womanDb = $db_functions->get_person($marriageDb->fam_woman));
             if (isset($person_womanDb->pers_death_date) and $person_womanDb->pers_death_date) {
                 // *** Check if men died earlier then woman (AT THIS MOMENT ONLY CHECK YEAR) ***
                 if ($end_date and substr($end_date, -4) > substr($person_womanDb->pers_death_date, -4)) {
                     $end_date = $person_womanDb->pers_death_date;
                 }
                 // *** Man still living or no date available  ***
                 if ($end_date == '') {
                     $end_date = $person_womanDb->pers_death_date;
                 }
             }
             // *** End of marriage by divorse ***
             if ($marriageDb->fam_div_date) {
                 $end_date = $marriageDb->fam_div_date;
             }
             $marr_years = new calculate_year_cls();
             $age = $marr_years->calculate_marriage($marriageDb->fam_marr_church_date, $marriageDb->fam_marr_date, $end_date);
             $text .= $age;
             // Space and komma in $age
             //PDF?
         }
     }
     // *** Show media/ pictures ***
     //$text.=show_media('',$marriageDb); // *** This function can be found in file: show_picture.php! ***
     $result = show_media('', $marriageDb);
     // *** This function can be found in file: show_picture.php! ***
     $text .= $result[0];
     //if (isset($templ_person))
     //	$templ_person = array_merge((array)$templ_person,(array)$result[1]);
     //else
     //	$templ_person=$result[1];
     // *** Show objecs ***
     // *** Show events ***
     if ($user['group_event'] == 'j') {
         if ($marriageDb->fam_gedcomnumber) {
             $event_qry = $db_functions->get_events_family($marriageDb->fam_gedcomnumber, 'event');
             $num_rows = count($event_qry);
             if ($num_rows > 0) {
                 $text .= '<span class="event">';
             }
             $i = 0;
             foreach ($event_qry as $eventDb) {
                 $i++;
                 //echo '<br>'.__('Event (family)');
                 if ($text != '') {
                     $text .= "<br>\n";
                 }
                 if ($i > 1) {
                     $templ_relation["event" . $i . "_ged"] = "\n";
                 }
                 // *** Check if NCHI is 0 or higher ***
                 $event_gedcom = $eventDb->event_gedcom;
                 $event_text = $eventDb->event_text;
                 if ($event_gedcom == 'NCHI' and trim($eventDb->event_text) == '0') {
                     $event_gedcom = 'NCHI0';
                     $event_text = '';
                 }
                 $text .= '<b>' . language_event($event_gedcom) . '</b>';
                 if (isset($templ_relation["event" . $i . "_ged"])) {
                     $templ_relation["event" . $i . "_ged"] .= language_event($event_gedcom);
                 } else {
                     $templ_relation["event" . $i . "_ged"] = language_event($event_gedcom);
                 }
                 // *** Show event kind ***
                 if ($eventDb->event_event) {
                     $templ_relation["event" . $i . "_event"] = ' (' . $eventDb->event_event . ')';
                     $text .= $templ_relation["event" . $i . "_event"];
                 }
                 if ($eventDb->event_date or $eventDb->event_place) {
                     $templ_relation["event" . $i . "_date"] = ' ' . date_place($eventDb->event_date, $eventDb->event_place);
                     $text .= $templ_relation["event" . $i . "_date"];
                 }
                 if ($event_text) {
                     $templ_relation["event" . $i . "_text"] = ' ' . process_text($eventDb->event_text);
                     $text .= $templ_relation["event" . $i . "_text"];
                 }
                 // *** Sources by a family event ***
                 $source = show_sources2("family", "fam_event_source", $eventDb->event_id);
                 if ($source) {
                     if ($screen_mode == 'PDF') {
                         //	$templ_relation["event_source"]=show_sources2("family","fam_event_source",$eventDb->event_id);
                         //	$temp="fam_event_source";
                     } else {
                         $text .= $source;
                     }
                 }
             }
             if ($num_rows > 0) {
                 $text .= "</span><br>\n";
                 // if there are events, the word "with" should be on a new line to make the text clearer
                 $templ_relation["event_lastline"] = "\n";
                 $addition = ltrim($addition);
             }
         }
     }
     // **********************************
     // *** Concacenate marriage texts ***
     // **********************************
     // Process english 1st, 2nd, 3rd and 4th marriage.
     $relation_number = '';
     //if ($number!=''){
     if ($presentation == 'short' or $presentation == 'shorter') {
         if ($number == '1') {
             $relation_number = __('1st');
         }
         if ($number == '2') {
             $relation_number = __('2nd');
         }
         if ($number == '3') {
             $relation_number = __('3rd');
         }
         if ($number > '3') {
             $relation_number = $number . __('th');
         }
         if ($marriage_check == true) {
             if ($number) {
                 $relation_number .= ' ' . __('marriage');
                 // marriage
                 $relation_kind = '';
                 $addition = __(' to: ');
             } else {
                 $relation_number .= __('Married ');
                 // Married
                 $relation_kind = '';
                 $addition = __(' to: ');
             }
         }
         if ($relation_check == true) {
             if ($number) {
                 $relation_number .= ' ' . __('related');
                 // relation
                 $relation_kind = '';
                 $addition = __(' to: ');
             } else {
                 $relation_number = ucfirst(__('related')) . ' ';
                 // Relation
                 $relation_kind = '';
                 $addition = __(' to: ');
             }
         }
         if ($relation_check == false and $marriage_check == false) {
             if ($number) {
                 // *** Other text in 2nd marriage: 2nd marriage Hubertus [Huub] Mons ***
                 if ($presentation == 'shorter') {
                     $relation_number .= ' ' . __('marriage/ relation');
                     // relation
                 } else {
                     $relation_number .= ' ' . __('marriage/ related');
                     // relation
                 }
                 $relation_kind = '';
                 $addition = __(' to: ');
             } else {
                 $relation_number .= __('Marriage/ Related');
                 // Relation
                 $relation_kind = '';
                 $addition = __(' to: ');
             }
         }
     }
     if ($presentation == 'short' or $presentation == 'shorter') {
         $text = '<b>' . $relation_number . $relation_kind . '</b>';
         $templ_relation = array();
         //reset array - don't need it
         // *** Show divorse if privacy filter is set ***
         if ($marriageDb->fam_div_date or $marriageDb->fam_div_place or $marriageDb->fam_div_text) {
             $text .= ' <span class="divorse">(' . __('divorced') . ')</span>';
         }
         // Show end of relation here?
         // *** No addition in text: 2nd marriage Hubertus [Huub] Mons ***
         if ($presentation == 'shorter') {
             $addition = '';
         }
     } else {
         $text = '<b>' . $relation_number . $relation_kind . '</b>' . $text;
     }
     if ($addition) {
         $text .= '<b>' . $addition . '</b>';
     }
     $templ_relation["relnr_rel"] = $relation_number . $relation_kind;
     $templ_relation["rel_add"] = $addition;
     if ($screen_mode != "PDF") {
         return $text;
     } else {
         return $templ_relation;
     }
 }
Example #6
0
 } else {
     if ($user["group_texts_fam"] == 'j' and process_text($familyDb->fam_text)) {
         if ($screen_mode == 'PDF') {
             // PDF rendering of marriage notes
             $pdf->SetFont('Arial', 'I', 11);
             $pdf->Write(6, process_text($familyDb->fam_text) . "\n");
             $pdf->Write(6, show_sources2("family", "fam_text", $familyDb->fam_gedcomnumber) . "\n");
             $pdf->SetFont('Arial', '', 12);
         } elseif ($screen_mode == 'RTF') {
             $sect->addEmptyParagraph($fontSmall, $parBlack);
             $rtf_text = strip_tags(process_text($familyDb->fam_text), "<b><i>");
             $sect->writeText($rtf_text, $arial12, new PHPRtfLite_ParFormat());
             $rtf_text = strip_tags(show_sources2("family", "fam_text", $familyDb->fam_gedcomnumber), "<b><i>");
             $sect->writeText($rtf_text, $arial12, new PHPRtfLite_ParFormat());
         } else {
             echo '<br>' . process_text($familyDb->fam_text, 'family');
             // *** BK: source by family text ***
             echo show_sources2("family", "fam_text", $familyDb->fam_gedcomnumber);
         }
     }
 }
 // *** Show addresses by family ***
 if ($user['group_living_place'] == 'j') {
     if ($familyDb->fam_gedcomnumber) {
         $addressnr = 0;
         $address_qry_prep = $db_functions->get_addresses_family($familyDb->fam_gedcomnumber);
         if ($screen_mode != 'PDF') {
             foreach ($address_qry_prep as $addressDb) {
                 $addressnr++;
                 if ($addressnr == '1') {
                     $nr_addresses = count($address_qry_prep);
function sources_export($connect_kind, $connect_sub_kind, $connect_connect_id, $start_number)
{
    global $dbh, $buffer, $tree_id;
    //$tree;
    // *** Search for all connected sources ***
    //$connect_qry="SELECT * FROM ".$tree."connections
    $connect_qry = "SELECT * FROM humo_connections\n\t\tWHERE connect_tree_id='" . $tree_id . "'\n\t\tAND connect_kind='" . $connect_kind . "'\n\t\tAND connect_sub_kind='" . $connect_sub_kind . "'\n\t\tAND connect_connect_id='" . $connect_connect_id . "'\n\t\tORDER BY connect_order";
    $connect_sql = $dbh->query($connect_qry);
    while ($connectDb = $connect_sql->fetch(PDO::FETCH_OBJ)) {
        $buffer .= $start_number . ' SOUR';
        if ($connectDb->connect_source_id) {
            $buffer .= ' @' . $connectDb->connect_source_id . "@";
        }
        $buffer .= "\r\n";
        // *** Source text ***
        if ($connectDb->connect_text) {
            // 3 DATA
            // 4 TEXT text .....
            // 5 CONT ..........
            $buffer .= $start_number + 1 . " DATA\r\n";
            $buffer .= $start_number + 2 . ' TEXT ' . process_text($start_number + 3, $connectDb->connect_text);
        }
        if ($connectDb->connect_date) {
            $buffer .= $start_number + 1 . ' DATE ' . $connectDb->connect_date . "\r\n";
        }
        if ($connectDb->connect_place) {
            $buffer .= $start_number + 1 . ' PLAC ' . $connectDb->connect_place . "\r\n";
        }
        if ($connectDb->connect_role) {
            $buffer .= $start_number + 1 . ' ROLE ' . $connectDb->connect_role . "\r\n";
        }
        if ($connectDb->connect_page) {
            $buffer .= $start_number + 1 . ' PAGE ' . $connectDb->connect_page . "\r\n";
        }
        if ($connectDb->connect_quality) {
            $buffer .= $start_number + 1 . ' QUAY ' . $connectDb->connect_quality . "\r\n";
        }
    }
}
Example #8
0
function source_display($sourcenum)
{
    global $dbh, $db_functions, $tree_prefix_quoted, $dataDb, $user, $pdf, $screen_mode, $language;
    if ($screen_mode != "PDF") {
        include_once "header.php";
        //returns CMS_ROOTPATH constant
        include_once CMS_ROOTPATH . "menu.php";
        include_once CMS_ROOTPATH . "include/date_place.php";
        include_once CMS_ROOTPATH . "include/process_text.php";
    }
    // *** Check user authority ***
    if ($user['group_sources'] != 'j') {
        echo __('You are not authorised to see this page.');
        exit;
    }
    if ($screen_mode != "PDF") {
        include_once CMS_ROOTPATH . "include/language_date.php";
        include_once CMS_ROOTPATH . "include/person_cls.php";
        echo '<table class="humo standard">';
        echo "<tr><td><h2>" . __('Sources') . "</h2>";
    }
    $sourceDb = $db_functions->get_source($sourcenum);
    // *** If an unknown source ID is choosen, exit function ***
    if (!isset($sourceDb->source_id)) {
        exit(__('No valid source number.'));
    }
    if ($sourceDb->source_title) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Title') . ": ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, $sourceDb->source_title . "\n");
        } else {
            echo '<b>' . __('Title') . ":</b> {$sourceDb->source_title}<br>";
        }
    }
    if ($sourceDb->source_date) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Date') . ": ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, language_date(strtolower($sourceDb->source_date)) . "\n");
        } else {
            echo '<b>' . __('Date') . ":</b> " . language_date(strtolower($sourceDb->source_date)) . "<br>";
        }
    }
    if ($sourceDb->source_publ) {
        $source_publ = $sourceDb->source_publ;
        $pdflink = 0;
        if (substr($source_publ, 0, 7) == 'http://') {
            $link = $source_publ;
            $source_publ = '<a href="' . $link . '">' . $link . '</a>';
            $pdflink = 1;
        }
        if (substr($source_publ, 0, 8) == 'https://') {
            $link = $source_publ;
            $source_publ = '<a href="' . $link . '">' . $link . '</a>';
            $pdflink = 1;
        }
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Publication') . ": ");
            $pdf->SetFont('Arial', '', 10);
            if ($pdflink == 1) {
                $pdf->SetFont('Arial', 'U', 10);
                $pdf->SetTextColor(28, 28, 255);
                $pdf->Write(6, strip_tags($source_publ) . "\n", strip_tags($source_publ));
                $pdf->SetFont('Arial', '', 10);
                $pdf->SetTextColor(0);
            } else {
                $pdf->Write(6, strip_tags($source_publ) . "\n");
            }
        } else {
            print '<b>' . __('Publication') . ":</b> {$source_publ}<br>";
        }
    }
    if ($sourceDb->source_place) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Place') . ": ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, $sourceDb->source_place . "\n");
        } else {
            print '<b>' . __('Place') . ":</b> {$sourceDb->source_place}<br>";
        }
    }
    if ($sourceDb->source_refn) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Own code') . ": ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, $sourceDb->source_refn . "\n");
        } else {
            print '<b>' . __('Own code') . ":</b> {$sourceDb->source_refn}<br>";
        }
    }
    if ($sourceDb->source_auth) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Author') . ": ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, $sourceDb->source_auth . "\n");
        } else {
            print '<b>' . __('Author') . ":</b> {$sourceDb->source_auth}<br>";
        }
    }
    if ($sourceDb->source_subj) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Subject') . ": ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, $sourceDb->source_subj . "\n");
        } else {
            print '<b>' . __('Subject') . ":</b> {$sourceDb->source_subj}<br>";
        }
    }
    if ($sourceDb->source_item) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Nr.') . ": ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, $sourceDb->source_item . "\n");
        } else {
            print '<b>' . __('Nr.') . ":</b> {$sourceDb->source_item}<br>";
        }
    }
    if ($sourceDb->source_kind) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Kind') . ": ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, $sourceDb->source_kind . "\n");
        } else {
            print '<b>' . __('Kind') . ":</b> {$sourceDb->source_kind}<br>";
        }
    }
    if ($sourceDb->source_repo_caln) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Archive') . " ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, $sourceDb->source_repo_caln . "\n");
        } else {
            print '<b>' . __('Archive') . "</b> {$sourceDb->source_repo_caln}<br>";
        }
    }
    if ($sourceDb->source_repo_page) {
        if ($screen_mode == "PDF") {
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Write(6, __('Page') . " ");
            $pdf->SetFont('Arial', '', 10);
            $pdf->Write(6, $sourceDb->source_repo_page . "\n");
        } else {
            print '<b>' . __('Page') . "</b> {$sourceDb->source_repo_page}<br>";
        }
    }
    if ($sourceDb->source_text) {
        if ($screen_mode == "PDF") {
            $source_text = $sourceDb->source_text;
            $source_text = str_replace('<br>', '', $source_text);
            //$pdf->Write(6,html_entity_decode($source_text)."\n");
            $pdf->Write(6, $source_text . "\n");
        } else {
            print '</td></tr><tr><td>' . process_text($sourceDb->source_text);
        }
    }
    // *** Source pictures not in use yet... ***
    // *** Show repository ***
    $repoDb = $db_functions->get_repository($sourceDb->source_repo_gedcomnr);
    if ($repoDb) {
        if ($screen_mode == "PDF") {
            // NO REPOSITORIES IN PDF YET...
        } else {
            echo '</td></tr><tr><td>';
            echo '<h3>' . __('Repository') . '</h3>';
            echo '<b>' . __('Title') . ':</b> ' . $repoDb->repo_name . '<br>';
            if ($user['group_addresses'] == 'j') {
                echo '<b>' . __('Zip code') . ':</b> ' . $repoDb->repo_zip . '<br>';
                echo '<b>' . __('Address') . ':</b> ' . $repoDb->repo_address . '<br>';
            }
            if ($repoDb->repo_date) {
                echo '<b>' . __('Date') . ':</b> ' . $repoDb->repo_date . '<br>';
            }
            if ($repoDb->repo_place) {
                echo '<b>' . __('Place') . ':</b> ' . $repoDb->repo_place . '<br>';
            }
            echo nl2br($repoDb->repo_text);
        }
    }
    if ($screen_mode != "PDF") {
        // we do not want all persons in the database as given online so
        // in the pdf file so we'll take just the above details
        // and leave references to persons
        print '</td></tr>';
        print '<tr><td>';
        $person_cls = new person_cls();
        // *** Find person data if source is connected to a family item ***
        // *** This seperate function speeds up the sources page ***
        function person_data($familyDb)
        {
            global $dbh, $tree_prefix_quoted, $db_functions;
            if ($familyDb->fam_man) {
                $personDb = $db_functions->get_person($familyDb->fam_man);
            } else {
                $personDb = $db_functions->get_person($familyDb->fam_woman);
            }
            return $personDb;
        }
        // *** Sources in connect table ***
        $connect_qry = "SELECT * FROM humo_connections WHERE connect_tree_id='" . $tree_id . "'\r\n\t\tAND connect_source_id='" . $sourceDb->source_gedcomnr . "'\r\n\t\tORDER BY connect_kind, connect_sub_kind, connect_order";
        $connect_sql = $dbh->query($connect_qry);
        while ($connectDb = $connect_sql->fetch(PDO::FETCH_OBJ)) {
            // *** Person source ***
            if ($connectDb->connect_kind == 'person') {
                if ($connectDb->connect_sub_kind == 'person_source') {
                    echo __('Source for:');
                }
                if ($connectDb->connect_sub_kind == 'pers_name_source') {
                    echo __('Source for name:');
                }
                if ($connectDb->connect_sub_kind == 'pers_birth_source') {
                    echo __('Source for birth:');
                }
                if ($connectDb->connect_sub_kind == 'pers_bapt_source') {
                    echo __('Source for baptism:');
                }
                if ($connectDb->connect_sub_kind == 'pers_death_source') {
                    echo __('Source for death:');
                }
                if ($connectDb->connect_sub_kind == 'pers_buried_source') {
                    echo __('Source for burial:');
                }
                if ($connectDb->connect_sub_kind == 'pers_text_source') {
                    echo __('Source for text:');
                }
                if ($connectDb->connect_sub_kind == 'pers_sexe_source') {
                    echo __('Source for sexe:');
                }
                //else { echo 'TEST'; }
                if ($connectDb->connect_sub_kind == 'pers_event_source') {
                    // *** Sources by event ***
                    $event_Db = $db_functions->get_event($connectDb->connect_connect_id);
                    // *** Person source ***
                    if ($event_Db->event_person_id) {
                        $personDb = $db_functions->get_person($event_Db->event_person_id);
                        $name = $person_cls->person_name($personDb);
                        print __('Source for:') . ' <a href="' . CMS_ROOTPATH . 'family.php?id=' . $personDb->pers_indexnr . '&amp;main_person=' . $personDb->pers_gedcomnumber . '">';
                        echo $name["standard_name"] . '</a>';
                        if ($event_Db->event_event) {
                            echo ' ' . $event_Db->event_event;
                        }
                    }
                } elseif (substr($connectDb->connect_sub_kind, -14) == 'address_source') {
                    // *** Sources in address table ***
                    $address_sql = "SELECT * FROM humo_addresses WHERE address_id='" . $connectDb->connect_connect_id . "'";
                    @($address_qry = $dbh->query($address_sql));
                    $address_Db = $address_qry->fetch(PDO::FETCH_OBJ);
                    if ($address_Db->address_person_id) {
                        $personDb = $db_functions->get_person($address_Db->address_person_id);
                        $name = $person_cls->person_name($personDb);
                        echo __('Source for address:') . ' <a href="' . CMS_ROOTPATH . 'family.php?id=' . $personDb->pers_indexnr . '&amp;main_person=' . $personDb->pers_gedcomnumber . '">';
                        echo $name["standard_name"] . '</a>';
                    }
                } else {
                    //$db_functions->set_tree_prefix($tree_prefix_quoted);
                    //echo 'TEST: '.$tree_id.' '.$connectDb->connect_sub_kind.' '.$connectDb->connect_connect_id.'<br>';
                    $personDb = $db_functions->get_person($connectDb->connect_connect_id);
                    echo ' <a href="' . CMS_ROOTPATH . 'family.php?id=' . $personDb->pers_indexnr . '&amp;main_person=' . $personDb->pers_gedcomnumber . '">';
                    $name = $person_cls->person_name($personDb);
                    echo $name["standard_name"] . '</a>';
                }
            }
            // *** Family source ***
            if ($connectDb->connect_kind == 'family') {
                if ($connectDb->connect_sub_kind == 'family_source') {
                    echo __('Source for family:');
                }
                if ($connectDb->connect_sub_kind == 'fam_relation_source') {
                    echo __('Source for cohabitation:');
                }
                if ($connectDb->connect_sub_kind == 'fam_marr_notice_source') {
                    echo __('Source for marriage notice:');
                }
                if ($connectDb->connect_sub_kind == 'fam_marr_source') {
                    echo __('Source for marriage:');
                }
                if ($connectDb->connect_sub_kind == 'fam_marr_church_notice_source') {
                    echo __('Source for marriage notice (church):');
                }
                if ($connectDb->connect_sub_kind == 'fam_marr_church_source') {
                    echo __('Source for marriage (church):');
                }
                if ($connectDb->connect_sub_kind == 'fam_div_source') {
                    echo __('Source for divorce:');
                }
                if ($connectDb->connect_sub_kind == 'fam_text_source') {
                    echo __('Source for family text:');
                }
                //else{
                //	echo 'TEST2';
                //}
                //if ($connectDb->connect_sub_kind=='event'){
                if ($connectDb->connect_sub_kind == 'fam_event_source') {
                    // *** Sources by event ***
                    $event_Db = $db_functions->get_event($connectDb->connect_connect_id);
                    // *** Family source ***
                    if ($event_Db->event_family_id) {
                        print __('Source for family:');
                        $familyDb = $db_functions->get_family($event_Db->event_family_id);
                        $personDb = person_data($familyDb);
                        echo ' <a href="' . CMS_ROOTPATH . 'family.php?id=' . $event_Db->event_family_id . '">';
                        $name = $person_cls->person_name($personDb);
                        echo $name["standard_name"] . '</a>';
                        if ($event_Db->event_event) {
                            echo ' ' . $event_Db->event_event;
                        }
                    }
                } else {
                    $familyDb = $db_functions->get_family($connectDb->connect_connect_id);
                    $personDb = person_data($familyDb);
                    echo ' <a href="' . CMS_ROOTPATH . 'family.php?id=' . $connectDb->connect_connect_id . '">';
                    $name = $person_cls->person_name($personDb);
                    echo $name["standard_name"] . '</a>';
                }
            }
            // *** Source by address ***
            if ($connectDb->connect_kind == 'address' and $connectDb->connect_sub_kind == 'address_source') {
                $sql = "SELECT * FROM humo_addresses WHERE address_id='" . $connectDb->connect_connect_id . "'";
                $address_sql = $dbh->query($sql);
                $addressDb = $address_sql->fetch(PDO::FETCH_OBJ);
                if ($addressDb->address_address) {
                    $text = $addressDb->address_address;
                }
                if ($addressDb->address_place) {
                    $text .= ' ' . $addressDb->address_place;
                }
                echo __('Source for address:');
                echo ' <a href="address.php?gedcomnumber=' . $addressDb->address_gedcomnr . '">' . $text . '</a>';
            }
            // *** Extra source connect information by every source ***
            if ($connectDb->connect_date or $connectDb->connect_place) {
                echo " " . date_place($connectDb->connect_date, $connectDb->connect_place);
            }
            // *** Source role ***
            if ($connectDb->connect_role) {
                echo ', ' . __('role') . ': ' . $connectDb->connect_role;
            }
            // *** Source page ***
            if ($connectDb->connect_page) {
                echo ', ' . strtolower(__('Page')) . ': ' . $connectDb->connect_page;
            }
            echo '<br>';
        }
        print '</td></tr>';
        print '</table>';
        include_once CMS_ROOTPATH . "footer.php";
    }
    // end if not PDF
}