public function getURL() { $url = 'placelist.php'; foreach (array_reverse($this->gedcom_place) as $n => $place) { $url .= $n ? '&' : '?'; $url .= 'parent%5B%5D=' . rawurlencode($place); } $url .= '&ged=' . rawurlencode(get_gedcom_from_id($this->gedcom_id)); return $url; }
public function getHtmlUrlDirect($which = 'main', $download = false) { // “cb” is “cache buster”, so clients will make new request if anything significant about the user or the file changes // The extension is there so that image viewers (e.g. colorbox) can do something sensible $thumbstr = $which == 'thumb' ? '&thumb=1' : ''; $downloadstr = $download ? '&dl=1' : ''; return 'mediafirewall.php?mid=' . $this->getXref() . $thumbstr . $downloadstr . '&ged=' . rawurlencode(get_gedcom_from_id($this->gedcom_id)) . '&cb=' . $this->getEtag($which); }
function search_repos($query, $geds, $match) { global $GEDCOM; // No query => no results if (!$query) { return array(); } // Convert the query into a SQL expression $querysql = array(); // Convert the query into a regular expression $queryregex = array(); foreach ($query as $q) { $queryregex[] = preg_quote(WT_I18N::strtoupper($q), '/'); $querysql[] = "o_gedcom LIKE " . WT_DB::quote("%{$q}%") . " COLLATE '" . WT_I18N::$collation . "'"; } $sql = "SELECT o_id AS xref, o_file AS gedcom_id, o_gedcom AS gedcom FROM `##other` WHERE (" . implode(" {$match} ", $querysql) . ") AND o_type='REPO' AND o_file IN (" . implode(',', $geds) . ')'; // Group results by gedcom, to minimise switching between privacy files $sql .= ' ORDER BY gedcom_id'; $list = array(); $rows = WT_DB::prepare($sql)->fetchAll(); $GED_ID = WT_GED_ID; foreach ($rows as $row) { // Switch privacy file if necessary if ($row->gedcom_id != $GED_ID) { $GEDCOM = get_gedcom_from_id($row->gedcom_id); load_gedcom_settings($row->gedcom_id); $GED_ID = $row->gedcom_id; } // SQL may have matched on private data or gedcom tags, so check again against privatized data. $record = WT_Individual::getInstance($row->xref, $row->gedcom_id, $row->gedcom); // Ignore non-genealogical data $gedrec = preg_replace('/\\n\\d (_UID|_WT_USER|FILE|FORM|TYPE|CHAN|REFN|RESN) .*/', '', $record->getGedcom()); // Ignore links and tags $gedrec = preg_replace('/\\n\\d ' . WT_REGEX_TAG . '( @' . WT_REGEX_XREF . '@)?/', '', $gedrec); // Ignore tags $gedrec = preg_replace('/\\n\\d ' . WT_REGEX_TAG . ' ?/', '', $gedrec); // Re-apply the filtering $gedrec = WT_I18N::strtoupper($gedrec); foreach ($queryregex as $regex) { if (!preg_match('/' . $regex . '/', $gedrec)) { continue 2; } } $list[] = $record; } // Switch privacy file if necessary if ($GED_ID != WT_GED_ID) { $GEDCOM = WT_GEDCOM; load_gedcom_settings(WT_GED_ID); } return $list; }
//--load common functions require_once PHPGEDVIEW_PKG_PATH . "includes/functions/functions.php"; //-- set the error handler // $OLD_HANDLER = set_error_handler("pgv_error_handler"); //-- load db specific functions require_once PHPGEDVIEW_PKG_PATH . "includes/functions/functions_db.php"; //-- Setup array of media types $MEDIATYPE = array("a11", "acb", "adc", "adf", "afm", "ai", "aiff", "aif", "amg", "anm", "ans", "apd", "asf", "au", "avi", "awm", "bga", "bmp", "bob", "bpt", "bw", "cal", "cel", "cdr", "cgm", "cmp", "cmv", "cmx", "cpi", "cur", "cut", "cvs", "cwk", "dcs", "dib", "dmf", "dng", "doc", "dsm", "dxf", "dwg", "emf", "enc", "eps", "fac", "fax", "fit", "fla", "flc", "fli", "fpx", "ftk", "ged", "gif", "gmf", "hdf", "iax", "ica", "icb", "ico", "idw", "iff", "img", "jbg", "jbig", "jfif", "jpe", "jpeg", "jp2", "jpg", "jtf", "jtp", "lwf", "mac", "mid", "midi", "miff", "mki", "mmm", ".mod", "mov", "mp2", "mp3", "mpg", "mpt", "msk", "msp", "mus", "mvi", "nap", "ogg", "pal", "pbm", "pcc", "pcd", "pcf", "pct", "pcx", "pdd", "pdf", "pfr", "pgm", "pic", "pict", "pk", "pm3", "pm4", "pm5", "png", "ppm", "ppt", "ps", "psd", "psp", "pxr", "qt", "qxd", "ras", "rgb", "rgba", "rif", "rip", "rla", "rle", "rpf", "rtf", "scr", "sdc", "sdd", "sdw", "sgi", "sid", "sng", "swf", "tga", "tiff", "tif", "txt", "text", "tub", "ul", "vda", "vis", "vob", "vpg", "vst", "wav", "wdb", "win", "wk1", "wks", "wmf", "wmv", "wpd", "wxf", "wp4", "wp5", "wp6", "wpg", "wpp", "xbm", "xls", "xpm", "xwd", "yuv", "zgm"); $BADMEDIA = array(".", "..", "CVS", "thumbs", "index.php", "MediaInfo.txt", ".cvsignore"); if (isset($_REQUEST["ged"])) { $GEDCOM = trim($_REQUEST["ged"]); } else { $GEDCOM = null; } if ($GEDCOM >= 1) { $GEDCOM = get_gedcom_from_id($GEDCOM); } $_SESSION["GEDCOM"] = $GEDCOM; $INDILIST_RETRIEVED = false; $FAMLIST_RETRIEVED = false; require_once PHPGEDVIEW_PKG_PATH . "config_gedcom.php"; //require_once( get_config_file() ); //-- make sure that the time limit is the true time limit //-- commented out for now because PHP does not seem to be reporting it correctly on Linux //$TIME_LIMIT = ini_get("max_execution_time"); require_once PHPGEDVIEW_PKG_PATH . "includes/functions/functions_rtl.php"; require_once PHPGEDVIEW_PKG_PATH . "includes/functions/functions_name.php"; if ($MULTI_MEDIA) { require_once PHPGEDVIEW_PKG_PATH . "includes/functions/functions_mediadb.php"; } require_once PHPGEDVIEW_PKG_PATH . "includes/functions/functions_date.php";
/** * split multi-ged keys and return either key or gedcom * * @param string $key the multi-ged key to be split * @param string $type either "id" or "ged", depending on what must be returned * @return string either the key or the gedcom name */ function splitkey($key, $type) { $p1 = strpos($key, "["); $id = substr($key, 0, $p1); if ($type == "id") { return $id; } $p2 = strpos($key, "]"); $ged = substr($key, $p1 + 1, $p2 - $p1 - 1); if ($ged >= 1) { get_gedcom_from_id($ged); } return $ged; }
$gedcom_id = WT_Filter::postInteger('gedcom_id'); // Make sure the gedcom still exists if (WT_Filter::checkCsrf() && get_gedcom_from_id($gedcom_id)) { $ged_name = basename(WT_Filter::post('ged_name')); import_gedcom_file($gedcom_id, WT_DATA_DIR . $ged_name, $ged_name); } header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?keep_media' . $gedcom_id . '=' . WT_Filter::postBool('keep_media' . $gedcom_id)); exit; } $controller->pageHeader(); // Process GET actions switch (WT_Filter::get('action')) { case 'uploadform': case 'importform': $gedcom_id = WT_Filter::getInteger('gedcom_id'); $gedcom_name = get_gedcom_from_id($gedcom_id); // Check it exists if (!$gedcom_name) { break; } echo '<p>', WT_I18N::translate('This will delete all the genealogical data from <b>%s</b> and replace it with data from another GEDCOM.', $gedcom_name), '</p>'; // the javascript in the next line strips any path associated with the file before comparing it to the current GEDCOM name (both Chrome and IE8 include c:\fakepath\ in the filename). $previous_gedcom_filename = get_gedcom_setting($gedcom_id, 'gedcom_filename'); echo '<form name="replaceform" method="post" enctype="multipart/form-data" action="', WT_SCRIPT_NAME, '" onsubmit="var newfile = document.replaceform.ged_name.value; newfile = newfile.substr(newfile.lastIndexOf(\'\\\\\')+1); if (newfile!=\'', WT_Filter::escapeHtml($previous_gedcom_filename), '\' && \'\' != \'', WT_Filter::escapeHtml($previous_gedcom_filename), '\') return confirm(\'', WT_Filter::escapeHtml(WT_I18N::translate('You have selected a GEDCOM with a different name. Is this correct?')), '\'); else return true;">'; echo '<input type="hidden" name="gedcom_id" value="', $gedcom_id, '">'; echo WT_Filter::getCsrf(); if (WT_Filter::get('action') == 'uploadform') { echo '<input type="hidden" name="action" value="replace_upload">'; echo '<input type="file" name="ged_name">'; } else { echo '<input type="hidden" name="action" value="replace_import">';
private function _getLinkUrl($link, $separator) { if ($this->gedcom_id == WT_GED_ID) { return $link . $this->getXref() . $separator . 'ged=' . WT_GEDURL; } elseif ($this->gedcom_id == 0) { return '#'; } else { return $link . $this->getXref() . $separator . 'ged=' . rawurlencode(get_gedcom_from_id($this->gedcom_id)); } }
} else { if ($ret < 0) { $indi_dead++; } else { $indi_unborn++; } } } uasort($names, "itemsort"); $count = count($names); $i = 0; foreach ($names as $indexval => $namearray) { $gid = $namearray["gid"]; $name = $namearray["name"]; $indi = $tindilist[$gid]; echo format_list_person($gid, array($name, get_gedcom_from_id($indi["gedfile"]))); $i++; if ($i == ceil($count / 2) && $count > 8) { print "</ul></td><td class=\"list_value_wrap {$TEXT_DIRECTION}\"><ul>\n"; } } print "</ul></td>\n"; print "</tr><tr><td colspan=\"2\" align=\"center\">"; if ($SHOW_MARRIED_NAMES) { print $pgv_lang["total_names"] . " " . $i . "<br />\n"; } print $pgv_lang["total_indis"] . " " . $count; print "<br />" . $pgv_lang["total_living"] . " {$i} -- " . $pgv_lang["total_dead"] . " {$indi_dead} -- " . $pgv_lang["total_not_born"] . " " . $indi_unborn; print "</td>\n"; } }
function print_htmlplus_block($block = true, $config = '', $side, $index) { global $ctype, $factarray, $GEDCOM, $HTML_BLOCK_COUNT, $PGV_BLOCKS, $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang, $TEXT_DIRECTION, $MULTI_MEDIA, $SHOW_ID_NUMBERS; // config sanity check if (empty($config)) { $config = $PGV_BLOCKS['print_htmlplus_block']['config']; } else { foreach ($PGV_BLOCKS['print_htmlplus_block']['config'] as $k => $v) { if (!isset($config[$k])) { $config[$k] = $v; } } } if (!isset($HTML_BLOCK_COUNT)) { $HTML_BLOCK_COUNT = 0; } $HTML_BLOCK_COUNT++; /* * Select GEDCOM */ switch ($config['gedcom']) { case '__current__': break; case '': break; case '__default__': $GEDCOM = get_site_setting('DEFAULT_GEDCOM'); if (!$GEDCOM) { foreach (get_all_gedcoms() as $gedcom) { $GEDCOM = $gedcom; break; } } break; default: if (get_gedcom_setting(get_gedcom_from_id($config['gedcom']), 'imported')) { $GEDCOM = $config['gedcom']; } break; } /* * Initiate the stats object. */ if ($config['compat'] == 1) { require_once PGV_ROOT . 'includes/classes/class_stats_compat.php'; $stats = new stats_compat($GEDCOM); } elseif ($config['ui'] == 1) { require_once PGV_ROOT . 'includes/classes/class_stats_ui.php'; $stats = new stats_ui($GEDCOM); } else { $stats = new stats($GEDCOM); } // Make some values from the GEDCOM's 0 HEAD record visible to the world global $CREATED_SOFTWARE, $CREATED_VERSION, $CREATED_DATE; $CREATED_SOFTWARE = $stats->gedcomCreatedSoftware(); $CREATED_VERSION = $stats->gedcomCreatedVersion(); $CREATED_DATE = $stats->gedcomDate(); /* * First Pass. * Handle embedded language, fact, global, etc. references * This needs to be done first because the language variables could themselves * contain embedded keywords. */ // Title $config['title'] = print_text($config['title'], 0, 2); // Content $config['html'] = print_text($config['html'], 0, 2); /* * Second Pass. */ list($new_tags, $new_values) = $stats->getTags("{$config['title']} {$config['html']}"); // Title if (strstr($config['title'], '#')) { $config['title'] = str_replace($new_tags, $new_values, $config['title']); } // Content $config['html'] = str_replace($new_tags, $new_values, $config['html']); /* * Restore Current GEDCOM */ $GEDCOM = PGV_GEDCOM; /* * Start Of Output */ $id = "html_block{$HTML_BLOCK_COUNT}"; $title = ""; if ($config['title'] != '') { if (PGV_USER_GEDCOM_ADMIN) { $title .= print_help_link('index_htmlplus_ahelp', 'qm_ah', '', false, true); } else { $title .= print_help_link('index_htmlplus_help', 'qm', '', false, true); } if ($PGV_BLOCKS['print_htmlplus_block']['canconfig']) { if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) { if ($ctype == "gedcom") { $name = PGV_GEDCOM; } else { $name = PGV_USER_NAME; } $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">" . "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"{$pgv_lang['config_block']}\" /></a>"; } } $title .= $config['title']; } $content = $config['html']; if ($config['title'] == '' && $PGV_BLOCKS['print_htmlplus_block']['canconfig']) { if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) { if ($ctype == "gedcom") { $name = str_replace("'", "\\'", $GEDCOM); } else { $name = PGV_USER_NAME; } $content .= "<br />" . print_help_link('index_htmlplus_ahelp', 'qm_ah', '', false, true) . "<a href=\"javascript:;\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=600,height=500,scrollbars=1,resizable=1'); return false;\">" . "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"{$pgv_lang['config_block']}\" title=\"{$pgv_lang['config_block']}\" /></a>"; } } global $THEME_DIR; if ($block) { require $THEME_DIR . 'templates/block_small_temp.php'; } else { require $THEME_DIR . 'templates/block_main_temp.php'; } }
function gedcomFilename() { return get_gedcom_from_id($this->_ged_id); }
public function gedcomFilename() { return get_gedcom_from_id($this->tree_id); }
function get_user_from_gedcom_xref($ged_id, $xref) { global $TBLPREFIX, $gBitDb; $ged_name = get_gedcom_from_id($ged_id); $rows = null; // $gBitDb->query("SELECT u_username, u_gedcomid FROM {$TBLPREFIX}users"); $username = false; while ($row = $rows->fetchRow()) { if ($row['u_gedcomid']) { $tmp_array = unserialize($row['u_gedcomid']); if (array_key_exists($ged_name, $tmp_array) && $tmp_array[$ged_name] == $xref) { return $row['u_username']; } } } return null; }
protected function _getLinkUrl($link) { $url = $link . $this->getXref() . '&ged=' . get_gedcom_from_id($this->ged_id); if ($this->isRemote()) { list($servid, $aliaid) = explode(':', $this->rfn); if ($aliaid && $servid) { $serviceClient = ServiceClient::getInstance($servid); if ($serviceClient) { $surl = $serviceClient->getURL(); $url = $link . $aliaid; if ($serviceClient->getType() == 'remote') { if (!empty($surl)) { $url = dirname($surl) . '/' . $url; } } else { $url = $surl . $url; } $gedcom = $serviceClient->getGedfile(); if ($gedcom) { $url .= "&ged={$gedcom}"; } } } } return $url; }