// NOTE: Build the gedcom record // NOTE: Level 0 $media_id = get_new_xref("OBJE"); $newged = "0 @" . $media_id . "@ OBJE\n"; //-- set the FILE text to the correct file location in the standard media directory if (PGV_USER_GEDCOM_ADMIN) { $text[0] = $folderName . $mediaFile; } else { $newged .= "1 FILE " . $folderName . $mediaFile . "\n"; } $newged = handle_updates($newged); require_once 'includes/classes/class_media.php'; $media_obje = new Media($newged); $mediaid = Media::in_obje_list($media_obje); if (!$mediaid) { $mediaid = append_gedrec($newged, $linktoid); } if ($mediaid) { AddToChangeLog("Media ID " . $mediaid . " successfully added."); if ($linktoid != "") { $link = linkMedia($mediaid, $linktoid, $level); } else { $link = false; } if ($link) { AddToChangeLog("Media ID " . $media_id . " successfully added to {$linktoid}."); } else { echo "<a href=\"javascript:// OBJE {$mediaid}\" onclick=\"openerpasteid('{$mediaid}'); return false;\">" . $pgv_lang["paste_id_into_field"] . " <b>{$mediaid}</b></a><br /><br />\n"; echo PGV_JS_START; echo "openerpasteid('", $mediaid, "');"; echo PGV_JS_END;
case "OTHER": $rows = $gBitDb->query("SELECT o_id FROM {$TBLPREFIX}other WHERE o_file=? AND o_type NOT IN ('REPO', 'NOTE') ORDER BY o_id", array($GED_ID)); break; default: $rows = $gBitDb->query("SELECT o_id FROM {$TBLPREFIX}other WHERE o_file=? AND o_type=? ORDER BY o_id", array($GED_ID, $type)); } print "SUCCESS\n"; while ($id = $rows->fetchColumn(0)) { print "{$id}\n"; } addDebugLog($action . " type={$type} position={$position} "); break; case 'new': if (empty($_SESSION['readonly']) && PGV_USER_CAN_EDIT) { $gedrec = "0 @REF@ {$type}"; $xref = append_gedrec($gedrec); if ($xref) { addDebugLog($action . " type={$type} position={$position} SUCCESS\n{$xref}"); print "SUCCESS\n{$xref}\n"; } } else { addDebugLog($action . " type={$type} position={$position} ERROR 11: No write privileges for this record."); print "ERROR 11: No write privileges for this record.\n"; } break; } exit; case 'uploadmedia': $error = ""; if (isset($_FILES['mediafile'])) { if (!move_uploaded_file($_FILES['mediafile']['tmp_name'], $MEDIA_DIRECTORY . $_FILES['mediafile']['name'])) {
} if (!empty($cplac)) { $childrec .= "2 PLAC {$cplac}\n"; } $var = "C" . $i . "DRESN"; if (isset($_REQUEST[$var])) { $cresn = $_REQUEST[$var]; } else { $cresn = ""; } if (!empty($cresn)) { $childrec .= "2 RESN {$cresn}\n"; } } $childrec .= "1 FAMC @{$famid}@\n"; $cxref = append_gedrec($childrec); $famrec .= "\n1 CHIL @{$cxref}@"; $famupdate = true; } if ($famupdate && $oldfamrec != $famrec) { $famrec = preg_replace("/0 @(.*)@/", "0 @" . $famid . "@", $famrec); replace_gedrec($famid, $famrec, $update_CHAN); } $i++; } if ($updated && empty($error)) { echo $pgv_lang["update_successful"], "<br />"; AddToChangeLog("Quick update for {$pid} by >" . PGV_USER_NAME . "<"); //echo "<pre>$gedrec</pre>"; if ($oldgedrec != $gedrec) { replace_gedrec($pid, $gedrec, $update_CHAN);
function addLink() { global $pgv_lang, $GEDCOM; switch ($this->form_location) { case 'remote': $serverID = $this->addRemoteServer($this->form_txtTitle, $this->form_txtURL, $this->form_txtGID, $this->form_txtUsername, $this->form_txtPassword); break; case 'local': $serverID = $this->addLocalServer($this->form_txtCB_Title, $this->form_txtCB_GID); break; case 'existing': $serverID = $this->form_cbExistingServers; break; case "FamilySearch": //TODO: Make sure that it is merging correctly $serverID = $this->addFamilySearchServer($this->form_txtFS_URL, $this->form_txtFS_URL, $this->form_txtFS_GID, $this->form_txtFS_Username, $this->form_txtFS_Password); break; } $link_pid = $this->form_txtPID; $relation_type = $this->form_cbRelationship; if ($serverID && $link_pid) { if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) { $indirec = find_updated_record($this->pid); } else { $indirec = find_person_record($this->pid); } switch ($relation_type) { case "father": $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}"; $stub_id = append_gedrec($indistub, false); $indistub = find_updated_record($stub_id); $gedcom_fam = "0 @new@ FAM\n1 HUSB @{$stub_id}@\n1 CHIL @{$this->pid}@"; $fam_id = append_gedrec($gedcom_fam); $indirec .= "\n1 FAMC @{$fam_id}@"; replace_gedrec($this->pid, $indirec); $serviceClient = ServiceClient::getInstance($serverID); $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true); $indistub .= "\n1 FAMS @{$fam_id}@"; replace_gedrec($stub_id, $indistub, false); break; case "mother": $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}"; $stub_id = append_gedrec($indistub, false); $indistub = find_updated_record($stub_id); $gedcom_fam = "0 @new@ FAM\n1 WIFE @{$stub_id}@\n1 CHIL @{$this->pid}@"; $fam_id = append_gedrec($gedcom_fam); $indirec .= "\n1 FAMC @{$fam_id}@"; replace_gedrec($this->pid, $indirec); $serviceClient = ServiceClient::getInstance($serverID); $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true); $indistub .= "\n1 FAMS @" . $fam_id . "@"; replace_gedrec($stub_id, $indistub, false); break; case "husband": $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}"; $stub_id = append_gedrec($indistub, false); $indistub = find_updated_record($stub_id); $gedcom_fam = "0 @new@ FAM\n1 MARR Y\n1 WIFE @{$this->pid}@\n1 HUSB @{$stub_id}@\n"; $fam_id = append_gedrec($gedcom_fam); $indirec .= "\n1 FAMS @{$fam_id}@"; replace_gedrec($this->pid, $indirec); $serviceClient = ServiceClient::getInstance($serverID); $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true); $indistub .= "\n1 FAMS @{$fam_id}@"; replace_gedrec($stub_id, $indistub, false); break; case "wife": $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}"; $stub_id = append_gedrec($indistub, false); $indistub = find_updated_record($stub_id); $gedcom_fam = "0 @new@ FAM\n1 MARR Y\n1 WIFE @{$stub_id}@\n1 HUSB @{$this->pid}@"; $fam_id = append_gedrec($gedcom_fam); $indirec .= "\n1 FAMS @{$fam_id}@"; replace_gedrec($this->pid, $indirec); $serviceClient = ServiceClient::getInstance($serverID); $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true); $indistub .= "\n1 FAMS @{$fam_id}@\n"; replace_gedrec($stub_id, $indistub, false); break; case "son": case "daughter": $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}"; $stub_id = append_gedrec($indistub, false); $indistub = find_updated_record($stub_id); if (get_gedcom_value('SEX', 1, $indirec, '', false) == 'F') { $gedcom_fam = "0 @new@ FAM\n1 WIFE @{$this->pid}@\n1 CHIL @{$stub_id}@"; } else { $gedcom_fam = "0 @new@ FAM\n1 HUSB @{$this->pid}@\n1 CHIL @{$stub_id}@"; } $fam_id = append_gedrec($gedcom_fam); $indirec .= "\n1 FAMS @{$fam_id}@"; replace_gedrec($this->pid, $indirec); $serviceClient = ServiceClient::getInstance($serverID); $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true); $indistub .= "\n1 FAMC @" . $fam_id . "@"; replace_gedrec($stub_id, $indistub, false); break; case 'current_person': $indirec .= "\n1 RFN {$serverID}:{$link_pid}\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}"; $serviceClient = ServiceClient::getInstance($serverID); if (!is_null($serviceClient)) { //-- get rid of change date $pos1 = strpos($indirec, "\n1 CHAN"); if ($pos1 !== false) { $pos2 = strpos($indirec, "\n1", $pos1 + 5); $indirec = substr($indirec, 0, $pos1) . substr($indirec, $pos2); } $indirec = $serviceClient->mergeGedcomRecord($link_pid, $indirec, true, true); } else { echo 'Unable to find server'; } break; } echo '<b>', $pgv_lang['link_success'], '</b>'; return true; } return false; }
} else { $famrec .= "\n1 HUSB @{$pid}@"; } if (!isset($pgv_changes[$pid . "_" . PGV_GEDCOM])) { $indirec = find_gedcom_record($pid, PGV_GED_ID); } else { $indirec = find_updated_record($pid, PGV_GED_ID); } if ($indirec) { $indirec .= "\n1 FAMS @{$newfamxref}@"; if (PGV_DEBUG) { echo "<pre>{$gedrec}</pre>"; echo "<pre>{$famrec}</pre>"; echo "<pre>{$indirec}</pre>"; } if (replace_gedrec($pid, $indirec, $update_CHAN) && append_gedrec($gedrec, $update_CHAN) && append_gedrec($famrec, $update_CHAN)) { echo "<br /><br />", $pgv_lang["update_successful"]; $success = true; } } break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case 'deleteperson': if (PGV_DEBUG) { phpinfo(INFO_VARIABLES); echo "<pre>{$gedrec}</pre>"; } if (!checkFactEdit($gedrec)) { echo "<br />", $pgv_lang["privacy_prevented_editing"]; if (!empty($pid)) {
} else { $famrec .= "\n1 HUSB @{$pid}@"; } if (!isset($pgv_changes[$pid . "_" . $GEDCOM])) { $indirec = find_gedcom_record($pid); } else { $indirec = find_updated_record($pid); } if ($indirec) { $indirec .= "\n1 FAMS @{$newfamxref}@"; if (PGV_DEBUG) { echo "<pre>{$gedrec}</pre>"; echo "<pre>{$famrec}</pre>"; echo "<pre>{$indirec}</pre>"; } if (replace_gedrec($pid, $indirec) && append_gedrec($gedrec) && append_gedrec($famrec)) { echo "<br /><br />" . $pgv_lang["update_successful"]; $success = true; } } break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case 'deleteperson': if (PGV_DEBUG) { phpinfo(INFO_VARIABLES); echo "<pre>{$gedrec}</pre>"; } if (!checkFactEdit($gedrec)) { echo "<br />" . $pgv_lang["privacy_prevented_editing"]; if (!empty($pid)) {