$level = safe_REQUEST($_REQUEST, 'level', PGV_REGEX_UNSAFE); $text = safe_REQUEST($_REQUEST, 'text', PGV_REGEX_UNSAFE); $tag = safe_REQUEST($_REQUEST, 'tag', PGV_REGEX_UNSAFE); $islink = safe_REQUEST($_REQUEST, 'islink', PGV_REGEX_UNSAFE); $glevels = safe_REQUEST($_REQUEST, 'glevels', PGV_REGEX_UNSAFE); $update_CHAN = !safe_POST_bool('preserve_last_changed'); $filename = decrypt($filename); $oldFilename = decrypt($oldFilename); print_simple_header($pgv_lang["add_media_tool"]); $disp = true; if (empty($pid) && !empty($mid)) { $pid = $mid; } if (!empty($pid)) { if (!isset($pgv_changes[$pid . "_" . $GEDCOM])) { $gedrec = find_media_record($pid); } else { $gedrec = find_updated_record($pid); } $disp = displayDetailsById($pid, "OBJE"); } if ($action == "update" || $action == "newentry") { if (!isset($linktoid) || $linktoid == "new") { $linktoid = ""; } if (empty($linktoid) && !empty($gid)) { $linktoid = $gid; } if (!empty($linktoid)) { $disp = displayDetailsById($linktoid); }
/** * Accept any edit changes into the database * Also update the mediarec we will use to generate the page */ function acceptChanges() { global $GEDCOM; if (!PGV_USER_CAN_ACCEPT) { return; } if (accept_changes($this->pid . "_" . $GEDCOM)) { $this->show_changes = false; $this->accept_success = true; $mediarec = find_media_record($this->pid); //-- check if we just deleted the record and redirect to index if (empty($mediarec)) { header("Location: index.php?ctype=gedcom"); exit; } //$this->mediaobject = Media::getInstance($this->pid); $this->mediaobject = new Media($mediarec); } //This sets the controller ID to be the Media ID if (is_null($this->mediaobject)) { $this->mediaobject = new Media("0 @" . $this->pid . "@ OBJE"); } }
/** * Creates a reference(handle) for xml element to element in the objects element of the root element * If such an element does not exists it is created using create_media method. * @param DOMElement $eParent - the parent you want to apend the elemnt to * @param GEDCOM record $sourcerefRec - the record use to get more information about the event(used when the event is being created) * @param int $level - the level the media could be found */ function create_mediaref($eParent, $sourcerefRec, $level, $done = 1) { $mediaId = get_gedcom_value("OBJE", $level, $sourcerefRec); $eMediaRef = $this->dom->createElement("objref"); $eMediaRef = $eParent->appendChild($eMediaRef); if (($sourceHlink = $this->query_dom("./objects/object[@id = \"{$mediaId}\"]/@handle")) == null) { $this->create_media($mediaId, find_media_record($mediaId)); } $eMediaRef->setAttribute("hlink", $this->query_dom("./objects/object[@id = \"{$mediaId}\"]/@handle")); $eParent->appendChild($eMediaRef); // $mediaRecord = find_gedcom_record($mediaId); // $this->create_media($mediaId,$mediaRecord); }
$level = safe_REQUEST($_REQUEST, 'level', PGV_REGEX_UNSAFE); $text = safe_REQUEST($_REQUEST, 'text', PGV_REGEX_UNSAFE); $tag = safe_REQUEST($_REQUEST, 'tag', PGV_REGEX_UNSAFE); $islink = safe_REQUEST($_REQUEST, 'islink', PGV_REGEX_UNSAFE); $glevels = safe_REQUEST($_REQUEST, 'glevels', PGV_REGEX_UNSAFE); $update_CHAN = !safe_POST_bool('preserve_last_changed'); $filename = decrypt($filename); $oldFilename = decrypt($oldFilename); print_simple_header($pgv_lang["add_media_tool"]); $disp = true; if (empty($pid) && !empty($mid)) { $pid = $mid; } if (!empty($pid)) { if (!isset($pgv_changes[$pid . "_" . PGV_GEDCOM])) { $gedrec = find_media_record($pid, PGV_GED_ID); } else { $gedrec = find_updated_record($pid, PGV_GED_ID); } $disp = displayDetailsById($pid, "OBJE"); } if ($action == "update" || $action == "newentry") { if (!isset($linktoid) || $linktoid == "new") { $linktoid = ""; } if (empty($linktoid) && !empty($gid)) { $linktoid = $gid; } if (!empty($linktoid)) { $disp = displayDetailsById($linktoid); }