Example #1
0
 static function &getInstance($data, $simple = true)
 {
     global $gedcom_record_cache, $GEDCOM, $pgv_changes;
     if (is_array($data)) {
         $ged_id = $data['ged_id'];
         $pid = $data['xref'];
     } else {
         $ged_id = get_id_from_gedcom($GEDCOM);
         $pid = $data;
     }
     // Check the cache first
     if (isset($gedcom_record_cache[$pid][$ged_id])) {
         return $gedcom_record_cache[$pid][$ged_id];
     }
     // Look for the record in the database
     if (!is_array($data)) {
         $data = fetch_media_record($pid, $ged_id);
         // If we didn't find the record in the database, it may be remote
         if (!$data && strpos($pid, ':')) {
             list($servid, $remoteid) = explode(':', $pid);
             $service = ServiceClient::getInstance($servid);
             if ($service) {
                 // TYPE will be replaced with the type from the remote record
                 $data = $service->mergeGedcomRecord($remoteid, "0 @{$pid}@ TYPE\n1 RFN {$pid}", false);
             }
         }
         // If we didn't find the record in the database, it may be new/pending
         if (!$data && PGV_USER_CAN_EDIT && isset($pgv_changes[$pid . '_' . $GEDCOM])) {
             $data = find_updated_record($pid);
             $fromfile = true;
         }
         // If we still didn't find it, it doesn't exist
         if (!$data) {
             return null;
         }
     }
     // Create the object
     $object = new Media($data, $simple);
     if (!empty($fromfile)) {
         $object->setChanged(true);
     }
     // Store it in the cache
     $gedcom_record_cache[$object->xref][$object->ged_id] =& $object;
     //-- also store it using its reference id (sid:pid and local gedcom for remote links)
     $gedcom_record_cache[$pid][$ged_id] =& $object;
     return $object;
 }
