function init() { // Cannot edit with a "remember me" login. if ($_SESSION["cookie_login"]) { header('Location: ' . encode_url("login.php?type=simple&url=" . urlencode("edit_interface.php?" . decode_url($QUERY_STRING)), false)); exit; } // Coming soon ??? $this->has_familysearch = file_exists('modules/FamilySearch/familySearchWrapper.php'); if ($this->has_familysearch) { require_once 'modules/FamilySearch/familySearchWrapper.php'; } // The PID can come from a URL or a form $this->pid = safe_REQUEST($_REQUEST, 'pid', PGV_REGEX_XREF); $this->person = Person::getInstance($this->pid); $this->server_list = get_server_list(); $this->gedcom_list = get_all_gedcoms(); unset($this->gedcom_list[PGV_GED_ID]); // Other input values come from the form $this->form_txtPID = safe_POST('txtPID', PGV_REGEX_XREF); $this->form_cbRelationship = safe_POST('cbRelationship'); $this->form_location = safe_POST('location'); $this->form_txtURL = safe_POST('txtURL', PGV_REGEX_URL); $this->form_txtTitle = safe_POST('txtTitle', '[^<>"%{};]+'); $this->form_txtGID = safe_POST('txtGID', $this->gedcom_list); $this->form_txtUsername = safe_POST('txtUsername', PGV_REGEX_USERNAME); $this->form_txtPassword = safe_POST('txtPassword', PGV_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', $this->gedcom_list); $this->form_txtFS_URL = safe_POST('txtFS_URL', PGV_REGEX_URL); $this->form_txtFS_Title = safe_POST('txtFS_Title', '[^<>"%{};]+'); $this->form_txtFS_GID = safe_POST('txtFS_GID', $this->gedcom_list); $this->form_txtFS_Username = safe_POST('txtFS_Username', PGV_REGEX_USERNAME); $this->form_txtFS_Password = safe_POST('txtFS_Password', PGV_REGEX_PASSWORD); if (is_null($this->form_location)) { if ($this->server_list) { $this->form_location = 'existing'; } else { $this->form_location = 'remote'; } } }
/** * get the search menu * @return Menu the menu item */ static function &getSearchMenu() { global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $pgv_lang; global $SHOW_MULTISITE_SEARCH, $SEARCH_SPIDER; if ($TEXT_DIRECTION == "rtl") { $ff = "_rtl"; } else { $ff = ""; } if (!file_exists("search.php") || !empty($SEARCH_SPIDER)) { $menu = new Menu("", "", ""); // $menu->print_menu = null; return $menu; } //-- main search menu item $menu = new Menu($pgv_lang["search"], encode_url('search.php?ged=' . $GEDCOM), "down"); if (!empty($PGV_IMAGES["search"]["large"])) { $menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["search"]["large"]); } $menu->addClass("menuitem{$ff}", "menuitem_hover{$ff}", "submenu{$ff}", "icon_large_search"); //-- search_general sub menu $submenu = new Menu($pgv_lang["search_general"], encode_url("search.php?ged={$GEDCOM}&action=general")); if (!empty($PGV_IMAGES["search"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["search"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_search"); $menu->addSubmenu($submenu); //-- search_soundex sub menu $submenu = new Menu($pgv_lang["search_soundex"], encode_url("search.php?ged={$GEDCOM}&action=soundex")); if (!empty($PGV_IMAGES["search"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["search"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_search"); $menu->addSubmenu($submenu); //-- advanced search $submenu = new Menu($pgv_lang["advanced_search"], encode_url("search_advanced.php?ged={$GEDCOM}")); if (!empty($PGV_IMAGES["search"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["search"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_search"); $menu->addSubmenu($submenu); //-- search_replace sub menu if (PGV_USER_CAN_EDIT) { $submenu = new Menu($pgv_lang["search_replace"], encode_url("search.php?ged={$GEDCOM}&action=replace")); if (!empty($PGV_IMAGES["search"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["search"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_search"); $menu->addSubmenu($submenu); } //-- search_multisite sub menu if ($SHOW_MULTISITE_SEARCH >= PGV_USER_ACCESS_LEVEL) { $sitelist = get_server_list(); if (count($sitelist) > 0) { $submenu = new Menu($pgv_lang["multi_site_search"], encode_url("search.php?ged={$GEDCOM}&action=multisite")); if (!empty($PGV_IMAGES["search"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["search"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_search"); $menu->addSubmenu($submenu); } } return $menu; }
/** * Initialization function */ function init() { global $pgv_lang, $ALLOW_CHANGE_GEDCOM, $GEDCOM, $GEDCOMS; if ($this->action == '') { $this->action = 'general'; } if (!empty($_REQUEST["topsearch"])) { $this->topsearch = true; $this->isPostBack = true; $this->srfams = 'yes'; $this->srindi = 'yes'; $this->srsour = 'yes'; $this->srnote = 'yes'; } // Get the query and remove slashes if (isset($_REQUEST["query"])) { // Reset the "Search" text from the page header if ($_REQUEST["query"] == $pgv_lang["search"] || strlen($_REQUEST["query"]) < 2 || preg_match("/^\\.+\$/", $_REQUEST["query"]) > 0) { $this->query = ""; $this->myquery = ""; } else { $this->query = stripslashes($_REQUEST["query"]); $this->myquery = htmlspecialchars($this->query, ENT_COMPAT, 'UTF-8'); } } if (isset($_REQUEST["replace"])) { $this->replace = $_REQUEST["replace"]; if (isset($_REQUEST["replaceNames"])) { $this->replaceNames = true; } if (isset($_REQUEST["replacePlaces"])) { $this->replacePlaces = true; } if (isset($_REQUEST["replacePlacesWord"])) { $this->replacePlacesWord = true; } if (isset($_REQUEST["replaceAll"])) { $this->replaceAll = true; } } // 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"); $this->setRequestValues($varNames); if (!$this->isPostBack) { // Enable the default gedcom for search $str = preg_replace(array("/\\./", "/-/", "/ /"), array("_", "_", "_"), $GEDCOM); $_REQUEST["{$str}"] = $str; } // Retrieve the gedcoms to search in if ($ALLOW_CHANGE_GEDCOM && count($GEDCOMS) > 1) { foreach ($GEDCOMS as $key => $gedarray) { $str = preg_replace(array("/\\./", "/-/", "/ /"), array("_", "_", "_"), $key); if (isset($_REQUEST["{$str}"]) || isset($this->topsearch)) { $this->sgeds[] = $key; $_REQUEST["{$str}"] = 'yes'; } } } else { $this->sgeds[] = $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"]; $this->myfirstname = $this->firstname; } else { $this->firstname = ""; $this->myfirstname = ""; } if (!empty($_REQUEST["lastname"])) { $this->lastname = $_REQUEST["lastname"]; $this->mylastname = $this->lastname; } else { $this->lastname = ""; $this->mylastname = ""; } if (!empty($_REQUEST["place"])) { $this->place = $_REQUEST["place"]; $this->myplace = $this->place; } else { $this->place = ""; $this->myplace = ""; } if (!empty($_REQUEST["year"])) { $this->year = $_REQUEST["year"]; $this->myyear = $this->year; } else { $this->year = ""; $this->myyear = ""; } // 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; } else { $this->name = ""; $this->myname = ""; } if (!empty($_REQUEST["birthdate"])) { $this->birthdate = $_REQUEST["birthdate"]; $this->mybirthdate = $this->birthdate; } else { $this->birthdate = ""; $this->mybirthdate = ""; } if (!empty($_REQUEST["birthplace"])) { $this->birthplace = $_REQUEST["birthplace"]; $this->mybirthplace = $this->birthplace; } else { $this->birthplace = ""; $this->mybirthplace = ""; } if (!empty($_REQUEST["deathdate"])) { $this->deathdate = $_REQUEST["deathdate"]; $this->mydeathdate = $this->deathdate; } else { $this->deathdate = ""; $this->mydeathdate = ""; } if (!empty($_REQUEST["deathplace"])) { $this->deathplace = $_REQUEST["deathplace"]; $this->mydeathplace = $this->deathplace; } else { $this->deathplace = ""; $this->mydeathplace = ""; } if (!empty($_REQUEST["gender"])) { $this->gender = $_REQUEST["gender"]; $this->mygender = $this->gender; } else { $this->gender = ""; $this->mygender = ""; } $this->inputFieldNames[] = "action"; $this->inputFieldNames[] = "isPostBack"; $this->inputFieldNames[] = "resultsPerPage"; $this->inputFieldNames[] = "query"; $this->inputFieldNames[] = "srindi"; $this->inputFieldNames[] = "srfams"; $this->inputFieldNames[] = "srsour"; $this->inputFieldNames[] = "srnote"; $this->inputFieldNames[] = "showasso"; $this->inputFieldNames[] = "firstname"; $this->inputFieldNames[] = "lastname"; $this->inputFieldNames[] = "place"; $this->inputFieldNames[] = "year"; $this->inputFieldNames[] = "soundex"; $this->inputFieldNames[] = "nameprt"; $this->inputFieldNames[] = "subaction"; $this->inputFieldNames[] = "multiquery"; $this->inputFieldNames[] = "name"; $this->inputFieldNames[] = "birthdate"; $this->inputFieldNames[] = "birthplace"; $this->inputFieldNames[] = "deathdate"; $this->inputFieldNames[] = "deathplace"; $this->inputFieldNames[] = "gender"; $this->inputFieldNames[] = "tagfilter"; // Get the search results based on the action if (isset($this->topsearch)) { $this->TopSearch(); } // If we want to show associated persons, build the list if ($this->action == "general") { $this->GeneralSearch(); } else { if ($this->action == "soundex") { $this->SoundexSearch(); } else { if ($this->action == "replace") { $this->SearchAndReplace(); } else { if ($this->action == "multisite") { $this->MultiSiteSearch(); } } } } }