summaryrefslogtreecommitdiff
path: root/includes/controllers
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2010-12-14 15:13:32 +0000
committerfisharebest <fisharebest@gmail.com>2010-12-14 15:13:32 +0000
commit12e41de1fc066a9e05adad8c98bad11c291243ae (patch)
tree8d313c7cb34fc6a80ae4005e3ad2a0ee1de2ef82 /includes/controllers
parent970e49fb0d4fc3306e550d1dcf43a3d480d4abd7 (diff)
downloadwebtrees-12e41de1fc066a9e05adad8c98bad11c291243ae.tar.gz
webtrees-12e41de1fc066a9e05adad8c98bad11c291243ae.tar.bz2
webtrees-12e41de1fc066a9e05adad8c98bad11c291243ae.zip
Diffstat (limited to 'includes/controllers')
-rw-r--r--includes/controllers/descendancy_ctrl.php8
-rw-r--r--includes/controllers/family_ctrl.php11
-rw-r--r--includes/controllers/individual_ctrl.php48
-rw-r--r--includes/controllers/remotelink_ctrl.php397
-rw-r--r--includes/controllers/search_ctrl.php213
5 files changed, 4 insertions, 673 deletions
diff --git a/includes/controllers/descendancy_ctrl.php b/includes/controllers/descendancy_ctrl.php
index a3de123406..92c5136c6f 100644
--- a/includes/controllers/descendancy_ctrl.php
+++ b/includes/controllers/descendancy_ctrl.php
@@ -106,14 +106,6 @@ class DescendancyController extends BaseController {
$this->descPerson = Person::getInstance($this->pid);
$this->name=$this->descPerson->getFullName();
-
- //-- if the person is from another gedcom then forward to the correct site
- /*
- if ($this->indi->isRemote()) {
- header('Location: '.$this->indi->getRawUrl());
- exit;
- }
- */
}
/**
diff --git a/includes/controllers/family_ctrl.php b/includes/controllers/family_ctrl.php
index bd8e0534d8..d5ee19447b 100644
--- a/includes/controllers/family_ctrl.php
+++ b/includes/controllers/family_ctrl.php
@@ -63,17 +63,6 @@ class FamilyController extends BaseController {
$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]);
- require_once WT_ROOT.'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 (find_updated_record($this->famid, WT_GED_ID)!==null) {
$this->famrec = "0 @".$this->famid."@ FAM\n";
diff --git a/includes/controllers/individual_ctrl.php b/includes/controllers/individual_ctrl.php
index 593894bb98..1d4d5170f0 100644
--- a/includes/controllers/individual_ctrl.php
+++ b/includes/controllers/individual_ctrl.php
@@ -70,19 +70,7 @@ class IndividualController extends BaseController {
$gedrec = find_person_record($this->pid, WT_GED_ID);
}
if (empty($gedrec)) {
- $ct = preg_match('/(\w+):(.+)/', $this->pid, $match);
- if ($ct>0) {
- $servid = trim($match[1]);
- $remoteid = trim($match[2]);
- require_once WT_ROOT.'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);
- $gedrec = $newrec;
- }
- } else {
- $gedrec = "0 @".$this->pid."@ INDI\n";
- }
+ $gedrec = "0 @".$this->pid."@ INDI\n";
}
if (WT_USER_ID) {
@@ -94,7 +82,7 @@ class IndividualController extends BaseController {
}
if (find_person_record($this->pid, WT_GED_ID) || find_updated_record($this->pid, WT_GED_ID)!==null) {
- $this->indi = new Person($gedrec, false);
+ $this->indi = new Person($gedrec);
$this->indi->ged_id=WT_GED_ID; // This record is from a file
} else if (!$this->indi) {
return false;
@@ -154,38 +142,8 @@ class IndividualController extends BaseController {
//-- if the user can edit and there are changes then get the new changes
if ($this->show_changes && WT_USER_CAN_EDIT) {
$newrec = find_updated_record($this->pid, WT_GED_ID);
- if ($newrec) {
- //-- get the changed record from the file
- //print("jkdsakjhdkjsadkjsakjdhsakd".$newrec);
- $remoterfn = get_gedcom_value("RFN", 1, $newrec);
- } else {
- $remoterfn = get_gedcom_value("RFN", 1, $gedrec);
- }
- // 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 WT_ROOT.'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, $gedrec, true);
- if ($serviceClient->type=="remote") {
- $newrec = $mergerec;
- }
- else {
- $gedrec = $mergerec;
- }
- }
- }
- }
- }
if (!empty($newrec)) {
- $this->diffindi = new Person($newrec, false);
+ $this->diffindi = new Person($newrec);
$this->diffindi->setChanged(true);
$gedrec = $newrec;
}
diff --git a/includes/controllers/remotelink_ctrl.php b/includes/controllers/remotelink_ctrl.php
deleted file mode 100644
index 5b9e5a5242..0000000000
--- a/includes/controllers/remotelink_ctrl.php
+++ /dev/null
@@ -1,397 +0,0 @@
-<?php
-// Add Remote Link Page
-//
-// Allow a user the ability to add links to people from other servers and other gedcoms.
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2010 webtrees development team.
-//
-// Derived from PhpGedView
-// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// @version $Id$
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_REMOTELINK_CTRL_PHP', '');
-
-require_once WT_ROOT.'includes/controllers/basecontrol.php';
-require_once WT_ROOT.'includes/functions/functions_edit.php';
-require_once WT_ROOT.'includes/classes/class_serviceclient.php';
-
-class RemoteLinkController extends BaseController {
- var $has_familysearch=null;
- var $pid=null;
- var $person=null;
- var $server_list=null;
- var $gedcom_list=null;
-
- // Values from the add remote link form.
- public $form_txtPID=null;
- public $form_cbRelationship='current_person';
- public $form_location=null;
- public $form_txtURL=null;
- public $form_txtTitle=null;
- public $form_txtGID=null;
- public $form_txtUsername=null;
- public $form_txtPassword=null;
- public $form_cbExistingServers=null;
- public $form_txtCB_Title=null;
- public $form_txtCB_GID=null;
- public $form_txtFS_URL=null;
- public $form_txtFS_Title=null;
- public $form_txtFS_GID=null;
- public $form_txtFS_Username=null;
- public $form_txtFS_Password=null;
-
- // Initialize the controller for the add remote link
- function init() {
- // Coming soon ???
- $this->has_familysearch=file_exists(WT_ROOT.'modules/FamilySearch/familySearchWrapper.php');
- if ($this->has_familysearch) {;
- require_once WT_ROOT.'modules/FamilySearch/familySearchWrapper.php';
- }
-
- // The PID can come from a URL or a form
- $this->pid=safe_REQUEST($_REQUEST, 'pid', WT_REGEX_XREF);
-
- $this->person=Person::getInstance($this->pid);
- $this->server_list=get_server_list();
- $this->gedcom_list=get_all_gedcoms();
-
- // Other input values come from the form
- $this->form_txtPID =safe_POST('txtPID', WT_REGEX_XREF);
- $this->form_cbRelationship =safe_POST('cbRelationship');
- $this->form_location =safe_POST('location');
- $this->form_txtURL =safe_POST('txtURL', WT_REGEX_URL);
- $this->form_txtTitle =safe_POST('txtTitle', '[^<>"%{};]+');
- $this->form_txtGID =safe_POST('txtGID', preg_quote_array($this->gedcom_list));
- $this->form_txtUsername =safe_POST('txtUsername', WT_REGEX_USERNAME);
- $this->form_txtPassword =safe_POST('txtPassword', WT_REGEX_PASSWORD);
- $this->form_cbExistingServers=safe_POST('cbExistingServers', array_keys($this->server_list));
- $this->form_txtCB_Title =safe_POST('txtCB_Title', '[^<>"%{};]+');
- $this->form_txtCB_GID =safe_POST('txtCB_GID', preg_quote_array($this->gedcom_list));
- $this->form_txtFS_URL =safe_POST('txtFS_URL', WT_REGEX_URL);
- $this->form_txtFS_Title =safe_POST('txtFS_Title', '[^<>"%{};]+');
- $this->form_txtFS_GID =safe_POST('txtFS_GID', preg_quote_array($this->gedcom_list));
- $this->form_txtFS_Username =safe_POST('txtFS_Username', WT_REGEX_USERNAME);
- $this->form_txtFS_Password =safe_POST('txtFS_Password', WT_REGEX_PASSWORD);
-
- if (is_null($this->form_location)) {
- if ($this->server_list) {
- $this->form_location='existing';
- } else {
- $this->form_location='remote';
- }
- }
-
- }
-
- // Perform the desired action and return true/false success.
- function runAction($action) {
- switch ($action) {
- case 'addlink':
- return $this->addLink();
- default:
- return false;
- }
- }
-
- // Add a remote webtrees server
- //
- // @param string $title
- // @param string $url
- // @param string $gedcom_id
- // @param string $username
- // @param string $password
- // @return mixed the serverID of the server to link to
- function addRemoteServer($title, $url, $gedcom_id, $username, $password) {
- if (!$url || !$gedcom_id || !$username || !$password) {
- return null;
- }
-
- if (preg_match('/\?wsdl$/', $url)==0) {
- $url.="?wsdl";
- }
-
- $serverID=$this->checkExistingServer($url, $gedcom_id);
- if (!$serverID) {
- $gedcom_string="0 @new@ SOUR\n1 URL {$url}\n1 _DBID {$gedcom_id}\n2 _USER {$username}\n2 _PASS {$password}\n3 RESN confidential";
- $service=new ServiceClient($gedcom_string);
- $sid=$service->authenticate();
- if (PEAR::isError($sid)) {
- $sid='';
- }
- if (!$sid) {
- echo '<span class="error">failed to authenticate to remote site</span>';
- $serverID=null;
- } else {
- if (!$title) {
- $title=$service->getServiceTitle();
- }
- $gedcom_string.="\n1 TITL {$title}";
- $serverID=append_gedrec($gedcom_string, WT_GED_ID);
- }
- }
- return $serverID;
- }
-
- // Add a familySearch server
- //
- // @param string $title
- // @param string $url
- // @param string $gedcom_id
- // @param string $username
- // @param string $password
- // @return mixed the serverID of the server to link to
- function addFamilySearchServer($title, $url, $gedcom_id, $username, $password) {
- $serverID = $this->checkExistingServer($url, $gedcom_id);
- if (!$serverID) {
- $gedcom_string = "0 @new@ SOUR\n";
- $gedcom_string.= "1 URL ".$url."\n";
- $gedcom_string.= "2 TYPE FamilySearch\n";
- $gedcom_string.= "1 _DBID ".$gedcom_id."\n";
- $gedcom_string.= "2 _USER ".$username."\n";
- $gedcom_string.= "2 _PASS ".$password."\n";
- //-- only allow admin users to see password
- $gedcom_string.= "3 RESN confidential\n";
- $service = new FamilySearchWrapper($gedcom_string);
- $sid = $service->authenticate();
- if (PEAR::isError($sid)) {
- $sid = '';
- }
- if (empty($sid)) {
- echo "<span class=\"error\">failed to authenticate to remote site</span>";
- } else {
- if (empty($title)) {
- $title = $service->getServiceTitle();
- }
- $title = $service->getServiceTitle();
- $gedcom_string.= "1 TITL ".$title."\n";
- $serverID = append_gedrec($gedcom_string, WT_GED_ID);
- }
- }
- return $serverID;
- }
-
- // Add a server record for a local remote link
- //
- // @param string $gedcom_id
- // @return mixed the serverID of the server to link to
- function addLocalServer($title, $gedcom_id) {
- $serverID = $this->checkExistingServer(WT_SERVER_NAME.WT_SCRIPT_PATH, $gedcom_id);
- if (!$serverID) {
- $gedcom_string = "0 @new@ SOUR\n";
- if (empty($title)) {
- $title=get_gedcom_setting(get_id_from_gedcom($gedcom_id), 'title');
- }
- $gedcom_string.= "1 TITL ".$title."\n";
- $gedcom_string.= "1 URL ".WT_SERVER_NAME.WT_SCRIPT_PATH."\n";
- $gedcom_string.= "1 _DBID ".$gedcom_id."\n";
- $gedcom_string.= "2 _BLOCK false\n";
- $serverID = append_gedrec($gedcom_string, WT_GED_ID);
- }
- return $serverID;
- }
-
- // check if the server already exists
- //
- // @param string $url
- // @param string $gedcom_id
- // @return mixed the id of the server to link to or false if it does not exist
- function checkExistingServer($url, $gedcom_id='') {
- //-- get rid of the protocol
- $turl = preg_replace('~^\w+://~', '', $url);
- //-- check the existing server list
- foreach ($this->server_list as $id=>$server) {
- if (stristr($server['url'], $turl)) {
- if (empty($gedcom_id) || preg_match("/\n1 _DBID {$gedcom_id}/", $server['gedcom']))
- return $id;
- }
- }
-
- //-- check for recent additions
- return WT_DB::prepare(
- "SELECT xref".
- " FROM `##change`".
- " WHERE status='pending' AND gedcom_id=? AND new_gedcom LIKE CONCAT('%\n1 _DBID ', ?, '%')".
- " ORDER BY change_id DESC".
- " LIMIT 1"
- )->execute(array(WT_GED_ID, $gedcom_id))->fetchOne();
- }
-
- function addLink() {
- global $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) {
- $indirec=find_gedcom_record($this->pid, WT_GED_ID, true);
-
- 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, WT_GED_ID);
- $indistub=find_gedcom_record($stub_id, WT_GED_ID, true);
-
- $gedcom_fam="0 @new@ FAM\n1 HUSB @{$stub_id}@\n1 CHIL @{$this->pid}@";
- $fam_id=append_gedrec($gedcom_fam, WT_GED_ID);
-
- $indirec.= "\n1 FAMC @{$fam_id}@";
- replace_gedrec($this->pid, WT_GED_ID, $indirec);
-
- $serviceClient=ServiceClient::getInstance($serverID);
- $indistub=$serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
- $indistub.="\n1 FAMS @{$fam_id}@";
- replace_gedrec($stub_id, WT_GED_ID, $indistub);
- break;
- case "mother":
- $indistub="0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
- $stub_id=append_gedrec($indistub, WT_GED_ID);
- $indistub=find_gedcom_record($stub_id, WT_GED_ID, true);
-
- $gedcom_fam="0 @new@ FAM\n1 WIFE @{$stub_id}@\n1 CHIL @{$this->pid}@";
- $fam_id=append_gedrec($gedcom_fam, WT_GED_ID);
-
- $indirec.="\n1 FAMC @{$fam_id}@";
- replace_gedrec($this->pid, WT_GED_ID, $indirec);
-
- $serviceClient=ServiceClient::getInstance($serverID);
- $indistub=$serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
- $indistub.="\n1 FAMS @".$fam_id."@";
- replace_gedrec($stub_id, WT_GED_ID, $indistub);
- break;
- case "husband":
- $indistub="0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
- $stub_id=append_gedrec($indistub, WT_GED_ID);
- $indistub=find_gedcom_record($stub_id, WT_GED_ID, true);
-
- $gedcom_fam="0 @new@ FAM\n1 MARR Y\n1 WIFE @{$this->pid}@\n1 HUSB @{$stub_id}@\n";
- $fam_id=append_gedrec($gedcom_fam, WT_GED_ID);
-
- $indirec.="\n1 FAMS @{$fam_id}@";
- replace_gedrec($this->pid, WT_GED_ID, $indirec);
-
- $serviceClient=ServiceClient::getInstance($serverID);
- $indistub=$serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
- $indistub.="\n1 FAMS @{$fam_id}@";
- replace_gedrec($stub_id, WT_GED_ID, $indistub);
- break;
- case "wife":
- $indistub="0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
- $stub_id=append_gedrec($indistub, WT_GED_ID);
- $indistub=find_gedcom_record($stub_id, WT_GED_ID, true);
-
- $gedcom_fam="0 @new@ FAM\n1 MARR Y\n1 WIFE @{$stub_id}@\n1 HUSB @{$this->pid}@";
- $fam_id=append_gedrec($gedcom_fam, WT_GED_ID);
-
- $indirec.="\n1 FAMS @{$fam_id}@";
- replace_gedrec($this->pid, WT_GED_ID, $indirec);
-
- $serviceClient=ServiceClient::getInstance($serverID);
- $indistub=$serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
- $indistub.="\n1 FAMS @{$fam_id}@\n";
- replace_gedrec($stub_id, WT_GED_ID, $indistub);
- 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, WT_GED_ID);
- $indistub=find_gedcom_record($stub_id, WT_GED_ID, true);
-
- 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, WT_GED_ID);
- $indirec.="\n1 FAMS @{$fam_id}@";
- replace_gedrec($this->pid, WT_GED_ID, $indirec);
-
- $serviceClient=ServiceClient::getInstance($serverID);
- $indistub=$serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
- $indistub.="\n1 FAMC @".$fam_id."@";
- replace_gedrec($stub_id, WT_GED_ID, $indistub);
- 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>', i18n::translate('Successfully added link'), '</b>';
- return true;
- }
- return false;
- }
-
- /**
- * whether or not the user has access to this area
- *
- * @return boolean
- */
- function canAccess() {
- global $ALLOW_EDIT_GEDCOM;
-
- return $ALLOW_EDIT_GEDCOM && WT_USER_GEDCOM_ADMIN && $this->person->canDisplayDetails();
- }
-}
diff --git a/includes/controllers/search_ctrl.php b/includes/controllers/search_ctrl.php
index 29dd72d68d..35aeabbaea 100644
--- a/includes/controllers/search_ctrl.php
+++ b/includes/controllers/search_ctrl.php
@@ -47,8 +47,6 @@ class SearchController extends BaseController {
var $indiResultsPrinted = -1;
var $famResultsPrinted = -1;
var $srcResultsPrinted = -1;
- var $multiResultsPerPage = -1;
- var $multiTotalResults = -1;
var $query;
var $myquery = "";
//var $soundex = "Russell";
@@ -57,8 +55,6 @@ class SearchController extends BaseController {
var $nameprt = "";
var $tagfilter = "on";
var $showasso = "off";
- var $multiquery="";
- var $mymultiquery;
var $name="";
var $myname;
var $birthdate="";
@@ -80,12 +76,10 @@ class SearchController extends BaseController {
var $year="";
var $myyear;
var $sgeds = array ();
- var $Sites = array ();
var $myindilist = array ();
var $mysourcelist = array ();
var $myfamlist = array ();
var $mynotelist = array ();
- var $multisiteResults = array ();
var $inputFieldNames = array ();
var $replace = false;
var $replaceNames = false;
@@ -134,7 +128,7 @@ class SearchController extends BaseController {
}
// Aquire all the variables values from the $_REQUEST
- $varNames = array ("isPostBack", "action", "topsearch", "srfams", "srindi", "srsour", "srnote", "view", "soundex", "subaction", "nameprt", "tagfilter", "showasso", "resultsPageNum", "resultsPerPage", "totalResults", "totalGeneralResults", "indiResultsPrinted", "famResultsPrinted", "multiTotalResults", "srcResultsPrinted", "multiResultsPerPage", "myindilist", "mysourcelist", "mynotelist", "myfamlist");
+ $varNames = array ("isPostBack", "action", "topsearch", "srfams", "srindi", "srsour", "srnote", "view", "soundex", "subaction", "nameprt", "tagfilter", "showasso", "resultsPageNum", "resultsPerPage", "totalResults", "totalGeneralResults", "indiResultsPrinted", "famResultsPrinted", "srcResultsPrinted", "myindilist", "mysourcelist", "mynotelist", "myfamlist");
$this->setRequestValues($varNames);
if (!$this->isPostBack) {
@@ -157,9 +151,6 @@ class SearchController extends BaseController {
$this->sgeds[WT_GED_ID] = $GEDCOM;
}
- // Retrieve the sites that can be searched
- $this->Sites = get_server_list();
-
// vars use for soundex search
if (!empty ($_REQUEST["firstname"])) {
$this->firstname = $_REQUEST["firstname"];
@@ -194,14 +185,6 @@ class SearchController extends BaseController {
$this->myquery=htmlspecialchars(implode(' ', array($this->firstname, $this->lastname, $this->place)));
};
- // vars use for multisite search
- if (!empty ($_REQUEST["multiquery"])) {
- $this->multiquery = $_REQUEST["multiquery"];
- $this->mymultiquery = $this->multiquery;
- } else {
- $this->multiquery="";
- $this->mymultiquery = "";
- }
if (!empty ($_REQUEST["name"])) {
$this->name = $_REQUEST["name"];
$this->myname = $this->name;
@@ -261,7 +244,6 @@ class SearchController extends BaseController {
$this->inputFieldNames[] = "soundex";
$this->inputFieldNames[] = "nameprt";
$this->inputFieldNames[] = "subaction";
- $this->inputFieldNames[] = "multiquery";
$this->inputFieldNames[] = "name";
$this->inputFieldNames[] = "birthdate";
$this->inputFieldNames[] = "birthplace";
@@ -285,10 +267,6 @@ class SearchController extends BaseController {
case 'replace':
$this->SearchAndReplace();
return;
- case 'multisite':
- $this->MultiSiteSearch();
- break;
-
}
}
@@ -300,8 +278,6 @@ class SearchController extends BaseController {
return i18n::translate('Soundex Search');
case 'replace':
return i18n::translate('Search and replace');
- case 'multisite':
- return i18n::translate('Multi Site Search');
}
}
@@ -643,77 +619,6 @@ class SearchController extends BaseController {
usort($this->myfamlist, array('GedcomRecord', 'Compare'));
}
- /**
- *
- */
- function MultiSiteSearch() {
- require_once WT_ROOT.'includes/classes/class_serviceclient.php';
-
- if (!empty ($this->Sites) && count($this->Sites) > 0) {
- $this->myindilist = array ();
- // This first tests to see if it just a basic site search
- if (!empty ($this->multiquery) && ($this->subaction == "basic")) {
- // Find out if the string is longer then one char if dont perform the search
- if (strlen($this->multiquery) > 1) {
- $my_query = $this->multiquery;
- // Now see if there is a query left after the cleanup
- if (trim($my_query) != "") {
- // Cleanup the querystring so it can be used in a database query
- $my_query = "%".preg_replace("/\s+/", "%", $my_query)."%";
- }
- }
-
- } else
- if (($this->subaction == "advanced") && (!empty ($this->myname) || !empty ($this->mybirthdate) || !empty ($this->mybirthplace) || !empty ($this->deathdate) || !empty ($this->mydeathplace) || !empty ($this->mygender))) {
- //Building the query string up
- $my_query = '';
- if (!empty ($this->myname)) {
- $my_query .= "NAME=".$this->myname;
- }
- if (!empty ($this->mybirthdate)) {
- if ($my_query != '')
- $my_query .= '&';
- $my_query .= "BIRTHDATE=".$this->mybirthdate;
- }
- if (!empty ($this->mybirthplace)) {
- if ($my_query != '')
- $my_query .= '&';
- $my_query .= "BIRTHPLACE=".$this->mybirthplace;
- }
- if (!empty ($this->deathdate)) {
- if ($my_query != '')
- $my_query .= '&';
- $my_query .= "DEATHDATE=".$this->deathdate;
- }
- if (!empty ($this->mydeathplace)) {
- if ($my_query != '')
- $my_query .= '&';
- $my_query."DEATHPLACE=".$this->mydeathplace;
- }
- if (!empty ($this->mygender)) {
- if ($my_query != '')
- $my_query .= '&';
- $my_query .= "GENDER=".$this->mygender;
- }
- }
-
- if (!empty ($my_query)) {
- $this->multisiteResults = array ();
- // loop through the selected site to search
- $i = 0;
- foreach ($this->Sites as $key => $site) {
- $vartemp = "server".$i;
- if (isset ($_REQUEST["$vartemp"])) {
- $serviceClient = ServiceClient :: getInstance($key);
- $result = $serviceClient->search($my_query);
- $this->multisiteResults[$key] = $result;
- }
- $i++;
- }
- }
- }
- }
-
function printResults() {
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
global $GEDCOM, $TEXT_DIRECTION, $WT_IMAGES;
@@ -803,122 +708,6 @@ class SearchController extends BaseController {
$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.
- echo "<br />";
- echo "<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) {
- require_once WT_ROOT.'includes/classes/class_serviceclient.php';
- $serviceClient = ServiceClient :: getInstance($key);
- $siteName = $serviceClient->getServiceTitle();
- $siteURL = dirname($serviceClient->getURL());
-
- echo "<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;
- echo "<tr><td class=\"list_label\" colspan=\"2\" width=\"100%\">";
- if (isset($WT_IMAGES["indis"])) echo "<img src=\"".$WT_IMAGES["indis"]."\" border=\"0\" width=\"25\" alt=\"\" /> ";
- echo i18n::translate('People')."</td></tr>";
- echo "<tr><td><table id=\"multiResultsInTbl\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" ><tr>";
- }
- $displayed_once = true;
- echo "<td class=\"list_label\" colspan=\"2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" >".i18n::translate('Site: ')."<a href=\"".$siteURL."\" target=\"_blank\">".$siteName."</a>".i18n::translate(' contained the following')."</td></tr>";
- }
- echo "<tr><td class=\"list_value $TEXT_DIRECTION\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" valign=\"center\" ><ul>";
- echo "<li class=\"$TEXT_DIRECTION\" dir=\"$TEXT_DIRECTION\">";
- echo "<a href=\"{$siteURL}/individual.php?pid={$person->PID}&amp;ged=".rawurlencode($serviceClient->gedfile)."\" target=\"_blank\">";
- $pageResultsNum += 1;
- echo "<b>".$person->getFullName()."</b>";
- if (!empty ($person->PID)) {
- echo " (".$person->PID.")";
- }
- if (!empty ($person->birthDate) || !empty ($person->birthPlace)) {
- echo " -- <i>";
- if (!empty ($person->birthDate)) {
- echo " ".$person->birthDate;
- }
- if (!empty ($person->birthPlace)) {
- echo " ".$person->birthPlace;
- }
- echo "</i>";
- }
- echo "</a></li></ul></td>";
-
- /******************************* Remote Links Per Result *************************************************/
- if (WT_USER_CAN_EDIT) {
- echo "<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>".i18n::translate('Add Local Link')."</b></a></ul></li></td></tr>";
- }
- }
- }
-
- echo "</table>";
-
- echo "&nbsp;</td></tr></table>";
- }
- if ($this->multiTotalResults > 0) {
- echo "</tr><tr><td align=\"left\">Displaying individuals ";
- echo (($this->multiResultsPerPage * $this->resultsPageNum) + 1)." ".i18n::translate('to')." ". (($this->multiResultsPerPage * $this->resultsPageNum) + $pageResultsNum);
- echo " ".i18n::translate('of')." ". ($this->multiTotalResults)."</td></tr></table>";
- $this->multiTotalResults = 0;
- } else
- echo "</tr></table>";
- }
- echo "</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))) {
- echo "<table align=\"center\" \><td class=\"warning\" style=\" text-align: center;\"><font color=\"red\"><b><i>".i18n::translate('No results found.')."</i></b></font><br /></td></tr></table>";
- }
- }
- } else
- if ($sitesChecked < 1 && $this->isPostBack) {
- echo "<table align=\"center\" \><tr><td class=\"warning\" style=\" text-align: center;\"><font color=\"red\"><b><i>".i18n::translate('Be sure to select at least one remote site.')."</i></b></font><br /></td></tr></table>";
- }
-
- echo "</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
}