foreach ($_POST as $key => $value) { if ($key != "path") { $key = str_replace("NEW_", "", $key); if ($value == 'yes') { ${$key} = true; } elseif ($value == 'no') { ${$key} = false; } else { ${$key} = $value; } } } //-- delete the cache files for the welcome page blocks require_once PGV_ROOT . 'includes/index_cache.php'; clearCache(); $logline = AddToLog("Gedcom configuration " . $INDEX_DIRECTORY . $FILE . "_conf.php" . " updated"); $gedcomconfname = $FILE . "_conf.php"; check_in($logline, $gedcomconfname, $INDEX_DIRECTORY); if (!$errors) { $gednews = getUserNews($FILE); if (count($gednews) == 0) { $news = array(); $news["title"] = "#default_news_title#"; $news["username"] = $FILE; $news["text"] = "#default_news_text#"; $news["date"] = client_time(); addNews($news); } if ($source == "upload_form") { $check = "upload"; } elseif ($source == "add_form") {
} if ($error == "" && !empty($_FILES["mediafile"]["name"]) && empty($_FILES["thumbnail"]["name"])) { if (safe_POST('genthumb', 'yes', 'no') == 'yes') { // Generate thumbnail from main image $parts = pathinfo_utf($mediaFile); if (!empty($parts["extension"])) { $ext = strtolower($parts["extension"]); if (isImageTypeSupported($ext)) { $thumbnail = $thumbFolderName . $mediaFile; $okThumb = generate_thumbnail($folderName . $mediaFile, $thumbnail, "OVERWRITE"); if (!$okThumb) { $error .= print_text("thumbgen_error", 0, 1); } else { print_text("thumb_genned"); print "<br />"; AddToLog("Media thumbnail {$thumbnail} generated"); } } } } } // Let's see if there are any errors generated and print it if (!empty($error)) { echo '<span class="error">', $error, "</span><br />\n"; $mediaFile = ""; $finalResult = false; } else { $finalResult = true; } } if ($mediaFile == "") {
if ($stat !== false) { addDebugLog($action . " username={$username} SUCCESS\n" . $stat); print "SUCCESS\n" . $stat; } $_SESSION['connected'] = $user_id; } else { addDebugLog($action . " username={$username} ERROR 10: Username and password key failed to authenticate."); print "ERROR 10: Username and password key failed to authenticate.\n"; } } else { $stat = newConnection(); if ($stat !== false) { addDebugLog($action . " SUCCESS\n" . $stat); print "SUCCESS\n" . $stat; } AddToLog('Read-Only Anonymous Client connection.'); $_SESSION['connected'] = 'Anonymous'; $_SESSION['readonly'] = 1; } exit; case 'listgedcoms': $out_msg = "SUCCESS\n"; foreach (get_all_gedcoms() as $ged_id => $gedcom) { $out_msg .= "{$gedcom}\t" . get_gedcom_setting($ged_id, 'title') . "\n"; } addDebugLog($action . " " . $out_msg); print $out_msg; exit; default: // All other actions require an authenticated connection if (empty($_SESSION['connected'])) {
function init() { global $PRIV_HIDE, $PRIV_PUBLIC, $ENABLE_CLIPPINGS_CART, $SCRIPT_NAME, $pgv_lang, $SERVER_URL, $CONTACT_EMAIL, $HOME_SITE_TEXT, $HOME_SITE_URL, $MEDIA_DIRECTORY; global $GEDCOM, $CHARACTER_SET, $cart; if (!isset($ENABLE_CLIPPINGS_CART)) { $ENABLE_CLIPPINGS_CART = $PRIV_HIDE; } if ($ENABLE_CLIPPINGS_CART === true) { $ENABLE_CLIPPING_CART = $PRIV_PUBLIC; } if ($ENABLE_CLIPPINGS_CART < PGV_USER_ACCESS_LEVEL) { header("Location: index.php"); exit; } if (!isset($_SESSION['exportConvPath'])) { $_SESSION['exportConvPath'] = $MEDIA_DIRECTORY; } if (!isset($_SESSION['exportConvSlashes'])) { $_SESSION['exportConvSlashes'] = 'forward'; } $this->action = safe_GET("action"); $this->id = safe_GET('id'); $remove = safe_GET('remove', "", "no"); $convert = safe_GET('convert', "", "no"); $this->Zip = safe_GET('Zip'); $this->IncludeMedia = safe_GET('IncludeMedia'); $this->conv_path = safe_GET('conv_path', PGV_REGEX_NOSCRIPT, $_SESSION['exportConvPath']); $this->conv_slashes = safe_GET('conv_slashes', array('forward', 'backward'), $_SESSION['exportConvSlashes']); $this->privatize_export = safe_GET('privatize_export', array('none', 'visitor', 'user', 'gedadmin', 'admin')); $this->filetype = safe_GET('filetype'); $this->level1 = safe_GET('level1'); $this->level2 = safe_GET('level2'); $this->level3 = safe_GET('level3'); if (empty($this->filetype)) { $this->filetype = "gedcom"; } $others = safe_GET('others'); $item = safe_GET('item'); if (!isset($cart)) { $cart = $_SESSION['cart']; } $this->type = safe_GET('type'); $this->conv_path = stripLRMRLM($this->conv_path); $_SESSION['exportConvPath'] = $this->conv_path; // remember this for the next Download $_SESSION['exportConvSlashes'] = $this->conv_slashes; if ($this->action == 'add') { if (empty($this->type) && !empty($this->id)) { $this->type = ""; $obj = GedcomRecord::getInstance($this->id); if (is_null($obj)) { $this->id = ""; $this->action = ""; } else { $this->type = strtolower($obj->getType()); } } else { if (empty($this->id)) { $this->action = ""; } } if (!empty($this->id) && $this->type != 'fam' && $this->type != 'indi' && $this->type != 'sour') { $this->action = 'add1'; } } if ($this->action == 'add1') { $clipping = array(); $clipping['type'] = $this->type; $clipping['id'] = $this->id; $clipping['gedcom'] = $GEDCOM; $ret = $this->add_clipping($clipping); if ($ret) { if ($this->type == 'sour') { if ($others == 'linked') { foreach (fetch_linked_indi($this->id, 'SOUR', PGV_GED_ID) as $indi) { if ($indi->canDisplayName()) { $this->add_clipping(array('type' => 'indi', 'id' => $indi->getXref())); } } foreach (fetch_linked_fam($this->id, 'SOUR', PGV_GED_ID) as $fam) { if ($fam->canDisplayName()) { $this->add_clipping(array('type' => 'fam', 'id' => $fam->getXref())); } } } } if ($this->type == 'fam') { if ($others == 'parents') { $parents = find_parents($this->id); if (!empty($parents["HUSB"])) { $clipping = array(); $clipping['type'] = "indi"; $clipping['id'] = $parents["HUSB"]; $ret = $this->add_clipping($clipping); } if (!empty($parents["WIFE"])) { $clipping = array(); $clipping['type'] = "indi"; $clipping['id'] = $parents["WIFE"]; $ret = $this->add_clipping($clipping); } } else { if ($others == "members") { $this->add_family_members($this->id); } else { if ($others == "descendants") { $this->add_family_descendancy($this->id); } } } } else { if ($this->type == 'indi') { if ($others == 'parents') { $famids = find_family_ids($this->id); foreach ($famids as $indexval => $famid) { $clipping = array(); $clipping['type'] = "fam"; $clipping['id'] = $famid; $ret = $this->add_clipping($clipping); if ($ret) { $this->add_family_members($famid); } } } else { if ($others == 'ancestors') { $this->add_ancestors_to_cart($this->id, $this->level1); } else { if ($others == 'ancestorsfamilies') { $this->add_ancestors_to_cart_families($this->id, $this->level2); } else { if ($others == 'members') { $famids = find_sfamily_ids($this->id); foreach ($famids as $indexval => $famid) { $clipping = array(); $clipping['type'] = "fam"; $clipping['id'] = $famid; $ret = $this->add_clipping($clipping); if ($ret) { $this->add_family_members($famid); } } } else { if ($others == 'descendants') { $famids = find_sfamily_ids($this->id); foreach ($famids as $indexval => $famid) { $clipping = array(); $clipping['type'] = "fam"; $clipping['id'] = $famid; $ret = $this->add_clipping($clipping); if ($ret) { $this->add_family_descendancy($famid, $this->level3); } } } } } } } } } } } else { if ($this->action == 'remove') { $ct = count($cart); for ($i = $item + 1; $i < $ct; $i++) { $cart[$i - 1] = $cart[$i]; } unset($cart[$ct - 1]); } else { if ($this->action == 'empty') { $cart = array(); $_SESSION["cart"] = $cart; } else { if ($this->action == 'download') { usort($cart, "same_group"); if ($this->filetype == "gedcom") { $path = substr($SCRIPT_NAME, 0, strrpos($SCRIPT_NAME, "/")); if (empty($path)) { $path = "/"; } if ($path[strlen($path) - 1] != "/") { $path .= "/"; } if ($SERVER_URL[strlen($SERVER_URL) - 1] == "/") { $dSERVER_URL = substr($SERVER_URL, 0, strlen($SERVER_URL) - 1); } else { $dSERVER_URL = $SERVER_URL; } $media = array(); $mediacount = 0; $ct = count($cart); $filetext = "0 HEAD\n1 SOUR " . PGV_PHPGEDVIEW . "\n2 NAME " . PGV_PHPGEDVIEW . "\n2 VERS " . PGV_VERSION_TEXT . "\n1 DEST DISKETTE\n1 DATE " . date("j M Y") . "\n2 TIME " . date("H:i:s") . "\n"; $filetext .= "1 GEDC\n2 VERS 5.5\n2 FORM LINEAGE-LINKED\n1 CHAR {$CHARACTER_SET}\n"; $head = find_gedcom_record("HEAD"); $placeform = trim(get_sub_record(1, "1 PLAC", $head)); if (!empty($placeform)) { $filetext .= $placeform . "\n"; } else { $filetext .= "1 PLAC\n2 FORM " . "City, County, State/Province, Country" . "\n"; } if ($convert == "yes") { $filetext = preg_replace("/UTF-8/", "ANSI", $filetext); $filetext = utf8_decode($filetext); } $tempUserID = '#ExPoRt#'; if ($this->privatize_export != 'none') { // Create a temporary userid $export_user_id = createTempUser($tempUserID, $this->privatize_export, $GEDCOM); // Create a temporary userid // Temporarily become this user $_SESSION["org_user"] = $_SESSION["pgv_user"]; $_SESSION["pgv_user"] = $tempUserID; } for ($i = 0; $i < $ct; $i++) { $clipping = $cart[$i]; if ($clipping['gedcom'] == $GEDCOM) { $record = find_gedcom_record($clipping['id']); $savedRecord = $record; // Save this for the "does this file exist" check if ($clipping['type'] == 'obje') { $record = convert_media_path($record, $this->conv_path, $this->conv_slashes); } $record = privatize_gedcom($record); $record = remove_custom_tags($record, $remove); if ($convert == "yes") { $record = utf8_decode($record); } switch ($clipping['type']) { case 'indi': $ft = preg_match_all("/1 FAMC @(.*)@/", $record, $match, PREG_SET_ORDER); for ($k = 0; $k < $ft; $k++) { if (!id_in_cart($match[$k][1])) { $record = preg_replace("/1 FAMC @" . $match[$k][1] . "@.*/", "", $record); } } $ft = preg_match_all("/1 FAMS @(.*)@/", $record, $match, PREG_SET_ORDER); for ($k = 0; $k < $ft; $k++) { if (!id_in_cart($match[$k][1])) { $record = preg_replace("/1 FAMS @" . $match[$k][1] . "@.*/", "", $record); } } $ft = preg_match_all("/\\d FILE (.*)/", $savedRecord, $match, PREG_SET_ORDER); for ($k = 0; $k < $ft; $k++) { $filename = $MEDIA_DIRECTORY . extract_filename(trim($match[$k][1])); if (file_exists($filename)) { $media[$mediacount] = array(PCLZIP_ATT_FILE_NAME => $filename); $mediacount++; } // $record = preg_replace("|(\d FILE )" . addslashes($match[$k][1]) . "|", "$1" . $filename, $record); } $filetext .= trim($record) . "\n"; $filetext .= "1 SOUR @SPGV1@\n"; $filetext .= "2 PAGE " . $dSERVER_URL . "/individual.php?pid=" . $clipping['id'] . "\n"; $filetext .= "2 DATA\n"; $filetext .= "3 TEXT " . $pgv_lang["indi_downloaded_from"] . "\n"; $filetext .= "4 CONT " . $dSERVER_URL . "/individual.php?pid=" . $clipping['id'] . "\n"; break; case 'fam': $ft = preg_match_all("/1 CHIL @(.*)@/", $record, $match, PREG_SET_ORDER); for ($k = 0; $k < $ft; $k++) { if (!id_in_cart($match[$k][1])) { /* if the child is not in the list delete the record of it */ $record = preg_replace("/1 CHIL @" . $match[$k][1] . "@.*/", "", $record); } } $ft = preg_match_all("/1 HUSB @(.*)@/", $record, $match, PREG_SET_ORDER); for ($k = 0; $k < $ft; $k++) { if (!id_in_cart($match[$k][1])) { /* if the husband is not in the list delete the record of him */ $record = preg_replace("/1 HUSB @" . $match[$k][1] . "@.*/", "", $record); } } $ft = preg_match_all("/1 WIFE @(.*)@/", $record, $match, PREG_SET_ORDER); for ($k = 0; $k < $ft; $k++) { if (!id_in_cart($match[$k][1])) { /* if the wife is not in the list delete the record of her */ $record = preg_replace("/1 WIFE @" . $match[$k][1] . "@.*/", "", $record); } } $ft = preg_match_all("/\\d FILE (.*)/", $savedRecord, $match, PREG_SET_ORDER); for ($k = 0; $k < $ft; $k++) { $filename = $MEDIA_DIRECTORY . extract_filename(trim($match[$k][1])); if (file_exists($filename)) { $media[$mediacount] = array(PCLZIP_ATT_FILE_NAME => $filename); $mediacount++; } // $record = preg_replace("|(\d FILE )" . addslashes($match[$k][1]) . "|", "$1" . $filename, $record); } $filetext .= trim($record) . "\n"; $filetext .= "1 SOUR @SPGV1@\n"; $filetext .= "2 PAGE " . $dSERVER_URL . $path . "family.php?famid=" . $clipping['id'] . "\n"; $filetext .= "2 DATA\n"; $filetext .= "3 TEXT " . $pgv_lang["family_downloaded_from"] . "\n"; $filetext .= "4 CONT " . $dSERVER_URL . "/family.php?famid=" . $clipping['id'] . "\n"; break; case 'source': $ft = preg_match_all("/\\d FILE (.*)/", $savedRecord, $match, PREG_SET_ORDER); for ($k = 0; $k < $ft; $k++) { $filename = $MEDIA_DIRECTORY . extract_filename(trim($match[$k][1])); if (file_exists($filename)) { $media[$mediacount] = array(PCLZIP_ATT_FILE_NAME => $filename); $mediacount++; } // $record = preg_replace("|(\d FILE )" . addslashes($match[$k][1]) . "|", "$1" . $filename, $record); } $filetext .= trim($record) . "\n"; $filetext .= "1 NOTE " . $pgv_lang["source_downloaded_from"] . "\n"; $filetext .= "2 CONT " . $dSERVER_URL . "/source.php?sid=" . $clipping['id'] . "\n"; break; default: $ft = preg_match_all("/\\d FILE (.*)/", $savedRecord, $match, PREG_SET_ORDER); for ($k = 0; $k < $ft; $k++) { $filename = $MEDIA_DIRECTORY . extract_filename(trim($match[$k][1])); if (file_exists($filename)) { $media[$mediacount] = array(PCLZIP_ATT_FILE_NAME => $filename); $mediacount++; } // $record = preg_replace("|(\d FILE )" . addslashes($match[$k][1]) . "|", "$1" . $filename, $record); } $filetext .= trim($record) . "\n"; break; } } } if ($this->privatize_export != 'none') { $_SESSION["pgv_user"] = $_SESSION["org_user"]; delete_user($export_user_id); AddToLog("deleted dummy user -> {$tempUserID} <-"); } if ($this->IncludeMedia == "yes") { $this->media_list = $media; } $filetext .= "0 @SPGV1@ SOUR\n"; if ($user_id = get_user_id($CONTACT_EMAIL)) { $filetext .= "1 AUTH " . getUserFullName($user_id) . "\n"; } $filetext .= "1 TITL " . $HOME_SITE_TEXT . "\n"; $filetext .= "1 ABBR " . $HOME_SITE_TEXT . "\n"; $filetext .= "1 PUBL " . $HOME_SITE_URL . "\n"; $filetext .= "0 TRLR\n"; //-- make sure the preferred line endings are used $filetext = preg_replace("/[\r\n]+/", PGV_EOL, $filetext); $this->download_data = $filetext; $this->download_clipping(); } else { if ($this->filetype == "gramps") { // Sort the clippings cart because the export works better when the cart is sorted usort($cart, "same_group"); require_once "includes/classes/class_geclippings.php"; $gramps_Exp = new GEClippings(); $gramps_Exp->begin_xml(); $ct = count($cart); usort($cart, "same_group"); for ($i = 0; $i < $ct; $i++) { $clipping = $cart[$i]; switch ($clipping['type']) { case 'indi': $rec = find_person_record($clipping['id']); $rec = remove_custom_tags($rec, $remove); if ($this->privatize_export != 'none') { $rec = privatize_gedcom($rec); } $gramps_Exp->create_person($rec, $clipping['id']); break; case 'fam': $rec = find_family_record($clipping['id']); $rec = remove_custom_tags($rec, $remove); if ($this->privatize_export != 'none') { $rec = privatize_gedcom($rec); } $gramps_Exp->create_family($rec, $clipping['id']); break; case 'source': $rec = find_source_record($clipping['id']); $rec = remove_custom_tags($rec, $remove); if ($this->privatize_export != 'none') { $rec = privatize_gedcom($rec); } $gramps_Exp->create_source($rec, $clipping['id']); break; } } $this->download_data = $gramps_Exp->dom->saveXML(); if ($convert) { $this->download_data = utf8_decode($this->download_data); } $this->media_list = $gramps_Exp->get_all_media(); $this->download_clipping(); } } } } } } }
/** * This function will replace a gedcom record with * the id $gid with the $gedrec * @param string $gid The XREF id of the record to replace * @param string $gedrec The new gedcom record to replace with * @param boolean $chan Whether or not to update/add the CHAN record * @param string $linkpid Tells whether or not this record change is linked with the record change of another record identified by $linkpid */ function replace_gedrec($gid, $gedrec, $chan = true, $linkpid = '') { global $fcontents, $GEDCOM, $pgv_changes, $manual_save, $pgv_private_records; $gid = strtoupper($gid); //-- restore any data that was hidden during privatizing if (isset($pgv_private_records[$gid])) { $privatedata = trim(get_last_private_data($gid)); $subs = get_all_subrecords("\n" . $privatedata, '', false, false); foreach ($subs as $s => $sub) { if (strstr($gedrec, $sub) === false) { $gedrec = trim($gedrec) . "\n" . $sub; } } unset($pgv_private_records[$gid]); } if (($gedrec = check_gedcom($gedrec, $chan)) !== false) { //-- the following block of code checks if the XREF was changed in this record. //-- if it was changed we add a warning to the change log $ct = preg_match("/0 @(.*)@/", $gedrec, $match); if ($ct > 0) { $oldgid = $gid; $gid = trim($match[1]); if ($oldgid != $gid) { if ($gid == "REF" || $gid == "new" || $gid == "NEW") { $gedrec = preg_replace("/0 @(.*)@/", "0 @" . $oldgid . "@", $gedrec); $gid = $oldgid; } else { AddToChangeLog("Warning: {$oldgid} was changed to {$gid}"); if (isset($pgv_changes[$oldgid . "_" . $GEDCOM])) { unset($pgv_changes[$oldgid . "_" . $GEDCOM]); } } } } $change = array(); $change["gid"] = $gid; $change["gedcom"] = $GEDCOM; $change["type"] = "replace"; $change["status"] = "submitted"; $change["user"] = PGV_USER_NAME; $change["time"] = time(); if (!empty($linkpid)) { $change["linkpid"] = $linkpid; } $change["undo"] = reformat_record_import($gedrec); if (!isset($pgv_changes[$gid . "_" . $GEDCOM])) { $pgv_changes[$gid . "_" . $GEDCOM] = array(); } else { $lastchange = end($pgv_changes[$gid . "_" . $GEDCOM]); if (!empty($lastchange)) { //-- append recods should continue to be marked as append if ($lastchange["type"] == "append") { $change["type"] = "append"; } else { if ($lastchange["type"] == "delete") { AddToLog("Possible GEDCOM corruption: Attempting to replace GEDCOM record {$gid} which has already been marked for deletion."); } } } } $pgv_changes[$gid . "_" . $GEDCOM][] = $change; if (PGV_USER_AUTO_ACCEPT) { accept_changes($gid . "_" . $GEDCOM); } else { write_changes(); } $backtrace = debug_backtrace(); $temp = ""; if (isset($backtrace[2])) { $temp .= basename($backtrace[2]["file"]) . " (" . $backtrace[2]["line"] . ")"; } if (isset($backtrace[1])) { $temp .= basename($backtrace[1]["file"]) . " (" . $backtrace[1]["line"] . ")"; } if (isset($backtrace[0])) { $temp .= basename($backtrace[0]["file"]) . " (" . $backtrace[0]["line"] . ")"; } $action = basename($_SERVER["SCRIPT_NAME"]); if (!empty($_REQUEST['action'])) { $action .= " " . $_REQUEST['action']; } AddToChangeLog($action . " " . $temp . " Replacing gedcom record {$gid} ->" . PGV_USER_NAME . "<-"); return true; } return false; }
/** * internal function, sets a number of properties * no need to call directly * @return nothing */ function setFileProperties() { global $pgv_lang; if ($this->fileExists()) { $this->filesizeraw = @filesize($this->getServerFilename()); $imgsize = @getimagesize($this->getServerFilename()); // [0]=width [1]=height [2]=filetype ['mime']=mimetype if (is_array($imgsize)) { // this is an image $this->width = 0 + $imgsize[0]; $this->height = 0 + $imgsize[1]; $imageTypes = array("", "GIF", "JPG", "PNG", "SWF", "PSD", "BMP", "TIFF", "TIFF", "JPC", "JP2", "JPX", "JB2", "SWC", "IFF", "WBMP", "XBM"); $this->ext = $imageTypes[0 + $imgsize[2]]; $this->mime = $imgsize['mime']; } } if (!$this->mime) { // this is not an image, OR the file doesn't exist OR it is a url // set file type equal to the file extension - can't use parse_url because this may not be a full url $exp = explode("?", $this->file); $pathinfo = pathinfo($exp[0]); $this->ext = @strtoupper($pathinfo['extension']); // all mimetypes we wish to serve with the media firewall must be added to this array. $mime = array('DOC' => 'application/msword', 'MOV' => 'video/quicktime', 'MP3' => 'audio/mpeg', 'PDF' => 'application/pdf', 'PPT' => 'application/vnd.ms-powerpoint', 'RTF' => 'text/rtf', 'SID' => 'image/x-mrsid', 'TXT' => 'text/plain', 'XLS' => 'application/vnd.ms-excel'); if (empty($mime[$this->ext])) { // if we don't know what the mimetype is, use something ambiguous $this->mime = 'application/octet-stream'; if ($this->fileExists()) { // alert the admin if we cannot determine the mime type of an existing file // as the media firewall will be unable to serve this file properly AddToLog($pgv_lang["unknown_mime"] . ' >' . $this->file . '<'); } } else { $this->mime = $mime[$this->ext]; } } $this->filepropset = true; }
/** * check if the page view rate for a session has been exeeded. */ function CheckPageViews() { global $SEARCH_SPIDER, $MAX_VIEWS, $MAX_VIEW_TIME; if ($MAX_VIEW_TIME == 0 || $MAX_VIEWS == 0 || !empty($SEARCH_SPIDER)) { return; } // The media firewall should not be throttled if (strpos($_SERVER["SCRIPT_NAME"], "mediafirewall") > -1) { return; } if (!empty($_SESSION["pageviews"]["time"]) && !empty($_SESSION["pageviews"]["number"])) { $_SESSION["pageviews"]["number"]++; if ($_SESSION["pageviews"]["number"] < $MAX_VIEWS) { return; } $sleepTime = $MAX_VIEW_TIME - time() + $_SESSION["pageviews"]["time"]; if ($sleepTime > 0) { // The configured page view rate has been exceeded // - Log a message and then sleep to slow things down $text = print_text("maxviews_exceeded", 0, 1); AddToLog($text); sleep($sleepTime); } } $_SESSION["pageviews"] = array("time" => time(), "number" => 1); }
} $configOverride = false; break; } unset($CONFIG_VARS); // Not needed any more //-- check if they are trying to hack if ($configOverride) { print "Config variable override detected. Possible hacking attempt. Script terminated.\n"; if (!ini_get('register_globals') || ini_get('register_globals') == "Off") { //-- load common functions require_once "functions/functions.php"; //-- load db specific functions require_once "functions/functions_db.php"; AddToLog("Config variable override detected. Possible hacking attempt. Script terminated."); AddToLog("URI>" . $_SERVER["REQUEST_URI"] . "<"); } exit; } if (empty($CONFIG_VERSION)) { $CONFIG_VERSION = "2.65"; } if (!isset($PGV_SIMPLE_MAIL)) { $PGV_SIMPLE_MAIL = false; } if (empty($PGV_MEMORY_LIMIT)) { $PGV_MEMORY_LIMIT = "32M"; } //--load common functions require_once PHPGEDVIEW_PKG_PATH . "includes/functions/functions.php"; //-- set the error handler
} else { replace_gedrec($myid, $person->getGedcomRecord() . "\n1 EMAIL " . $form_email); } } $GEDCOM = $OLDGEDCOM; } } } if ($form_firstname != $old_firstname || $form_lastname != $old_lastname) { // update gedcom record with new name // Is this functionality required? } } // Change username if ($form_username != PGV_USER_NAME) { AddToLog('User renamed to ->' . $form_username . '<-'); rename_user(PGV_USER_ID, $form_username); $_SESSION['pgv_user'] = $form_username; } // Reload page to pick up changes such as theme and user_id header('Location: edituser.php'); exit; } } } else { print_header($pgv_lang['user_admin']); if ($ENABLE_AUTOCOMPLETE) { require PGV_ROOT . 'js/autocomplete.js.htm'; } } // Form validation
/** * logs a user out of the system * @param string $user_id logout a specific user */ function userLogout($user_id) { global $GEDCOM; if ($user_id) { set_user_setting($user_id, 'loggedin', 'N'); AddToLog("Logout " . getUserName($user_id)); if (isset($_SESSION['pgv_user']) && $_SESSION['pgv_user'] == $user_id || isset($_COOKIE['pgv_rem']) && $_COOKIE['pgv_rem'] == $user_id) { if ($_SESSION['pgv_user'] == $user_id) { $_SESSION['pgv_user'] = ""; unset($_SESSION['pgv_user']); if (isset($_SESSION["pgv_counter"])) { $tmphits = $_SESSION["pgv_counter"]; } else { $tmphits = -1; } @session_destroy(); $_SESSION["gedcom"] = $GEDCOM; $_SESSION["show_context_help"] = "yes"; @setcookie("pgv_rem", "", -1000); if ($tmphits >= 0) { $_SESSION["pgv_counter"] = $tmphits; } //set since it was set before so don't get double hits } } } }
/** * Preforms a search and replace */ function SearchAndReplace() { global $GEDCOM, $pgv_changes, $manual_save, $STANDARD_NAME_FACTS, $ADVANCED_NAME_FACTS; $this->sgeds = array($GEDCOM); $this->srindi = "yes"; $this->srfams = "yes"; $this->srsour = "yes"; $this->srnote = "yes"; $oldquery = $this->query; $this->GeneralSearch(); //-- don't try to make any changes if nothing was found if (!$this->myindilist && !$this->myfamlist && !$this->mysourcelist && !$this->mynotelist) { return; } AddToLog("Search And Replace old:" . $oldquery . " new:" . $this->replace); $manual_save = true; // Include edit functions. include_once "includes/functions/functions_edit.php"; // These contain the search query and the replace string // $this->replace; // $this->query; // These contain the search results // We need to iterate through them and do the replaces //$this->myindilist; $adv_name_tags = preg_split("/[\\s,;: ]+/", $ADVANCED_NAME_FACTS); $name_tags = array_unique(array_merge($STANDARD_NAME_FACTS, $adv_name_tags)); $name_tags[] = "_MARNM"; foreach ($this->myindilist as $id => $individual) { if (isset($pgv_changes[$individual->getXref() . '_' . $GEDCOM])) { $indirec = find_updated_record($individual->getXref()); } else { $indirec = $individual->getGedcomRecord(); } $oldRecord = $indirec; $newRecord = $indirec; if ($this->replaceAll) { $newRecord = preg_replace("~" . $oldquery . "~i", $this->replace, $newRecord); } else { if ($this->replaceNames) { foreach ($name_tags as $f => $tag) { $newRecord = preg_replace("~(\\d) " . $tag . " (.*)" . $oldquery . "(.*)~i", "\$1 " . $tag . " \$2" . $this->replace . "\$3", $newRecord); } } if ($this->replacePlaces) { if ($this->replacePlacesWord) { $newRecord = preg_replace("~(\\d) PLAC (.*)([,\\W\\s])" . $oldquery . "([,\\W\\s])~i", "\$1 PLAC \$2\$3" . $this->replace . "\$4", $newRecord); } else { $newRecord = preg_replace("~(\\d) PLAC (.*)" . $oldquery . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $newRecord); } } } //-- if the record changed replace the record otherwise remove it from the search results if ($newRecord != $oldRecord) { replace_gedrec($individual->getXref(), $newRecord); } else { unset($this->myindilist[$id]); } } foreach ($this->myfamlist as $id => $family) { if (isset($pgv_changes[$family->getXref() . '_' . $GEDCOM])) { $indirec = find_updated_record($family->getXref()); } else { $indirec = $family->getGedcomRecord(); } $oldRecord = $indirec; $newRecord = $indirec; if ($this->replaceAll) { $newRecord = preg_replace("~" . $oldquery . "~i", $this->replace, $newRecord); } else { if ($this->replacePlaces) { if ($this->replacePlacesWord) { $newRecord = preg_replace("~(\\d) PLAC (.*)([,\\W\\s])" . $oldquery . "([,\\W\\s])~i", "\$1 PLAC \$2\$3" . $this->replace . "\$4", $newRecord); } else { $newRecord = preg_replace("~(\\d) PLAC (.*)" . $oldquery . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $newRecord); } } } //-- if the record changed replace the record otherwise remove it from the search results if ($newRecord != $oldRecord) { replace_gedrec($family->getXref(), $newRecord); } else { unset($this->myfamlist[$id]); } } foreach ($this->mysourcelist as $id => $source) { if (isset($pgv_changes[$source->getXref() . '_' . $GEDCOM])) { $indirec = find_updated_record($source->getXref()); } else { $indirec = $source->getGedcomRecord(); } $oldRecord = $indirec; $newRecord = $indirec; if ($this->replaceAll) { $newRecord = preg_replace("~" . $oldquery . "~i", $this->replace, $newRecord); } else { if ($this->replaceNames) { $newRecord = preg_replace("~(\\d) TITL (.*)" . $oldquery . "(.*)~i", "\$1 TITL \$2" . $this->replace . "\$3", $newRecord); $newRecord = preg_replace("~(\\d) ABBR (.*)" . $oldquery . "(.*)~i", "\$1 ABBR \$2" . $this->replace . "\$3", $newRecord); } if ($this->replacePlaces) { if ($this->replacePlacesWord) { $newRecord = preg_replace("~(\\d) PLAC (.*)([,\\W\\s])" . $oldquery . "([,\\W\\s])~i", "\$1 PLAC \$2\$3" . $this->replace . "\$4", $newRecord); } else { $newRecord = preg_replace("~(\\d) PLAC (.*)" . $oldquery . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $newRecord); } } } //-- if the record changed replace the record otherwise remove it from the search results if ($newRecord != $oldRecord) { replace_gedrec($source->getXref(), $newRecord); } else { unset($this->mysourcelist[$id]); } } foreach ($this->mynotelist as $id => $note) { if (isset($pgv_changes[$note->getXref() . '_' . $GEDCOM])) { $indirec = find_updated_record($note->getXref()); } else { $indirec = $note->getGedcomRecord(); } $oldRecord = $indirec; $newRecord = $indirec; if ($this->replaceAll) { $newRecord = preg_replace("~" . $oldquery . "~i", $this->replace, $newRecord); } //-- if the record changed replace the record otherwise remove it from the search results if ($newRecord != $oldRecord) { replace_gedrec($note->getXref(), $newRecord); } else { unset($this->mynotelist[$id]); } } write_changes(); }
/** * Import users etc. from index files * */ function import() { global $INDEX_DIRECTORY, $TBLPREFIX, $pgv_lang, $GEDCOMS, $GEDCOM, $gBitDb; if (file_exists($INDEX_DIRECTORY . "authenticate.php") == false) { $this->impSuccess = false; return; } else { require $INDEX_DIRECTORY . "authenticate.php"; $countold = count($users); $gBitDb->query("DELETE FROM {$TBLPREFIX}users"); foreach ($users as $username => $user) { if ($user["editaccount"] == "1") { $user["editaccount"] = "Y"; } else { $user["editaccount"] = "N"; } //-- make sure fields are set for v4.0 DB if (!isset($user["firstname"])) { if (isset($user["fullname"])) { $parts = explode(' ', trim($user["fullname"])); $user["lastname"] = array_pop($parts); $user["firstname"] = implode(" ", $parts); } else { $user["firstname"] = ''; $user["lastname"] = ''; } } if (!isset($user["comment"])) { $user["comment"] = ''; } if (!isset($user["comment_exp"])) { $user["comment_exp"] = ''; } if (!isset($user["sync_gedcom"])) { $user["sync_gedcom"] = 'N'; } if (!isset($user["relationship_privacy"])) { $user["relationship_privacy"] = 'N'; } if (!isset($user["max_relation_path"])) { $user["max_relation_path"] = '2'; } if (!isset($user["auto_accept"])) { $user["auto_accept"] = 'N'; } if ($user_id = create_user($user['username'], $user['password'])) { set_user_setting($user_id, 'firstname', $user["firstname"]); set_user_setting($user_id, 'lastname', $user["lastname"]); set_user_setting($user_id, 'email', $user["email"]); set_user_setting($user_id, 'theme', $user["theme"]); set_user_setting($user_id, 'language', $user["language"]); set_user_setting($user_id, 'contactmethod', $user["contactmethod"]); set_user_setting($user_id, 'defaulttab', $user["defaulttab"]); set_user_setting($user_id, 'comment', $user["comment"]); set_user_setting($user_id, 'comment_exp', $user["comment_exp"]); set_user_setting($user_id, 'pwrequested', $user["pwrequested"]); set_user_setting($user_id, 'reg_timestamp', $user["reg_timestamp"]); set_user_setting($user_id, 'reg_hashcode', $user["reg_hashcode"]); set_user_setting($user_id, 'loggedin', $user["loggedin"]); set_user_setting($user_id, 'sessiontime', $user["sessiontime"]); set_user_setting($user_id, 'max_relation_path', $user["max_relation_path"]); set_user_setting($user_id, 'sync_gedcom', $user["sync_gedcom"] ? 'Y' : 'N'); set_user_setting($user_id, 'relationship_privacy', $user["relationship_privacy"] ? 'Y' : 'N'); set_user_setting($user_id, 'auto_accept', $user["auto_accept"] ? 'Y' : 'N'); set_user_setting($user_id, 'canadmin', $user["canadmin"] ? 'Y' : 'N'); set_user_setting($user_id, 'visibleonline', $user["visibleonline"] ? 'Y' : 'N'); set_user_setting($user_id, 'editaccount', $user["editaccount"] ? 'Y' : 'N'); set_user_setting($user_id, 'verified', $user["verified"] ? 'yes' : 'no'); set_user_setting($user_id, 'verified_by_admin', $user["verified_by_admin"] ? 'yes' : 'no'); foreach (array('gedcomid', 'rootid', 'canedit') as $var) { if ($user[$var]) { foreach (unserialize(stripslashes($user[$var])) as $gedcom => $id) { set_user_gedcom_setting($user_id, $gedcom, $var, $id); } } } AddToLog("added user -> {$user['username']} <-"); } } if ($countold == get_user_count()) { $this->impSuccess = true; } else { $this->impSuccess = false; } } if (file_exists($INDEX_DIRECTORY . "messages.dat") == false) { $this->msgSuccess = false; } else { $gBitDb->query("DELETE FROM {$TBLPREFIX}messages"); $messages = array(); $fp = fopen($INDEX_DIRECTORY . "messages.dat", "rb"); $mstring = fread($fp, filesize($INDEX_DIRECTORY . "messages.dat")); fclose($fp); $messages = unserialize($mstring); foreach ($messages as $newid => $message) { $gBitDb->query("INSERT INTO {$TBLPREFIX}messages (m_id, m_from, m_to, m_subject, m_body, m_created) VALUES (?, ? ,? ,? ,? ,?)", array($newid, $message["from"], $message["to"], $message["subject"], $message["body"], $message["created"])); } $this->msgSuccess = true; } if (file_exists($INDEX_DIRECTORY . "favorites.dat") == false) { $this->favSuccess = false; print $pgv_lang["um_nofav"] . "<br /><br />"; } else { $gBitDb->query("DELETE FROM {$TBLPREFIX}favorites"); $favorites = array(); $fp = fopen($INDEX_DIRECTORY . "favorites.dat", "rb"); $mstring = fread($fp, filesize($INDEX_DIRECTORY . "favorites.dat")); fclose($fp); $favorites = unserialize($mstring); foreach ($favorites as $newid => $favorite) { $res = addFavorite($favorite); if (!$res || DB::isError($res)) { $this->errorMsg = "<span class=\"error\">Unable to update <i>Favorites</i> table.</span><br />\n"; return; } } $this->favSuccess = true; } if (file_exists($INDEX_DIRECTORY . "news.dat") == false) { $this->newsSuccess = false; } else { $gBitDb->query("DELETE FROM {$TBLPREFIX}news"); $allnews = array(); $fp = fopen($INDEX_DIRECTORY . "news.dat", "rb"); $mstring = fread($fp, filesize($INDEX_DIRECTORY . "news.dat")); fclose($fp); $allnews = unserialize($mstring); foreach ($allnews as $newid => $news) { $res = addNews($news); if (!$res) { $this->errorMsg = "<span class=\"error\">Unable to update <i>News</i> table.</span><br />\n"; return; } } $this->newsSuccess = true; } if (file_exists($INDEX_DIRECTORY . "blocks.dat") == false) { $this->blockSuccess = false; } else { $gBitDb->query("DELETE FROM {$TBLPREFIX}blocks"); $allblocks = array(); $fp = fopen($INDEX_DIRECTORY . "blocks.dat", "rb"); $mstring = fread($fp, filesize($INDEX_DIRECTORY . "blocks.dat")); fclose($fp); $allblocks = unserialize($mstring); foreach ($allblocks as $bid => $blocks) { $username = $blocks["username"]; $gBitDb->query("INSERT INTO {$TBLPREFIX}blocks (b_id, b_username, b_location, b_order, b_name, b_config) VALUES (?, ? ,? , ?, ?, ?)", array($bid, $blocks["username"], $blocks["location"], $blocks["order"], $blocks["name"], serialize($blocks["config"]))); } $this->blockSuccess = true; } }
/** * merge a local gedcom record with the information from the remote site * @param string $xref the remote ID to merge with * @param string $localrec the local gedcom record to merge the remote record with * @param boolean $isStub whether or not this is a stub record * @param boolean $firstLink is this the first time this record is being linked */ function mergeGedcomRecord($xref, $localrec, $isStub = false, $firstLink = false) { global $FILE, $GEDCOM; global $TBLPREFIX, $pgv_changes; $FILE = $GEDCOM; if (!$isStub) { $gedrec = find_gedcom_record($this->xref . ":" . $xref); if (!empty($gedrec)) { $localrec = $gedrec; } } //-- used to force an update on the first time linking a person if ($firstLink) { $this->authenticate(); $result = $this->soapClient->getGedcomRecord($this->SID, $xref); if (PEAR::isError($result) || isset($result->faultcode) || get_class($result) == 'SOAP_Fault' || is_object($result)) { if (isset($result->faultstring)) { AddToLog($result->faultstring); print $result->faultstring; } return $localrec; } $gedrec = $result; $gedrec = preg_replace("/@([^#@\\s]+)@/", "@" . $this->xref . ":\$1@", $gedrec); $gedrec = $this->checkIds($gedrec); $localrec = $this->_merge($localrec, $gedrec); include_once "includes/functions/functions_edit.php"; $localrec = $this->UpdateFamily($localrec, $gedrec); $ct = preg_match("/0 @(.*)@/", $localrec, $match); if ($ct > 0) { $pid = trim($match[1]); replace_gedrec($pid, $localrec); } } //-- get the last change date of the record $change_date = get_gedcom_value("CHAN:DATE", 1, $localrec, '', false); if (empty($change_date)) { $this->authenticate(); if (!is_object($this->soapClient) || $this->isError($this->soapClient)) { return false; } $result = $this->soapClient->getGedcomRecord($this->SID, $xref); if (PEAR::isError($result) || isset($result->faultcode) || get_class($result) == 'SOAP_Fault' || is_object($result)) { if (isset($result->faultstring)) { AddToLog($result->faultstring); print $result->faultstring; } return $localrec; } $gedrec = $result; $gedrec = preg_replace("/@([^#@\\s]+)@/", "@" . $this->xref . ":\$1@", $gedrec); $gedrec = $this->checkIds($gedrec); $localrec = $this->_merge($localrec, $gedrec); $ct = preg_match("/0 @(.*)@/", $localrec, $match); if ($ct > 0) { $pid = trim($match[1]); if ($isStub) { include_once "includes/functions/functions_edit.php"; $localrec = $this->UpdateFamily($localrec, $gedrec); replace_gedrec($pid, $localrec); } else { update_record($localrec); } } } else { $chan_date = new GedcomDate($change_date); $chan_time_str = get_gedcom_value("CHAN:DATE:TIME", 1, $localrec, '', false); $chan_time = parse_time($chan_time_str); $change_time = mktime($chan_time[0], $chan_time[1], $chan_time[2], $chan_date->date1->m, $chan_date->date1->d, $chan_date->date1->y); /** * @todo make the timeout a config option */ // Time Clock (determines how often a record is checked) if ($change_time < time() - 60 * 60 * 24 * 14) { //$change_date= "1 JAN 2000"; $this->authenticate(); if (!is_object($this->soapClient) || $this->isError($this->soapClient)) { return false; } $person = $this->soapClient->checkUpdatesByID($this->SID, $xref, $change_date); // If there are no changes between the local and remote copies if (PEAR::isError($person) || isset($person->faultcode) || get_class($person) == 'SOAP_Fault' || isset($person->error_message_prefix)) { if (isset($person->faultstring)) { AddToLog($person->faultstring); } else { AddToLog($person->message); } //-- update the last change time $pos1 = strpos($localrec, "1 CHAN"); if ($pos1 !== false) { $pos2 = strpos($localrec, "\n1", $pos1 + 4); if ($pos2 === false) { $pos2 = strlen($localrec); } $newgedrec = substr($localrec, 0, $pos1); $newgedrec .= "1 CHAN\n2 DATE " . date("d M Y") . "\n"; $newgedrec .= "3 TIME " . date("H:i:s") . "\n"; $newgedrec .= "2 _PGVU @" . $this->xref . "@\n"; $newgedrec .= substr($localrec, $pos2); $localrec = $newgedrec; } else { $newgedrec = "\n1 CHAN\n2 DATE " . date("d M Y") . "\n"; $newgedrec .= "3 TIME " . date("H:i:s") . "\n"; $newgedrec .= "2 _PGVU @" . $this->xref . "@"; $localrec .= $newgedrec; } update_record($localrec); } else { $gedrec = $person->gedcom; $gedrec = preg_replace("/@([^#@\\s]+)@/", "@" . $this->xref . ":\$1@", $gedrec); $gedrec = $this->checkIds($gedrec); $ct = preg_match("/0 @(.*)@/", $localrec, $match); if ($ct > 0) { $pid = trim($match[1]); if (isset($pgv_changes[$pid . "_" . $GEDCOM])) { $localrec = find_updated_record($pid); } $localrec = $this->_merge($localrec, $gedrec); if ($isStub) { include_once "includes/functions/functions_edit.php"; $localrec = $this->UpdateFamily($localrec, $gedrec); replace_gedrec($pid, $localrec); } else { update_record($localrec); } } } } } return $localrec; }
} } $configtext = $configtext_beg . $person_privacy_text . $configtext_end; $PRIVACY_MODULE = $INDEX_DIRECTORY . $GEDCOM . "_priv.php"; $fp = @fopen($PRIVACY_MODULE, "wb"); if (!$fp) { global $whichFile; $whichFile = $PRIVACY_MODULE; print "<span class=\"error\">" . print_text("gedcom_config_write_error", 0, 1) . "<br /></span>\n"; } else { fwrite($fp, $configtext); fclose($fp); } // NOTE: load the new variables require $INDEX_DIRECTORY . $GEDCOM . '_priv.php'; $logline = AddToLog("Privacy file {$PRIVACY_MODULE} updated"); $gedcomprivname = $GEDCOM . "_priv.php"; check_in($logline, $gedcomprivname, $INDEX_DIRECTORY); //-- delete the cache files for the welcome page blocks require_once PGV_ROOT . 'includes/index_cache.php'; clearCache(); } ?> <script language="JavaScript" type="text/javascript"> <!-- var pastefield; function paste_id(value) { pastefield.value=value; } var helpWin; function helpPopup(which) {
/** * Accpet changed gedcom record into database * * This function gets an updated record from the gedcom file and replaces it in the database * @author John Finlay * @param string $cid The change id of the record to accept */ function accept_changes($cid) { global $pgv_changes, $GEDCOM, $TBLPREFIX, $FILE, $GEDCOMS; global $INDEX_DIRECTORY, $SYNC_GEDCOM_FILE, $fcontents, $manual_save; if (isset($pgv_changes[$cid])) { $changes = $pgv_changes[$cid]; $change = $changes[count($changes) - 1]; if ($GEDCOM != $change["gedcom"]) { $GEDCOM = $change["gedcom"]; } $FILE = $GEDCOM; $gid = $change["gid"]; $gedrec = $change["undo"]; if (empty($gedrec)) { $gedrec = find_gedcom_record($gid); } update_record($gedrec, $change["type"] == "delete"); //-- write the changes back to the gedcom file if ($SYNC_GEDCOM_FILE) { // TODO: We merge CONC lines on import, so need to add them back on export if (!isset($manual_save) || $manual_save == false) { //-- only allow one thread to accept changes at a time // $mutex = new Mutex("accept_changes"); // $mutex->Wait(); } if (empty($fcontents)) { read_gedcom_file(); } if ($change["type"] == "delete") { $pos1 = find_newline_string($fcontents, "0 @{$gid}@"); if ($pos1 !== false) { $pos2 = find_newline_string($fcontents, "0", $pos1 + 5); if ($pos2 === false) { $fcontents = substr($fcontents, 0, $pos1) . '0 TRLR' . PGV_EOL; AddToLog("Corruption found in GEDCOM {$GEDCOM} Attempted to correct"); } else { $fcontents = substr($fcontents, 0, $pos1) . substr($fcontents, $pos2); } } else { AddToLog("Corruption found in GEDCOM {$GEDCOM} Attempted to correct. Deleted gedcom record {$gid} was not found in the gedcom file."); } } elseif ($change["type"] == "append") { $pos1 = find_newline_string($fcontents, "0 TRLR"); $fcontents = substr($fcontents, 0, $pos1) . reformat_record_export($gedrec) . '0 TRLR' . PGV_EOL; } elseif ($change["type"] == "replace") { $pos1 = find_newline_string($fcontents, "0 @{$gid}@"); if ($pos1 !== false) { $pos2 = find_newline_string($fcontents, "0", $pos1 + 5); if ($pos2 === false) { $fcontents = substr($fcontents, 0, $pos1) . '0 TRLR' . PGV_EOL; AddToLog("Corruption found in GEDCOM {$GEDCOM} Attempted to correct"); } else { $fcontents = substr($fcontents, 0, $pos1) . reformat_record_export($gedrec) . substr($fcontents, $pos2); } } else { //-- attempted to replace a record that doesn't exist AddToLog("Corruption found in GEDCOM {$GEDCOM} Attempted to correct. Replaced gedcom record {$gid} was not found in the gedcom file."); $pos1 = find_newline_string($fcontents, "0 TRLR"); $fcontents = substr($fcontents, 0, $pos1) . reformat_record_export($gedrec) . '0 TRLR' . PGV_EOL; AddToLog("Gedcom record {$gid} was appended back to the GEDCOM file."); } } if (!isset($manual_save) || $manual_save == false) { write_file(); // $mutex->Release(); } } if ($change["type"] != "delete") { //-- synchronize the gedcom record with any user account $username = get_user_from_gedcom_xref($GEDCOM, $gid); if ($username && get_user_setting($username, 'sync_gedcom') == 'Y') { $firstname = get_gedcom_value("GIVN", 2, $gedrec); $lastname = get_gedcom_value("SURN", 2, $gedrec); if (empty($lastname)) { $fullname = get_gedcom_value("NAME", 1, $gedrec, "", false); $ct = preg_match("~(.*)/(.*)/~", $fullname, $match); if ($ct > 0) { $firstname = $match[1]; $lastname = $match[2]; } else { $firstname = $fullname; } } //-- SEE [ 1753047 ] Email/sync with account $email = get_gedcom_value("EMAIL", 1, $gedrec); if (empty($email)) { $email = get_gedcom_value("_EMAIL", 1, $gedrec); } if (!empty($email)) { set_user_setting($username, 'email', $email); } set_user_setting($username, 'firstname', $firstname); set_user_setting($username, 'lastname', $lastname); } } unset($pgv_changes[$cid]); if (!isset($manual_save) || $manual_save == false) { write_changes(); } $logline = AddToLog("Accepted change {$cid} " . $change["type"] . " into database"); check_in($logline, $GEDCOM, dirname($GEDCOMS[$GEDCOM]['path'])); if (isset($change["linkpid"])) { accept_changes($change["linkpid"] . "_" . $GEDCOM); } return true; } return false; }