Example #2
0
        }
        @($array = unserialize($setting->u_rootid));
        if (is_array($array)) {
            foreach ($array as $gedcom => $value) {
                try {
                    WT_DB::prepare("INSERT IGNORE INTO `##user_gedcom_setting` (user_id, gedcom_id, setting_name, setting_value) VALUES (?, ?, ?, ?)")->execute(array($setting->user_id, get_id_from_gedcom($gedcom), 'rootid', $value));
                } catch (PDOException $ex) {
                    // Invalid data?  Reference to non-existing tree?
                }
            }
        }
        @($array = unserialize($setting->u_canedit));
        if (is_array($array)) {
            foreach ($array as $gedcom => $value) {
                try {
                    WT_DB::prepare("INSERT IGNORE INTO `##user_gedcom_setting` (user_id, gedcom_id, setting_name, setting_value) VALUES (?, ?, ?, ?)")->execute(array($setting->user_id, get_id_from_gedcom($gedcom), 'canedit', $value));
                } catch (PDOException $ex) {
                    // Invalid data?  Reference to non-existing tree?
                }
            }
        }
    }
}
define('PGV_PHPGEDVIEW', true);
define('PGV_PRIV_PUBLIC', WT_PRIV_PUBLIC);
define('PGV_PRIV_USER', WT_PRIV_USER);
define('PGV_PRIV_NONE', WT_PRIV_NONE);
define('PGV_PRIV_HIDE', WT_PRIV_HIDE);
$PRIV_PUBLIC = WT_PRIV_PUBLIC;
$PRIV_USER = WT_PRIV_USER;
$PRIV_NONE = WT_PRIV_NONE;
Example #3
0
    if ($file != 'config_gedcom.php') {
        $locked_by_context[] = str_replace($INDEX_DIRECTORY, "", $file);
    }
}
$dir = dir($INDEX_DIRECTORY);
$path = $INDEX_DIRECTORY;
// snag our path
$entryList = array();
while (false !== ($entry = $dir->read())) {
    $entryList[] = $entry;
}
sort($entryList);
foreach ($entryList as $entry) {
    //echo $entry, "\n";
    if ($entry[0] != '.') {
        if ($ged_id = get_id_from_gedcom($entry)) {
            print "<li class=\"facts_value\" name=\"{$entry}\" style=\"margin-bottom:2px;\" id=\"lock_{$entry}\" >";
            print "<img src=\"./images/RESN_confidential.gif\" alt=\"\" />&nbsp;&nbsp;";
            print "<span class=\"name2\">" . $entry . "</span>";
            print "&nbsp;&nbsp;{$pgv_lang["associated_files"]}<i>&nbsp;&nbsp;" . str_replace($path, "", get_gedcom_setting($ged_id, 'privacy'));
            print "&nbsp;&nbsp;" . str_replace($path, "", get_gedcom_setting($ged_id, 'config')) . "</i>";
        } else {
            if (in_array($entry, $locked_by_context)) {
                print "<li class=\"facts_value\" name=\"{$entry}\" style=\"margin-bottom:2px;\" id=\"lock_{$entry}\" >";
                print "<img src=\"./images/RESN_confidential.gif\" alt=\"\" />&nbsp;&nbsp;";
                print "<span class=\"name2\">" . $entry . "</span>";
            } else {
                if (in_array($entry, $locked_with_warning)) {
                    print "<li class=\"facts_value\" name=\"{$entry}\" warn=\"true\" style=\"cursor:move;margin-bottom:2px;\" id=\"li_{$entry}\" >";
                    print "<input type=\"checkbox\" name=\"to_delete[]\" warn=\"true\" value=\"" . $entry . "\" onclick=\"warnuser(this);\" />\n";
                    print "<img src=\"./images/RESN_locked.gif\" alt=\"\" />&nbsp;&nbsp;";
Example #4
0
/**
 * Get a user's favorites
 * Return an array of a users messages
 * @param string $username		the username to get the favorites for
 */
function getUserFavorites($username)
{
    global $TBLPREFIX, $gBitDb;
    $rows = $gBitDb->getAll("SELECT * FROM {$TBLPREFIX}favorites WHERE fv_username=?", array($username));
    $favorites = array();
    foreach ($rows as $row) {
        if (get_id_from_gedcom($row->fv_file)) {
            // If gedcom exists
            $favorites[] = array("id" => $row->fv_id, "username" => $row->fv_username, "gid" => $row->fv_gid, "type" => $row->fv_type, "file" => $row->fv_file, "title" => $row->fv_title, "note" => $row->fv_note, "url" => $row->fv_url);
        }
    }
    return $favorites;
}
 static function &getInstance($data, $simple = true)
 {
     global $gedcom_record_cache, $GEDCOM, $pgv_changes;
     if (is_array($data)) {
         $ged_id = $data['ged_id'];
         $pid = $data['xref'];
     } else {
         $ged_id = get_id_from_gedcom($GEDCOM);
         $pid = $data;
     }
     // Check the cache first
     if (isset($gedcom_record_cache[$pid][$ged_id])) {
         return $gedcom_record_cache[$pid][$ged_id];
     }
     // Look for the record in the database
     if (!is_array($data)) {
         $data = fetch_gedcom_record($pid, $ged_id);
         // If we didn't find the record in the database, it may be remote
         if (!$data && strpos($pid, ':')) {
             list($servid, $remoteid) = explode(':', $pid);
             $service = ServiceClient::getInstance($servid);
             if ($service) {
                 // TYPE will be replaced with the type from the remote record
                 $data = $service->mergeGedcomRecord($remoteid, "0 @{$pid}@ TYPE\n1 RFN {$pid}", false);
             }
         }
         // If we didn't find the record in the database, it may be new/pending
         if (!$data && PGV_USER_CAN_EDIT && isset($pgv_changes[$pid . '_' . $GEDCOM])) {
             $data = find_updated_record($pid);
             $fromfile = true;
         }
         // If we still didn't find it, it doesn't exist
         if (!$data) {
             return null;
         }
     }
     // Create the object
     if (is_array($data)) {
         $type = $data['type'];
     } elseif (preg_match('/^0 @' . PGV_REGEX_XREF . '@ (' . PGV_REGEX_TAG . ')/', $data, $match)) {
         $type = $match[1];
     } else {
         $type = '';
     }
     switch ($type) {
         case 'INDI':
             $object = new Person($data, $simple);
             break;
         case 'FAM':
             $object = new Family($data, $simple);
             break;
         case 'SOUR':
             $object = new Source($data, $simple);
             break;
             //BH ==================
         //BH ==================
         case 'NOTE':
             $object = new Note($data, $simple);
             break;
         case 'REPO':
             $object = new Repository($data, $simple);
             break;
         case 'OBJE':
             $object = new Media($data, $simple);
             break;
         default:
             $object = new GedcomRecord($data, $simple);
             break;
     }
     // This is an object from the database, but we created it from raw gedcom
     // rather than a database row.  Set the gedcom to indicate that it is not
     // a dynamically created record.
     $object->ged_id = $ged_id;
     if (!empty($fromfile)) {
         $object->setChanged(true);
     }
     // Store it in the cache
     $gedcom_record_cache[$object->xref][$object->ged_id] =& $object;
     //-- also store it using its reference id (sid:pid and local gedcom for remote links)
     $gedcom_record_cache[$pid][$ged_id] =& $object;
     return $object;
 }
Example #6
0
    exit;
}
if ($action != "choose") {
    if ($gid1 == $gid2 && $GEDCOM == $ged2) {
        $action = "choose";
        echo "<span class=\"error\">", $pgv_lang["same_ids"], "</span>\n";
    } else {
        if (!isset($pgv_changes[$gid1 . "_" . PGV_GEDCOM])) {
            $gedrec1 = find_gedcom_record($gid1, PGV_GED_ID);
        } else {
            $gedrec1 = find_updated_record($gid1, get_id_from_gedcom($GEDCOM));
        }
        if (!isset($pgv_changes[$gid2 . "_" . $ged2])) {
            $gedrec2 = find_gedcom_record($gid2, get_id_from_gedcom($ged2));
        } else {
            $gedrec2 = find_updated_record($gid2, get_id_from_gedcom($ged2));
        }
        // Fetch the original XREF - may differ in case from the supplied value
        $tmp = new Person($gedrec1);
        $gid1 = $tmp->getXref();
        $tmp = new Person($gedrec2);
        $gid2 = $tmp->getXref();
        if (empty($gedrec1)) {
            echo '<span class="error">', $pgv_lang['unable_to_find_record'], ':</span> ', $gid1, ', ', $ged;
            $action = "choose";
        } elseif (empty($gedrec2)) {
            echo '<span class="error">', $pgv_lang['unable_to_find_record'], ':</span> ', $gid2, ', ', $ged2;
            $action = "choose";
        } else {
            $type1 = "";
            $ct = preg_match("/0 @{$gid1}@ (.*)/", $gedrec1, $match);
Example #7
0
 function printResults()
 {
     include_once "includes/functions/functions_print_lists.php";
     global $GEDCOM, $GEDCOMS, $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang, $global_facts;
     //-- all privacy settings must be global if we are going to load up privacy files
     global $SHOW_DEAD_PEOPLE, $SHOW_LIVING_NAMES, $SHOW_SOURCES, $MAX_ALIVE_AGE, $USE_RELATIONSHIP_PRIVACY, $MAX_RELATION_PATH_LENGTH;
     global $CHECK_MARRIAGE_RELATIONS, $PRIVACY_BY_YEAR, $PRIVACY_BY_RESN, $SHOW_PRIVATE_RELATIONSHIPS, $person_privacy, $user_privacy;
     global $global_facts, $person_facts;
     $somethingPrinted = false;
     // whether anything printed
     // ---- section to search and display results on a general keyword search
     if ($this->action == "general" || $this->action == "soundex" || $this->action == "replace") {
         if ($this->myindilist || $this->myfamlist || $this->mysourcelist || $this->mynotelist) {
             echo '<br />';
             $OLD_GEDCOM = $GEDCOM;
             // Split individuals by gedcom
             foreach ($this->sgeds as $gedcom) {
                 $datalist = array();
                 foreach ($this->myindilist as $individual) {
                     if ($individual->getGedId() == get_id_from_gedcom($gedcom)) {
                         $datalist[] = $individual;
                     }
                 }
                 if ($datalist) {
                     $somethingPrinted = true;
                     usort($datalist, array('GedcomRecord', 'Compare'));
                     $GEDCOM = $gedcom;
                     print_indi_table($datalist, $pgv_lang['individuals'] . ' : &laquo;' . $this->myquery . '&raquo; @ ' . PrintReady($GEDCOMS[$gedcom]['title'], true));
                 }
             }
             // Split families by gedcom
             foreach ($this->sgeds as $gedcom) {
                 $datalist = array();
                 foreach ($this->myfamlist as $family) {
                     if ($family->getGedId() == get_id_from_gedcom($gedcom)) {
                         $datalist[] = $family;
                     }
                 }
                 if ($datalist) {
                     $somethingPrinted = true;
                     usort($datalist, array('GedcomRecord', 'Compare'));
                     $GEDCOM = $gedcom;
                     print_fam_table($datalist, $pgv_lang['families'] . ' : &laquo;' . $this->myquery . '&raquo; @ ' . PrintReady($GEDCOMS[$gedcom]['title'], true));
                 }
             }
             // Split sources by gedcom
             foreach ($this->sgeds as $gedcom) {
                 $datalist = array();
                 foreach ($this->mysourcelist as $source) {
                     if ($source->getGedId() == get_id_from_gedcom($gedcom)) {
                         $datalist[] = $source;
                     }
                 }
                 if ($datalist) {
                     $somethingPrinted = true;
                     usort($datalist, array('GedcomRecord', 'Compare'));
                     $GEDCOM = $gedcom;
                     print_sour_table($datalist, $pgv_lang['sources'] . ' : &laquo;' . $this->myquery . '&raquo; @ ' . PrintReady($GEDCOMS[$gedcom]['title'], true));
                 }
             }
             // Split notes by gedcom
             foreach ($this->sgeds as $gedcom) {
                 $datalist = array();
                 foreach ($this->mynotelist as $note) {
                     if ($note->getGedId() == get_id_from_gedcom($gedcom)) {
                         $datalist[] = $note;
                     }
                 }
                 if ($datalist) {
                     $somethingPrinted = true;
                     usort($datalist, array('GedcomRecord', 'Compare'));
                     $GEDCOM = $gedcom;
                     print_note_table($datalist, $pgv_lang['notes'] . ' : &laquo;' . $this->myquery . '&raquo; @ ' . PrintReady($GEDCOMS[$gedcom]['title'], true));
                 }
             }
             $GEDCOM = $OLD_GEDCOM;
         } else {
             if (isset($this->query)) {
                 print "<br /><div class=\"warning\" style=\" text-align: center;\"><i>" . $pgv_lang["no_results"] . "</i><br />";
                 if (!isset($this->srindi) && !isset($this->srfams) && !isset($this->srsour) && !isset($this->srnote)) {
                     print "<i>" . $pgv_lang["no_search_for"] . "</i><br />";
                 }
                 echo '</div>';
             }
         }
         // Prints the Paged Results: << 1 2 3 4 >> links if there are more than $this->resultsPerPage results
         if ($this->resultsPerPage >= 1 && $this->totalGeneralResults > $this->resultsPerPage) {
             $this->printPageResultsLinks($this->inputFieldNames, $this->totalGeneralResults, $this->resultsPerPage);
         }
     }
     // ----- section to search and display results for multisite
     if ($this->action == "multisite") {
         // Only Display 5 results per 2 sites if the total results per page is 10
         $sitesChecked = 0;
         $i = 0;
         foreach ($this->Sites as $server) {
             $siteName = "server" . $i;
             if (isset($_REQUEST["{$siteName}"])) {
                 $sitesChecked++;
             }
             $i++;
         }
         if ($sitesChecked >= 1) {
             $this->multiResultsPerPage = $this->resultsPerPage / $sitesChecked;
             if (!empty($this->Sites) && count($this->Sites) > 0) {
                 $no_results_found = false;
                 // Start output here, because from the indi's we may have printed some fams which need the column header.
                 print "<br />";
                 print "<div class=\"center\">";
                 if (isset($this->multisiteResults) && count($this->multisiteResults) > 0) {
                     $this->totalResults = 0;
                     $this->multiTotalResults = 0;
                     $somethingPrinted = true;
                     foreach ($this->multisiteResults as $key => $siteResults) {
                         include_once 'includes/classes/class_serviceclient.php';
                         $serviceClient = ServiceClient::getInstance($key);
                         $siteName = $serviceClient->getServiceTitle();
                         $siteURL = dirname($serviceClient->getURL());
                         print "<table id=\"multiResultsOutTbl\" class=\"list_table, {$TEXT_DIRECTION}\" align=\"center\">";
                         if (isset($siteResults) && !empty($siteResults->persons)) {
                             $displayed_once = false;
                             $personlist = $siteResults->persons;
                             /***************************************************** PAGING HERE **********************************************************************/
                             //set the total results and only get the results for this page
                             $this->multiTotalResults += count($personlist);
                             if ($this->totalResults < $this->multiTotalResults) {
                                 $this->totalResults = $this->multiTotalResults;
                             }
                             $personlist = $this->getPagedResults($personlist, $this->multiResultsPerPage);
                             $pageResultsNum = 0;
                             foreach ($personlist as $index => $person) {
                                 //if there is a name to display then diplay it
                                 if (!empty($person->gedcomName)) {
                                     if (!$displayed_once) {
                                         if (!$no_results_found) {
                                             $no_results_found = true;
                                             print "<tr><td class=\"list_label\" colspan=\"2\" width=\"100%\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["indis"]["large"] . "\" border=\"0\" width=\"25\" alt=\"\" /> " . $pgv_lang["people"] . "</td></tr>";
                                             print "<tr><td><table id=\"multiResultsInTbl\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" ><tr>";
                                         }
                                         $displayed_once = true;
                                         print "<td class=\"list_label\" colspan=\"2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" >" . $pgv_lang["site_list"] . "<a href=\"" . encode_url($siteURL) . "\" target=\"_blank\">" . $siteName . "</a>" . $pgv_lang["site_had"] . "</td></tr>";
                                     }
                                     print "<tr><td class=\"list_value {$TEXT_DIRECTION}\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" valign=\"center\" ><ul>";
                                     print "<li class=\"{$TEXT_DIRECTION}\" dir=\"{$TEXT_DIRECTION}\">";
                                     print "<a href=\"" . encode_url("{$siteURL}/individual.php?pid={$person->PID}&ged={$serviceClient->gedfile}") . "\" target=\"_blank\">";
                                     $pageResultsNum += 1;
                                     print "<b>" . $person->getFullName() . "</b>";
                                     if (!empty($person->PID)) {
                                         print " (" . $person->PID . ")";
                                     }
                                     if (!empty($person->birthDate) || !empty($person->birthPlace)) {
                                         print " -- <i>";
                                         if (!empty($person->birthDate)) {
                                             print " " . $person->birthDate;
                                         }
                                         if (!empty($person->birthPlace)) {
                                             print " " . $person->birthPlace;
                                         }
                                         print "</i>";
                                     }
                                     print "</a></li></ul></td>";
                                     /*******************************  Remote Links Per Result *************************************************/
                                     if (PGV_USER_CAN_EDIT) {
                                         print "<td class=\"list_value {$TEXT_DIRECTION}\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" >" . "<ul style=\"list-style: NONE\"><li><a href=\"javascript:;\" " . "onclick=\"return open_link('" . $key . "', '" . $person->PID . "', '" . $person->getFullName() . "');\">" . "<b>" . $pgv_lang["title_search_link"] . "</b></a></ul></li></td></tr>\n";
                                     }
                                 }
                             }
                             print "</table>";
                             print "\n\t\t&nbsp;</td></tr></table>";
                         }
                         if ($this->multiTotalResults > 0) {
                             print "</tr><tr><td align=\"left\">Displaying individuals ";
                             print $this->multiResultsPerPage * $this->resultsPageNum + 1 . " " . $pgv_lang["search_to"] . " " . ($this->multiResultsPerPage * $this->resultsPageNum + $pageResultsNum);
                             print " " . $pgv_lang["of"] . " " . $this->multiTotalResults . "</td></tr></table>";
                             $this->multiTotalResults = 0;
                         } else {
                             print "</tr></table>";
                         }
                     }
                     print "</table>";
                 }
                 echo '</div>';
                 if (!$no_results_found && $this->multiTotalResults == 0 && (isset($this->multiquery) || isset($this->name) || isset($this->birthdate) || isset($this->birthplace) || isset($this->deathdate) || isset($this->deathplace) || isset($this->gender))) {
                     print "<table align=\"center\" \\><td class=\"warning\" style=\" text-align: center;\"><font color=\"red\"><b><i>" . $pgv_lang["no_results"] . "</i></b></font><br /></td></tr></table>";
                 }
             }
         } else {
             if ($sitesChecked < 1 && $this->isPostBack) {
                 print "<table align=\"center\" \\><tr><td class=\"warning\" style=\" text-align: center;\"><font color=\"red\"><b><i>" . $pgv_lang["no_search_site"] . "</i></b></font><br /></td></tr></table>";
             }
         }
         print "</table>";
         // Prints the Paged Results: << 1 2 3 4 >> links if there are more than $this->resultsPerPage results
         if ($this->resultsPerPage > 1 && $this->totalResults > $this->resultsPerPage) {
             $this->printPageResultsLinks($this->inputFieldNames, $this->totalResults, $this->multiResultsPerPage);
         }
     }
     return $somethingPrinted;
     // whether anything printed
 }
Example #8
0
function pgv_href($tag, $xref, $name = '')
{
    global $PGV_LINK, $target, $ged;
    $text = $name == '' ? "{$tag} {$xref}" : "{$name} ({$xref})";
    if (isset($PGV_LINK[$tag]) && get_id_from_gedcom($ged)) {
        return '&lrm;<a href="' . $PGV_LINK[$tag] . str_replace('@', '', $xref) . '"&amp;ged=' . $ged . $target . '>' . $text . '</a>&lrm;';
    } else {
        return "&lrm;{$tag} {$xref}&lrm;";
    }
}
Example #9
0
 static function _commonGivenQuery($sex = 'B', $type = 'list', $show_tot = false, $params = null)
 {
     global $TEXT_DIRECTION, $GEDCOM, $TBLPREFIX, $pgv_lang, $gBitDb;
     static $sort_types = array('count' => 'asort', 'rcount' => 'arsort', 'alpha' => 'ksort', 'ralpha' => 'krsort');
     static $sort_flags = array('count' => SORT_NUMERIC, 'rcount' => SORT_NUMERIC, 'alpha' => SORT_STRING, 'ralpha' => SORT_STRING);
     if (is_array($params) && isset($params[0]) && $params[0] != '' && $params[0] >= 0) {
         $threshold = strtolower($params[0]);
     } else {
         $threshold = 1;
     }
     if (is_array($params) && isset($params[1]) && $params[1] != '' && $params[1] >= 0) {
         $maxtoshow = strtolower($params[1]);
     } else {
         $maxtoshow = 10;
     }
     if (is_array($params) && isset($params[2]) && $params[2] != '' && isset($sort_types[strtolower($params[2])])) {
         $sorting = strtolower($params[2]);
     } else {
         $sorting = 'rcount';
     }
     switch ($sex) {
         case 'M':
             $sex_sql = "i_sex='M'";
             break;
         case 'F':
             $sex_sql = "i_sex='F'";
             break;
         case 'U':
             $sex_sql = "i_sex='U'";
             break;
         case 'B':
             $sex_sql = "i_sex!='U'";
             break;
     }
     $ged_id = get_id_from_gedcom($GEDCOM);
     $result = $gBitDb->query("SELECT n_givn, COUNT(*) AS num FROM {$TBLPREFIX}name JOIN {$TBLPREFIX}individuals ON (n_id=i_id AND n_file=i_file) WHERE n_file={$ged_id} AND n_type!='_MARNM' AND n_givn NOT IN ('@P.N.', '') AND LENGTH(n_givn)>1 AND {$sex_sql} GROUP BY n_id, n_givn");
     $nameList = array();
     while ($row = $result->fetchRow) {
         // Split "John Thomas" into "John" and "Thomas" and count against both totals
         foreach (explode(' ', $row[n_givn]) as $given) {
             $given = str_replace(array('*', '"'), '', $given);
             if (strlen($given) > 1) {
                 if (array_key_exists($given, $nameList)) {
                     $nameList[$given] += $row[num];
                 } else {
                     $nameList[$given] = $row[num];
                 }
             }
         }
     }
     arsort($nameList, SORT_NUMERIC);
     $nameList = array_slice($nameList, 0, $maxtoshow);
     if (count($nameList) == 0) {
         return '';
     }
     if ($type == 'chart') {
         return $nameList;
     }
     $common = array();
     foreach ($nameList as $given => $total) {
         if ($maxtoshow !== -1) {
             if ($maxtoshow-- <= 0) {
                 break;
             }
         }
         if ($total < $threshold) {
             break;
         }
         if ($show_tot) {
             $tot = PrintReady("[{$total}]");
             if ($TEXT_DIRECTION == 'ltr') {
                 $totL = '';
                 $totR = '&nbsp;' . $tot;
             } else {
                 $totL = $tot . '&nbsp;';
                 $totR = '';
             }
         } else {
             $totL = '';
             $totR = '';
         }
         switch ($type) {
             case 'table':
                 $common[] = '<tr><td class="optionbox">' . PrintReady(UTF8_substr($given, 0, 1) . UTF8_strtolower(UTF8_substr($given, 1))) . '</td><td class="optionbox">' . $total . '</td></tr>';
                 break;
             case 'list':
                 $common[] = "\t<li>{$totL}" . PrintReady(UTF8_substr($given, 0, 1) . UTF8_strtolower(UTF8_substr($given, 1))) . "{$totR}</li>\n";
                 break;
             case 'nolist':
                 $common[] = $totL . PrintReady(UTF8_substr($given, 0, 1) . UTF8_strtolower(UTF8_substr($given, 1))) . $totR;
                 break;
         }
     }
     if ($common) {
         switch ($type) {
             case 'table':
                 $lookup = array('M' => $pgv_lang['male'], 'F' => $pgv_lang['female'], 'U' => $pgv_lang['unknown'], 'B' => $pgv_lang['all']);
                 return '<table><tr><td colspan="2" class="descriptionbox center">' . $lookup[$sex] . '</td></tr><tr><td class="descriptionbox center">' . $pgv_lang['names'] . '</td><td class="descriptionbox center">' . $pgv_lang['count'] . '</td></tr>' . join('', $common) . '</table>';
             case 'list':
                 return "<ul>\n" . join("\n", $common) . "</ul>\n";
             case 'nolist':
                 return join(';&nbsp; ', $common);
         }
     } else {
         return '';
     }
 }
Example #10
0
 private static function _getHitCount($page_name, $params)
 {
     if (is_array($params) && isset($params[0]) && $params[0] != '') {
         $page_parameter = $params[0];
     } else {
         $page_parameter = '';
     }
     if ($page_name === null) {
         // index.php?ctype=gedcom
         $page_name = 'index.php';
         $page_parameter = 'gedcom:' . get_id_from_gedcom($page_parameter ? $page_parameter : WT_GEDCOM);
     } elseif ($page_name == 'index.php') {
         // index.php?ctype=user
         $user = User::findByIdentifier($page_parameter);
         $page_parameter = 'user:'******'<span class="hit-counter">' . WT_I18N::number($count) . '</span>';
 }
Example #11
0
 $boolarray["no"] = "false";
 $boolarray[false] = "false";
 $boolarray[true] = "true";
 print "<table class=\"facts_table {$TEXT_DIRECTION}\">";
 print "<tr><td class=\"descriptionbox\">";
 print $pgv_lang["performing_update"];
 print "<br />";
 $configtext = implode('', file("privacy.php"));
 print $pgv_lang["config_file_read"];
 print "</td></tr></table>\n";
 $configtext = preg_replace('/\\$SHOW_DEAD_PEOPLE\\s*=\\s*.*;/', "\$SHOW_DEAD_PEOPLE = " . $_POST["v_SHOW_DEAD_PEOPLE"] . ";", $configtext);
 $configtext = preg_replace('/\\$SHOW_LIVING_NAMES\\s*=\\s*.*;/', "\$SHOW_LIVING_NAMES = " . $_POST["v_SHOW_LIVING_NAMES"] . ";", $configtext);
 $configtext = preg_replace('/\\$SHOW_SOURCES\\s*=\\s*.*;/', "\$SHOW_SOURCES = " . $_POST["v_SHOW_SOURCES"] . ";", $configtext);
 $configtext = preg_replace('/\\$MAX_ALIVE_AGE\\s*=\\s*".*";/', "\$MAX_ALIVE_AGE = \"" . $_POST["v_MAX_ALIVE_AGE"] . "\";", $configtext);
 if ($MAX_ALIVE_AGE != $_POST["v_MAX_ALIVE_AGE"]) {
     reset_isdead(get_id_from_gedcom($ged));
 }
 if (file_exists(PGV_ROOT . 'modules/research_assistant.php')) {
     $configtext = preg_replace('/\\$SHOW_RESEARCH_ASSISTANT\\s*=\\s*.*;/', "\$SHOW_RESEARCH_ASSISTANT = " . $_POST["v_SHOW_RESEARCH_ASSISTANT"] . ";", $configtext);
 }
 $configtext = preg_replace('/\\$SHOW_MULTISITE_SEARCH\\s*=\\s*.*;/', "\$SHOW_MULTISITE_SEARCH = " . $_POST["v_SHOW_MULTISITE_SEARCH"] . ";", $configtext);
 $configtext = preg_replace('/\\$ENABLE_CLIPPINGS_CART\\s*=\\s*.*;/', "\$ENABLE_CLIPPINGS_CART = " . $_POST["v_ENABLE_CLIPPINGS_CART"] . ";", $configtext);
 $configtext = preg_replace('/\\$PRIVACY_BY_YEAR\\s*=\\s*.*;/', "\$PRIVACY_BY_YEAR = " . $boolarray[$_POST["v_PRIVACY_BY_YEAR"]] . ";", $configtext);
 $configtext = preg_replace('/\\$PRIVACY_BY_RESN\\s*=\\s*.*;/', "\$PRIVACY_BY_RESN = " . $boolarray[$_POST["v_PRIVACY_BY_RESN"]] . ";", $configtext);
 $configtext = preg_replace('/\\$SHOW_DEAD_PEOPLE\\s*=\\s*.*;/', "\$SHOW_DEAD_PEOPLE = " . $_POST["v_SHOW_DEAD_PEOPLE"] . ";", $configtext);
 $configtext = preg_replace('/\\$USE_RELATIONSHIP_PRIVACY\\s*=\\s*.*;/', "\$USE_RELATIONSHIP_PRIVACY = " . $boolarray[$_POST["v_USE_RELATIONSHIP_PRIVACY"]] . ";", $configtext);
 $configtext = preg_replace('/\\$MAX_RELATION_PATH_LENGTH\\s*=\\s*.*;/', "\$MAX_RELATION_PATH_LENGTH = \"" . $_POST["v_MAX_RELATION_PATH_LENGTH"] . "\";", $configtext);
 $configtext = preg_replace('/\\$CHECK_MARRIAGE_RELATIONS\\s*=\\s*.*;/', "\$CHECK_MARRIAGE_RELATIONS = " . $boolarray[$_POST["v_CHECK_MARRIAGE_RELATIONS"]] . ";", $configtext);
 $configtext = preg_replace('/\\$SHOW_PRIVATE_RELATIONSHIPS\\s*=\\s*.*;/', "\$SHOW_PRIVATE_RELATIONSHIPS = " . $boolarray[$_POST["v_SHOW_PRIVATE_RELATIONSHIPS"]] . ";", $configtext);
 //-- Update the "Person Privacy" section
 $configtext_beg = substr($configtext, 0, strpos($configtext, "//-- start person privacy --//"));
Example #12
0
/**
* update a record in the database
* @param string $gedrec
*/
function update_record($gedrec, $delete = false)
{
    global $TBLPREFIX, $GEDCOM, $FILE, $gBitDb;
    if (empty($FILE)) {
        $FILE = $GEDCOM;
    }
    if (preg_match('/^0 @(' . PGV_REGEX_XREF . ')@ (' . PGV_REGEX_TAG . ')/', $gedrec, $match)) {
        list(, $gid, $type) = $match;
    } else {
        print "ERROR: Invalid gedcom record.";
        return false;
    }
    $ged_id = get_id_from_gedcom($FILE);
    // TODO deleting unlinked places can be done more efficiently in a single query
    $placeids = $gBitDb->getOne("SELECT pl_p_id FROM {$TBLPREFIX}placelinks WHERE pl_gid=? AND pl_file=?", array($gid, $ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}placelinks WHERE pl_gid=? AND pl_file=?", array($gid, $ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}dates      WHERE d_gid =? AND d_file =?", array($gid, $ged_id));
    //-- delete any unlinked places
    foreach ($placeids as $p_id) {
        $num = $gBitDb->getOne("SELECT count(pl_p_id) FROM {$TBLPREFIX}placelinks WHERE pl_p_id=? AND pl_file=?", array($p_id, $ged_id));
        if ($num == 0) {
            $gBitDb->query("DELETE FROM {$TBLPREFIX}places WHERE p_id=? AND p_file=?", array($p_id, $ged_id));
        }
    }
    $gBitDb->query("DELETE FROM {$TBLPREFIX}media_mapping WHERE mm_gid=? AND mm_gedfile=?", array($gid, $ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}remotelinks WHERE r_gid=? AND r_file=?", array($gid, $ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}name WHERE n_id=? AND n_file=?", array($gid, $ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}link WHERE l_from=? AND l_file=?", array($gid, $ged_id));
    switch ($type) {
        case 'INDI':
            $gBitDb->query("DELETE FROM {$TBLPREFIX}individuals WHERE i_id=? AND i_file=?", array($gid, $ged_id));
            break;
        case 'FAM':
            $gBitDb->query("DELETE FROM {$TBLPREFIX}families WHERE f_id=? AND f_file=?", array($gid, $ged_id));
            break;
        case 'SOUR':
            $gBitDb->query("DELETE FROM {$TBLPREFIX}sources WHERE s_id=? AND s_file=?", array($gid, $ged_id));
            break;
        case 'OBJE':
            $gBitDb->query("DELETE FROM {$TBLPREFIX}media WHERE m_media=? AND m_gedfile=?", array($gid, $ged_id));
            break;
        default:
            $gBitDb->query("DELETE FROM {$TBLPREFIX}other WHERE o_id=? AND o_file=?", array($gid, $ged_id));
            break;
    }
    if (!$delete) {
        import_record($gedrec, true);
    }
}
Example #13
0
/**
* Delete a gedcom from the database and the system
* Does not delete the file from the file system
* @param string $ged  the filename of the gedcom to delete
*/
function delete_gedcom($ged)
{
    global $TBLPREFIX, $pgv_changes, $GEDCOMS, $gBitDb;
    if (!isset($GEDCOMS[$ged])) {
        return;
    }
    $ged_id = get_id_from_gedcom($ged);
    $gBitDb->query("DELETE FROM {$TBLPREFIX}blocks        WHERE b_username=?", array($ged));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}dates         WHERE d_file    =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}families      WHERE f_file    =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}favorites     WHERE fv_file   =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}individuals   WHERE i_file    =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}link          WHERE l_file    =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}media         WHERE m_gedfile =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}media_mapping WHERE mm_gedfile=?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}name          WHERE n_file    =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}news          WHERE n_username=?", array($ged));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}nextid        WHERE ni_gedfile=?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}other         WHERE o_file    =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}placelinks    WHERE pl_file   =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}places        WHERE p_file    =?", array($ged_id));
    $gBitDb->query("DELETE FROM {$TBLPREFIX}sources       WHERE s_file    =?", array($ged_id));
    if (isset($pgv_changes)) {
        //-- erase any of the changes
        foreach ($pgv_changes as $cid => $changes) {
            if ($changes[0]["gedcom"] == $ged) {
                unset($pgv_changes[$cid]);
            }
        }
        write_changes();
    }
    unset($GEDCOMS[$ged]);
    store_gedcoms();
    if (get_site_setting('DEFAULT_GEDCOM') == $ged) {
        set_site_setting('DEFAULT_GEDCOM', '');
    }
}
Example #14
0
// Make sure there is at least one gedcom.
if (count(get_all_gedcoms()) == 0) {
    addDebugLog($action . " ERROR 21: No Gedcoms available on this site.");
    print "ERROR 21: No Gedcoms available on this site.\n";
    exit;
}
$gedcom = safe_REQUEST($_REQUEST, 'GEDCOM');
if ($gedcom) {
    if (!in_array($gedcom, get_all_gedcoms())) {
        addDebugLog("ERROR 21: Invalid GEDCOM specified.  Remember that the GEDCOM is case sensitive.");
        print "ERROR 21: Invalid GEDCOM specified.  Remember that the GEDCOM is case sensitive.\n";
        exit;
    }
    $GEDCOM = $gedcom;
}
$GED_ID = get_id_from_gedcom($GEDCOM);
if (!check_for_import($GEDCOM)) {
    addDebugLog($action . " ERROR 22: Gedcom [{$GEDCOM}] needs to be imported.");
    print "ERROR 22: Gedcom [{$GEDCOM}] needs to be imported.\n";
    exit;
}
$action = safe_REQUEST($_REQUEST, 'action');
// The following actions can be performed without being connected.
switch ($action) {
    case '':
        addDebugLog("ERROR 1: No action specified.");
        print "ERROR 1: No action specified.\n";
        exit;
    case 'version':
        addDebugLog($action . " SUCCESS\n" . PGV_VERSION_TEXT . "\n");
        print "SUCCESS\n" . PGV_VERSION_TEXT . "\n";
Example #15
0
    // open successfull : now make sure this is a GEDCOM file
    $txt = fread($handle, 80);
    fclose($handle);
    if (strpos($txt, " HEAD") == false) {
        return false;
    }
    return $url;
}
//-- make sure that they have admin status before they can use this page
//-- otherwise have them login again
if (!PGV_USER_GEDCOM_ADMIN) {
    header("Location: login.php?url=editgedcoms.php");
    exit;
}
if ($action == "delete") {
    delete_gedcom(get_id_from_gedcom($ged));
    // Reload this page, otherwise the page header will still reference the now-deleted gedcom
    header("Location: editgedcoms.php");
}
print_header($pgv_lang["gedcom_adm_head"]);
print "<center>\n";
if ($action == "setdefault" && in_array($default_ged, $all_gedcoms)) {
    set_site_setting('DEFAULT_GEDCOM', $default_ged);
    $DEFAULT_GEDCOM = $default_ged;
} else {
    $DEFAULT_GEDCOM = get_site_setting('DEFAULT_GEDCOM');
}
print "<br /><br />";
?>
<span class="subheaders"><?php 
print_text("current_gedcoms");
Example #16
0
$gedcoms = array();
foreach (get_all_gedcoms() as $ged_id => $gedcom) {
    if (userGedcomAdmin(PGV_USER_ID, $ged_id)) {
        $gedcoms[$ged_id] = $gedcom;
    }
}
// If we don't have permission to administer any gedcoms, redirect to
// this page, which will force a login and provide a list.
if (empty($gedcoms)) {
    header('Location: editgedcoms.php');
}
// Which gedcom have we requested to export
$export = safe_GET('export', $gedcoms);
print_simple_header($pgv_lang['ged_export']);
if ($export) {
    $ged_id = get_id_from_gedcom($export);
    $filename = get_gedcom_setting($ged_id, 'path');
    echo '<h1>', $pgv_lang['ged_export'], '</h1>';
    echo '<p>', htmlspecialchars(filename_decode($export)), ' => ', $filename, '</p>';
    flush();
    $gedout = fopen($filename . '.tmp', 'w');
    if ($gedout) {
        $start = microtime(true);
        $exportOptions = array();
        $exportOptions['privatize'] = 'none';
        $exportOptions['toANSI'] = 'no';
        $exportOptions['noCustomTags'] = 'no';
        $exportOptions['path'] = $MEDIA_DIRECTORY;
        $exportOptions['slashes'] = 'forward';
        export_gedcom($export, $gedout, $exportOptions);
        $end = microtime(true);
Example #17
0
 function addLocalServer($title, $gedcom_id)
 {
     global $SERVER_URL;
     $serverID = $this->checkExistingServer($SERVER_URL, $gedcom_id);
     if ($serverID === false) {
         $gedcom_string = "0 @new@ SOUR\n";
         if (empty($title)) {
             $title = get_gedcom_setting(get_id_from_gedcom($gedcom_id), 'title');
         }
         $gedcom_string .= "1 TITL " . $title . "\n";
         $gedcom_string .= "1 URL " . $SERVER_URL . "\n";
         $gedcom_string .= "1 _DBID " . $gedcom_id . "\n";
         $gedcom_string .= "2 _BLOCK false\n";
         $serverID = append_gedrec($gedcom_string);
     }
     return $serverID;
 }
 if (!file_exists($INDEX_DIRECTORY . $FILE . "_priv.php")) {
     if (copy($gedcom_privacy, $INDEX_DIRECTORY . $FILE . "_priv.php")) {
         $gedcom_privacy = "\${INDEX_DIRECTORY}" . $FILE . "_priv.php";
     }
 } else {
     $gedcom_privacy = "\${INDEX_DIRECTORY}" . $FILE . "_priv.php";
 }
 if (empty($gedcom_title)) {
     if (!empty($_POST["gedcom_title"])) {
         $gedcom_title = $_POST["gedcom_title"];
     } else {
         $gedcom_title = str_replace("#GEDCOMFILE#", $FILE, $pgv_lang["new_gedcom_title"]);
     }
 }
 // Create the gedcom if it doesn't already exist
 $ged_id = get_id_from_gedcom($FILE, true);
 set_gedcom_setting($ged_id, 'config', $gedcom_config);
 set_gedcom_setting($ged_id, 'privacy', $gedcom_privacy);
 set_gedcom_setting($ged_id, 'title', $gedcom_title);
 set_gedcom_setting($ged_id, 'path', $path . $GEDFILENAME);
 set_gedcom_setting($ged_id, 'pgv_ver', PGV_VERSION);
 // Check that add/remove common surnames are separated by [,;] blank
 $_POST["NEW_COMMON_NAMES_REMOVE"] = preg_replace("/[,;]\\b/", ", ", $_POST["NEW_COMMON_NAMES_REMOVE"]);
 $_POST["NEW_COMMON_NAMES_ADD"] = preg_replace("/[,;]\\b/", ", ", $_POST["NEW_COMMON_NAMES_ADD"]);
 $COMMON_NAMES_THRESHOLD = $_POST["NEW_COMMON_NAMES_THRESHOLD"];
 $COMMON_NAMES_ADD = $_POST["NEW_COMMON_NAMES_ADD"];
 $COMMON_NAMES_REMOVE = $_POST["NEW_COMMON_NAMES_REMOVE"];
 $boolarray = array();
 $boolarray["yes"] = "true";
 $boolarray["no"] = "false";
 $boolarray[false] = "false";
Example #19
0
function export_gedcom($gedcom, $gedout, $exportOptions)
{
    global $GEDCOM;
    // Temporarily switch to the specified GEDCOM
    $oldGEDCOM = $GEDCOM;
    $GEDCOM = $gedcom;
    $ged_id = get_id_from_gedcom($gedcom);
    switch ($exportOptions['privatize']) {
        case 'gedadmin':
            $access_level = WT_PRIV_NONE;
            break;
        case 'user':
            $access_level = WT_PRIV_USER;
            break;
        case 'visitor':
            $access_level = WT_PRIV_PUBLIC;
            break;
        case 'none':
            $access_level = WT_PRIV_HIDE;
            break;
    }
    $head = gedcom_header($gedcom);
    if ($exportOptions['toANSI'] == 'yes') {
        $head = str_replace('UTF-8', 'ANSI', $head);
        $head = utf8_decode($head);
    }
    $head = reformat_record_export($head);
    fwrite($gedout, $head);
    // Buffer the output.  Lots of small fwrite() calls can be very slow when writing large gedcoms.
    $buffer = '';
    // Generate the OBJE/SOUR/REPO/NOTE records first, as their privacy calcualations involve
    // database queries, and we wish to avoid large gaps between queries due to MySQL connection timeouts.
    $tmp_gedcom = '';
    $rows = WT_DB::prepare("SELECT 'OBJE' AS type, m_id AS xref, m_file AS gedcom_id, m_gedcom AS gedcom" . " FROM `##media` WHERE m_file=? ORDER BY m_id")->execute(array($ged_id))->fetchAll();
    foreach ($rows as $row) {
        $rec = WT_Media::getInstance($row->xref, $row->gedcom_id, $row->gedcom)->privatizeGedcom($access_level);
        $rec = convert_media_path($rec, $exportOptions['path']);
        if ($exportOptions['toANSI'] == 'yes') {
            $rec = utf8_decode($rec);
        }
        $tmp_gedcom .= reformat_record_export($rec);
    }
    $rows = WT_DB::prepare("SELECT s_id AS xref, s_file AS gedcom_id, s_gedcom AS gedcom" . " FROM `##sources` WHERE s_file=? ORDER BY s_id")->execute(array($ged_id))->fetchAll();
    foreach ($rows as $row) {
        $rec = WT_Source::getInstance($row->xref, $row->gedcom_id, $row->gedcom)->privatizeGedcom($access_level);
        if ($exportOptions['toANSI'] == 'yes') {
            $rec = utf8_decode($rec);
        }
        $tmp_gedcom .= reformat_record_export($rec);
    }
    $rows = WT_DB::prepare("SELECT o_type AS type, o_id AS xref, o_file AS gedcom_id, o_gedcom AS gedcom" . " FROM `##other` WHERE o_file=? AND o_type!='HEAD' AND o_type!='TRLR' ORDER BY o_id")->execute(array($ged_id))->fetchAll();
    foreach ($rows as $row) {
        switch ($row->type) {
            case 'NOTE':
                $record = WT_Note::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
                break;
            case 'REPO':
                $record = WT_Repository::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
                break;
            default:
                $record = WT_GedcomRecord::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
                break;
        }
        $rec = $record->privatizeGedcom($access_level);
        if ($exportOptions['toANSI'] == 'yes') {
            $rec = utf8_decode($rec);
        }
        $tmp_gedcom .= reformat_record_export($rec);
    }
    $rows = WT_DB::prepare("SELECT i_id AS xref, i_file AS gedcom_id, i_gedcom AS gedcom" . " FROM `##individuals` WHERE i_file=? ORDER BY i_id")->execute(array($ged_id))->fetchAll();
    foreach ($rows as $row) {
        $rec = WT_Individual::getInstance($row->xref, $row->gedcom_id, $row->gedcom)->privatizeGedcom($access_level);
        if ($exportOptions['toANSI'] == 'yes') {
            $rec = utf8_decode($rec);
        }
        $buffer .= reformat_record_export($rec);
        if (strlen($buffer) > 65536) {
            fwrite($gedout, $buffer);
            $buffer = '';
        }
    }
    $rows = WT_DB::prepare("SELECT f_id AS xref, f_file AS gedcom_id, f_gedcom AS gedcom" . " FROM `##families` WHERE f_file=? ORDER BY f_id")->execute(array($ged_id))->fetchAll();
    foreach ($rows as $row) {
        $rec = WT_Family::getInstance($row->xref, $row->gedcom_id, $row->gedcom)->privatizeGedcom($access_level);
        if ($exportOptions['toANSI'] == 'yes') {
            $rec = utf8_decode($rec);
        }
        $buffer .= reformat_record_export($rec);
        if (strlen($buffer) > 65536) {
            fwrite($gedout, $buffer);
            $buffer = '';
        }
    }
    fwrite($gedout, $buffer);
    fwrite($gedout, $tmp_gedcom);
    fwrite($gedout, '0 TRLR' . WT_EOL);
    $GEDCOM = $oldGEDCOM;
}