use WT\User; define('WT_SCRIPT_NAME', 'action.php'); require './includes/session.php'; header('Content-type: text/html; charset=UTF-8'); if (!WT_Filter::checkCsrf()) { Zend_Session::writeClose(); header('HTTP/1.0 406 Not Acceptable'); exit; } switch (WT_Filter::post('action')) { case 'accept-changes': // Accept all the pending changes for a record $record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF)); if ($record && WT_USER_CAN_ACCEPT && $record->canShow() && $record->canEdit()) { WT_FlashMessages::addMessage(WT_I18N::translate('The changes to “%s” have been accepted.', $record->getFullName())); accept_all_changes($record->getXref(), $record->getGedcomId()); } else { header('HTTP/1.0 406 Not Acceptable'); } break; case 'copy-fact': // Copy a fact to the clipboard require WT_ROOT . 'includes/functions/functions_edit.php'; $xref = WT_Filter::post('xref', WT_REGEX_XREF); $fact_id = WT_Filter::post('fact_id'); $record = WT_GedcomRecord::getInstance($xref); if ($record && $record->canEdit()) { foreach ($record->getFacts() as $fact) { if ($fact->getfactId() == $fact_id) { switch ($fact->getTag()) { case 'NOTE':
public function deleteRecord() { // Create a pending change WT_DB::prepare("INSERT INTO `##change` (gedcom_id, xref, old_gedcom, new_gedcom, user_id) VALUES (?, ?, ?, '', ?)")->execute(array($this->gedcom_id, $this->xref, $this->getGedcom(), Auth::id())); // Accept this pending change if (Auth::user()->getSetting('auto_accept')) { accept_all_changes($this->xref, $this->gedcom_id); } // Clear the cache self::$gedcom_record_cache = null; self::$pending_record_cache = null; Log::addEditLog('Delete: ' . static::RECORD_TYPE . ' ' . $this->xref); }