include_once "modules/db/DAOFactory.php"; $peep = new PersonDetail(); $peep->queryType = Q_IND; $pdao = getPeopleDAO(); $cen = new CensusDetail(); $dao = getCensusDAO(); if (isset($_REQUEST["func"]) && $_REQUEST["func"] == "delete") { $peep->setFromRequest(); $pdao->getPersonDetails($peep); $peep = $peep->results[0]; if (!$peep->isEditable()) { die(include "inc/forbidden.inc.php"); } $cen->setFromRequest(); $dao->deleteCensusRecord($cen); stamppeeps($peep); } else { $peep->setFromPost(); $pdao->getPersonDetails($peep); $peep = $peep->results[0]; if (!$peep->isEditable()) { die(include "inc/forbidden.inc.php"); } $cen->setFromPost(); $e = new Event(); $e->setFromPost(); $prefix = 'a'; $e->sources = array(); while (isset($_POST[$prefix . "_title"])) { $s = new Source(); $s->setFromPost($prefix . "_");
if ($e->type == BIRTH_EVENT && $attendee) { $addEvent = true; $e->attendees = array(); if ($a->person->person_id == '') { $a->person->person_id = $per->father->person_id; } if ($a->person->person_id != '') { $e->attendees[] = $a; } } $prefix = 'a'; $e->sources = array(); while (isset($_POST[$prefix . "_" . $strEvent[$i] . "title"])) { $s = new Source(); $s->setFromPost($prefix . "_" . $strEvent[$i]); if ($s->hasData()) { $e->sources[] = $s; } $prefix++; } if ($addEvent) { $per->events[] = $e; } } if ($dao->savePersonDetails($per) > 0) { //Only stamp if changed stamppeeps($per); } $loc = "people.php?person=" . $per->person_id; } header("Location: " . $loc);
function stampAttendees($e) { $pdao = getPeopleDAO(); foreach ($e->attendees as $a) { if ($a->changed == false) { continue; } $peep = $a->person; $peep->queryType = Q_IND; $pdao->getPersonDetails($peep); $peep = $peep->results[0]; if (!$peep->isEditable()) { die(include "inc/forbidden.inc.php"); } stamppeeps($peep); } }
$dao->getRelationshipDetails($peep); $peep = $peep->results[0]; if (!$peep->isEditable()) { die(include "inc/forbidden.inc.php"); } if (isset($rel->oldRelation) && $rel->oldRelation != $peep->relation->person_id) { $old = new PersonDetail(); $old->queryType = Q_IND; $pdao = getPeopleDAO(); $old->person_id = $rel->oldRelation; $pdao->getPersonDetails($old); $old = $old->results[0]; if (!$old->isEditable()) { die(include "inc/forbidden.inc.php"); } else { stamppeeps($old); } } $rel->setFromPost(); $e = new Event(); $e->setFromPost(); $prefix = 'a'; $e->attendees = array(); while (isset($_POST[$prefix . "person_id"])) { $a = new Attendee(); $a->setFromPost($prefix); $l = new Location(); $l->setFromPost($prefix); $a->location = $l; if ($a->hasData()) { $e->attendees[] = $a;