0) { $text = mysql_fetch_assoc($result); return parseText($text['text'])."

"; mysql_free_result($result); } else { $query = "SELECT person_id, text, asterisk FROM text_person WHERE also_person_id = '".$person_id."'"; $result = mysql_query($query) or die ("$text[cannotexecutequery]: $query"); if (mysql_num_rows($result)>0) { $text = mysql_fetch_assoc($result); return parseText($text['text'])."

"; mysql_free_result($result); } else { return false; } } } function search_individual($person_id) { $query = "SELECT name, bd_dd, person_id, s.surname AS surname FROM individuals AS i, surnames AS s WHERE i.surname_id = s.id AND person_id = '".$person_id."'"; $result = mysql_query($query) or die ("Cannot execute query: ".$query."
".mysql_error()); if (mysql_num_rows($result)>0) { while ($name = mysql_fetch_assoc($result)) { $person .= $name['name']." ".$name['surname']." - ".$name['bd_dd']."
Links: ".parsetext($name['person_id'])."

\n"; } return stripslashes($person); mysql_free_result($result); } else { return false; } } function search_addresses($person_id) { $query = "SELECT person_id, name, address_info FROM addresses WHERE person_id = '".$person_id."'"; $result = mysql_query($query) or die ("$text[cannotexecutequery]: $query"); if (mysql_num_rows($result)>0) { $text = mysql_fetch_assoc($result); return $text['name']."

".stripslashes(parseText($text['address_info'])); mysql_free_result($result); } else { return false; } } function search_oagroup($oagroup) { $oagroup = trim(substr($oagroup,2,10)); $query = "SELECT text FROM other_addr WHERE oa_id LIKE '".$oagroup.".%'"; $result = mysql_query($query) or die ("$text[cannotexecutequery]: $query"); if (mysql_num_rows($result)>0) { $text = mysql_fetch_assoc($result); return stripslashes(parseText($text['text']))."

"; mysql_free_result($result); } else { return false; } } function list_places() { if ($_REQUEST['l']) { $l = $_REQUEST['l']; } else { $l = 'A'; } $query = "SELECT id, name, location FROM places WHERE LEFT(name,1) = '".$l."' ORDER BY name ASC"; $result = mysql_query($query) or die ("Cannot execute query: ".$query."
".mysql_error()); if ($result) { $select = "\n"; return $select; mysql_free_result($result); } } function draw_a2z() { $query = "SELECT LEFT(name,1) AS letter FROM places ORDER BY name ASC"; $result = mysql_query($query) or die ("Cannot execute query: ".$query."
".mysql_error()); if ($result) { while ($row = mysql_fetch_assoc($result)) { $letter = $row['letter']; if ($old != $letter) $a2z .= " ".$letter."\n"; $old = $letter; } return $a2z; mysql_free_result($result); } } function findplace($word) { $exclude = array("son","purvis","the","and","you","was","are","for","his","her","one","had","but","can","out","all","use","how"); if (!in_array(strtolower($word),$exclude)) { $word = addslashes($word); if (($word != '') && (strlen($word) >=3)) { $query = "SELECT name, location FROM places WHERE name = '".$word."'"; $result = mysql_query($query) or die ("Cannot execute query: ".$query."
".mysql_error()); if ($result) { return $row = mysql_fetch_assoc($result); mysql_free_result($result); } else { return false; } } else { return false; } } } function parseText($text) { $words = explode(' ',$text); $count = 1; foreach ($words as $word) { $strip_word = str_replace(chr(40),'',$word); $strip_word = str_replace(chr(41),'',$strip_word); $strip_word = str_replace(chr(44),'',$strip_word); //$strip_word = str_replace(chr(46),'',$strip_word); $strip_word = str_replace("..",".",$strip_word); $strip_word = str_replace(",","",$strip_word); //if (($link = findplace($strip_word)) && ($count > 3)) { // $newword = "".$word.""; // $newtext .= $newword." "; //} elseif (ereg('^1\.',$word) || (ereg('^\(1\.',$word))) { if (ereg('^1\.',$word) || (ereg('^\(1\.',$word))) { $b = array('(',')',','); $strip_word = str_replace($b,'',$word); $strip_word = str_replace('..','.',$strip_word); $newword = "".$word.""; $newtext .= $newword." "; } else { $newtext .= $word." "; } $count++; } $query = "SELECT name FROM places"; $result = mysql_query($query) or die ("Cannot execute query: ".$query."
".mysql_error()); if ($result) { while ($row = mysql_fetch_assoc($result)) { $place = ucwords(strtolower($row['name'])); $place = explode("(",$place); $place = trim(str_replace(',','',$place[0])); $exclude = array("Son","Purvis","Alexander","John","Thomas"); if (!in_array($place,$exclude)) { //echo "replaced: ".$place." with ".$place."
"; //echo $place."
"; $newtext = str_replace(" ".$place." ", " ".$place." ", $newtext); $newtext = str_replace(" ".$place.",", " ".$place.",", $newtext); $newtext = str_replace(" ".$place.".", " ".$place.".", $newtext); $newtext = str_replace(" ".$place.")", " ".$place.")", $newtext); } } mysql_free_result($result); } return $newtext; } // ------------------------------- $showhistory_url = getURL( "showhistory", 1 ); if( $familyID ) $personID = $familyID; elseif( $sourceID ) $personID = $sourceID; if( !$personID ) { $query = "SELECT description, bodytext, notes, alwayson, usenl FROM $histories_table WHERE docID = \"$docID\""; $result = mysql_query($query) or die ("$text[cannotexecutequery]: $query"); $row = mysql_fetch_assoc($result); $docdescription = $row[description]; $docnotes = $row[notes]; } else { $query = "SELECT description, altdescription, bodytext, notes, altnotes, alwayson, usenl, $histories_table.docID as docID FROM $histories_table, $doclinks_table WHERE personID = \"$personID\" AND $doclinks_table.gedcom = \"$tree\" AND ordernum = \"$ordernum\" AND $histories_table.docID = $doclinks_table.docID ORDER by ordernum"; $result = mysql_query($query) or die ("$text[cannotexecutequery]: $query"); $row = mysql_fetch_assoc($result); $docID = $row[docID]; $docdescription = $row[altdescription] ? $row[altdescription] : $row[description]; $docnotes = $row[altnotes] ? $row[altnotes] : $row[notes]; } //write to log $query = "SELECT $doclinks_table.ID, $doclinks_table.personID as personID, $doclinks_table.gedcom as gedcom, people.living as living, people.branch as branch, $families_table.branch as fbranch, $families_table.living as fliving FROM $doclinks_table LEFT JOIN $people_table AS people ON $doclinks_table.personID = people.personID AND $doclinks_table.gedcom = people.gedcom LEFT JOIN $families_table ON $doclinks_table.personID = $families_table.familyID AND $doclinks_table.gedcom = $families_table.gedcom WHERE $doclinks_table.docID = \"$docID\""; $dresult = mysql_query($query) or die ("$text[cannotexecutequery]: $query"); $noneliving = 1; $rightbranch = 0; $allrightbranch = 1; while( $drow = mysql_fetch_assoc( $dresult ) ) { if( $drow[fbranch] != NULL ) $drow[branch] = $drow[fbranch]; if( $drow[fliving] != NULL ) $drow[living] = $drow[fliving]; if( $drow[living] == NULL ) { $query = "SELECT count(personID) as ccount FROM $citations_table, $people_table WHERE $citations_table.sourceID = '$drow[personID]' AND $citations_table.persfamID = $people_table.personID AND $citations_table.gedcom = $people_table.gedcom AND living = '1'"; $dresult2 = mysql_query($query) or die ("$text[cannotexecutequery]: $query"); $drow2 = mysql_fetch_assoc( $dresult2 ); if( $drow2[ccount] ) $drow[living] = 1; mysql_free_result( $dresult2 ); } if( $drow[living] && $livedefault != 2 ) { if( !$allow_living_db || $livedefault == 1 || ($assignedtree && $assignedtree != $drow[gedcom]) || !checkbranch( $drow[branch] ) ) $noneliving = 0; } if( $drow[personID] == $personID && checkbranch( $drow[branch] ) ) $rightbranch = 1; if( !checkbranch( $drow[branch] ) ) $allrightbranch = 0; } mysql_free_result( $dresult ); if( $noneliving || !$nonames || $row[alwayson] ) { $description = $docdescription; $notes = $docnotes; $bodytext = $row[usenl] ? nl2br(html_entity_decode($row[bodytext],ENT_QUOTES)) : html_entity_decode($row[bodytext],ENT_QUOTES); } else { $description = $bodytext = $text[living]; $notes = ""; } $logdesc = $nonames && !$noneliving && !$row[alwayson] ? $text[living] : $description; if( !$personID ) writelog( "$text[docof] $logdesc ($docID)" ); else { if( $familyID ) writelog( "$text[historyof] $logdesc ($row[docID])" ); elseif( $sourceID ) writelog( "$text[historyof] $logdesc ($row[docID])" ); else writelog( "$text[historyof] $logdesc ($row[docID])" ); } tng_header( $row[description], $flags ); echo "

