diff options
| author | fisharebest <fisharebest@gmail.com> | 2011-11-01 14:50:52 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2011-11-01 14:50:52 +0000 |
| commit | 8aef4e72a809c6646fc68986c8aff2096cdf1bd3 (patch) | |
| tree | 134d48fac05cc0f360906b14a1c0f0a92f07c1fb /includes | |
| parent | 7da9795efd4537bda4e624f5ed81393f36e01147 (diff) | |
| download | webtrees-8aef4e72a809c6646fc68986c8aff2096cdf1bd3.tar.gz webtrees-8aef4e72a809c6646fc68986c8aff2096cdf1bd3.tar.bz2 webtrees-8aef4e72a809c6646fc68986c8aff2096cdf1bd3.zip | |
Use AJAX (action.php) instead of popup windows (edit_interface.php)
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/functions/functions_edit.php | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php index f454a16d5f..5cac794af8 100644 --- a/includes/functions/functions_edit.php +++ b/includes/functions/functions_edit.php @@ -2581,106 +2581,3 @@ function insert_missing_subtags($level1tag, $add_date=false) { } } } - -/** -* Delete a person and update all records that link to that person -* @param string $pid the id of the person to delete -* @param string $gedrec the gedcom record of the person to delete -* @return boolean true or false based on the successful completion of the deletion -*/ -function delete_person($pid, $gedrec='') { - if (WT_DEBUG) { - phpinfo(INFO_VARIABLES); - echo "<pre>$gedrec</pre>"; - } - - if (empty($gedrec)) $gedrec = find_person_record($pid, WT_GED_ID); - if (!empty($gedrec)) { - $success = true; - $ct = preg_match_all("/1 FAM. @(.*)@/", $gedrec, $match, PREG_SET_ORDER); - for ($i=0; $i<$ct; $i++) { - $famid = $match[$i][1]; - $famrec = find_gedcom_record($famid, WT_GED_ID, true); - if (!empty($famrec)) { - $lines = explode("\n", $famrec); - $newfamrec = ''; - $lastlevel = -1; - foreach ($lines as $indexval => $line) { - $ct = preg_match("/^(\d+)/", $line, $levelmatch); - if ($ct>0) $level = $levelmatch[1]; - else $level = 1; - //-- make sure we don't add any sublevel records - if ($level<=$lastlevel) $lastlevel = -1; - if ((strpos($line, "@$pid@")===false) && ($lastlevel==-1)) $newfamrec .= $line."\n"; - else { - $lastlevel=$level; - } - } - //-- if there is not at least two people in a family then the family is deleted - $pt = preg_match_all("/1 (?:HUSB|WIFE|CHIL) @(.*)@/", $newfamrec, $pmatch, PREG_SET_ORDER); - if ($pt<2) { - for ($j=0; $j<$pt; $j++) { - $xref = $pmatch[$j][1]; - if ($xref!=$pid) { - $indirec = find_gedcom_record($xref, WT_GED_ID, true); - $indirec = preg_replace("/1.*@$famid@.*/", '', $indirec); - if (WT_DEBUG) { - echo "<pre>$indirec</pre>"; - } - replace_gedrec($xref, WT_GED_ID, $indirec); - } - } - delete_gedrec($famid, WT_GED_ID); - } - else replace_gedrec($famid, WT_GED_ID, $newfamrec); - } - } - delete_gedrec($pid, WT_GED_ID); - return true; - } - return false; -} - -/** -* Delete a person and update all records that link to that person -* @param string $pid the id of the person to delete -* @param string $gedrec the gedcom record of the person to delete -* @return boolean true or false based on the successful completion of the deletion -*/ -function delete_family($pid, $gedrec='') { - if (empty($gedrec)) $gedrec = find_family_record($pid, WT_GED_ID); - if (!empty($gedrec)) { - $success = true; - $ct = preg_match_all("/1 (\w+) @(.*)@/", $gedrec, $match, PREG_SET_ORDER); - for ($i=0; $i<$ct; $i++) { - $type = $match[$i][1]; - $id = $match[$i][2]; - if (WT_DEBUG) { - echo $type, ' ', $id, ' '; - } - $indirec = find_gedcom_record($id, WT_GED_ID, true); - if (!empty($indirec)) { - $lines = explode("\n", $indirec); - $newindirec = ''; - $lastlevel = -1; - foreach ($lines as $indexval => $line) { - $lct = preg_match("/^(\d+)/", $line, $levelmatch); - if ($lct>0) $level = $levelmatch[1]; - else $level = 1; - //-- make sure we don't add any sublevel records - if ($level<=$lastlevel) $lastlevel = -1; - if ((strpos($line, "@$pid@")===false) && ($lastlevel==-1)) $newindirec .= $line."\n"; - else { - $lastlevel=$level; - } - } - replace_gedrec($id, WT_GED_ID, $newindirec); - } - } - if ($success) { - delete_gedrec($pid, WT_GED_ID); - } - return true; - } - return false; -} |
