Example #1
0
 $text = WT_Filter::postArray('text');
 $islink = WT_Filter::postArray('islink', '[01]');
 $family = WT_Family::getInstance($xref);
 check_record_access($family);
 if (!WT_Filter::checkCsrf()) {
     $famtag = WT_Filter::get('famtag', 'HUSB|WIFE');
     Zend_Session::writeClose();
     header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=add_spouse_to_family&xref=' . $xref . '&famtag=' . $famtag);
     exit;
 }
 $controller->pageHeader();
 // Create the new spouse
 splitSOUR();
 // separate SOUR record from the rest
 $gedrec = "0 @REF@ INDI";
 $gedrec .= addNewName();
 $gedrec .= addNewSex();
 if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FACTS, $matches)) {
     foreach ($matches[1] as $match) {
         $gedrec .= addNewFact($match);
     }
 }
 if (WT_Filter::postBool('SOUR_INDI')) {
     $gedrec = handle_updates($gedrec);
 } else {
     $gedrec = updateRest($gedrec);
 }
 $gedrec .= "\n1 FAMS @" . $family->getXref() . "@";
 $spouse = WT_GedcomRecord::createRecord($gedrec, WT_GED_ID);
 // Update the existing family - add marriage, etc
 if ($family->getFirstFact('HUSB')) {
                 replace_gedrec($pid, $indirec, $update_CHAN);
             }
         }
     }
     break;
     //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 case 'addopfchildaction':
     if (PGV_DEBUG) {
         phpinfo(INFO_VARIABLES);
     }
     splitSOUR();
     // separate SOUR record from the rest
     $newindixref = get_new_xref('INDI');
     $newfamxref = get_new_xref('FAM');
     $gedrec = "0 @{$newindixref}@ INDI\n1 FAMC @{$newfamxref}@\n" . addNewName() . addNewSex();
     if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FACTS, $matches)) {
         foreach ($matches[1] as $match) {
             $gedrec .= addNewFact($match);
         }
     }
     if (safe_POST_bool('SOUR_INDI')) {
         $gedrec = handle_updates($gedrec);
     } else {
         $gedrec = updateRest($gedrec);
     }
     $famrec = "0 @{$newfamxref}@ FAM\n1 CHIL @{$newindixref}@";
     $person = Person::getInstance($pid);
     if ($person->getSex() == 'F') {
         $famrec .= "\n1 WIFE @{$pid}@";
     } else {