diff options
| author | fisharebest <fisharebest@gmail.com> | 2013-07-05 22:19:27 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2013-07-05 22:19:27 +0000 |
| commit | 0c110dca9ce181a3e21df70c034617bf447fb63a (patch) | |
| tree | 022ea6b990531cc9b33ed42f0f2c05ae45946a1c | |
| parent | 11c7bec9fe404966bedcec618fc461449cd5fa57 (diff) | |
| download | webtrees-0c110dca9ce181a3e21df70c034617bf447fb63a.tar.gz webtrees-0c110dca9ce181a3e21df70c034617bf447fb63a.tar.bz2 webtrees-0c110dca9ce181a3e21df70c034617bf447fb63a.zip | |
Rollback some ideas about always returning gedcom records, even for invalid links.
| -rw-r--r-- | library/WT/Family.php | 10 | ||||
| -rw-r--r-- | library/WT/GedcomRecord.php | 8 | ||||
| -rw-r--r-- | library/WT/Media.php | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/library/WT/Family.php b/library/WT/Family.php index 5e1b531f99..a27a1bd827 100644 --- a/library/WT/Family.php +++ b/library/WT/Family.php @@ -44,13 +44,15 @@ class WT_Family extends WT_GedcomRecord { // Fetch husband and wife if (preg_match('/^1 HUSB @(.+)@/m', $gedcom.$pending, $match)) { $this->husb = WT_Individual::getInstance($match[1]); - } else { - $this->husb = WT_Individual::getInstance(self::DUMMY_XREF); + } + if (!$this->husb) { + $this->husb = new WT_Individual('M', '0 @M@ INDI', null, $gedcom_id); } if (preg_match('/^1 WIFE @(.+)@/m', $gedcom.$pending, $match)) { $this->wife = WT_Individual::getInstance($match[1]); - } else { - $this->wife = WT_Individual::getInstance(self::DUMMY_XREF); + } + if (!$this->wife) { + $this->wife = new WT_Individual('F', '0 @F@ INDI', null, $gedcom_id); } // Make sure husb/wife are the right way round. diff --git a/library/WT/GedcomRecord.php b/library/WT/GedcomRecord.php index f81e82c135..13e20a46d9 100644 --- a/library/WT/GedcomRecord.php +++ b/library/WT/GedcomRecord.php @@ -137,9 +137,11 @@ class WT_GedcomRecord { // No such record exists - create a dummy one if ($gedcom === null && $pending === null) { - $xref = self::DUMMY_XREF; - $gedcom = "0 @$xref@ " . static::RECORD_TYPE . "\n1 RESN none"; - $gedcom_id = 0; + // Is this a good idea? + //$xref = self::DUMMY_XREF; + //$gedcom = "0 @$xref@ " . static::RECORD_TYPE . "\n1 RESN none"; + //$gedcom_id = 0; + return null; } // Create the object diff --git a/library/WT/Media.php b/library/WT/Media.php index bd4e93d899..19a7d1155f 100644 --- a/library/WT/Media.php +++ b/library/WT/Media.php @@ -86,7 +86,7 @@ class WT_Media extends WT_GedcomRecord { $note = $this->getFactByType('NOTE'); if ($note) { $text = $note->getValue(); - if (preg_match('//', $text)) { + if (preg_match('/@' . WT_REGEX_XREF . '@/', $text)) { $text = $note->getTarget()->getNote(); } return $text; |
