// **** end action "delete" // **** begin action "showmediaform" if ($action == "showmediaform") { if (!isset($pid)) { $pid = ""; } if (empty($level)) { $level = 1; } if (!isset($linktoid)) { $linktoid = ""; } show_media_form($pid, "newentry", $filename, $linktoid, $level); } // **** end action "showmediaform" // **** begin action "editmedia" if ($action == "editmedia") { if (!isset($pid)) { $pid = ""; } if (empty($level)) { $level = 1; } show_media_form($pid, "update", $filename, $linktoid, $level); } // **** end action "editmedia" print "<br />"; print "<div class=\"center\"><a href=\"#\" onclick=\"if (window.opener.showchanges) window.opener.showchanges(); window.close();\">" . $pgv_lang["close_window"] . "</a></div>\n"; print "<br />"; print_simple_footer();
/** * Check if the given gedcom record has changed since the last session access * This is used to check if the gedcom record changed between the time the user * loaded the individual page and the time they clicked on a link to edit * the data. * * @param string $pid The gedcom id of the record to check pgv_changes * @param string $gedrec The latest gedcom record to check the CHAN:DATE:TIME (auto accept) */ function checkChangeTime($pid, $gedrec, $last_time) { global $GEDCOM, $pgv_changes, $pgv_lang; //-- check if the record changes since last access $changeTime = 0; $changeUser = ""; if (isset($pgv_changes[$pid . "_" . $GEDCOM])) { $change = end($pgv_changes[$pid . "_" . $GEDCOM]); $changeTime = $change['time']; $changeUser = $change['user']; } else { $changrec = get_sub_record(1, "1 CHAN", $gedrec); $cdate = get_gedcom_value("DATE", 2, $changrec, '', false); if (!empty($cdate)) { $ctime = get_gedcom_value("DATE:TIME", 2, $changrec); $changeUser = get_gedcom_value("_PGVU", 2, $changrec, '', false); $chan_date = new GedcomDate($cdate); $chan_date = $chan_date->MinDate(); $chan_time = parse_time($ctime); $changeTime = mktime($chan_time[0], $chan_time[1], $chan_time[2], $chan_date->m, $chan_date->d, $chan_date->y); } } if (isset($_REQUEST['linenum']) && $changeTime != 0 && $last_time && $changeTime > $last_time) { echo "<span class=\"error\">" . preg_replace("/#PID#/", $pid, $pgv_lang["edit_concurrency_msg2"]) . "<br /><br />"; if (!empty($changeUser)) { echo preg_replace(array("/#CHANGEUSER#/", "/#CHANGEDATE#/"), array($changeUser, date("d M Y H:i:s", $changeTime)), $pgv_lang["edit_concurrency_change"]) . "<br /><br />"; } echo $pgv_lang["edit_concurrency_reload"] . "</span>"; print_simple_footer(); exit; } }