$description

$notes


\n\n"; echo tng_coreicons(); echo parseText($bodytext); $query1 = "SELECT docID FROM $histories_table"; $result1 = mysql_query($query1) or die ("$text[cannotexecutequery]: $query"); $docIDmax = mysql_num_rows($result1); mysql_free_result( $result1 ); if ($docID-1 < 1) { $docIDprev = $docIDmax; } else { $docIDprev = $docID-1; } if ($docID+1 > $docIDmax) { $docIDnext = 1; } else { $docIDnext = $docID+1; } echo '

<< View previous History article          View next History article >> '; if( $ioffset ) { $ioffsetstr = "$ioffset, "; $newioffset = $ioffset + 1; } else { $ioffsetstr = ""; $newioffset = ""; } $query = "SELECT $doclinks_table.ID, $doclinks_table.personID as personID, people.living as living, people.branch as branch, $families_table.branch as fbranch, $families_table.living as fliving, people.lastname as lastname, people.lnprefix as lnprefix, people.firstname as firstname, people.suffix as suffix, people.nameorder, altdescription, altnotes, $doclinks_table.gedcom, familyID, people.personID as personID2, wifepeople.personID as wpersonID, wifepeople.firstname as wfirstname, wifepeople.lnprefix as wlnprefix, wifepeople.lastname as wlastname, wifepeople.suffix as wsuffix, husbpeople.personID as hpersonID, husbpeople.firstname as hfirstname, husbpeople.lnprefix as hlnprefix, husbpeople.lastname as hlastname, husbpeople.suffix as hsuffix, $sources_table.title, $sources_table.sourceID FROM $doclinks_table LEFT JOIN $people_table AS people ON $doclinks_table.personID = people.personID AND $doclinks_table.gedcom = people.gedcom LEFT JOIN $families_table ON $doclinks_table.personID = $families_table.familyID AND $doclinks_table.gedcom = $families_table.gedcom LEFT JOIN $people_table AS husbpeople ON $families_table.husband = husbpeople.personID AND $families_table.gedcom = husbpeople.gedcom LEFT JOIN $people_table AS wifepeople ON $families_table.wife = wifepeople.personID AND $families_table.gedcom = wifepeople.gedcom LEFT JOIN $sources_table ON $doclinks_table.personID = $sources_table.sourceID AND $doclinks_table.gedcom = $sources_table.gedcom WHERE docID = \"$docID\" ORDER BY people.lastname, people.lnprefix, people.firstname, hlastname, hlnprefix, hfirstname LIMIT $ioffsetstr" . ($maxsearchresults + 1); $presult = mysql_query($query) or die ("$text[cannotexecutequery]: $query"); $numrows = mysql_num_rows( $presult ); $doclinktext = ""; $noneliving = 1; $count = 0; while( $count < $maxsearchresults && $prow = mysql_fetch_assoc( $presult ) ) { if( $prow[fbranch] != NULL ) $prow[branch] = $prow[fbranch]; if( $prow[fliving] != NULL ) $prow[living] = $prow[fliving]; if( $doclinktext ) $doclinktext .= "\n"; if( !$prow[living] || $livedefault == 2 || ( !$livedefault && $allow_living_db && ( !$assignedtree || $assignedtree == $prow[gedcom] ) && checkbranch( $prow[branch] ) ) ) $prow[allow_living] = 1; else { $noneliving = 0; $prow[allow_living] = 0; } if( $prow[personID2] != NULL ) { $doclinktext .= ""; $doclinktext .= getName( $prow ) . ""; } elseif( $prow[sourceID] != NULL ) { $sourcetext = $prow[title] ? $prow[title] : $prow[sourceID]; $doclinktext .= "$text[source]: $sourcetext"; } elseif( $prow[familyID] != NULL ) { $familyname = trim("$prow[hlnprefix] $prow[hlastname]") . "/" . trim("$prow[wlnprefix] $prow[wlastname]") . " ($prow[familyID])"; $doclinktext .= "$text[family]: $familyname"; } $count++; } mysql_free_result( $presult ); if( $numrows > $maxsearchresults ) $doclinktext .= "\n[$text[morelinks]]"; $filename = basename( $imgrow[path] ); echo "

$pagenav

\n"; echo "\n"; if( $showextended ) { echo showEvent( array( "text"=>$text[filename], "fact"=>$filename ) ); //echo showEvent( array( "text"=>$text[photosize], "fact"=>"$size[0] x $size[1]" ) ); } if( $doclinktext ) echo showEvent( array( "text"=>$text[indlinked], "fact"=>$doclinktext ) ); echo "
\n"; tng_footer( "" ); ?>