static function &getInstance($data, $simple = true)
 {
     global $gedcom_record_cache, $GEDCOM, $pgv_changes;
     if (is_array($data)) {
         $ged_id = $data['ged_id'];
         $pid = $data['xref'];
     } else {
         $ged_id = get_id_from_gedcom($GEDCOM);
         $pid = $data;
     }
     // Check the cache first
     if (isset($gedcom_record_cache[$pid][$ged_id])) {
         return $gedcom_record_cache[$pid][$ged_id];
     }
     // Look for the record in the database
     if (!is_array($data)) {
         $data = fetch_other_record($pid, $ged_id);
         // If we didn't find the record in the database, it may be remote
         if (!$data && strpos($pid, ':')) {
             list($servid, $remoteid) = explode(':', $pid);
             $service = ServiceClient::getInstance($servid);
             if ($service) {
                 // TYPE will be replaced with the type from the remote record
                 $data = $service->mergeGedcomRecord($remoteid, "0 @{$pid}@ TYPE\n1 RFN {$pid}", false);
             }
         }
         // If we didn't find the record in the database, it may be new/pending
         if (!$data && PGV_USER_CAN_EDIT && isset($pgv_changes[$pid . '_' . $GEDCOM])) {
             $data = find_updated_record($pid);
             $fromfile = true;
         }
         // If we still didn't find it, it doesn't exist
         if (!$data) {
             return null;
         }
     }
     // Create the object
     $object = new Repository($data, $simple);
     if (!empty($fromfile)) {
         $object->setChanged(true);
     }
     // Store it in the cache
     $gedcom_record_cache[$object->xref][$object->ged_id] =& $object;
     //-- also store it using its reference id (sid:pid and local gedcom for remote links)
     $gedcom_record_cache[$pid][$ged_id] =& $object;
     return $object;
 }
