$term = WT_Filter::get('term'); // we can search on '"><& etc. $type = WT_Filter::get('field'); switch ($type) { case 'ASSO': // Associates of an individuals, whose name contains the search terms $data = array(); // Fetch all data, regardless of privacy $rows = WT_DB::prepare("SELECT 'INDI' AS type, i_id AS xref, i_file AS gedcom_id, i_gedcom AS gedcom, n_full" . " FROM `##individuals`" . " JOIN `##name` ON (i_id=n_id AND i_file=n_file)" . " WHERE (n_full LIKE CONCAT('%', REPLACE(?, ' ', '%'), '%') OR n_surn LIKE CONCAT('%', REPLACE(?, ' ', '%'), '%')) AND i_file=? ORDER BY n_full COLLATE '" . WT_I18N::$collation . "'")->execute(array($term, $term, WT_GED_ID))->fetchAll(); // Filter for privacy - and whether they could be alive at the right time $pid = WT_Filter::get('pid', WT_REGEX_XREF); $event_date = WT_Filter::get('event_date'); $record = WT_GedcomRecord::getInstance($pid); // INDI or FAM $tmp = new WT_Date($event_date); $event_jd = $tmp->JD(); // INDI $indi_birth_jd = 0; if ($record instanceof WT_Individual) { $indi_birth_jd = $record->getEstimatedBirthDate()->minJD(); } // HUSB & WIFE $husb_birth_jd = 0; $wife_birth_jd = 0; if ($record instanceof WT_Family) { $husb = $record->getHusband(); if ($husb) { $husb_birth_jd = $husb->getEstimatedBirthDate()->minJD(); } $wife = $record->getWife(); if ($wife) {