Beispiel #1
0
 /**
  * constructor for this class
  */
 function BaseController()
 {
     $this->view = safe_GET('view', 'preview');
     $this->action = safe_GET('action');
     $this->show_changes = safe_GET('show_changes', 'no', 'yes') == 'yes';
     // if not specified, then default to "yes"
 }
Beispiel #2
0
 * @package PhpGedView
 */
define('PGV_SCRIPT_NAME', 'editnews.php');
require './config.php';
$useFCK = file_exists(PGV_ROOT . 'modules/FCKeditor/fckeditor.php');
if ($useFCK) {
    require PGV_ROOT . 'modules/FCKeditor/fckeditor.php';
}
if (!PGV_USER_ID) {
    print_simple_header("");
    print $pgv_lang["access_denied"];
    print_simple_footer();
    exit;
}
$action = safe_GET('action', array('compose', 'save', 'delete'), 'compose');
$news_id = safe_GET('news_id');
$username = safe_REQUEST($_REQUEST, 'username');
$date = safe_POST('date', PGV_REGEX_UNSAFE);
$title = safe_POST('title', PGV_REGEX_UNSAFE);
$text = safe_POST('text', PGV_REGEX_UNSAFE);
print_simple_header($pgv_lang["edit_news"]);
if (empty($username)) {
    $username = $GEDCOM;
}
if ($action == "compose") {
    print '<span class="subheaders">' . $pgv_lang["edit_news"] . '</span>';
    ?>
	<script language="JavaScript" type="text/javascript">
		function checkForm(frm) {
			if (frm.title.value=="") {
				alert('<?php 
 function init()
 {
     global $PRIV_HIDE, $PRIV_PUBLIC, $ENABLE_CLIPPINGS_CART, $SCRIPT_NAME, $pgv_lang, $SERVER_URL, $CONTACT_EMAIL, $HOME_SITE_TEXT, $HOME_SITE_URL, $MEDIA_DIRECTORY;
     global $GEDCOM, $CHARACTER_SET, $cart;
     if (!isset($ENABLE_CLIPPINGS_CART)) {
         $ENABLE_CLIPPINGS_CART = $PRIV_HIDE;
     }
     if ($ENABLE_CLIPPINGS_CART === true) {
         $ENABLE_CLIPPING_CART = $PRIV_PUBLIC;
     }
     if ($ENABLE_CLIPPINGS_CART < PGV_USER_ACCESS_LEVEL) {
         header("Location: index.php");
         exit;
     }
     if (!isset($_SESSION['exportConvPath'])) {
         $_SESSION['exportConvPath'] = $MEDIA_DIRECTORY;
     }
     if (!isset($_SESSION['exportConvSlashes'])) {
         $_SESSION['exportConvSlashes'] = 'forward';
     }
     $this->action = safe_GET("action");
     $this->id = safe_GET('id');
     $remove = safe_GET('remove', "", "no");
     $convert = safe_GET('convert', "", "no");
     $this->Zip = safe_GET('Zip');
     $this->IncludeMedia = safe_GET('IncludeMedia');
     $this->conv_path = safe_GET('conv_path', PGV_REGEX_NOSCRIPT, $_SESSION['exportConvPath']);
     $this->conv_slashes = safe_GET('conv_slashes', array('forward', 'backward'), $_SESSION['exportConvSlashes']);
     $this->privatize_export = safe_GET('privatize_export', array('none', 'visitor', 'user', 'gedadmin', 'admin'));
     $this->filetype = safe_GET('filetype');
     $this->level1 = safe_GET('level1');
     $this->level2 = safe_GET('level2');
     $this->level3 = safe_GET('level3');
     if (empty($this->filetype)) {
         $this->filetype = "gedcom";
     }
     $others = safe_GET('others');
     $item = safe_GET('item');
     if (!isset($cart)) {
         $cart = $_SESSION['cart'];
     }
     $this->type = safe_GET('type');
     $this->conv_path = stripLRMRLM($this->conv_path);
     $_SESSION['exportConvPath'] = $this->conv_path;
     // remember this for the next Download
     $_SESSION['exportConvSlashes'] = $this->conv_slashes;
     if ($this->action == 'add') {
         if (empty($this->type) && !empty($this->id)) {
             $this->type = "";
             $obj = GedcomRecord::getInstance($this->id);
             if (is_null($obj)) {
                 $this->id = "";
                 $this->action = "";
             } else {
                 $this->type = strtolower($obj->getType());
             }
         } else {
             if (empty($this->id)) {
                 $this->action = "";
             }
         }
         if (!empty($this->id) && $this->type != 'fam' && $this->type != 'indi' && $this->type != 'sour') {
             $this->action = 'add1';
         }
     }
     if ($this->action == 'add1') {
         $clipping = array();
         $clipping['type'] = $this->type;
         $clipping['id'] = $this->id;
         $clipping['gedcom'] = $GEDCOM;
         $ret = $this->add_clipping($clipping);
         if ($ret) {
             if ($this->type == 'sour') {
                 if ($others == 'linked') {
                     foreach (fetch_linked_indi($this->id, 'SOUR', PGV_GED_ID) as $indi) {
                         if ($indi->canDisplayName()) {
                             $this->add_clipping(array('type' => 'indi', 'id' => $indi->getXref()));
                         }
                     }
                     foreach (fetch_linked_fam($this->id, 'SOUR', PGV_GED_ID) as $fam) {
                         if ($fam->canDisplayName()) {
                             $this->add_clipping(array('type' => 'fam', 'id' => $fam->getXref()));
                         }
                     }
                 }
             }
             if ($this->type == 'fam') {
                 if ($others == 'parents') {
                     $parents = find_parents($this->id);
                     if (!empty($parents["HUSB"])) {
                         $clipping = array();
                         $clipping['type'] = "indi";
                         $clipping['id'] = $parents["HUSB"];
                         $ret = $this->add_clipping($clipping);
                     }
                     if (!empty($parents["WIFE"])) {
                         $clipping = array();
                         $clipping['type'] = "indi";
                         $clipping['id'] = $parents["WIFE"];
                         $ret = $this->add_clipping($clipping);
                     }
                 } else {
                     if ($others == "members") {
                         $this->add_family_members($this->id);
                     } else {
                         if ($others == "descendants") {
                             $this->add_family_descendancy($this->id);
                         }
                     }
                 }
             } else {
                 if ($this->type == 'indi') {
                     if ($others == 'parents') {
                         $famids = find_family_ids($this->id);
                         foreach ($famids as $indexval => $famid) {
                             $clipping = array();
                             $clipping['type'] = "fam";
                             $clipping['id'] = $famid;
                             $ret = $this->add_clipping($clipping);
                             if ($ret) {
                                 $this->add_family_members($famid);
                             }
                         }
                     } else {
                         if ($others == 'ancestors') {
                             $this->add_ancestors_to_cart($this->id, $this->level1);
                         } else {
                             if ($others == 'ancestorsfamilies') {
                                 $this->add_ancestors_to_cart_families($this->id, $this->level2);
                             } else {
                                 if ($others == 'members') {
                                     $famids = find_sfamily_ids($this->id);
                                     foreach ($famids as $indexval => $famid) {
                                         $clipping = array();
                                         $clipping['type'] = "fam";
                                         $clipping['id'] = $famid;
                                         $ret = $this->add_clipping($clipping);
                                         if ($ret) {
                                             $this->add_family_members($famid);
                                         }
                                     }
                                 } else {
                                     if ($others == 'descendants') {
                                         $famids = find_sfamily_ids($this->id);
                                         foreach ($famids as $indexval => $famid) {
                                             $clipping = array();
                                             $clipping['type'] = "fam";
                                             $clipping['id'] = $famid;
                                             $ret = $this->add_clipping($clipping);
                                             if ($ret) {
                                                 $this->add_family_descendancy($famid, $this->level3);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         if ($this->action == 'remove') {
             $ct = count($cart);
             for ($i = $item + 1; $i < $ct; $i++) {
                 $cart[$i - 1] = $cart[$i];
             }
             unset($cart[$ct - 1]);
         } else {
             if ($this->action == 'empty') {
                 $cart = array();
                 $_SESSION["cart"] = $cart;
             } else {
                 if ($this->action == 'download') {
                     usort($cart, "same_group");
                     if ($this->filetype == "gedcom") {
                         $path = substr($SCRIPT_NAME, 0, strrpos($SCRIPT_NAME, "/"));
                         if (empty($path)) {
                             $path = "/";
                         }
                         if ($path[strlen($path) - 1] != "/") {
                             $path .= "/";
                         }
                         if ($SERVER_URL[strlen($SERVER_URL) - 1] == "/") {
                             $dSERVER_URL = substr($SERVER_URL, 0, strlen($SERVER_URL) - 1);
                         } else {
                             $dSERVER_URL = $SERVER_URL;
                         }
                         $media = array();
                         $mediacount = 0;
                         $ct = count($cart);
                         $filetext = "0 HEAD\n1 SOUR " . PGV_PHPGEDVIEW . "\n2 NAME " . PGV_PHPGEDVIEW . "\n2 VERS " . PGV_VERSION_TEXT . "\n1 DEST DISKETTE\n1 DATE " . date("j M Y") . "\n2 TIME " . date("H:i:s") . "\n";
                         $filetext .= "1 GEDC\n2 VERS 5.5\n2 FORM LINEAGE-LINKED\n1 CHAR {$CHARACTER_SET}\n";
                         $head = find_gedcom_record("HEAD");
                         $placeform = trim(get_sub_record(1, "1 PLAC", $head));
                         if (!empty($placeform)) {
                             $filetext .= $placeform . "\n";
                         } else {
                             $filetext .= "1 PLAC\n2 FORM " . "City, County, State/Province, Country" . "\n";
                         }
                         if ($convert == "yes") {
                             $filetext = preg_replace("/UTF-8/", "ANSI", $filetext);
                             $filetext = utf8_decode($filetext);
                         }
                         $tempUserID = '#ExPoRt#';
                         if ($this->privatize_export != 'none') {
                             // Create a temporary userid
                             $export_user_id = createTempUser($tempUserID, $this->privatize_export, $GEDCOM);
                             // Create a temporary userid
                             // Temporarily become this user
                             $_SESSION["org_user"] = $_SESSION["pgv_user"];
                             $_SESSION["pgv_user"] = $tempUserID;
                         }
                         for ($i = 0; $i < $ct; $i++) {
                             $clipping = $cart[$i];
                             if ($clipping['gedcom'] == $GEDCOM) {
                                 $record = find_gedcom_record($clipping['id']);
                                 $savedRecord = $record;
                                 // Save this for the "does this file exist" check
                                 if ($clipping['type'] == 'obje') {
                                     $record = convert_media_path($record, $this->conv_path, $this->conv_slashes);
                                 }
                                 $record = privatize_gedcom($record);
                                 $record = remove_custom_tags($record, $remove);
                                 if ($convert == "yes") {
                                     $record = utf8_decode($record);
                                 }
                                 switch ($clipping['type']) {
                                     case 'indi':
                                         $ft = preg_match_all("/1 FAMC @(.*)@/", $record, $match, PREG_SET_ORDER);
                                         for ($k = 0; $k < $ft; $k++) {
                                             if (!id_in_cart($match[$k][1])) {
                                                 $record = preg_replace("/1 FAMC @" . $match[$k][1] . "@.*/", "", $record);
                                             }
                                         }
                                         $ft = preg_match_all("/1 FAMS @(.*)@/", $record, $match, PREG_SET_ORDER);
                                         for ($k = 0; $k < $ft; $k++) {
                                             if (!id_in_cart($match[$k][1])) {
                                                 $record = preg_replace("/1 FAMS @" . $match[$k][1] . "@.*/", "", $record);
                                             }
                                         }
                                         $ft = preg_match_all("/\\d FILE (.*)/", $savedRecord, $match, PREG_SET_ORDER);
                                         for ($k = 0; $k < $ft; $k++) {
                                             $filename = $MEDIA_DIRECTORY . extract_filename(trim($match[$k][1]));
                                             if (file_exists($filename)) {
                                                 $media[$mediacount] = array(PCLZIP_ATT_FILE_NAME => $filename);
                                                 $mediacount++;
                                             }
                                             //								$record = preg_replace("|(\d FILE )" . addslashes($match[$k][1]) . "|", "$1" . $filename, $record);
                                         }
                                         $filetext .= trim($record) . "\n";
                                         $filetext .= "1 SOUR @SPGV1@\n";
                                         $filetext .= "2 PAGE " . $dSERVER_URL . "/individual.php?pid=" . $clipping['id'] . "\n";
                                         $filetext .= "2 DATA\n";
                                         $filetext .= "3 TEXT " . $pgv_lang["indi_downloaded_from"] . "\n";
                                         $filetext .= "4 CONT " . $dSERVER_URL . "/individual.php?pid=" . $clipping['id'] . "\n";
                                         break;
                                     case 'fam':
                                         $ft = preg_match_all("/1 CHIL @(.*)@/", $record, $match, PREG_SET_ORDER);
                                         for ($k = 0; $k < $ft; $k++) {
                                             if (!id_in_cart($match[$k][1])) {
                                                 /* if the child is not in the list delete the record of it */
                                                 $record = preg_replace("/1 CHIL @" . $match[$k][1] . "@.*/", "", $record);
                                             }
                                         }
                                         $ft = preg_match_all("/1 HUSB @(.*)@/", $record, $match, PREG_SET_ORDER);
                                         for ($k = 0; $k < $ft; $k++) {
                                             if (!id_in_cart($match[$k][1])) {
                                                 /* if the husband is not in the list delete the record of him */
                                                 $record = preg_replace("/1 HUSB @" . $match[$k][1] . "@.*/", "", $record);
                                             }
                                         }
                                         $ft = preg_match_all("/1 WIFE @(.*)@/", $record, $match, PREG_SET_ORDER);
                                         for ($k = 0; $k < $ft; $k++) {
                                             if (!id_in_cart($match[$k][1])) {
                                                 /* if the wife is not in the list delete the record of her */
                                                 $record = preg_replace("/1 WIFE @" . $match[$k][1] . "@.*/", "", $record);
                                             }
                                         }
                                         $ft = preg_match_all("/\\d FILE (.*)/", $savedRecord, $match, PREG_SET_ORDER);
                                         for ($k = 0; $k < $ft; $k++) {
                                             $filename = $MEDIA_DIRECTORY . extract_filename(trim($match[$k][1]));
                                             if (file_exists($filename)) {
                                                 $media[$mediacount] = array(PCLZIP_ATT_FILE_NAME => $filename);
                                                 $mediacount++;
                                             }
                                             //								$record = preg_replace("|(\d FILE )" . addslashes($match[$k][1]) . "|", "$1" . $filename, $record);
                                         }
                                         $filetext .= trim($record) . "\n";
                                         $filetext .= "1 SOUR @SPGV1@\n";
                                         $filetext .= "2 PAGE " . $dSERVER_URL . $path . "family.php?famid=" . $clipping['id'] . "\n";
                                         $filetext .= "2 DATA\n";
                                         $filetext .= "3 TEXT " . $pgv_lang["family_downloaded_from"] . "\n";
                                         $filetext .= "4 CONT " . $dSERVER_URL . "/family.php?famid=" . $clipping['id'] . "\n";
                                         break;
                                     case 'source':
                                         $ft = preg_match_all("/\\d FILE (.*)/", $savedRecord, $match, PREG_SET_ORDER);
                                         for ($k = 0; $k < $ft; $k++) {
                                             $filename = $MEDIA_DIRECTORY . extract_filename(trim($match[$k][1]));
                                             if (file_exists($filename)) {
                                                 $media[$mediacount] = array(PCLZIP_ATT_FILE_NAME => $filename);
                                                 $mediacount++;
                                             }
                                             //								$record = preg_replace("|(\d FILE )" . addslashes($match[$k][1]) . "|", "$1" . $filename, $record);
                                         }
                                         $filetext .= trim($record) . "\n";
                                         $filetext .= "1 NOTE " . $pgv_lang["source_downloaded_from"] . "\n";
                                         $filetext .= "2 CONT " . $dSERVER_URL . "/source.php?sid=" . $clipping['id'] . "\n";
                                         break;
                                     default:
                                         $ft = preg_match_all("/\\d FILE (.*)/", $savedRecord, $match, PREG_SET_ORDER);
                                         for ($k = 0; $k < $ft; $k++) {
                                             $filename = $MEDIA_DIRECTORY . extract_filename(trim($match[$k][1]));
                                             if (file_exists($filename)) {
                                                 $media[$mediacount] = array(PCLZIP_ATT_FILE_NAME => $filename);
                                                 $mediacount++;
                                             }
                                             //								$record = preg_replace("|(\d FILE )" . addslashes($match[$k][1]) . "|", "$1" . $filename, $record);
                                         }
                                         $filetext .= trim($record) . "\n";
                                         break;
                                 }
                             }
                         }
                         if ($this->privatize_export != 'none') {
                             $_SESSION["pgv_user"] = $_SESSION["org_user"];
                             delete_user($export_user_id);
                             AddToLog("deleted dummy user -> {$tempUserID} <-");
                         }
                         if ($this->IncludeMedia == "yes") {
                             $this->media_list = $media;
                         }
                         $filetext .= "0 @SPGV1@ SOUR\n";
                         if ($user_id = get_user_id($CONTACT_EMAIL)) {
                             $filetext .= "1 AUTH " . getUserFullName($user_id) . "\n";
                         }
                         $filetext .= "1 TITL " . $HOME_SITE_TEXT . "\n";
                         $filetext .= "1 ABBR " . $HOME_SITE_TEXT . "\n";
                         $filetext .= "1 PUBL " . $HOME_SITE_URL . "\n";
                         $filetext .= "0 TRLR\n";
                         //-- make sure the preferred line endings are used
                         $filetext = preg_replace("/[\r\n]+/", PGV_EOL, $filetext);
                         $this->download_data = $filetext;
                         $this->download_clipping();
                     } else {
                         if ($this->filetype == "gramps") {
                             // Sort the clippings cart because the export works better when the cart is sorted
                             usort($cart, "same_group");
                             require_once "includes/classes/class_geclippings.php";
                             $gramps_Exp = new GEClippings();
                             $gramps_Exp->begin_xml();
                             $ct = count($cart);
                             usort($cart, "same_group");
                             for ($i = 0; $i < $ct; $i++) {
                                 $clipping = $cart[$i];
                                 switch ($clipping['type']) {
                                     case 'indi':
                                         $rec = find_person_record($clipping['id']);
                                         $rec = remove_custom_tags($rec, $remove);
                                         if ($this->privatize_export != 'none') {
                                             $rec = privatize_gedcom($rec);
                                         }
                                         $gramps_Exp->create_person($rec, $clipping['id']);
                                         break;
                                     case 'fam':
                                         $rec = find_family_record($clipping['id']);
                                         $rec = remove_custom_tags($rec, $remove);
                                         if ($this->privatize_export != 'none') {
                                             $rec = privatize_gedcom($rec);
                                         }
                                         $gramps_Exp->create_family($rec, $clipping['id']);
                                         break;
                                     case 'source':
                                         $rec = find_source_record($clipping['id']);
                                         $rec = remove_custom_tags($rec, $remove);
                                         if ($this->privatize_export != 'none') {
                                             $rec = privatize_gedcom($rec);
                                         }
                                         $gramps_Exp->create_source($rec, $clipping['id']);
                                         break;
                                 }
                             }
                             $this->download_data = $gramps_Exp->dom->saveXML();
                             if ($convert) {
                                 $this->download_data = utf8_decode($this->download_data);
                             }
                             $this->media_list = $gramps_Exp->get_all_media();
                             $this->download_clipping();
                         }
                     }
                 }
             }
         }
     }
 }
* phpGedView: Genealogy Viewer
* Copyright (C) 2002 to 2009 PGV Development Team
*
* 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: config_download.php 6879 2010-01-30 11:35:46Z fisharebest $
* @package PhpGedView
* @subpackage Admin
*/
define('PGV_SCRIPT_NAME', 'config_download.php');
require './config.php';
if (PGV_ADMIN_USER_EXISTS && !PGV_USER_IS_ADMIN && $CONFIGURED) {
    header('Location: admin.php');
    exit;
}
$file = safe_GET('file', PGV_REGEX_NOSCRIPT, 'config.php');
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="' . $file . '"');
echo $_SESSION[$file];
require './config.php';
require_once PGV_ROOT . 'includes/functions/functions_export.php';
// Which gedcoms do we have permission to export?
$gedcoms = array();
foreach (get_all_gedcoms() as $ged_id => $gedcom) {
    if (userGedcomAdmin(PGV_USER_ID, $ged_id)) {
        $gedcoms[$ged_id] = $gedcom;
    }
}
// If we don't have permission to administer any gedcoms, redirect to
// this page, which will force a login and provide a list.
if (empty($gedcoms)) {
    header('Location: editgedcoms.php');
}
// Which gedcom have we requested to export
$export = safe_GET('export', $gedcoms);
print_simple_header($pgv_lang['ged_export']);
if ($export) {
    $ged_id = get_id_from_gedcom($export);
    $filename = get_gedcom_setting($ged_id, 'path');
    echo '<h1>', $pgv_lang['ged_export'], '</h1>';
    echo '<p>', htmlspecialchars(filename_decode($export)), ' => ', $filename, '</p>';
    flush();
    $gedout = fopen($filename . '.tmp', 'w');
    if ($gedout) {
        $start = microtime(true);
        $exportOptions = array();
        $exportOptions['privatize'] = 'none';
        $exportOptions['toANSI'] = 'no';
        $exportOptions['noCustomTags'] = 'no';
        $exportOptions['path'] = $MEDIA_DIRECTORY;
        }
    }
    if (!$related) {
        echo $pgv_lang["access_denied"];
        print_simple_footer();
        exit;
    }
}
//-- find the latest gedrec for the individual
if (!isset($pgv_changes[$pid . "_" . PGV_GEDCOM])) {
    $gedrec = find_gedcom_record($pid, PGV_GED_ID);
} else {
    $gedrec = find_updated_record($pid, PGV_GED_ID);
}
// Don't allow edits if the record has changed since the edit-link was created
checkChangeTime($pid, $gedrec, safe_GET('accesstime', PGV_REGEX_INTEGER));
//-- only allow edit of individual records
$disp = true;
$ct = preg_match("/0 @{$pid}@ (.*)/", $gedrec, $match);
if ($ct > 0) {
    $type = trim($match[1]);
    if ($type == "INDI") {
        $disp = displayDetailsById($pid);
    } else {
        echo $pgv_lang["access_denied"];
        print_simple_footer();
        exit;
    }
}
if (!$disp || !$ALLOW_EDIT_GEDCOM) {
    echo $pgv_lang["access_denied"];
Beispiel #7
0
 *
 * 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
 *
 * @package PhpGedView
 * @subpackage Charts
 * @version $Id: familybook.php 6879 2010-01-30 11:35:46Z fisharebest $
 */
define('PGV_SCRIPT_NAME', 'familybook.php');
require './config.php';
require_once PGV_ROOT . 'includes/functions/functions_charts.php';
// Extract form variables
$pid = safe_GET_xref('pid');
$show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS);
$show_spouse = safe_GET('show_spouse', '1', '0');
$descent = safe_GET_integer('descent', 0, 9, 5);
$generations = safe_GET_integer('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 2);
$box_width = safe_GET_integer('box_width', 50, 300, 100);
// -- size of the boxes
if (!$show_full) {
    $bwidth = $bwidth / 1.5;
}
$bwidth = (int) ($bwidth * $box_width / 100);
if ($show_full == false) {
    $bheight = (int) ($bheight / 2.5);
}
$bhalfheight = (int) ($bheight / 2);
// -- root id
$pid = check_rootid($pid);
$person = Person::getInstance($pid);
Beispiel #8
0
 function init()
 {
     global $MEDIA_DIRECTORY, $USE_MEDIA_FIREWALL, $GEDCOM, $pgv_changes;
     $filename = decrypt(safe_GET('filename'));
     $this->mid = safe_GET_xref('mid');
     if ($USE_MEDIA_FIREWALL && empty($filename) && empty($this->mid)) {
         // this section used by mediafirewall.php to determine what media file was requested
         if (isset($_SERVER['REQUEST_URI'])) {
             // NOTE: format of this server variable:
             // Apache: /phpGedView/media/a.jpg
             // IIS:    /phpGedView/mediafirewall.php?404;http://server/phpGedView/media/a.jpg
             $requestedfile = $_SERVER['REQUEST_URI'];
             // urldecode the request
             $requestedfile = rawurldecode($requestedfile);
             // make sure the requested file is in the media directory
             if (strpos($requestedfile, $MEDIA_DIRECTORY) !== false) {
                 // strip off the pgv directory and media directory from the requested url so just the image information is left
                 $filename = substr($requestedfile, strpos($requestedfile, $MEDIA_DIRECTORY) + strlen($MEDIA_DIRECTORY) - 1);
                 // if user requested a thumbnail, lookup permissions based on the original image
                 $filename = str_replace('/thumbs', '', $filename);
             }
         }
     }
     //Checks to see if the File Name ($filename) exists
     if (!empty($filename)) {
         //If the File Name ($filename) is set, then it will call the method to get the Media ID ($this->mid) from the File Name ($filename)
         $this->mid = get_media_id_from_file($filename);
         if (!$this->mid) {
             //This will set the Media ID to be false if the File given doesn't match to anything in the database
             $this->mid = false;
             // create a very basic gedcom record for this file so that the functions of the media object will work
             // this is used by the media firewall when requesting an object that exists in the media firewall directory but not in the gedcom
             $this->mediaobject = new Media("0 @" . "0" . "@ OBJE\n1 FILE " . $filename);
         }
     }
     //checks to see if the Media ID ($this->mid) is set. If the Media ID isn't set then there isn't any information avaliable for that picture the picture doesn't exist.
     if ($this->mid) {
         //This creates a Media Object from the getInstance method of the Media Class. It takes the Media ID ($this->mid) and creates the object.
         $this->mediaobject = Media::getInstance($this->mid);
         //This sets the controller ID to be the Media ID
         $this->pid = $this->mid;
     }
     if (is_null($this->mediaobject)) {
         return false;
     }
     $this->mediaobject->ged_id = PGV_GED_ID;
     // This record is from a file
     //-- perform the desired action
     switch ($this->action) {
         case "addfav":
             $this->addFavorite();
             break;
         case "accept":
             $this->acceptChanges();
             break;
         case "undo":
             $this->mediaobject->undoChange();
             break;
     }
     if ($this->mediaobject->canDisplayDetails()) {
         $this->canedit = PGV_USER_CAN_EDIT;
     }
 }
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @package PhpGedView
 * @subpackage Admin
 * @version $Id: editconfig_help.php 6879 2010-01-30 11:35:46Z fisharebest $
 */
define('PGV_SCRIPT_NAME', 'editconfig_help.php');
if (file_exists('./config.php')) {
    require './config.php';
} else {
    require './config.dist';
}
loadLangFile("all");
require PGV_ROOT . 'includes/help_text_vars.php';
$help = safe_GET('help');
// Make sure this input variable isn't a script
if (empty($help)) {
    exit;
}
// Quit if this isn't a legitimate request for help
if (substr($help, -5) != "_help") {
    if (substr($help, 0, 5) != 'help_' || substr($help, -4) != '.php') {
        exit;
    }
}
print_simple_header($pgv_lang["config_help"]);
print '<span class="helpheader">';
print_text("config_help");
print '</span><br /><br /><span class="helptext">';
if ($help == "help_contents_help") {
Beispiel #10
0
* @package PhpGedView
* @subpackage Edit
* @version $Id: autocomplete.php 6996 2010-12-01 11:29:54Z canajun2eh $
*/
define('PGV_SCRIPT_NAME', 'autocomplete.php');
require './config.php';
header("Content-Type: text/plain; charset={$CHARACTER_SET}");
// We have finished writing to $_SESSION, so release the lock
session_write_close();
//-- args
$FILTER = safe_GET('q', PGV_REGEX_UNSAFE);
// we can search on '"><& etc.
$FILTER = UTF8_strtoupper($FILTER);
$OPTION = safe_GET('option');
$FORMAT = safe_GET('fmt');
$FIELD = safe_GET('field');
switch ($FIELD) {
    case 'INDI':
        $data = autocomplete_INDI($FILTER, $OPTION);
        break;
    case 'FAM':
        $data = autocomplete_FAM($FILTER, $OPTION);
        break;
    case 'NOTE':
        $data = autocomplete_NOTE($FILTER);
        break;
    case 'SOUR':
        $data = autocomplete_SOUR($FILTER);
        break;
    case 'SOUR_TITL':
        $data = autocomplete_SOUR($FILTER);
Beispiel #11
0
 *
 * This Page Is Valid XHTML 1.0 Transitional! > 12 September 2005
 *
 * @author PGV Development Team
 * @package PhpGedView
 * @subpackage Admin
 * @version $Id: editgedcoms.php 6879 2010-01-30 11:35:46Z fisharebest $
 */
define('PGV_SCRIPT_NAME', 'editgedcoms.php');
require './config.php';
loadLangFile("pgv_confighelp");
$all_gedcoms = get_all_gedcoms();
asort($all_gedcoms);
$action = safe_GET('action', array('delete', 'setdefault'));
$ged = safe_GET('ged', $all_gedcoms);
$default_ged = safe_GET('default_ged', $all_gedcoms);
/**
 * Check if a gedcom file is downloadable over the internet
 *
 * @author opus27
 * @param string $gedfile gedcom file
 * @return mixed 	$url if file is downloadable, false if not
 */
function check_gedcom_downloadable($gedfile)
{
    global $SERVER_URL, $pgv_lang;
    //$url = $SERVER_URL;
    $url = "http://localhost/";
    if (substr($url, -1, 1) != "/") {
        $url .= "/";
    }
 /**
  * Initialization function
  */
 function init()
 {
     global $USE_RIN, $MAX_ALIVE_AGE, $bwidth, $bheight, $pbwidth, $pbheight, $GEDCOM, $GEDCOM_DEFAULT_TAB, $pgv_lang, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS, $show_full;
     $this->sexarray["M"] = $pgv_lang["male"];
     $this->sexarray["F"] = $pgv_lang["female"];
     $this->sexarray["U"] = $pgv_lang["unknown"];
     // Extract parameters from form
     $this->pid = safe_GET_xref('pid');
     $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS);
     $this->chart_style = safe_GET_integer('chart_style', 0, 3, 0);
     $this->generations = safe_GET_integer('generations', 2, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS);
     $this->box_width = safe_GET_integer('box_width', 50, 300, 100);
     // This is passed as a global.  A parameter would be better...
     $show_full = $this->show_full;
     if (!isset($this->view)) {
         $this->view = "";
     }
     if (!isset($this->personcount)) {
         $this->personcount = 1;
     }
     $this->Dbwidth *= $this->box_width / 100;
     if (!$this->show_full) {
         $bwidth *= $this->box_width / 150;
     } else {
         $bwidth *= $this->box_width / 100;
     }
     if (!$this->show_full) {
         $bheight = $bheight / 1.5;
     }
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     $this->show_changes = safe_GET('show_changes');
     $this->action = safe_GET('action');
     // Validate form variables
     $this->pid = check_rootid($this->pid);
     if (strlen($this->name) < 30) {
         $this->cellwidth = "420";
     } else {
         $this->cellwidth = strlen($this->name) * 14;
     }
     $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: '.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->desc->undoChange();
             break;
     }
 }
Beispiel #13
0
 * Initialization
 */
require_once '../kernel/setup_inc.php';
// Is package installed and enabled
$gBitSystem->verifyPackage('phpgedview');
include_once PHPGEDVIEW_PKG_PATH . 'BitGEDCOM.php';
$gGedcom = new BitGEDCOM();
// leave manual config until we can move it to bitweaver table
require "config.php";
loadLangFile("pgv_help, pgv_admin, pgv_editor, ra_lang, gm_lang, gm_help, sm_lang, sm_help");
// Load language keys
require 'includes/help_text_vars.php';
print_simple_header($pgv_lang['help_header']);
echo '<a name="top"></a><span class="helpheader">', $pgv_lang['help_header'], '</span><br /><br /><div class="helptext">';
$help = safe_GET('help');
$action = safe_GET('action');
if ($help == 'help_useradmin.php' && $action == 'edituser') {
    $help = 'edit_useradmin_help';
}
if ($help == 'help_login_register.php' && $action == 'pwlost') {
    $help = 'help_login_lost_pw.php';
}
if ($help == 'help_contents_help') {
    if (PGV_USER_IS_ADMIN) {
        $help = 'admin_help_contents_help';
        echo $pgv_lang['admin_help_contents_head_help'];
    } else {
        echo $pgv_lang['help_contents_head_help'];
    }
    print_help_index($help);
} else {
Beispiel #14
0
} else {
    $showList = false;
}
// Long lists can be broken down by given name
$falpha = safe_GET('falpha');
// All first names beginning with this letter
$show_all_firstnames = safe_GET('show_all_firstnames', array('no', 'yes'), 'no');
// We can show either a list of surnames or a list of names
$surname_sublist = safe_GET('surname_sublist', array('no', 'yes'));
if (!$surname_sublist) {
    $surname_sublist = safe_COOKIE('surname_sublist', array('no', 'yes'), 'yes');
}
setcookie('surname_sublist', $surname_sublist);
// We can either include or exclude married names.
// We default to exclude.
$show_marnm = safe_GET('show_marnm', array('no', 'yes'));
if (!$show_marnm) {
    $show_marnm = safe_COOKIE('show_marnm_famlist', array('no', 'yes'));
}
if (!$show_marnm) {
    $show_marnm = 'no';
}
setcookie('show_marnm_famlist', $show_marnm);
// Override $SHOW_MARRIED_NAMES for this page
$SHOW_MARRIED_NAMES = $show_marnm == 'yes';
// Fetch a list of the initial letters of all surnames in the database
$initials = get_indilist_salpha($SHOW_MARRIED_NAMES, true, PGV_GED_ID);
// If there are no individuals in the database, do something sensible
if (!$initials) {
    $initials[] = '@';
}
// Validate user parameters
if (!isset($_SESSION['exportConvPath'])) {
    $_SESSION['exportConvPath'] = $MEDIA_DIRECTORY;
}
if (!isset($_SESSION['exportConvSlashes'])) {
    $_SESSION['exportConvSlashes'] = 'forward';
}
$ged = safe_GET('ged', get_all_gedcoms());
$action = safe_GET('action', 'download');
$remove = safe_GET('remove', 'yes', 'no');
$convert = safe_GET('convert', 'yes', 'no');
$zip = safe_GET('zip', 'yes', 'no');
$conv_path = safe_GET('conv_path', PGV_REGEX_NOSCRIPT, $_SESSION['exportConvPath']);
$conv_slashes = safe_GET('conv_slashes', array('forward', 'backward'), $_SESSION['exportConvSlashes']);
$privatize_export = safe_GET('privatize_export', array('none', 'visitor', 'user', 'gedadmin', 'admin'));
$filetype = safe_GET('filetype', array('gedcom', 'gramps'));
$conv_path = stripLRMRLM($conv_path);
$_SESSION['exportConvPath'] = $conv_path;
// remember this for the next Download
$_SESSION['exportConvSlashes'] = $conv_slashes;
if (!PGV_USER_GEDCOM_ADMIN || !$ged) {
    header("Location: editgedcoms.php");
    exit;
}
if ($action == 'download') {
    $conv_path = rtrim(str_replace('\\', '/', trim($conv_path)), '/') . '/';
    // make sure we have a trailing slash here
    if ($conv_path == '/') {
        $conv_path = '';
    }
    $exportOptions = array();
Beispiel #16
0
 */
/**
 * Initialization
 */
require_once '../kernel/setup_inc.php';
// Is package installed and enabled
$gBitSystem->verifyPackage('phpgedview');
require_once PHPGEDVIEW_PKG_PATH . 'includes/bitsession.php';
include_once PHPGEDVIEW_PKG_PATH . 'BitGEDCOM.php';
$gGedcom = new BitGEDCOM(1);
// We show three different lists:
$alpha = safe_GET('alpha');
// All surnames beginning with this letter where "@"=unknown and ","=none
$surname = safe_GET('surname', '[^<>&%{};]*');
// All fams with this surname.  NB - allow ' and "
$show_all = safe_GET('show_all', array('no', 'yes'), 'no');
// All fams
// Remove slashes
if (isset($alpha)) {
    $alpha = stripslashes($alpha);
    $doctitle = "Family List : " . $alpha;
}
if (isset($surname)) {
    $surname = stripslashes($surname);
    $doctitle = "Family List : ";
    if (empty($surname) or trim("@" . $surname, "_") == "@" or $surname == "@N.N.") {
        $doctitle .= $pgv_lang["NN"];
    } else {
        $doctitle .= $surname;
    }
}
 * 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
 *
 * @package PhpGedView
 * @subpackage Admin
 * @version $Id: downloadbackup.php 6879 2010-01-30 11:35:46Z fisharebest $
 */
define('PGV_SCRIPT_NAME', 'downloadbackup.php');
require './config.php';
$fname = safe_GET('fname');
if (!PGV_USER_GEDCOM_ADMIN || !preg_match('/\\.zip$/', $fname)) {
    print $pgv_lang['access_denied'];
    exit;
}
if (ini_get('zlib.output_compression')) {
    @ini_set('zlib.output_compression', 'Off');
}
header('Pragma: public');
// required
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
// required for certain browsers
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="' . $fname . '"');
Beispiel #18
0
require PGV_ROOT . 'includes/functions/functions_print_lists.php';
$type = safe_GET('type', PGV_REGEX_ALPHA, 'indi');
$filter = safe_GET('filter');
$action = safe_GET('action');
$callback = safe_GET('callback', PGV_REGEX_NOSCRIPT, 'paste_id');
$create = safe_GET('create');
$media = safe_GET('media');
$external_links = safe_GET('external_links');
$directory = safe_GET('directory', PGV_REGEX_NOSCRIPT, $MEDIA_DIRECTORY);
$multiple = safe_GET_bool('multiple');
$showthumb = safe_GET_bool('showthumb');
$all = safe_GET_bool('all');
$subclick = safe_GET('subclick');
$choose = safe_GET('choose', PGV_REGEX_NOSCRIPT, '0all');
$level = safe_GET('level', PGV_REGEX_INTEGER, 0);
$language_filter = safe_GET('language_filter');
$magnify = safe_GET_bool('magnify');
if ($showthumb) {
    $thumbget = '&showthumb=true';
} else {
    $thumbget = '';
}
if ($subclick == 'all') {
    $all = true;
}
$embed = substr($choose, 0, 1) == "1";
$chooseType = substr($choose, 1);
if ($chooseType != "media" && $chooseType != "0file") {
    $chooseType = "all";
}
//-- force the thumbnail directory to have the same layout as the media directory
Beispiel #19
0
 /**
  * Initialization function
  */
 function init()
 {
     global $PEDIGREE_FULL_DETAILS, $PEDIGREE_LAYOUT, $MAX_PEDIGREE_GENERATIONS;
     global $DEFAULT_PEDIGREE_GENERATIONS, $SHOW_EMPTY_BOXES;
     global $bwidth, $bheight, $baseyoffset, $basexoffset, $byspacing, $bxspacing;
     global $TEXT_DIRECTION, $BROWSER_TYPE, $show_full, $talloffset;
     $this->log2 = log(2);
     if ($this->isPrintPreview()) {
         $this->show_famlink = false;
     }
     $this->rootid = safe_GET_xref('rootid');
     $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS);
     $this->talloffset = safe_GET('talloffset', array('0', '1', '2', '3'), $PEDIGREE_LAYOUT);
     $this->PEDIGREE_GENERATIONS = safe_GET_integer('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS);
     if ($this->talloffset == 1) {
         $this->talloffset = 1;
     }
     // Make SURE this is an integer
     if ($this->talloffset > 1 && $this->PEDIGREE_GENERATIONS > 8) {
         $this->PEDIGREE_GENERATIONS = 8;
     }
     // TODO: some library functions expect this as a global.
     // Passing a function parameter would be much better.
     global $PEDIGREE_GENERATIONS;
     $PEDIGREE_GENERATIONS = $this->PEDIGREE_GENERATIONS;
     // This is passed as a global.  A parameter would be better...
     $this->show_full = $this->show_full ? 1 : 0;
     // Make SURE this is an integer
     if ($this->talloffset > 3) {
         $this->talloffset = 3;
     } else {
         if ($this->talloffset < 0) {
             $this->talloffset = 0;
         }
     }
     $show_full = $this->show_full;
     $talloffset = $this->talloffset;
     // Validate parameters
     $this->rootid = check_rootid($this->rootid);
     $this->rootPerson = Person::getInstance($this->rootid);
     if (is_null($this->rootPerson)) {
         $this->rootPerson = new Person('');
     }
     $this->name = $this->rootPerson->getFullName();
     $this->addname = $this->rootPerson->getAddName();
     //-- adjustments for hide details
     if ($this->show_full == false) {
         $bheight = 30;
         if ($this->talloffset < 2) {
             $bwidth -= 30;
         } else {
             $bwidth -= 50;
         }
     }
     //-- adjustments for portrait mode
     if ($this->talloffset == 0) {
         $bxspacing += 12;
         $bwidth += 20;
         $baseyoffset -= 20 * ($this->PEDIGREE_GENERATIONS - 1);
     }
     $this->pbwidth = $bwidth + 6;
     $this->pbheight = $bheight + 5;
     $this->treeid = ancestry_array($this->rootid);
     $this->treesize = pow(2, (int) $this->PEDIGREE_GENERATIONS) - 1;
     //-- ancestry_array puts everyone at $i+1
     for ($i = 0; $i < $this->treesize; $i++) {
         $this->treeid[$i] = $this->treeid[$i + 1];
     }
     if (!$this->show_full) {
         if ($this->talloffset == 0) {
             $baseyoffset = 160 + $bheight * 2;
         } else {
             if ($this->talloffset == 1) {
                 $baseyoffset = 180 + $bheight * 2;
             } else {
                 if ($this->talloffset > 1) {
                     if ($this->PEDIGREE_GENERATIONS == 3) {
                         $baseyoffset = 30;
                     } else {
                         $baseyoffset = -85;
                     }
                 }
             }
         }
     } else {
         if ($this->talloffset == 0) {
             $baseyoffset = 100 + $bheight / 2;
         } else {
             if ($this->talloffset == 1) {
                 $baseyoffset = 160 + $bheight / 2;
             } else {
                 if ($this->talloffset > 1) {
                     if ($this->PEDIGREE_GENERATIONS == 3) {
                         $baseyoffset = 30;
                     } else {
                         $baseyoffset = -85;
                     }
                 }
             }
         }
     }
     //-- adjustments for preview
     if ($this->isPrintPreview() && $this->talloffset < 2) {
         $baseyoffset -= 230;
     }
     // -- this next section will create and position the DIV layers for the pedigree tree
     $this->curgen = 1;
     // -- variable to track which generation the algorithm is currently working on
     $this->yoffset = 0;
     // -- used to offset the position of each box as it is generated
     $this->xoffset = 0;
     $this->prevyoffset = 0;
     // -- used to track the y position of the previous box
     $this->offsetarray = array();
     $this->minyoffset = 0;
     if ($this->treesize < 3) {
         $this->treesize = 3;
     }
     // -- loop through all of id's in the array starting at the last and working to the first
     //-- calculation the box positions
     for ($i = $this->treesize - 1; $i >= 0; $i--) {
         // -- check to see if we have moved to the next generation
         if ($i < floor($this->treesize / pow(2, $this->curgen))) {
             $this->curgen++;
         }
         //-- box position in current generation
         $boxpos = $i - pow(2, $this->PEDIGREE_GENERATIONS - $this->curgen);
         //-- offset multiple for current generation
         if ($this->talloffset < 2) {
             $genoffset = pow(2, $this->curgen - $this->talloffset);
             $boxspacing = $this->pbheight + $byspacing;
         } else {
             $genoffset = pow(2, $this->curgen - 1);
             $boxspacing = $this->pbwidth + $byspacing;
         }
         // -- calculate the yoffset		Position in the generation		Spacing between boxes		put child between parents
         $this->yoffset = $baseyoffset + $boxpos * ($boxspacing * $genoffset) + $boxspacing / 2 * $genoffset + $boxspacing * $genoffset;
         // -- calculate the xoffset
         if ($this->talloffset == 0) {
             if ($this->PEDIGREE_GENERATIONS < 6) {
                 $addxoffset = $basexoffset + (10 + 60 * (5 - $this->PEDIGREE_GENERATIONS));
                 $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset;
             } else {
                 $addxoffset = $basexoffset + 10;
                 $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset;
             }
             //-- compact the tree
             if ($this->curgen < $this->PEDIGREE_GENERATIONS) {
                 $parent = floor(($i - 1) / 2);
                 if ($i % 2 == 0) {
                     $this->yoffset = $this->yoffset - $boxspacing / 2 * ($this->curgen - 1);
                 } else {
                     $this->yoffset = $this->yoffset + $boxspacing / 2 * ($this->curgen - 1);
                 }
                 $pgen = $this->curgen;
                 while ($parent > 0) {
                     if ($parent % 2 == 0) {
                         $this->yoffset = $this->yoffset - $boxspacing / 2 * $pgen;
                     } else {
                         $this->yoffset = $this->yoffset + $boxspacing / 2 * $pgen;
                     }
                     $pgen++;
                     if ($pgen > 3) {
                         $temp = 0;
                         for ($j = 1; $j < $pgen - 2; $j++) {
                             $temp += pow(2, $j) - 1;
                         }
                         if ($parent % 2 == 0) {
                             $this->yoffset = $this->yoffset - $boxspacing / 2 * $temp;
                         } else {
                             $this->yoffset = $this->yoffset + $boxspacing / 2 * $temp;
                         }
                     }
                     $parent = floor(($parent - 1) / 2);
                 }
                 if ($this->curgen > 3) {
                     $temp = 0;
                     for ($j = 1; $j < $this->curgen - 2; $j++) {
                         $temp += pow(2, $j) - 1;
                     }
                     if ($i % 2 == 0) {
                         $this->yoffset = $this->yoffset - $boxspacing / 2 * $temp;
                     } else {
                         $this->yoffset = $this->yoffset + $boxspacing / 2 * $temp;
                     }
                 }
             }
             $this->yoffset -= $boxspacing / 2 * pow(2, $this->PEDIGREE_GENERATIONS - 2) - $boxspacing / 2;
         } else {
             if ($this->talloffset == 1) {
                 $this->xoffset = 10 + $basexoffset + ($this->PEDIGREE_GENERATIONS - $this->curgen) * ($this->pbwidth + $bxspacing);
                 if ($this->curgen == $this->PEDIGREE_GENERATIONS) {
                     $this->xoffset += 10;
                 }
                 if ($this->PEDIGREE_GENERATIONS < 4) {
                     $this->xoffset += 60;
                 }
             } else {
                 if ($this->talloffset == 2) {
                     if ($this->show_full) {
                         $this->xoffset = $this->curgen * (($this->pbwidth + $bxspacing) / 2) + $this->curgen * 10 + 136.5;
                     } else {
                         $this->xoffset = $this->curgen * (($this->pbwidth + $bxspacing) / 4) + $this->curgen * 10 + 215.75;
                     }
                     if ($this->isPrintPreview()) {
                         $this->xoffset -= 260;
                     }
                 } else {
                     if ($this->show_full) {
                         $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + 260;
                     } else {
                         $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 4) + 270;
                     }
                     if ($this->isPrintPreview()) {
                         $this->xoffset -= 260;
                     }
                 }
             }
         }
         if ($this->curgen == 1 && $this->talloffset == 1) {
             $this->xoffset += 10;
         }
         $this->offsetarray[$i]["x"] = $this->xoffset;
         $this->offsetarray[$i]["y"] = $this->yoffset;
     }
     //-- collapse the tree if boxes are missing
     if (!$SHOW_EMPTY_BOXES) {
         if ($this->PEDIGREE_GENERATIONS > 1) {
             $this->collapse_tree(0, 1, 0);
         }
     }
     //-- calculate the smallest yoffset and adjust the tree to that offset
     $minyoffset = 0;
     for ($i = 0; $i < count($this->treeid); $i++) {
         if ($SHOW_EMPTY_BOXES || !empty($treeid[$i])) {
             if (!empty($offsetarray[$i])) {
                 if ($minyoffset == 0 || $minyoffset > $this->offsetarray[$i]["y"]) {
                     $minyoffset = $this->offsetarray[$i]["y"];
                 }
             }
         }
     }
     $ydiff = $baseyoffset + 35 - $minyoffset;
     $this->adjust_subtree(0, $ydiff);
     //-- if no father keep the tree off of the pedigree form
     if ($this->isPrintPreview() && $this->offsetarray[0]["y"] + $baseyoffset < 300) {
         $this->adjust_subtree(0, 300 - ($this->offsetarray[0]["y"] + $baseyoffset));
     }
 }
Beispiel #20
0
 /**
  * Initialization function
  */
 function init()
 {
     global $USE_RIN, $MAX_ALIVE_AGE, $GEDCOM, $bwidth, $bheight, $pbwidth, $pbheight, $GEDCOM_DEFAULT_TAB, $pgv_lang, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS;
     global $DEFAULT_PEDIGREE_GENERATIONS, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $OLD_PGENS, $box_width, $Dbwidth, $Dbheight;
     global $show_full;
     // Extract form parameters
     $this->rootid = safe_GET_xref('rootid');
     $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS);
     $this->show_cousins = safe_GET('show_cousins', array('0', '1'), '0');
     $this->chart_style = safe_GET_integer('chart_style', 0, 3, 0);
     $box_width = safe_GET_integer('box_width', 50, 300, 100);
     $PEDIGREE_GENERATIONS = safe_GET_integer('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS);
     // This is passed as a global.  A parameter would be better...
     $show_full = $this->show_full;
     $OLD_PGENS = $PEDIGREE_GENERATIONS;
     // Validate form parameters
     $this->rootid = check_rootid($this->rootid);
     // -- size of the boxes
     $Dbwidth *= $box_width / 100;
     $bwidth = $Dbwidth;
     if (!$this->show_full) {
         $bwidth = $bwidth / 1.5;
     }
     $bheight = $Dbheight;
     if (!$this->show_full) {
         $bheight = $bheight / 1.5;
     }
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     $this->ancestry = Person::getInstance($this->rootid);
     $this->name = $this->ancestry->getFullName();
     $this->addname = $this->ancestry->getAddName();
     if (strlen($this->name) < 30) {
         $this->cellwidth = "420";
     } else {
         $this->cellwidth = strlen($this->name) * 14;
     }
     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->hour->undoChange();
             break;
     }
 }
Beispiel #21
0
function safe_GET_xref($var, $default = null)
{
    return safe_GET($var, PGV_REGEX_XREF, $default);
}
Beispiel #22
0
 *
 * @package PhpGedView
 * @subpackage Languages
 * @version $Id$
 */
require './config.php';
if (!PGV_USER_IS_ADMIN) {
    header('Location: login.php?url=editlang.php');
    exit;
}
loadLangFile('pgv_confighelp');
require './includes/functions/functions_editlang.php';
$action = safe_GET('action');
$file_type = safe_GET('file_type');
$language1 = safe_GET('language1', array_keys($language_settings), 'english');
$language2 = safe_GET('language2', array_keys($language_settings), $LANGUAGE);
$hide_translated = safe_GET_bool('hide_translated');
$commitTranslationsLink = safe_GET_bool('commitTranslationsLink');
$execute = safe_GET_bool('execute');
$lang_shortcut = $language_settings[$language2]["lang_short_cut"];
switch ($action) {
    case 'edit':
        print_header($pgv_lang['edit_lang_utility']);
        break;
    case 'export':
        print_header($pgv_lang['export_lang_utility']);
        break;
    case 'compare':
        print_header($pgv_lang['compare_lang_utility']);
        break;
    default:
Beispiel #23
0
 /**
  * Initialization function
  */
 function init()
 {
     global $GEDCOM_ID_PREFIX;
     $this->baseyear = date("Y");
     //-- new pid
     $newpid = safe_GET_xref('newpid');
     if ($newpid) {
         $indirec = find_person_record($newpid);
         if (empty($indirec) && $GEDCOM_ID_PREFIX) {
             if (stristr($newpid, $GEDCOM_ID_PREFIX) === false) {
                 $newpid = $GEDCOM_ID_PREFIX . $newpid;
             }
         }
     }
     if (safe_GET('clear', '1') == '1') {
         unset($_SESSION['timeline_pids']);
     } else {
         if (isset($_SESSION['timeline_pids'])) {
             $this->pids = $_SESSION['timeline_pids'];
         }
         //-- pids array
         $this->pids = safe_GET_xref('pids');
     }
     if (!is_array($this->pids)) {
         $this->pids = array();
     } else {
         //-- make sure that arrays are indexed by numbers
         $this->pids = array_values($this->pids);
     }
     if (!empty($newpid) && !in_array($newpid, $this->pids)) {
         $this->pids[] = $newpid;
     }
     if (count($this->pids) == 0) {
         $this->pids[] = check_rootid("");
     }
     $remove = safe_GET_xref('remove');
     //-- cleanup user input
     $newpids = array();
     foreach ($this->pids as $key => $value) {
         if ($value != $remove) {
             $newpids[] = $value;
             $person = Person::getInstance($value);
             if (!is_null($person)) {
                 $this->people[] = $person;
             }
         }
     }
     $this->pids = $newpids;
     $this->pidlinks = "";
     /* @var $indi Person */
     foreach ($this->people as $p => $indi) {
         if (!is_null($indi) && $indi->canDisplayDetails()) {
             //-- setup string of valid pids for links
             $this->pidlinks .= "pids[]=" . $indi->getXref() . "&amp;";
             $bdate = $indi->getBirthDate();
             if ($bdate->isOK()) {
                 $date = $bdate->MinDate();
                 $date = $date->convert_to_cal('gregorian');
                 if ($date->y) {
                     $this->birthyears[$indi->getXref()] = $date->y;
                     $this->birthmonths[$indi->getXref()] = max(1, $date->m);
                     $this->birthdays[$indi->getXref()] = max(1, $date->d);
                 }
             }
             // find all the fact information
             $indi->add_family_facts(false);
             foreach ($indi->getIndiFacts() as $event) {
                 //-- get the fact type
                 $fact = $event->getTag();
                 if (!in_array($fact, $this->nonfacts)) {
                     //-- check for a date
                     $date = $event->getDate();
                     $date = $date->MinDate();
                     $date = $date->convert_to_cal('gregorian');
                     if ($date->y) {
                         $this->baseyear = min($this->baseyear, $date->y);
                         $this->topyear = max($this->topyear, $date->y);
                         if (!$indi->isDead()) {
                             $this->topyear = max($this->topyear, date('Y'));
                         }
                         $event->temp = $p;
                         //-- do not add the same fact twice (prevents marriages from being added multiple times)
                         if (!in_array($event, $this->indifacts, true)) {
                             $this->indifacts[] = $event;
                         }
                     }
                 }
             }
         }
     }
     $_SESSION['timeline_pids'] = $this->pids;
     $scale = safe_GET_integer('scale', 0, 200, 0);
     if ($scale == 0) {
         $this->scale = round(($this->topyear - $this->baseyear) / 20 * count($this->indifacts) / 4);
         if ($this->scale < 6) {
             $this->scale = 6;
         }
     } else {
         $this->scale = $scale;
     }
     if ($this->scale < 2) {
         $this->scale = 2;
     }
     $this->baseyear -= 5;
     $this->topyear += 5;
 }
Beispiel #24
0
 /**
  * Initialization function
  */
 function init()
 {
     global $GEDCOM_ID_PREFIX;
     $this->colorindex = 0;
     $this->Fcolorindex = 0;
     $this->Mcolorindex = 0;
     $this->zoomfactor = 10;
     $this->color = "#0000FF";
     $this->currentYear = date("Y");
     $this->deathMod = 0;
     $this->endDate = $this->currentYear;
     //--new pid
     $newpid = safe_GET_xref('newpid');
     if ($newpid) {
         $person = Person::getInstance($newpid);
         if (is_null($person) && $GEDCOM_ID_PREFIX) {
             //-- allow the user to enter the id without the "I" prefix
             $newpid = $GEDCOM_ID_PREFIX . $newpid;
             $person = Person::getInstance($newpid);
         } else {
             $newpid = $person->getXref();
         }
     }
     if (safe_GET('clear', '1') == '1') {
         unset($_SESSION['timeline_pids']);
     } else {
         if (isset($_SESSION['timeline_pids'])) {
             $this->pids = $_SESSION['timeline_pids'];
         }
         if (!empty($newpid)) {
             $this->pids[] = $newpid;
         }
         //-- pids array
         $pids = safe_GET_xref('pids');
         if ($pids) {
             $this->pids = $pids;
             if (!empty($newpid)) {
                 $this->pids[] = $newpid;
             }
         }
         //-- gets the immediate family for the individual being added if the include immediate family checkbox is checked.
         if (safe_GET('addFamily', 'yes') == 'yes') {
             if (isset($newpid)) {
                 $this->addFamily($newpid);
             }
         }
         $remove = safe_GET_xref('remove');
         //-- always start with someone on the chart
         if (count($this->pids) == 0) {
             $this->pids[] = $this->addFamily(check_rootid(""));
         }
         //-- limit to a certain place
         $searchplace = safe_GET('place');
         if (!empty($searchplace)) {
             $place_pids = get_place_positions($searchplace);
             if (count($place_pids) > 0) {
                 $this->pids = $place_pids;
             }
         }
         //-- store the people in the session
         $_SESSION['timeline_pids'] = $this->pids;
         $beginYear = safe_GET_integer('beginYear', 0, date('Y') + 100, 0);
         $endYear = safe_GET_integer('endYear', 0, date('Y') + 100, 0);
         if ($beginYear == 0 || $endYear == 0) {
             //-- cleanup user input
             $this->pids = array_unique($this->pids);
             //removes duplicates
             foreach ($this->pids as $key => $value) {
                 if ($value != $remove) {
                     $this->pids[$key] = $value;
                     $person = Person::getInstance($value);
                     if ($person) {
                         $bdate = $person->getEstimatedBirthDate();
                         $ddate = $person->getEstimatedDeathDate();
                         //--Checks to see if the details of that person can be viewed
                         if ($bdate->isOK() && $person->canDisplayDetails()) {
                             $this->people[] = $person;
                         }
                     }
                 }
             }
         } else {
             //-- reset the people array when doing a year range search
             $this->people = array();
             //Takes the begining year and end year passed by the postback and modifies them and uses them to populate
             //the time line
             //Variables to restrict the person boxes to the year searched.
             //--Searches for individuals who had an even between the year begin and end years
             $indis = search_indis_year_range($beginYear, $endYear);
             //--Populates an array of people that had an event within those years
             foreach ($indis as $pid) {
                 if (empty($searchplace) || in_array($pid, $this->pids)) {
                     $person = Person::getInstance($pid);
                     if ($person) {
                         $bdate = $person->getEstimatedBirthDate();
                         $ddate = $person->getEstimatedDeathDate();
                         //--Checks to see if the details of that person can be viewed
                         if ($bdate->isOK() && $person->canDisplayDetails()) {
                             $this->people[] = $person;
                         }
                     }
                 }
             }
             unset($_SESSION['timeline_pids']);
         }
         //--Sort the arrar in order of being year
         uasort($this->people, "compare_people");
         //If there is people in the array posted back this if occurs
         if (isset($this->people[0])) {
             //Find the maximum Death year and mimimum Birth year for each individual returned in the array.
             $bdate = $this->people[0]->getEstimatedBirthDate();
             $ddate = $this->people[0]->getEstimatedDeathDate();
             $this->timelineMinYear = $bdate->gregorianYear();
             $this->timelineMaxYear = $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y');
             foreach ($this->people as $key => $value) {
                 $bdate = $value->getEstimatedBirthDate();
                 $ddate = $value->getEstimatedDeathDate();
                 $this->timelineMinYear = min($this->timelineMinYear, $bdate->gregorianYear());
                 $this->timelineMaxYear = max($this->timelineMaxYear, $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y'));
             }
             if ($this->timelineMaxYear > $this->currentYear) {
                 $this->timelineMaxYear = $this->currentYear;
             }
         } else {
             // Sets the default timeline length
             $this->timelineMinYear = date("Y") - 101;
             $this->timelineMaxYear = date("Y");
         }
     }
 }
Beispiel #25
0
 *
 * 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
 *
 * @package PhpGedView
 * @subpackage Charts
 * @version $Id: compact.php 6879 2010-01-30 11:35:46Z fisharebest $
 */
define('PGV_SCRIPT_NAME', 'compact.php');
require './config.php';
require_once PGV_ROOT . 'includes/functions/functions_charts.php';
// Extract form variables
$rootid = safe_GET_xref('rootid');
$showids = safe_GET('showids', '1', '0');
$showthumbs = safe_GET('showthumbs', '1', '0');
// Validate form variables
$rootid = check_rootid($rootid);
$person = Person::getInstance($rootid);
$name = $person->getFullName();
$addname = $person->getAddName();
// -- print html header information
print_header(PrintReady($name) . " " . $pgv_lang["compact_chart"]);
if ($ENABLE_AUTOCOMPLETE) {
    require PGV_ROOT . 'js/autocomplete.js.htm';
}
// LBox =====================================================================================
if (PGV_USE_LIGHTBOX) {
    require PGV_ROOT . 'modules/lightbox/lb_defaultconfig.php';
    require PGV_ROOT . 'modules/lightbox/functions/lb_call_js.php';
}
Beispiel #26
0
{
    Header('Content-Type: image/png');
    $image = imagecreate(safe_GET_integer('width', 100, 1000, 400), safe_GET_integer('height', 40, 400, 100));
    $bg = imagecolorallocate($image, 0xee, 0xee, 0xee);
    $red = Imagecolorallocate($image, 0xff, 0x0, 0x0);
    imagestring($image, 2, 10, 10, $txt, $red);
    imagepng($image);
}
// Get image_type
$image_type = safe_GET('image_type', PGV_REGEX_ALPHA, 'png');
if ($image_type == 'jpg') {
    $image_type = 'jpeg';
}
// Get name of SESSION variable containing an image file name
// These names are generated by PGV
$tempVarName = safe_GET('image_name', PGV_REGEX_ALPHANUM, 'graphFile');
// read image_data from SESSION variable or from file pointed to by SESSION variable
if (isset($_SESSION['image_data'])) {
    $image_data = @$_SESSION['image_data'];
    $image_data = @unserialize($image_data);
    unset($_SESSION['image_data']);
} else {
    if (isset($_SESSION[$tempVarName])) {
        $image_data = file_get_contents($_SESSION[$tempVarName]);
        unlink($_SESSION[$tempVarName]);
        unset($_SESSION[$tempVarName]);
    }
}
if (empty($image_data)) {
    ImageFlushError('Error: $_SESSION["image_data"] or $_SESSION["' . $tempVarName . '"] is empty');
} else {
Beispiel #27
0
 /**
  * Initialization function
  */
 function init($rootid = '', $show_full = 1, $generations = 3)
 {
     global $USE_RIN, $MAX_ALIVE_AGE, $GEDCOM, $bheight, $bwidth, $bhalfheight, $GEDCOM_DEFAULT_TAB, $pgv_lang, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS;
     global $PGV_IMAGES, $PGV_IMAGE_DIR, $TEXT_DIRECTION, $show_full;
     // Extract parameters from from
     $this->pid = safe_GET_xref('pid');
     $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS);
     $this->show_spouse = safe_GET('show_spouse', array('0', '1'), '0');
     $this->generations = safe_GET_integer('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 3);
     $this->box_width = safe_GET_integer('box_width', 50, 300, 100);
     // This is passed as a global.  A parameter would be better...
     $show_full = $this->show_full;
     if (!empty($_REQUEST["action"])) {
         $this->action = $_REQUEST["action"];
     }
     if (!empty($rootid)) {
         $this->pid = $rootid;
     }
     //-- flip the arrows for RTL languages
     if ($TEXT_DIRECTION == "rtl") {
         $temp = $PGV_IMAGES['larrow']['other'];
         $PGV_IMAGES['larrow']['other'] = $PGV_IMAGES['rarrow']['other'];
         $PGV_IMAGES['rarrow']['other'] = $temp;
     }
     //-- get the width and height of the arrow images for adjusting spacing
     if (file_exists($PGV_IMAGE_DIR . "/" . $PGV_IMAGES['larrow']['other'])) {
         $temp = getimagesize($PGV_IMAGE_DIR . "/" . $PGV_IMAGES['larrow']['other']);
         $this->arrwidth = $temp[0];
         $this->arrheight = $temp[1];
     }
     // -- Sets the sizes of the boxes
     if (!$this->show_full) {
         $bwidth *= $this->box_width / 150;
     } else {
         $bwidth *= $this->box_width / 100;
     }
     if (!$this->show_full) {
         $bheight = (int) ($bheight / 2);
     }
     $bhalfheight = (int) ($bheight / 2);
     // Validate parameters
     $this->pid = check_rootid($this->pid);
     $this->hourPerson = Person::getInstance($this->pid);
     $this->name = $this->hourPerson->getFullName();
     //Checks how many generations of descendency is for the person for formatting purposes
     $this->dgenerations = $this->max_descendency_generations($this->pid, 0);
     if ($this->dgenerations < 1) {
         $this->dgenerations = 1;
     }
     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->hourPerson->undoChange();
             break;
     }
 }
Beispiel #28
0
// Now check permissions to access this page
$gBitSystem->verifyPermission('bit_p_admin_phpgedview');
require_once PHPGEDVIEW_PKG_PATH . 'BitGEDCOM.php';
$gGedcom = new BitGEDCOM();
/**
 * load the main configuration and context
 */
require "includes/bitsession.php";
require $confighelpfile["english"];
global $TEXT_DIRECTION;
if (file_exists($confighelpfile[$LANGUAGE])) {
    require $confighelpfile[$LANGUAGE];
}
$action = safe_GET('action', array('delete', 'setdefault'));
$ged = safe_GET('ged', get_all_gedcoms());
$default_ged = safe_GET('default_ged', get_all_gedcoms());
/**
 * Check if a gedcom file is downloadable over the internet
 *
 * @author opus27
 * @param string $gedfile gedcom file
 * @return mixed 	$url if file is downloadable, false if not
 */
function check_gedcom_downloadable($gedfile)
{
    global $SERVER_URL, $pgv_lang;
    //$url = $SERVER_URL;
    $url = "http://localhost/";
    if (substr($url, -1, 1) != "/") {
        $url .= "/";
    }
Beispiel #29
0
 * @package PhpGedView
 * @subpackage Edit
 * @version $Id: edit_changes.php 6879 2010-01-30 11:35:46Z fisharebest $
 */
define('PGV_SCRIPT_NAME', 'edit_changes.php');
require './config.php';
require PGV_ROOT . 'includes/functions/functions_edit.php';
if (!PGV_USER_CAN_ACCEPT) {
    header('Location: login.php?url=edit_changes.php');
    exit;
}
require $INDEX_DIRECTORY . 'pgv_changes.php';
$action = safe_GET('action');
$cid = safe_GET('cid');
$index = safe_GET('index');
$ged = safe_GET('ged');
print_simple_header($pgv_lang['review_changes']);
?>
<script language="JavaScript" type="text/javascript">
<!--
	function show_gedcom_record(xref) {
		var recwin = window.open("gedrecord.php?fromfile=1&pid="+xref, "_blank", "top=50, left=50, width=600, height=400, scrollbars=1, scrollable=1, resizable=1");
	}
	function showchanges() {
		window.location = '<?php 
echo PGV_SCRIPT_NAME;
?>
';
	}

	function show_diff(diffurl) {
Beispiel #30
0
    /**
     * Tree Navigator Constructor
     * @param string $rootid the rootid of the person
     * @param int $zoom The starting zoom level
     */
    function TreeNav($rootid = '', $name = 'nav', $zoom = 0)
    {
        global $SHOW_PRIVATE_RELATIONSHIPS;
        $SHOW_PRIVATE_RELATIONSHIPS = true;
        // Interactive Tree doesn't work if this is "false"
        if ($rootid != 'none') {
            $rootid = check_rootid($rootid);
            $this->zoomLevel = $zoom;
            $this->rootPerson = Person::getInstance($rootid);
            if (is_null($this->rootPerson)) {
                $this->rootPerson = new Person('');
            }
        }
        $this->name = $name;
        //-- handle AJAX requests
        if (!empty($_REQUEST['navAjax'])) {
            //-- embedded tree for mashups
            if ($_REQUEST['navAjax'] == 'embed') {
                global $SERVER_URL;
                global $stylesheet;
                ?>
				document.writeln('<link rel="stylesheet" href="<?php 
                print $SERVER_URL . $stylesheet;
                ?>
" type="text/css" media="all" />');
				document.writeln('<script type="text/javascript" src="<?php 
                print $SERVER_URL;
                ?>
/js/phpgedview.js"></script>');
				<?php 
                ob_start();
                $w = safe_GET('width', PGV_REGEX_INTEGER, '');
                $h = safe_GET('height', PGV_REGEX_INTEGER, '');
                if (!empty($w)) {
                    $w .= "px";
                }
                if (!empty($h)) {
                    $h .= "px";
                }
                $this->drawViewport($rootid, $w, $h);
                $output = ob_get_clean();
                $lines = preg_split("/\r?\n/", $output);
                foreach ($lines as $line) {
                    print "document.writeln('" . preg_replace("/'/", "\\'", $line) . "');\n";
                }
                exit;
            }
            if (isset($_REQUEST['allSpouses'])) {
                if ($_REQUEST['allSpouses'] == 'false' || $_REQUEST['allSpouses'] == false) {
                    $this->allSpouses = false;
                } else {
                    $this->allSpouses = true;
                }
            }
            if (!empty($_REQUEST['details'])) {
                $this->getDetails($this->rootPerson);
            } else {
                if (!empty($_REQUEST['newroot'])) {
                    if (!empty($_REQUEST['drawport'])) {
                        $this->drawViewport('', "", "150px");
                    } else {
                        $fam = null;
                        if ($this->allSpouses) {
                            $this->drawPersonAllSpouses($this->rootPerson, 4, 0);
                        } else {
                            $this->drawPerson($this->rootPerson, 4, 0, $fam);
                        }
                    }
                } else {
                    if (!empty($_REQUEST['parent'])) {
                        $person = $this->rootPerson;
                        if ($_REQUEST['parent'] == 'f') {
                            $cfamily = $person->getPrimaryChildFamily();
                            if (!empty($cfamily)) {
                                $father = $cfamily->getHusband();
                                if (!empty($father)) {
                                    $fam = null;
                                    $this->drawPerson($father, 2, 1, $fam);
                                } else {
                                    print "<br />\n";
                                }
                            } else {
                                print "<br />\n";
                            }
                        } else {
                            $spouse = $person->getCurrentSpouse();
                            if (!empty($spouse)) {
                                $cfamily = $spouse->getPrimaryChildFamily();
                                if (!empty($cfamily)) {
                                    $mother = $cfamily->getHusband();
                                    if (!empty($mother)) {
                                        $fam = null;
                                        $this->drawPerson($mother, 2, 1, $fam);
                                    } else {
                                        print "<br />\n";
                                    }
                                } else {
                                    print "<br />\n";
                                }
                            } else {
                                print "<br />\n";
                            }
                        }
                    } else {
                        $fams = $this->rootPerson->getSpouseFamilies();
                        $family = end($fams);
                        if (!$this->allSpouses) {
                            $this->drawChildren($family, 2);
                        } else {
                            $this->drawAllChildren($this->rootPerson, 2);
                        }
                    }
                }
            }
            exit;
        }
    }