Example #2
0
 /**
  * Initialization function
  */
 function init()
 {
     global $USE_RIN, $MAX_ALIVE_AGE, $GEDCOM, $GEDCOM_DEFAULT_TAB, $pgv_changes, $pgv_lang, $CHARACTER_SET;
     global $USE_QUICK_UPDATE, $pid;
     global $Fam_Navigator, $gBitUser, $gGedcom;
     $this->sexarray["M"] = $pgv_lang["male"];
     $this->sexarray["F"] = $pgv_lang["female"];
     $this->sexarray["U"] = $pgv_lang["unknown"];
     $this->pid = safe_GET_xref('pid');
     $show_famlink = $this->view != 'preview';
     $pid = $this->pid;
     $this->default_tab = $GEDCOM_DEFAULT_TAB;
     $indirec = find_person_record($this->pid);
     if ($USE_RIN && $indirec == false) {
         $this->pid = find_rin_id($this->pid);
         $indirec = find_person_record($this->pid);
     }
     if (empty($indirec)) {
         $ct = preg_match("/(\\w+):(.+)/", $this->pid, $match);
         if ($ct > 0) {
             $servid = trim($match[1]);
             $remoteid = trim($match[2]);
             include_once 'includes/classes/class_serviceclient.php';
             $service = ServiceClient::getInstance($servid);
             if ($service != null) {
                 $newrec = $service->mergeGedcomRecord($remoteid, "0 @" . $this->pid . "@ INDI\n1 RFN " . $this->pid, false);
                 $indirec = $newrec;
             }
         } else {
             if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) {
                 $indirec = "0 @" . $this->pid . "@ INDI\n";
             } else {
                 return false;
             }
         }
     }
     //-- check for the user
     if ($gBitUser->isRegistered()) {
         $this->default_tab = get_user_setting($gBitUser->mUserId, 'defaulttab');
     }
     //-- check for a cookie telling what the last tab was when they were last
     //-- visiting this individual
     if ($this->default_tab == -2) {
         if (isset($_COOKIE['lasttabs'])) {
             $ct = preg_match("/" . $this->pid . "=(\\d+)/", $_COOKIE['lasttabs'], $match);
             if ($ct > 0) {
                 $this->default_tab = $match[1] - 1;
             }
         }
     }
     //-- if the action is a research assistant action then default to the RA tab
     if (strstr($this->action, 'ra_') !== false) {
         $this->default_tab = 6;
     }
     //-- set the default tab from a request parameter
     if (isset($_REQUEST['tab'])) {
         $this->default_tab = $_REQUEST['tab'];
     }
     if ($this->default_tab < -2 || $this->default_tab > 9) {
         $this->default_tab = 0;
     }
     $this->indi = new Person($indirec, false);
     $this->indi->ged_id = $gGedcom->mGEDCOMId;
     // This record is from a file
     //-- if the person is from another gedcom then forward to the correct site
     /*
     if ($this->indi->isRemote()) {
     	header('Location: '.encode_url(decode_url($this->indi->getLinkUrl()), false));
     	exit;
     }
     */
     if (!$this->isPrintPreview()) {
         $this->visibility = "hidden";
         $this->position = "absolute";
         $this->display = "none";
     }
     //-- perform the desired action
     switch ($this->action) {
         case "addfav":
             $this->addFavorite();
             break;
         case "accept":
             $this->acceptChanges();
             break;
         case "undo":
             $this->indi->undoChange();
             break;
     }
     //-- if the user can edit and there are changes then get the new changes
     if ($this->show_changes && $gGedcom->isEditable()) {
         if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) {
             //-- get the changed record from the file
             $newrec = find_updated_record($this->pid);
             //print("jkdsakjhdkjsadkjsakjdhsakd".$newrec);
             $remoterfn = get_gedcom_value("RFN", 1, $newrec);
         } else {
             $remoterfn = get_gedcom_value("RFN", 1, $indirec);
         }
         // print "remoterfn=".$remoterfn;
         //-- get an updated record from the web service
         if (!empty($remoterfn)) {
             $parts = explode(':', $remoterfn);
             if (count($parts) == 2) {
                 $servid = $parts[0];
                 $aliaid = $parts[1];
                 if (!empty($servid) && !empty($aliaid)) {
                     require_once "includes/classes/class_serviceclient.php";
                     $serviceClient = ServiceClient::getInstance($servid);
                     if (!is_null($serviceClient)) {
                         if (!empty($newrec)) {
                             $mergerec = $serviceClient->mergeGedcomRecord($aliaid, $newrec, true);
                         } else {
                             $mergerec = $serviceClient->mergeGedcomRecord($aliaid, $indirec, true);
                         }
                         if ($serviceClient->type == "remote") {
                             $newrec = $mergerec;
                         } else {
                             $indirec = $mergerec;
                         }
                     }
                 }
             }
         }
         if (!empty($newrec)) {
             $this->diffindi = new Person($newrec, false);
             $this->diffindi->setChanged(true);
             $indirec = $newrec;
         }
     }
     if ($this->show_changes) {
         $this->indi->diffMerge($this->diffindi);
     }
     //-- only allow editors or users who are editing their own individual or their immediate relatives
     if ($this->indi->canDisplayDetails()) {
         $this->canedit = $gGedcom->isEditable();
         /* Disable self-editing completely until we have a GEDCOM config option to control this
         			if (!$this->canedit && $USE_QUICK_UPDATE) {
         				$my_id=PGV_USER_GEDCOM_ID;
         				if ($my_id) {
         					if ($this->pid==$my_id) $this->canedit=true;
         					else {
         						$famids = array_merge(find_sfamily_ids($my_id), find_family_ids($my_id));
         						foreach($famids as $indexval => $famid) {
         							if (!isset($pgv_changes[$famid."_".$GEDCOM])) $famrec = find_family_record($famid);
         							else $famrec = find_updated_record($famid);
         							if (preg_match("/1 (HUSB|WIFE|CHIL) @$this->pid@/", $famrec)>0) $this->canedit=true;
         						}
         					}
         				}
         			}
         */
     }
     //-- handle ajax calls
     if ($this->action == "ajax") {
         $tab = 0;
         if (isset($_REQUEST['tab'])) {
             $tab = $_REQUEST['tab'] - 1;
         }
         header("Content-Type: text/html; charset={$CHARACTER_SET}");
         //AJAX calls do not have the meta tag headers and need this set
         $this->getTab($tab);
         //-- only get the requested tab and then exit
         /* TODO
         			if (PGV_DEBUG_SQL) {
         				echo ADOdb::getQueryLog();
         			}
          */
         exit;
     }
 }
