include("begin.php"); include($cms[tngpath] . "genlib.php"); include($cms[tngpath] . "getlang.php"); include($cms[tngpath] . "$mylanguage/text.php"); tng_db_connect($database_host,$database_name,$database_username,$database_password) or exit; include($cms[tngpath] . "checklogin.php"); include($cms[tngpath] . "log.php" ); $showhistory_url = getURL( "showhistory", 1 ); if( $familyID ) $personID = $familyID; elseif( $sourceID ) $personID = $sourceID; if( !$personID ) { $query = "SELECT description, bodytext, 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]; } else { $query = "SELECT description, altdescription, bodytext, 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]; } //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; $bodytext = $row[usenl] ? nl2br($row[bodytext]) : $row[bodytext]; } else $description = $bodytext = $text[living]; $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