Example #3
0
/**
 * find the highlighted media object for a gedcom entity
 *
 * Rules for finding the highlighted media object:
 * 1. The first _PRIM Y object will be used regardless of level in gedcom record
 * 2. The first level 1 object will be used if there if it doesn't have _PRIM N (level 1 objects appear on the media tab on the individual page)
 *
 * @param string $pid the individual, source, or family id
 * @param string $indirec the gedcom record to look in
 * @return array an object array with indexes "thumb" and "file" for thumbnail and filename
 */
function find_highlighted_object($pid, $indirec)
{
    global $MEDIA_DIRECTORY, $MEDIA_DIRECTORY_LEVELS, $PGV_IMAGE_DIR, $PGV_IMAGES, $MEDIA_EXTERNAL;
    global $GEDCOMS, $GEDCOM, $TBLPREFIX, $gBitDb;
    if (!showFactDetails("OBJE", $pid)) {
        return false;
    }
    $object = array();
    $media = array();
    //-- handle finding the media of remote objects
    $ct = preg_match("/(.*):(.*)/", $pid, $match);
    if ($ct > 0) {
        require_once '../classes/class_serviceclient.php';
        $client = ServiceClient::getInstance($match[1]);
        if (!is_null($client)) {
            $mt = preg_match_all('/\\n\\d OBJE @(' . PGV_REGEX_XREF . ')@/', $indirec, $matches, PREG_SET_ORDER);
            for ($i = 0; $i < $mt; $i++) {
                $mediaObj = Media::getInstance($matches[$i][1]);
                $mrec = $mediaObj->getGedcomRecord();
                if (!empty($mrec)) {
                    $file = get_gedcom_value("FILE", 1, $mrec);
                    $row = array($matches[$i][1], $file, $mrec, $matches[$i][0]);
                    $media[] = $row;
                }
            }
        }
    }
    //-- find all of the media items for a person
    $media = $gBitDb->query("SELECT m_media, m_file, m_gedrec, mm_gedrec FROM {$TBLPREFIX}media, {$TBLPREFIX}media_mapping WHERE m_media=mm_media AND m_gedfile=mm_gedfile AND m_gedfile=? AND mm_gid=? ORDER BY mm_order", array($GEDCOMS[$GEDCOM]["id"], $pid));
    while ($row = $media->fetchRow()) {
        if (displayDetailsById($row['m_media'], 'OBJE') && !FactViewRestricted($row['m_media'], $row['m_gedrec'])) {
            $level = 0;
            $ct = preg_match("/(\\d+) OBJE/", $row['mm_gedrec'], $match);
            if ($ct > 0) {
                $level = $match[1];
            }
            if (strstr($row['mm_gedrec'], "_PRIM ")) {
                $thum = get_gedcom_value('_THUM', $level + 1, $row['mm_gedrec']);
                $prim = get_gedcom_value('_PRIM', $level + 1, $row['mm_gedrec']);
            } else {
                $thum = get_gedcom_value('_THUM', 1, $row['m_gedrec']);
                $prim = get_gedcom_value('_PRIM', 1, $row['m_gedrec']);
            }
            if ($prim == 'N') {
                continue;
            }
            // Skip _PRIM N objects
            if ($prim == 'Y') {
                // Take the first _PRIM Y object
                $object["file"] = check_media_depth($row['m_file']);
                $object["thumb"] = thumbnail_file($row['m_file'], true, false, $pid);
                //				$object["_PRIM"] = $prim;	// Not sure whether this is needed.
                $object["_THUM"] = $thum;
                // This overrides GEDCOM's "Use main image as thumbnail" option
                $object["level"] = $level;
                $object["mid"] = $row['m_media'];
                break;
                // Stop looking: we found a suitable image
            }
            if ($level == 1 && empty($object)) {
                // Take the first level 1 object, but keep looking for an overriding _PRIM Y
                $object["file"] = check_media_depth($row['m_file']);
                $object["thumb"] = thumbnail_file($row['m_file'], true, false, $pid);
                //				$object["_PRIM"] = $prim;	// Not sure whether this is needed.
                $object["_THUM"] = $thum;
                // This overrides GEDCOM's "Use main image as thumbnail" option
                $object["level"] = $level;
                $object["mid"] = $row['m_media'];
            }
        }
    }
    return $object;
}
Example #4
0
 function init()
 {
     global $Dbwidth, $bwidth, $pbwidth, $pbheight, $bheight, $GEDCOM, $pgv_lang, $CONTACT_EMAIL, $show_famlink, $pgv_changes;
     $bwidth = $Dbwidth;
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     $show_famlink = $this->view != 'preview';
     $this->famid = safe_GET_xref('famid');
     $this->family = Family::getInstance($this->famid);
     if (empty($this->famrec)) {
         $ct = preg_match("/(\\w+):(.+)/", $this->famid, $match);
         if ($ct > 0) {
             $servid = trim($match[1]);
             $remoteid = trim($match[2]);
             include_once 'includes/classes/class_serviceclient.php';
             $service = ServiceClient::getInstance($servid);
             if (!is_null($service)) {
                 $newrec = $service->mergeGedcomRecord($remoteid, "0 @" . $this->famid . "@ FAM\n1 RFN " . $this->famid, false);
                 $this->famrec = $newrec;
             }
         }
         //-- if no record was found create a default empty one
         if (isset($pgv_changes[$this->famid . "_" . $GEDCOM])) {
             $this->famrec = "0 @" . $this->famid . "@ FAM\n";
             $this->family = new Family($this->famrec);
         } else {
             if (empty($this->family)) {
                 return false;
             }
         }
     }
     $this->famrec = $this->family->getGedcomRecord();
     $this->display = displayDetailsById($this->famid, 'FAM');
     //-- if the user can edit and there are changes then get the new changes
     if ($this->show_changes && PGV_USER_CAN_EDIT && isset($pgv_changes[$this->famid . "_" . $GEDCOM])) {
         $newrec = find_updated_record($this->famid);
         if (empty($newrec)) {
             $newrec = find_family_record($this->famid);
         }
         $this->difffam = new Family($newrec);
         $this->difffam->setChanged(true);
         $this->family->diffMerge($this->difffam);
         //$this->famrec = $newrec;
         //$this->family = new Family($this->famrec);
     }
     $this->parents = array('HUSB' => $this->family->getHusbId(), 'WIFE' => $this->family->getWifeId());
     //-- check if we can display both parents
     if ($this->display == false) {
         $this->showLivingHusb = showLivingNameById($this->parents['HUSB']);
         $this->showLivingWife = showLivingNameById($this->parents['WIFE']);
     }
     //-- add favorites action
     if ($this->action == 'addfav' && !empty($_REQUEST['gid']) && PGV_USER_NAME) {
         $_REQUEST['gid'] = strtoupper($_REQUEST['gid']);
         $indirec = find_family_record($_REQUEST['gid']);
         if ($indirec) {
             $favorite = array('username' => PGV_USER_NAME, 'gid' => $_REQUEST['gid'], 'type' => 'FAM', 'file' => $GEDCOM, 'url' => '', 'note' => '', 'title' => '');
             addFavorite($favorite);
         }
     }
     if (PGV_USER_CAN_ACCEPT) {
         if ($this->action == 'accept') {
             if (accept_changes($_REQUEST['famid'] . '_' . $GEDCOM)) {
                 $this->show_changes = false;
                 $this->accept_success = true;
                 //-- check if we just deleted the record and redirect to index
                 $famrec = find_family_record($_REQUEST['famid']);
                 if (empty($famrec)) {
                     header("Location: index.php?ctype=gedcom");
                     exit;
                 }
                 $this->family = new Family($famrec);
                 $this->parents = find_parents($_REQUEST['famid']);
             }
         }
         if ($this->action == 'undo') {
             $this->family->undoChange();
             $this->parents = find_parents($_REQUEST['famid']);
         }
     }
     //-- make sure we have the true id from the record
     $ct = preg_match("/0 @(.*)@/", $this->famrec, $match);
     if ($ct > 0) {
         $this->famid = trim($match[1]);
     }
     if ($this->showLivingHusb == false && $this->showLivingWife == false) {
         print_header($pgv_lang['private'] . " " . $pgv_lang['family_info']);
         print_privacy_error($CONTACT_EMAIL);
         print_footer();
         exit;
     }
     $this->title = $this->family->getFullName();
     if (empty($this->parents['HUSB']) || empty($this->parents['WIFE'])) {
         $this->link_relation = 0;
     } else {
         $this->link_relation = 1;
     }
 }
 /**
  * constructor
  * @param string $gedrec	the gedcom record
  */
 function LocalClient($gedrec)
 {
     parent::ServiceClient($gedrec);
     $this->type = "local";
 }
Example #6
0
 function addLink()
 {
     global $pgv_lang, $GEDCOM;
     switch ($this->form_location) {
         case 'remote':
             $serverID = $this->addRemoteServer($this->form_txtTitle, $this->form_txtURL, $this->form_txtGID, $this->form_txtUsername, $this->form_txtPassword);
             break;
         case 'local':
             $serverID = $this->addLocalServer($this->form_txtCB_Title, $this->form_txtCB_GID);
             break;
         case 'existing':
             $serverID = $this->form_cbExistingServers;
             break;
         case "FamilySearch":
             //TODO: Make sure that it is merging correctly
             $serverID = $this->addFamilySearchServer($this->form_txtFS_URL, $this->form_txtFS_URL, $this->form_txtFS_GID, $this->form_txtFS_Username, $this->form_txtFS_Password);
             break;
     }
     $link_pid = $this->form_txtPID;
     $relation_type = $this->form_cbRelationship;
     if ($serverID && $link_pid) {
         if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) {
             $indirec = find_updated_record($this->pid);
         } else {
             $indirec = find_person_record($this->pid);
         }
         switch ($relation_type) {
             case "father":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 $gedcom_fam = "0 @new@ FAM\n1 HUSB @{$stub_id}@\n1 CHIL @{$this->pid}@";
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMC @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case "mother":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 $gedcom_fam = "0 @new@ FAM\n1 WIFE @{$stub_id}@\n1 CHIL @{$this->pid}@";
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMC @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMS @" . $fam_id . "@";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case "husband":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 $gedcom_fam = "0 @new@ FAM\n1 MARR Y\n1 WIFE @{$this->pid}@\n1 HUSB @{$stub_id}@\n";
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case "wife":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 $gedcom_fam = "0 @new@ FAM\n1 MARR Y\n1 WIFE @{$stub_id}@\n1 HUSB @{$this->pid}@";
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMS @{$fam_id}@\n";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case "son":
             case "daughter":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 if (get_gedcom_value('SEX', 1, $indirec, '', false) == 'F') {
                     $gedcom_fam = "0 @new@ FAM\n1 WIFE @{$this->pid}@\n1 CHIL @{$stub_id}@";
                 } else {
                     $gedcom_fam = "0 @new@ FAM\n1 HUSB @{$this->pid}@\n1 CHIL @{$stub_id}@";
                 }
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMC @" . $fam_id . "@";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case 'current_person':
                 $indirec .= "\n1 RFN {$serverID}:{$link_pid}\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}";
                 $serviceClient = ServiceClient::getInstance($serverID);
                 if (!is_null($serviceClient)) {
                     //-- get rid of change date
                     $pos1 = strpos($indirec, "\n1 CHAN");
                     if ($pos1 !== false) {
                         $pos2 = strpos($indirec, "\n1", $pos1 + 5);
                         $indirec = substr($indirec, 0, $pos1) . substr($indirec, $pos2);
                     }
                     $indirec = $serviceClient->mergeGedcomRecord($link_pid, $indirec, true, true);
                 } else {
                     echo 'Unable to find server';
                 }
                 break;
         }
         echo '<b>', $pgv_lang['link_success'], '</b>';
         return true;
     }
     return false;
 }
Example #7
0
 function printResults()
 {
     include_once "includes/functions/functions_print_lists.php";
     global $GEDCOM, $GEDCOMS, $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang, $global_facts;
     //-- all privacy settings must be global if we are going to load up privacy files
     global $SHOW_DEAD_PEOPLE, $SHOW_LIVING_NAMES, $SHOW_SOURCES, $MAX_ALIVE_AGE, $USE_RELATIONSHIP_PRIVACY, $MAX_RELATION_PATH_LENGTH;
     global $CHECK_MARRIAGE_RELATIONS, $PRIVACY_BY_YEAR, $PRIVACY_BY_RESN, $SHOW_PRIVATE_RELATIONSHIPS, $person_privacy, $user_privacy;
     global $global_facts, $person_facts;
     $somethingPrinted = false;
     // whether anything printed
     // ---- section to search and display results on a general keyword search
     if ($this->action == "general" || $this->action == "soundex" || $this->action == "replace") {
         if ($this->myindilist || $this->myfamlist || $this->mysourcelist || $this->mynotelist) {
             echo '<br />';
             $OLD_GEDCOM = $GEDCOM;
             // Split individuals by gedcom
             foreach ($this->sgeds as $gedcom) {
                 $datalist = array();
                 foreach ($this->myindilist as $individual) {
                     if ($individual->getGedId() == get_id_from_gedcom($gedcom)) {
                         $datalist[] = $individual;
                     }
                 }
                 if ($datalist) {
                     $somethingPrinted = true;
                     usort($datalist, array('GedcomRecord', 'Compare'));
                     $GEDCOM = $gedcom;
                     print_indi_table($datalist, $pgv_lang['individuals'] . ' : &laquo;' . $this->myquery . '&raquo; @ ' . PrintReady($GEDCOMS[$gedcom]['title'], true));
                 }
             }
             // Split families by gedcom
             foreach ($this->sgeds as $gedcom) {
                 $datalist = array();
                 foreach ($this->myfamlist as $family) {
                     if ($family->getGedId() == get_id_from_gedcom($gedcom)) {
                         $datalist[] = $family;
                     }
                 }
                 if ($datalist) {
                     $somethingPrinted = true;
                     usort($datalist, array('GedcomRecord', 'Compare'));
                     $GEDCOM = $gedcom;
                     print_fam_table($datalist, $pgv_lang['families'] . ' : &laquo;' . $this->myquery . '&raquo; @ ' . PrintReady($GEDCOMS[$gedcom]['title'], true));
                 }
             }
             // Split sources by gedcom
             foreach ($this->sgeds as $gedcom) {
                 $datalist = array();
                 foreach ($this->mysourcelist as $source) {
                     if ($source->getGedId() == get_id_from_gedcom($gedcom)) {
                         $datalist[] = $source;
                     }
                 }
                 if ($datalist) {
                     $somethingPrinted = true;
                     usort($datalist, array('GedcomRecord', 'Compare'));
                     $GEDCOM = $gedcom;
                     print_sour_table($datalist, $pgv_lang['sources'] . ' : &laquo;' . $this->myquery . '&raquo; @ ' . PrintReady($GEDCOMS[$gedcom]['title'], true));
                 }
             }
             // Split notes by gedcom
             foreach ($this->sgeds as $gedcom) {
                 $datalist = array();
                 foreach ($this->mynotelist as $note) {
                     if ($note->getGedId() == get_id_from_gedcom($gedcom)) {
                         $datalist[] = $note;
                     }
                 }
                 if ($datalist) {
                     $somethingPrinted = true;
                     usort($datalist, array('GedcomRecord', 'Compare'));
                     $GEDCOM = $gedcom;
                     print_note_table($datalist, $pgv_lang['notes'] . ' : &laquo;' . $this->myquery . '&raquo; @ ' . PrintReady($GEDCOMS[$gedcom]['title'], true));
                 }
             }
             $GEDCOM = $OLD_GEDCOM;
         } else {
             if (isset($this->query)) {
                 print "<br /><div class=\"warning\" style=\" text-align: center;\"><i>" . $pgv_lang["no_results"] . "</i><br />";
                 if (!isset($this->srindi) && !isset($this->srfams) && !isset($this->srsour) && !isset($this->srnote)) {
                     print "<i>" . $pgv_lang["no_search_for"] . "</i><br />";
                 }
                 echo '</div>';
             }
         }
         // Prints the Paged Results: << 1 2 3 4 >> links if there are more than $this->resultsPerPage results
         if ($this->resultsPerPage >= 1 && $this->totalGeneralResults > $this->resultsPerPage) {
             $this->printPageResultsLinks($this->inputFieldNames, $this->totalGeneralResults, $this->resultsPerPage);
         }
     }
     // ----- section to search and display results for multisite
     if ($this->action == "multisite") {
         // Only Display 5 results per 2 sites if the total results per page is 10
         $sitesChecked = 0;
         $i = 0;
         foreach ($this->Sites as $server) {
             $siteName = "server" . $i;
             if (isset($_REQUEST["{$siteName}"])) {
                 $sitesChecked++;
             }
             $i++;
         }
         if ($sitesChecked >= 1) {
             $this->multiResultsPerPage = $this->resultsPerPage / $sitesChecked;
             if (!empty($this->Sites) && count($this->Sites) > 0) {
                 $no_results_found = false;
                 // Start output here, because from the indi's we may have printed some fams which need the column header.
                 print "<br />";
                 print "<div class=\"center\">";
                 if (isset($this->multisiteResults) && count($this->multisiteResults) > 0) {
                     $this->totalResults = 0;
                     $this->multiTotalResults = 0;
                     $somethingPrinted = true;
                     foreach ($this->multisiteResults as $key => $siteResults) {
                         include_once 'includes/classes/class_serviceclient.php';
                         $serviceClient = ServiceClient::getInstance($key);
                         $siteName = $serviceClient->getServiceTitle();
                         $siteURL = dirname($serviceClient->getURL());
                         print "<table id=\"multiResultsOutTbl\" class=\"list_table, {$TEXT_DIRECTION}\" align=\"center\">";
                         if (isset($siteResults) && !empty($siteResults->persons)) {
                             $displayed_once = false;
                             $personlist = $siteResults->persons;
                             /***************************************************** PAGING HERE **********************************************************************/
                             //set the total results and only get the results for this page
                             $this->multiTotalResults += count($personlist);
                             if ($this->totalResults < $this->multiTotalResults) {
                                 $this->totalResults = $this->multiTotalResults;
                             }
                             $personlist = $this->getPagedResults($personlist, $this->multiResultsPerPage);
                             $pageResultsNum = 0;
                             foreach ($personlist as $index => $person) {
                                 //if there is a name to display then diplay it
                                 if (!empty($person->gedcomName)) {
                                     if (!$displayed_once) {
                                         if (!$no_results_found) {
                                             $no_results_found = true;
                                             print "<tr><td class=\"list_label\" colspan=\"2\" width=\"100%\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["indis"]["large"] . "\" border=\"0\" width=\"25\" alt=\"\" /> " . $pgv_lang["people"] . "</td></tr>";
                                             print "<tr><td><table id=\"multiResultsInTbl\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" ><tr>";
                                         }
                                         $displayed_once = true;
                                         print "<td class=\"list_label\" colspan=\"2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" >" . $pgv_lang["site_list"] . "<a href=\"" . encode_url($siteURL) . "\" target=\"_blank\">" . $siteName . "</a>" . $pgv_lang["site_had"] . "</td></tr>";
                                     }
                                     print "<tr><td class=\"list_value {$TEXT_DIRECTION}\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" valign=\"center\" ><ul>";
                                     print "<li class=\"{$TEXT_DIRECTION}\" dir=\"{$TEXT_DIRECTION}\">";
                                     print "<a href=\"" . encode_url("{$siteURL}/individual.php?pid={$person->PID}&ged={$serviceClient->gedfile}") . "\" target=\"_blank\">";
                                     $pageResultsNum += 1;
                                     print "<b>" . $person->getFullName() . "</b>";
                                     if (!empty($person->PID)) {
                                         print " (" . $person->PID . ")";
                                     }
                                     if (!empty($person->birthDate) || !empty($person->birthPlace)) {
                                         print " -- <i>";
                                         if (!empty($person->birthDate)) {
                                             print " " . $person->birthDate;
                                         }
                                         if (!empty($person->birthPlace)) {
                                             print " " . $person->birthPlace;
                                         }
                                         print "</i>";
                                     }
                                     print "</a></li></ul></td>";
                                     /*******************************  Remote Links Per Result *************************************************/
                                     if (PGV_USER_CAN_EDIT) {
                                         print "<td class=\"list_value {$TEXT_DIRECTION}\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" >" . "<ul style=\"list-style: NONE\"><li><a href=\"javascript:;\" " . "onclick=\"return open_link('" . $key . "', '" . $person->PID . "', '" . $person->getFullName() . "');\">" . "<b>" . $pgv_lang["title_search_link"] . "</b></a></ul></li></td></tr>\n";
                                     }
                                 }
                             }
                             print "</table>";
                             print "\n\t\t&nbsp;</td></tr></table>";
                         }
                         if ($this->multiTotalResults > 0) {
                             print "</tr><tr><td align=\"left\">Displaying individuals ";
                             print $this->multiResultsPerPage * $this->resultsPageNum + 1 . " " . $pgv_lang["search_to"] . " " . ($this->multiResultsPerPage * $this->resultsPageNum + $pageResultsNum);
                             print " " . $pgv_lang["of"] . " " . $this->multiTotalResults . "</td></tr></table>";
                             $this->multiTotalResults = 0;
                         } else {
                             print "</tr></table>";
                         }
                     }
                     print "</table>";
                 }
                 echo '</div>';
                 if (!$no_results_found && $this->multiTotalResults == 0 && (isset($this->multiquery) || isset($this->name) || isset($this->birthdate) || isset($this->birthplace) || isset($this->deathdate) || isset($this->deathplace) || isset($this->gender))) {
                     print "<table align=\"center\" \\><td class=\"warning\" style=\" text-align: center;\"><font color=\"red\"><b><i>" . $pgv_lang["no_results"] . "</i></b></font><br /></td></tr></table>";
                 }
             }
         } else {
             if ($sitesChecked < 1 && $this->isPostBack) {
                 print "<table align=\"center\" \\><tr><td class=\"warning\" style=\" text-align: center;\"><font color=\"red\"><b><i>" . $pgv_lang["no_search_site"] . "</i></b></font><br /></td></tr></table>";
             }
         }
         print "</table>";
         // Prints the Paged Results: << 1 2 3 4 >> links if there are more than $this->resultsPerPage results
         if ($this->resultsPerPage > 1 && $this->totalResults > $this->resultsPerPage) {
             $this->printPageResultsLinks($this->inputFieldNames, $this->totalResults, $this->multiResultsPerPage);
         }
     }
     return $somethingPrinted;
     // whether anything printed
 }
     $obj_page->setData('questions', $tab_questions);
     $obj_page->setData('jours', $days);
     $obj_page->setUrlPage('service_client/service_client_liste_traites');
 } else {
     if ($http_request['act'] == 'detail_message') {
         $tab_messages = ServiceClientManager::getListMessageByMembre($http_request['id']);
         $obj_page->setData('messages', $tab_messages);
         $tab_sujets = ServiceClientManager::getSujets();
         $obj_page->setData('sujet', $tab_sujets);
         $obj_page->setAppelAjax(true);
         $obj_page->setUrlPage('service_client/service_client_conversation');
     } else {
         if ($http_request['act'] == 'update_valide') {
             $id = isset($http_request['id']) && $http_request['id'] != '' ? $http_request['id'] : null;
             $valide_message = isset($http_request['valide_message']) && $http_request['valide_message'] != '' ? $http_request['valide_message'] : null;
             $obj_message = new ServiceClient($id);
             if ($valide_message == "on") {
                 $obj_message->setValide(1);
             } else {
                 $obj_message->setValide(0);
             }
             ServiceClientManager::updateBdd($obj_message);
         } else {
             if ($http_request['act'] == 'liste_question_membre') {
                 if (isset($http_request['choix']) && $http_request['choix'] == "non_traites") {
                     $tab_joueurs = ServiceClientManager::getListNonTraitesMembre();
                 } else {
                     $tab_joueurs = ServiceClientManager::getListMembre();
                 }
                 $obj_page->setData('joueurs', $tab_joueurs);
                 $obj_page->setAppelAjax(true);
 /**
  * Get the title that should be used in the link
  * @return string
  */
 function getLinkTitle()
 {
     $title = get_gedcom_setting($this->ged_id, 'title');
     if ($this->isRemote()) {
         $parts = explode(':', $this->rfn);
         if (count($parts) == 2) {
             $servid = $parts[0];
             $aliaid = $parts[1];
             if (!empty($servid) && !empty($aliaid)) {
                 $serviceClient = ServiceClient::getInstance($servid);
                 if (!empty($serviceClient)) {
                     $title = $serviceClient->getTitle();
                 }
             }
         }
     }
     return $title;
 }