Пример #1
0
function print_yahrzeit($block = true, $config = '', $side, $index)
{
    global $pgv_lang, $factarray, $SHOW_ID_NUMBERS, $ctype, $TEXT_DIRECTION;
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $PGV_BLOCKS;
    global $DAYS_TO_SHOW_LIMIT, $SHOW_MARRIED_NAMES, $SERVER_URL;
    $block = true;
    // Always restrict this block's height
    if (empty($config)) {
        $config = $PGV_BLOCKS['print_yahrzeit']['config'];
    }
    if (empty($config['infoStyle'])) {
        $config['infoStyle'] = 'style2';
    }
    if (empty($config['allowDownload'])) {
        $config['allowDownload'] = 'yes';
    }
    if (empty($config['days'])) {
        $config['days'] = $DAYS_TO_SHOW_LIMIT;
    }
    if ($config['days'] < 1) {
        $config['days'] = 1;
    }
    if ($config['days'] > $DAYS_TO_SHOW_LIMIT) {
        $config['days'] = $DAYS_TO_SHOW_LIMIT;
    }
    $startjd = server_jd();
    $endjd = $startjd + max(min($config['days'], 1), $DAYS_TO_SHOW_LIMIT) - 1;
    if (!PGV_USER_ID) {
        $allowDownload = "no";
    }
    $id = "yahrzeit";
    $title = print_help_link('yahrzeit_help', 'qm', '', false, true);
    if ($PGV_BLOCKS['print_yahrzeit']['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;\">";
            $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"{$pgv_lang['config_block']}\" /></a>";
        }
    }
    $title .= $pgv_lang['yahrzeit_block'];
    $content = "";
    // The standard anniversary rules cover most of the Yahrzeit rules, we just
    // need to handle a few special cases.
    // Fetch normal anniversaries...
    $yahrzeits = array();
    $hidden = 0;
    for ($jd = $startjd - 1; $jd <= $endjd + 30; ++$jd) {
        foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) {
            // Extract hebrew dates only
            if ($fact['date']->date1->CALENDAR_ESCAPE() == '@#DHEBREW@' && $fact['date']->MinJD() == $fact['date']->MaxJD()) {
                // Apply privacy
                if (displayDetailsById($fact['id']) && showFactDetails($fact['fact'], $fact['id']) && !FactViewRestricted($fact['id'], $fact['factrec'])) {
                    $yahrzeits[] = $fact;
                } else {
                    ++$hidden;
                }
            }
        }
    }
    // ...then adjust dates
    foreach ($yahrzeits as $key => $yahrzeit) {
        if (strpos('1 DEAT', $yahrzeit['factrec']) !== false) {
            // Just DEAT, not _YART
            $today = new JewishDate($yahrzeit['jd']);
            $hd = $yahrzeit['date']->MinDate();
            $hd1 = new JewishDate($hd);
            $hd1->y += 1;
            $hd1->SetJDFromYMD();
            // Special rules.  See http://www.hebcal.com/help/anniv.html
            // Everything else is taken care of by our standard anniversary rules.
            if ($hd->d == 30 && $hd->m == 2 && $hd->y != 0 && $hd1->DaysInMonth() < 30) {
                // 30 CSH
                // Last day in CSH
                $yahrzeit[$key]['jd'] = JewishDate::YMDtoJD($today->y, 3, 1) - 1;
            }
            if ($hd->d == 30 && $hd->m == 3 && $hd->y != 0 && $hd1->DaysInMonth() < 30) {
                // 30 KSL
                // Last day in KSL
                $yahrzeit[$key]['jd'] = JewishDate::YMDtoJD($today->y, 4, 1) - 1;
            }
            if ($hd->d == 30 && $hd->m == 6 && $hd->y != 0 && $today->DaysInMonth() < 30 && !$today->IsLeapYear()) {
                // 30 ADR
                // Last day in SHV
                $yahrzeit[$key]['jd'] = JewishDate::YMDtoJD($today->y, 6, 1) - 1;
            }
        }
    }
    switch ($config['infoStyle']) {
        case "style1":
            // List style
            foreach ($yahrzeits as $yahrzeit) {
                if ($yahrzeit['jd'] >= $startjd && $yahrzeit['jd'] < $startjd + $config['days']) {
                    $ind = person::GetInstance($yahrzeit['id']);
                    //@@			$content .= "<a href=\"".encode_url($ind->getLinkUrl())."\" class=\"list_item name2\">".$ind->getFullName()."</a>".$ind->getSexImage();
                    $content .= "<a href=\"" . encode_url($ind->getLinkUrl()) . "\" class=\"list_item name2\">" . PrintReady($ind->getFullName()) . "</a>" . $ind->getSexImage();
                    $content .= "<div class=\"indent\">";
                    $content .= $yahrzeit['date']->Display(true);
                    $content .= ', ' . str_replace("#year_var#", $yahrzeit['anniv'], $pgv_lang["year_anniversary"]);
                    $content .= "</div>";
                }
            }
            break;
        case "style2":
            // Table style
            require_once PGV_ROOT . 'js/sorttable.js.htm';
            require_once PGV_ROOT . 'includes/classes/class_gedcomrecord.php';
            $table_id = "ID" . floor(microtime() * 1000000);
            // sorttable requires a unique ID
            $content .= "<table id=\"{$table_id}\" class=\"sortable list_table center\">";
            $content .= "<tr>";
            $content .= "<th class=\"list_label\">{$factarray['NAME']}</th>";
            $content .= "<th style=\"display:none\">GIVN</th>";
            $content .= "<th class=\"list_label\">{$factarray['DATE']}</th>";
            $content .= "<th class=\"list_label\"><img src=\"./images/reminder.gif\" alt=\"{$pgv_lang['anniversary']}\" title=\"{$pgv_lang['anniversary']}\" border=\"0\" /></th>";
            $content .= "<th class=\"list_label\">{$factarray['_YART']}</th>";
            $content .= "</tr>";
            $count = 0;
            foreach ($yahrzeits as $yahrzeit) {
                if ($yahrzeit['jd'] >= $startjd && $yahrzeit['jd'] < $startjd + $config['days']) {
                    ++$count;
                    $ind = person::GetInstance($yahrzeit['id']);
                    $content .= "<tr class=\"vevent\">";
                    // hCalendar:vevent
                    // Record name(s)
                    $name = $ind->getFullName();
                    $url = $ind->getLinkUrl();
                    $content .= "<td class=\"list_value_wrap\" align=\"" . get_align($name) . "\">";
                    $content .= "<a href=\"" . encode_url($ind->getLinkUrl()) . "\" class=\"list_item name2\" dir=\"" . $TEXT_DIRECTION . "\">" . PrintReady($name) . "</a>";
                    $content .= $ind->getSexImage();
                    $addname = $ind->getAddName();
                    if ($addname) {
                        $content .= "<br /><a href=\"" . encode_url($url) . "\" class=\"list_item\">" . PrintReady($addname) . "</a>";
                    }
                    $content .= "</td>";
                    // GIVN for sorting
                    $content .= "<td style=\"display:none\">";
                    $exp = explode(",", str_replace('<', ',', $name) . ",");
                    $content .= $exp[1];
                    $content .= "</td>";
                    $today = new JewishDate($yahrzeit['jd']);
                    $td = new GedcomDate($today->Format('@ A O E'));
                    // death/yahrzeit event date
                    $content .= "<td class=\"list_value_wrap\">";
                    $content .= "<a name='{$yahrzeit['jd']}'>" . $yahrzeit['date']->Display(true, NULL, array()) . "</a>";
                    $content .= "</td>";
                    // Anniversary
                    $content .= "<td class=\"list_value_wrap rela\">";
                    $anniv = $yahrzeit['anniv'];
                    if ($anniv == 0) {
                        $content .= '<a name="0">&nbsp;</a>';
                    } else {
                        $content .= "<a name=\"{$anniv}\">{$anniv}</a>";
                    }
                    if ($config['allowDownload'] == 'yes') {
                        // hCalendar:dtstart and hCalendar:summary
                        //TODO does this work??
                        $content .= "<abbr class=\"dtstart\" title=\"" . strip_tags($yahrzeit['date']->Display(false, 'Ymd', array())) . "\"></abbr>";
                        $content .= "<abbr class=\"summary\" title=\"" . $pgv_lang["anniversary"] . " #{$anniv} " . $factarray[$yahrzeit['fact']] . " : " . PrintReady(strip_tags($ind->getFullName())) . "\"></abbr>";
                    }
                    // upcomming yahrzeit dates
                    $content .= "<td class=\"list_value_wrap\">";
                    $content .= "<a href=\"" . $url . "\" class=\"list_item url\">" . $td->Display(true, NULL, array('gregorian')) . "</a>";
                    // hCalendar:url
                    $content .= "&nbsp;</td>";
                    $content .= "</tr>";
                }
            }
            // table footer
            $content .= "<tr class=\"sortbottom\">";
            $content .= "<td class=\"list_label\">";
            $content .= '<a href="javascript:;" onclick="sortByOtherCol(this,1)"><img src="images/topdown.gif" alt="" border="0" /> ' . $factarray["GIVN"] . '</a><br />';
            $content .= $pgv_lang["total_names"] . ": " . $count;
            if ($hidden) {
                $content .= "<br /><span class=\"warning\">{$pgv_lang['hidden']} : {$hidden}</span>";
            }
            $content .= "</td>";
            $content .= "<td style=\"display:none\">GIVN</td>";
            $content .= "<td>";
            if ($config['allowDownload'] == 'yes') {
                $uri = $SERVER_URL . basename($_SERVER['REQUEST_URI']);
                global $whichFile;
                $whichFile = 'hCal-events.ics';
                $alt = print_text('download_file', 0, 1);
                if (count($yahrzeits)) {
                    $content .= "<a href=\"http://feeds.technorati.com/events/{$uri}\"><img src=\"images/hcal.png\" border=\"0\" alt=\"{$alt}\" title=\"{$alt}\" /></a>";
                }
            }
            $content .= '</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
            $content .= '</table>';
            break;
    }
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
}
Пример #2
0
         addDebugLog($action . " xref={$xref} SUCCESS\n" . trim($gedrec));
         print "SUCCESS\n" . trim($gedrec);
     } else {
         addDebugLog($action . " ERROR 3: No gedcom id specified.  Please specify a xref.");
         print "ERROR 3: No gedcom id specified.  Please specify a xref.\n";
     }
     exit;
 case 'getprev':
     $xref = safe_REQUEST($_REQUEST, 'xref', PGV_REGEX_XREF);
     if ($xref) {
         $xref1 = get_prev_xref($xref, $GED_ID);
         $gedrec = find_updated_record($xref1);
         if (!$gedrec) {
             $gedrec = find_gedcom_record($xref1);
         }
         if (!displayDetailsById($xref1)) {
             //-- do not have full access to this record, so privatize it
             $gedrec = privatize_gedcom($gedrec);
         }
         addDebugLog($action . " xref={$xref} SUCCESS\n" . trim($gedrec));
         print "SUCCESS\n" . trim($gedrec);
     } else {
         addDebugLog($action . " ERROR 3: No gedcom id specified.  Please specify a xref.");
         print "ERROR 3: No gedcom id specified.  Please specify a xref.\n";
     }
     exit;
 case 'search':
     $query = safe_REQUEST($_REQUEST, 'query');
     if ($query) {
         $sindilist = search_indis(array($query), array(PGV_GED_ID), 'AND', true);
         print "SUCCESS\n";
Пример #3
0
function print_family_book($pid, $descent)
{
    global $generations, $dgenerations, $pgv_lang, $firstrun;
    if ($descent == 0) {
        return;
    }
    $famids = find_sfamily_ids($pid);
    if (count($famids) > 0 || empty($firstrun)) {
        $firstrun = true;
        $pid = check_rootid($pid);
        $person = Person::getInstance($pid);
        $name = $person->getFullName();
        print "\n\t<h2 style=\"text-align: center\">" . $pgv_lang["family_of"] . PrintReady($name) . "</h2>";
        print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr>\n";
        //-- descendancy
        print "<td valign=\"middle\">\n";
        $dgenerations = $generations;
        // $dgenerations = max_descendency_generations($pid, 0);
        print_descendency($pid, 1);
        print "</td>\n";
        //-- pedigree
        print "<td valign=\"middle\">\n";
        print_person_pedigree($pid, 1);
        print "</td>\n";
        print "</tr></table>\n";
        print "<br /><br />\n";
        print "<hr style=\"page-break-after:always;\"/>\n";
        print "<br /><br />\n";
        foreach ($famids as $indexval => $famid) {
            $famrec = find_family_record($famid, PGV_GED_ID);
            $ct = preg_match_all("/1 CHIL @(.*)@/", $famrec, $match, PREG_SET_ORDER);
            for ($i = 0; $i < $ct; $i++) {
                $chil = trim($match[$i][1]);
                if (showLivingNameById($chil) || displayDetailsById($chil)) {
                    print_family_book($chil, $descent - 1);
                }
            }
        }
    }
}
Пример #4
0
/**
 * find the highlighted media object for a gedcom entity
 *
 * Rules for finding the highlighted media object:
 * 1. The first _PRIM Y object will be used regardless of level in gedcom record
 * 2. The first level 1 object will be used if there if it doesn't have _PRIM N (level 1 objects appear on the media tab on the individual page)
 *
 * @param string $pid the individual, source, or family id
 * @param string $indirec the gedcom record to look in
 * @return array an object array with indexes "thumb" and "file" for thumbnail and filename
 */
function find_highlighted_object($pid, $indirec)
{
    global $MEDIA_DIRECTORY, $MEDIA_DIRECTORY_LEVELS, $PGV_IMAGE_DIR, $PGV_IMAGES, $MEDIA_EXTERNAL;
    global $GEDCOMS, $GEDCOM, $TBLPREFIX, $gBitDb;
    if (!showFactDetails("OBJE", $pid)) {
        return false;
    }
    $object = array();
    $media = array();
    //-- handle finding the media of remote objects
    $ct = preg_match("/(.*):(.*)/", $pid, $match);
    if ($ct > 0) {
        require_once '../classes/class_serviceclient.php';
        $client = ServiceClient::getInstance($match[1]);
        if (!is_null($client)) {
            $mt = preg_match_all('/\\n\\d OBJE @(' . PGV_REGEX_XREF . ')@/', $indirec, $matches, PREG_SET_ORDER);
            for ($i = 0; $i < $mt; $i++) {
                $mediaObj = Media::getInstance($matches[$i][1]);
                $mrec = $mediaObj->getGedcomRecord();
                if (!empty($mrec)) {
                    $file = get_gedcom_value("FILE", 1, $mrec);
                    $row = array($matches[$i][1], $file, $mrec, $matches[$i][0]);
                    $media[] = $row;
                }
            }
        }
    }
    //-- find all of the media items for a person
    $media = $gBitDb->query("SELECT m_media, m_file, m_gedrec, mm_gedrec FROM {$TBLPREFIX}media, {$TBLPREFIX}media_mapping WHERE m_media=mm_media AND m_gedfile=mm_gedfile AND m_gedfile=? AND mm_gid=? ORDER BY mm_order", array($GEDCOMS[$GEDCOM]["id"], $pid));
    while ($row = $media->fetchRow()) {
        if (displayDetailsById($row['m_media'], 'OBJE') && !FactViewRestricted($row['m_media'], $row['m_gedrec'])) {
            $level = 0;
            $ct = preg_match("/(\\d+) OBJE/", $row['mm_gedrec'], $match);
            if ($ct > 0) {
                $level = $match[1];
            }
            if (strstr($row['mm_gedrec'], "_PRIM ")) {
                $thum = get_gedcom_value('_THUM', $level + 1, $row['mm_gedrec']);
                $prim = get_gedcom_value('_PRIM', $level + 1, $row['mm_gedrec']);
            } else {
                $thum = get_gedcom_value('_THUM', 1, $row['m_gedrec']);
                $prim = get_gedcom_value('_PRIM', 1, $row['m_gedrec']);
            }
            if ($prim == 'N') {
                continue;
            }
            // Skip _PRIM N objects
            if ($prim == 'Y') {
                // Take the first _PRIM Y object
                $object["file"] = check_media_depth($row['m_file']);
                $object["thumb"] = thumbnail_file($row['m_file'], true, false, $pid);
                //				$object["_PRIM"] = $prim;	// Not sure whether this is needed.
                $object["_THUM"] = $thum;
                // This overrides GEDCOM's "Use main image as thumbnail" option
                $object["level"] = $level;
                $object["mid"] = $row['m_media'];
                break;
                // Stop looking: we found a suitable image
            }
            if ($level == 1 && empty($object)) {
                // Take the first level 1 object, but keep looking for an overriding _PRIM Y
                $object["file"] = check_media_depth($row['m_file']);
                $object["thumb"] = thumbnail_file($row['m_file'], true, false, $pid);
                //				$object["_PRIM"] = $prim;	// Not sure whether this is needed.
                $object["_THUM"] = $thum;
                // This overrides GEDCOM's "Use main image as thumbnail" option
                $object["level"] = $level;
                $object["mid"] = $row['m_media'];
            }
        }
    }
    return $object;
}
Пример #5
0
function print_favorite_selector_xx($option = 0)
{
    global $pgv_lang, $GEDCOM, $SCRIPT_NAME, $SHOW_ID_NUMBERS, $pid, $INDEX_DIRECTORY, $indilist, $famlist, $sourcelist, $medialist, $QUERY_STRING, $famid, $sid;
    global $TEXT_DIRECTION, $REQUIRE_AUTHENTICATION, $PGV_IMAGE_DIR, $PGV_IMAGES, $SEARCH_SPIDER;
    //	$username = getUserName();
    //	if (!empty($username)) $userfavs = getUserFavorites($username);
    //	else {
    //		if ($REQUIRE_AUTHENTICATION) return false;
    //		$userfavs = array();
    //	}
    if (empty($pid) && !empty($famid)) {
        $pid = $famid;
    }
    if (empty($pid) && !empty($sid)) {
        $pid = $sid;
    }
    $gedcomfavs = array();
    if (empty($username) && count($gedcomfavs) == 0) {
        return;
    }
    if (!empty($SEARCH_SPIDER)) {
        return;
        // show no favorites, because they taint every page that is indexed.
    }
    print "<div class=\"favorites_form\">\n";
    switch ($option) {
        case 1:
            $menu = array();
            $menu["label"] = $pgv_lang["favorites"];
            $menu["labelpos"] = "right";
            $menu["link"] = "#";
            $menu["class"] = "favmenuitem";
            $menu["hoverclass"] = "favmenuitem_hover";
            $menu["flyout"] = "down";
            $menu["submenuclass"] = "favsubmenu";
            $menu["items"] = array();
            $mygedcom = $GEDCOM;
            $current_gedcom = $GEDCOM;
            $mypid = $pid;
            if (count($userfavs) > 0) {
                $submenu = array();
                $submenu["label"] = "<b>" . $pgv_lang["my_favorites"] . "</b>";
                $submenu["labelpos"] = "right";
                $submenu["link"] = "#";
                $submenu["class"] = "favsubmenuitem";
                $submenu["hoverclass"] = "favsubmenuitem_hover";
                $menu["items"][] = $submenu;
            }
            foreach ($userfavs as $key => $favorite) {
                $pid = $favorite["gid"];
                $current_gedcom = $GEDCOM;
                $GEDCOM = $favorite["file"];
                $submenu = array();
                if ($favorite["type"] == "URL" && !empty($favorite["url"])) {
                    //					$submenu["link"] = $favorite["url"]."&amp;ged=$GEDCOM";
                    $submenu["link"] = $favorite["url"];
                    $submenu["label"] = PrintReady($favorite["title"]);
                    $submenu["labelpos"] = "right";
                    $submenu["class"] = "favsubmenuitem";
                    $submenu["hoverclass"] = "favsubmenuitem_hover";
                    $menu["items"][] = $submenu;
                } else {
                    if (displayDetailsById($pid, $favorite["type"])) {
                        $indirec = find_gedcom_record($pid);
                        if ($favorite["type"] == "INDI") {
                            $submenu["link"] = "individual.php?pid=" . $favorite["gid"] . "&amp;ged={$GEDCOM}";
                            $submenu["label"] = PrintReady(get_person_name($favorite["gid"]));
                            if ($SHOW_ID_NUMBERS) {
                                if ($TEXT_DIRECTION == "ltr") {
                                    $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                } else {
                                    $submenu["label"] .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                }
                            }
                            unset($indilist[$pid]);
                        }
                        if ($favorite["type"] == "FAM") {
                            $submenu["link"] = "family.php?famid=" . $favorite["gid"] . "&amp;ged={$GEDCOM}";
                            $submenu["label"] = PrintReady(get_family_descriptor($favorite["gid"]));
                            if ($SHOW_ID_NUMBERS) {
                                if ($TEXT_DIRECTION == "ltr") {
                                    $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                } else {
                                    $submenu["label"] .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                }
                            }
                            unset($famlist[$pid]);
                        }
                        if ($favorite["type"] == "SOUR") {
                            $submenu["link"] = "source.php?sid=" . $favorite["gid"] . "&amp;ged={$GEDCOM}";
                            $submenu["label"] = PrintReady(get_source_descriptor($favorite["gid"]));
                            if ($SHOW_ID_NUMBERS) {
                                if ($TEXT_DIRECTION == "ltr") {
                                    $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                } else {
                                    $submenu["label"] .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                }
                            }
                            unset($sourcelist[$pid]);
                        }
                        if ($favorite["type"] == "OBJE") {
                            $media = Media::getInstance($pid);
                            if (!is_null($media)) {
                                $submenu["link"] = "mediaviewer.php?mid=" . $favorite["gid"] . "&amp;ged={$GEDCOM}";
                                $submenu["label"] = PrintReady($media->getTitle());
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $submenu["label"] .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                                if (isset($medialist[$pid])) {
                                    unset($medialist[$pid]);
                                }
                            }
                        }
                        $submenu["labelpos"] = "right";
                        $submenu["class"] = "favsubmenuitem";
                        $submenu["hoverclass"] = "favsubmenuitem_hover";
                        $menu["items"][] = $submenu;
                    }
                }
            }
            $pid = $mypid;
            $GEDCOM = $mygedcom;
            if (!empty($username) && strpos($_SERVER["SCRIPT_NAME"], "individual.php") !== false) {
                $menu["items"][] = "separator";
                $submenu = array();
                $submenu["label"] = $pgv_lang["add_to_my_favorites"];
                $submenu["labelpos"] = "right";
                $submenu["link"] = "individual.php?action=addfav&amp;gid={$pid}&amp;pid={$pid}";
                $submenu["class"] = "favsubmenuitem";
                $submenu["hoverclass"] = "favsubmenuitem_hover";
                $menu["items"][] = $submenu;
            }
            if (count($gedcomfavs) > 0) {
                $menu["items"][] = "separator";
                $submenu = array();
                $submenu["label"] = "<b>" . $pgv_lang["gedcom_favorites"] . "</b>";
                $submenu["labelpos"] = "right";
                $submenu["link"] = "#";
                $submenu["class"] = "favsubmenuitem";
                $submenu["hoverclass"] = "favsubmenuitem_hover";
                $menu["items"][] = $submenu;
                $current_gedcom = $GEDCOM;
                foreach ($gedcomfavs as $key => $favorite) {
                    $GEDCOM = $favorite["file"];
                    $pid = $favorite["gid"];
                    $submenu = array();
                    if ($favorite["type"] == "URL" && !empty($favorite["url"])) {
                        //						$submenu["link"] = $favorite["url"]."&amp;ged=$GEDCOM";
                        $submenu["link"] = $favorite["url"];
                        $submenu["label"] = PrintReady($favorite["title"]);
                        $submenu["labelpos"] = "right";
                        $submenu["class"] = "favsubmenuitem";
                        $submenu["hoverclass"] = "favsubmenuitem_hover";
                        $menu["items"][] = $submenu;
                    } else {
                        if (displayDetailsById($pid, $favorite["type"])) {
                            $indirec = find_gedcom_record($pid);
                            if ($favorite["type"] == "INDI") {
                                $submenu["link"] = "individual.php?pid=" . $favorite["gid"] . "&amp;ged={$GEDCOM}";
                                $submenu["label"] = PrintReady(get_person_name($favorite["gid"]));
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $submenu["label"] .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                            }
                            if ($favorite["type"] == "FAM") {
                                $submenu["link"] = "family.php?famid=" . $favorite["gid"] . "&amp;ged={$GEDCOM}";
                                $submenu["label"] = PrintReady(get_family_descriptor($favorite["gid"]));
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $submenu["label"] .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                            }
                            if ($favorite["type"] == "SOUR") {
                                $submenu["link"] = "source.php?sid=" . $favorite["gid"] . "&amp;ged={$GEDCOM}";
                                $submenu["label"] = PrintReady(get_source_descriptor($favorite["gid"]));
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $submenu["label"] .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                            }
                            $submenu["labelpos"] = "right";
                            $submenu["class"] = "favsubmenuitem";
                            $submenu["hoverclass"] = "favsubmenuitem_hover";
                            $menu["items"][] = $submenu;
                        }
                    }
                }
                $pid = $mypid;
                $GEDCOM = $mygedcom;
                print_menu($menu);
            }
            break;
        default:
            print "<form name=\"favoriteform\" action=\"{$SCRIPT_NAME}";
            print "\" method=\"post\" onsubmit=\"return false;\">";
            print "\n\t\t<select name=\"fav_id\" class=\"header_select\" onchange=\"if (document.favoriteform.fav_id.options[document.favoriteform.fav_id.selectedIndex].value!='') window.location=document.favoriteform.fav_id.options[document.favoriteform.fav_id.selectedIndex].value; if (document.favoriteform.fav_id.options[document.favoriteform.fav_id.selectedIndex].value=='add') window.location='{$SCRIPT_NAME}?{$QUERY_STRING}&amp;action=addfav&amp;gid={$pid}&amp;pid={$pid}';\">";
            print "\n\t\t\t<option value=\"\">" . $pgv_lang["favorites"] . "</option>\n";
            if (!empty($username)) {
                if (count($userfavs) > 0 || (strpos($_SERVER["SCRIPT_NAME"], "individual.php") !== false || strpos($_SERVER["SCRIPT_NAME"], "family.php") !== false || strpos($_SERVER["SCRIPT_NAME"], "source.php") !== false)) {
                    print "\n\t\t\t<optgroup label=\"" . $pgv_lang["my_favorites"] . "\">";
                }
                $mygedcom = $GEDCOM;
                $current_gedcom = $GEDCOM;
                $mypid = $pid;
                if (strpos($_SERVER["SCRIPT_NAME"], "individual.php") !== false || strpos($_SERVER["SCRIPT_NAME"], "family.php") !== false || strpos($_SERVER["SCRIPT_NAME"], "source.php") !== false) {
                    print "<option value=\"add\">- " . $pgv_lang["add_to_my_favorites"] . " -</option>\n";
                }
                foreach ($userfavs as $key => $favorite) {
                    $current_gedcom = $GEDCOM;
                    $GEDCOM = $favorite["file"];
                    $pid = $favorite["gid"];
                    if ($favorite["type"] == "URL" && !empty($favorite["url"])) {
                        //							print "\n\t\t\t\t<option value=\"".$favorite["url"]."&amp;ged=".$GEDCOM."\">".PrintReady($favorite["title"]);
                        print "\n\t\t\t\t<option value=\"" . $favorite["url"] . "\">" . PrintReady($favorite["title"]);
                        print "</option>";
                    } else {
                        if (displayDetailsById($pid, $favorite["type"])) {
                            $indirec = find_gedcom_record($pid);
                            $name = $pgv_lang["unknown"];
                            if ($favorite["type"] == "INDI") {
                                $name = strip_tags(PrintReady(get_person_name($pid)));
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $name .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $name .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                                print "\n\t\t\t\t<option value=\"individual.php?pid=";
                                unset($indilist[$pid]);
                            }
                            if ($favorite["type"] == "FAM") {
                                $name = strip_tags(PrintReady(get_family_descriptor($pid)));
                                if (strlen($name) > 50) {
                                    $name = substr($name, 0, 50);
                                }
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $name .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $name .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                                print "\n\t\t\t\t<option value=\"family.php?famid=";
                                unset($famlist[$pid]);
                            }
                            if ($favorite["type"] == "SOUR") {
                                $name = strip_tags(PrintReady(get_source_descriptor($pid)));
                                if (strlen($name) > 50) {
                                    $name = substr($name, 0, 50);
                                }
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $name .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $name .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                                print "\n\t\t\t\t<option value=\"source.php?sid=";
                                unset($sourcelist[$pid]);
                            }
                            if ($favorite["type"] == "OBJE") {
                                $media = Media::getInstance($pid);
                                if (!is_null($media)) {
                                    $name = strip_tags(PrintReady($media->getTitle()));
                                    if (strlen($name) > 50) {
                                        $name = substr($name, 0, 50);
                                    }
                                    if ($SHOW_ID_NUMBERS) {
                                        if ($TEXT_DIRECTION == "ltr") {
                                            $name .= " (" . $favorite["gid"] . ")";
                                        } else {
                                            $name .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                        }
                                    }
                                    print "\n\t\t\t\t<option value=\"mediaviewer.php?mid=";
                                    unset($sourcelist[$pid]);
                                }
                            }
                            print $favorite["gid"] . "&amp;ged=" . $GEDCOM . "\">" . $name . "</option>";
                        }
                    }
                }
                if (count($userfavs) > 0 || (strpos($_SERVER["SCRIPT_NAME"], "individual.php") !== false || strpos($_SERVER["SCRIPT_NAME"], "family.php") !== false || strpos($_SERVER["SCRIPT_NAME"], "source.php") !== false)) {
                    print "\n\t\t\t</optgroup>";
                }
                $GEDCOM = $mygedcom;
                $pid = $mypid;
            }
            if (count($gedcomfavs) > 0) {
                print "\n\t\t\t<optgroup label=\"" . $pgv_lang["gedcom_favorites"] . "\">\n";
                $mygedcom = $GEDCOM;
                $current_gedcom = $GEDCOM;
                $mypid = $pid;
                foreach ($gedcomfavs as $key => $favorite) {
                    $current_gedcom = $GEDCOM;
                    $GEDCOM = $favorite["file"];
                    $pid = $favorite["gid"];
                    if ($favorite["type"] == "URL" && !empty($favorite["url"])) {
                        //							print "\n\t\t\t\t<option value=\"".$favorite["url"]."&amp;ged=".$GEDCOM."\">".PrintReady($favorite["title"]);
                        print "\n\t\t\t\t<option value=\"" . $favorite["url"] . "\">" . PrintReady($favorite["title"]);
                        print "</option>";
                    } else {
                        $indirec = find_gedcom_record($pid);
                        $name = $pgv_lang["unknown"];
                        if (displayDetailsById($pid, $favorite["type"])) {
                            if ($favorite["type"] == "INDI") {
                                $name = strip_tags(PrintReady(get_person_name($pid)));
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $name .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $name .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                                print "\n\t\t\t\t<option value=\"individual.php?pid=";
                            }
                            if ($favorite["type"] == "FAM") {
                                $name = strip_tags(PrintReady(get_family_descriptor($pid)));
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $name .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $name .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                                print "\n\t\t\t\t<option value=\"family.php?famid=";
                            }
                            if ($favorite["type"] == "SOUR") {
                                $name = strip_tags(PrintReady(get_source_descriptor($pid)));
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $name .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $name .= " &rlm;(" . $favorite["gid"] . ")&rlm;";
                                    }
                                }
                                print "\n\t\t\t\t<option value=\"source.php?sid=";
                            }
                            print $favorite["gid"] . "&amp;ged={$GEDCOM}\">" . $name . "</option>";
                        }
                    }
                }
                print "\n\t\t\t</optgroup>";
                $GEDCOM = $mygedcom;
                $pid = $mypid;
            }
            print "</select>\n\t</form>\n";
            break;
    }
    print "</div>\n";
}
Пример #6
0
        checkChangeTime($pid, $gedrec, safe_GET('accesstime', PGV_REGEX_INTEGER));
    } else {
        $disp = true;
    }
} else {
    if (!empty($famid)) {
        if ($famid != "new") {
            if (!isset($pgv_changes[$famid . "_" . PGV_GEDCOM])) {
                $gedrec = find_gedcom_record($famid, PGV_GED_ID);
            } else {
                $gedrec = find_updated_record($famid, PGV_GED_ID);
            }
            $ct = preg_match("/0 @{$famid}@ (.*)/", $gedrec, $match);
            if ($ct > 0) {
                $type = trim($match[1]);
                $disp = displayDetailsById($famid, $type);
            }
            // Don't allow edits if the record has changed since the edit-link was created
            checkChangeTime($famid, $gedrec, safe_GET('accesstime', PGV_REGEX_INTEGER));
        }
    } else {
        if ($action != "addchild" && $action != "addchildaction" && $action != "addnewsource" && $action != "mod_edit_fact" && $action != "addnewnote" && $action != "addmedia_links" && $action != "addnoteaction" && $action != "addnoteaction_assisted") {
            echo "<span class=\"error\">The \$pid variable was empty. Unable to perform {$action} xxx.</span>";
            print_simple_footer();
            $disp = true;
        } else {
            $disp = true;
        }
    }
}
if (!PGV_USER_CAN_EDIT || !$disp || !$ALLOW_EDIT_GEDCOM) {
Пример #7
0
        }
    }
    if (isset($startalpha)) {
        $alpha = $startalpha;
    }
    $gBitSmarty->assign_by_ref("indialpha", $famalpha);
}
if ($surname_sublist == "yes" && $show_all == "yes") {
    get_fam_list();
    if (!isset($alpha)) {
        $alpha = "";
    }
    $surnames = array();
    $fam_hide = array();
    foreach ($famlist as $gid => $fam) {
        if (displayDetailsById($gid, "FAM") || showLivingNameById($gid, "FAM")) {
            $names = preg_split("/\\+/", $fam["name"]);
            $foundnames = array();
            for ($i = 0; $i < count($names); $i++) {
                $name = trim($names[$i]);
                $sname = extract_surname($name);
                if (isset($foundnames[$sname])) {
                    if (isset($surnames[$sname]["match"])) {
                        $surnames[$sname]["match"]--;
                    }
                } else {
                    $foundnames[$sname] = 1;
                }
            }
        } else {
            $fam_hide[$gid . "[" . $fam["gedfile"] . "]"] = 1;
Пример #8
0
 /**
  * Inserts a clipping into the clipping cart
  *
  * @param
  */
 function add_clipping($clipping)
 {
     global $cart, $pgv_lang, $SHOW_SOURCES, $MULTI_MEDIA, $GEDCOM;
     if ($clipping['id'] == false || $clipping['id'] == "") {
         return false;
     }
     if (!id_in_cart($clipping['id'])) {
         $clipping['gedcom'] = $GEDCOM;
         if ($clipping['type'] == "indi") {
             if (displayDetailsById($clipping['id']) || showLivingNameById($clipping['id'])) {
                 $cart[] = $clipping;
                 $this->addCount++;
             } else {
                 $this->privCount++;
                 return false;
             }
         } else {
             if ($clipping['type'] == "fam") {
                 $parents = find_parents($clipping['id']);
                 if ((displayDetailsById($parents['HUSB']) || showLivingNameById($parents['HUSB'])) && (displayDetailsById($parents['WIFE']) || showLivingNameById($parents['WIFE']))) {
                     $cart[] = $clipping;
                     $this->addCount++;
                 } else {
                     $this->privCount++;
                     return false;
                 }
             } else {
                 if (displayDetailsById($clipping['id'], strtoupper($clipping['type']))) {
                     $cart[] = $clipping;
                     $this->addCount++;
                 } else {
                     $this->privCount++;
                     return false;
                 }
             }
         }
         //-- look in the gedcom record for any linked SOUR, NOTE, or OBJE and also add them to the
         //- clippings cart
         $gedrec = find_gedcom_record($clipping['id']);
         if ($SHOW_SOURCES >= PGV_USER_ACCESS_LEVEL) {
             $st = preg_match_all("/\\d SOUR @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
             for ($i = 0; $i < $st; $i++) {
                 // add SOUR
                 $clipping = array();
                 $clipping['type'] = "source";
                 $clipping['id'] = $match[$i][1];
                 $clipping['gedcom'] = $GEDCOM;
                 $this->add_clipping($clipping);
                 // add REPO
                 $sourec = find_gedcom_record($match[$i][1]);
                 $rt = preg_match_all("/\\d REPO @(.*)@/", $sourec, $rmatch, PREG_SET_ORDER);
                 for ($j = 0; $j < $rt; $j++) {
                     $clipping = array();
                     $clipping['type'] = "repository";
                     $clipping['id'] = $rmatch[$j][1];
                     $clipping['gedcom'] = $GEDCOM;
                     $this->add_clipping($clipping);
                 }
             }
         }
         $nt = preg_match_all("/\\d NOTE @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
         for ($i = 0; $i < $nt; $i++) {
             $clipping = array();
             $clipping['type'] = "note";
             $clipping['id'] = $match[$i][1];
             $clipping['gedcom'] = $GEDCOM;
             $this->add_clipping($clipping);
         }
         if ($MULTI_MEDIA) {
             $nt = preg_match_all("/\\d OBJE @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
             for ($i = 0; $i < $nt; $i++) {
                 $clipping = array();
                 $clipping['type'] = "obje";
                 $clipping['id'] = $match[$i][1];
                 $clipping['gedcom'] = $GEDCOM;
                 $this->add_clipping($clipping);
             }
         }
     }
     return true;
 }
Пример #9
0
 static function &getFavoritesMenu()
 {
     global $REQUIRE_AUTHENTICATION, $pgv_lang, $GEDCOM, $QUERY_STRING, $SCRIPT_NAME, $PGV_IMAGE_DIR, $PGV_IMAGES, $TEXT_DIRECTION;
     global $SEARCH_SPIDER;
     global $controller;
     // Pages with a controller can be added to the favorites
     if (!empty($SEARCH_SPIDER)) {
         return false;
         // show no favorites, because they taint every page that is indexed.
     }
     if ($TEXT_DIRECTION == "rtl") {
         $ff = "_rtl";
     } else {
         $ff = "";
     }
     if (PGV_USER_ID || !$REQUIRE_AUTHENTICATION) {
         $menu = new Menu($pgv_lang['favorites'], '#', 'down');
         if (!empty($PGV_IMAGES['gedcom']['large'])) {
             $menu->addIcon($PGV_IMAGE_DIR . '/' . $PGV_IMAGES['gedcom']['large']);
         }
         $menu->addClass("menuitem{$ff}", "menuitem_hover{$ff}", "submenu{$ff}", "icon_large_gedcom");
         //			$menu->print_menu = NULL;
         $userfavs = getUserFavorites(PGV_USER_ID);
         $gedfavs = getUserFavorites($GEDCOM);
         // User favorites
         if ($userfavs || PGV_USER_ID) {
             $submenu = new Menu('<strong>' . $pgv_lang['my_favorites'] . '</strong>');
             $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
             $menu->addSubMenu($submenu);
             while (PGV_USER_ID && isset($controller)) {
                 // Get the right $gid from each supported controller type
                 switch (get_class($controller)) {
                     case 'IndividualController':
                         $gid = $controller->pid;
                         break;
                     case 'FamilyController':
                         $gid = $controller->famid;
                         break;
                     case 'MediaController':
                         $gid = $controller->mid;
                         break;
                     case 'SourceController':
                         $gid = $controller->sid;
                         break;
                     case 'RepositoryController':
                         $gid = $controller->rid;
                         break;
                     default:
                         break 2;
                 }
                 $submenu = new Menu('<em>' . $pgv_lang['add_to_my_favorites'] . '</em>', $SCRIPT_NAME . normalize_query_string($QUERY_STRING . '&amp;action=addfav&amp;gid=' . $gid));
                 $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                 $menu->addSubMenu($submenu);
                 break;
             }
             foreach ($userfavs as $fav) {
                 $OLD_GEDCOM = $GEDCOM;
                 $GEDCOM = $fav['file'];
                 switch ($fav['type']) {
                     case 'URL':
                         $submenu = new Menu(PrintReady($fav['title']), $fav['url']);
                         $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                         $menu->addSubMenu($submenu);
                         break;
                     case 'INDI':
                     case 'FAM':
                     case 'SOUR':
                     case 'OBJE':
                         if (displayDetailsById($fav['gid'], $fav['type'])) {
                             $obj = GedcomRecord::getInstance($fav['gid']);
                             if ($obj) {
                                 $submenu = new Menu(PrintReady($obj->getFullName()), encode_url($obj->getLinkUrl()));
                                 $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                                 $menu->addSubMenu($submenu);
                             }
                         }
                         break;
                 }
                 $GEDCOM = $OLD_GEDCOM;
             }
             if ($gedfavs) {
                 $menu->addSeparator();
             }
         }
         // Gedcom favorites
         if ($gedfavs) {
             $submenu = new Menu('<strong>' . $pgv_lang['gedcom_favorites'] . '</strong>');
             $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
             $menu->addSubMenu($submenu);
             foreach ($gedfavs as $fav) {
                 $OLD_GEDCOM = $GEDCOM;
                 $GEDCOM = $fav['file'];
                 switch ($fav['type']) {
                     case 'URL':
                         $submenu = new Menu(PrintReady($fav['title']), $fav['url']);
                         $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                         $menu->addSubMenu($submenu);
                         break;
                     case 'INDI':
                     case 'FAM':
                     case 'SOUR':
                     case 'OBJE':
                         if (displayDetailsById($fav['gid'], $fav['type'])) {
                             $obj = GedcomRecord::getInstance($fav['gid']);
                             if ($obj) {
                                 $submenu = new Menu(PrintReady($obj->getFullName()), encode_url($obj->getLinkUrl()));
                                 $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                                 $menu->addSubMenu($submenu);
                             }
                         }
                         break;
                 }
                 $GEDCOM = $OLD_GEDCOM;
             }
         }
     }
     return $menu;
 }
Пример #10
0
$TableTitle = "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["indis"]["small"] . "\" border=\"0\" title=\"" . $pgv_lang["individuals"] . "\" alt=\"" . $pgv_lang["individuals"] . "\" />&nbsp;&nbsp;" . $pgv_lang["surnames"];
print "<br /><br /><table class=\"list_table {$TEXT_DIRECTION}\"><tr>";
if ($surname_sublist == "yes" && $show_all == "yes") {
    get_indi_list();
    if (!isset($alpha)) {
        $alpha = "";
    }
    $surnames = array();
    $indi_hide = array();
    $indi_dead = 0;
    $indi_unborn = 0;
    $indi_alive = 0;
    foreach ($indilist as $gid => $indi) {
        //-- make sure that favorites from other gedcoms are not shown
        if ($indi["gedfile"] == PGV_GED_ID) {
            if (displayDetailsById($gid) || showLivingNameById($gid)) {
                $ret = check_alive($indi["gedcom"], $year);
                if ($ret == 0) {
                    foreach ($indi["names"] as $indexval => $name) {
                        surname_count($name[2]);
                        $indi_alive++;
                    }
                } else {
                    if ($ret < 0) {
                        $indi_dead++;
                    } else {
                        $indi_unborn++;
                    }
                }
            } else {
                $indi_hide[$gid . "[" . $indi["gedfile"] . "]"] = 1;
Пример #11
0
    function print_random_media($block = true, $config = "", $side, $index)
    {
        global $pgv_lang, $foundlist, $MULTI_MEDIA, $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES;
        global $MEDIA_EXTERNAL, $MEDIA_DIRECTORY, $SHOW_SOURCES;
        global $MEDIATYPE, $THUMBNAIL_WIDTH, $USE_MEDIA_VIEWER;
        global $PGV_BLOCKS, $ctype, $action;
        global $PGV_IMAGE_DIR, $PGV_IMAGES;
        if (!$MULTI_MEDIA) {
            return;
        }
        if (empty($config)) {
            $config = $PGV_BLOCKS["print_random_media"]["config"];
        }
        if (isset($config["filter"])) {
            $filter = $config["filter"];
        } else {
            $filter = "all";
        }
        if (!isset($config['controls'])) {
            $config['controls'] = "yes";
        }
        if (!isset($config['start'])) {
            $config['start'] = "no";
        }
        $medialist = array();
        $foundlist = array();
        $medialist = get_medialist(false, '', true, true);
        $ct = count($medialist);
        if ($ct > 0) {
            $i = 0;
            $disp = false;
            //-- try up to 40 times to get a media to display
            while ($i < 40) {
                $error = false;
                $value = array_rand($medialist);
                if (PGV_DEBUG) {
                    print "<br />";
                    print_r($medialist[$value]);
                    print "<br />";
                    print "Trying " . $medialist[$value]["XREF"] . "<br />";
                }
                $links = $medialist[$value]["LINKS"];
                $disp = $medialist[$value]["EXISTS"] > 0 && $medialist[$value]["LINKED"] && $medialist[$value]["CHANGE"] != "delete";
                if (PGV_DEBUG && !$disp && !$error) {
                    $error = true;
                    print "<span class=\"error\">" . $medialist[$value]["XREF"] . " File does not exist, or is not linked to anyone, or is marked for deletion.</span><br />";
                }
                $disp &= displayDetailsById($medialist[$value]["XREF"], "OBJE");
                $disp &= !FactViewRestricted($medialist[$value]["XREF"], $medialist[$value]["GEDCOM"]);
                if (PGV_DEBUG && !$disp && !$error) {
                    $error = true;
                    print "<span class=\"error\">" . $medialist[$value]["XREF"] . " Failed to pass privacy</span><br />";
                }
                $isExternal = isFileExternal($medialist[$value]["FILE"]);
                if ($block && !$isExternal) {
                    $disp &= $medialist[$value]["THUMBEXISTS"] > 0;
                }
                if (PGV_DEBUG && !$disp && !$error) {
                    $error = true;
                    print "<span class=\"error\">" . $medialist[$value]["XREF"] . " thumbnail file could not be found</span><br />";
                }
                // Filter according to format and type  (Default: unless configured otherwise, don't filter)
                if (!empty($medialist[$value]["FORM"]) && isset($config["filter_" . $medialist[$value]["FORM"]]) && $config["filter_" . $medialist[$value]["FORM"]] != "yes") {
                    $disp = false;
                }
                if (!empty($medialist[$value]["TYPE"]) && isset($config["filter_" . $medialist[$value]["TYPE"]]) && $config["filter_" . $medialist[$value]["TYPE"]] != "yes") {
                    $disp = false;
                }
                if (PGV_DEBUG && !$disp && !$error) {
                    $error = true;
                    print "<span class=\"error\">" . $medialist[$value]["XREF"] . " failed Format or Type filters</span><br />";
                }
                if ($disp && count($links) != 0) {
                    /** link privacy allready checked in displayDetailsById
                    				foreach($links as $key=>$type) {
                    					$gedrec = find_gedcom_record($key, PGV_GED_ID);
                    					$disp &= !empty($gedrec);
                    					//-- source privacy is now available through the display details by id method
                    					// $disp &= $type!="SOUR";
                    					$disp &= displayDetailsById($key, $type);
                    				}
                    				if (PGV_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." failed link privacy</span><br />";}
                    				*/
                    if ($disp && $filter != "all") {
                        // Apply filter criteria
                        $ct = preg_match("/0\\s(@.*@)\\sOBJE/", $medialist[$value]["GEDCOM"], $match);
                        $objectID = $match[1];
                        //-- we could probably use the database for this filter
                        foreach ($links as $key => $type) {
                            $gedrec = find_gedcom_record($key, PGV_GED_ID);
                            $ct2 = preg_match("/(\\d)\\sOBJE\\s{$objectID}/", $gedrec, $match2);
                            if ($ct2 > 0) {
                                $objectRefLevel = $match2[1];
                                if ($filter == "indi" && $objectRefLevel != "1") {
                                    $disp = false;
                                }
                                if ($filter == "event" && $objectRefLevel == "1") {
                                    $disp = false;
                                }
                                if (PGV_DEBUG && !$disp && !$error) {
                                    $error = true;
                                    print "<span class=\"error\">" . $medialist[$value]["XREF"] . " failed to pass config filter</span><br />";
                                }
                            } else {
                                $disp = false;
                            }
                        }
                    }
                }
                //-- leave the loop if we find an image that works
                if ($disp) {
                    break;
                } else {
                    if (PGV_DEBUG) {
                        print "<span class=\"error\">" . $medialist[$value]["XREF"] . " Will not be shown</span><br />";
                    }
                    unset($medialist[$value]);
                }
                //-- if there are no more media items, then try to get some more
                if (count($medialist) == 0) {
                    $medialist = get_medialist(false, '', true, true);
                }
                $i++;
            }
            if (!$disp) {
                return false;
            }
            $content = "";
            $id = "";
            $id = "random_picture{$index}";
            $title = print_help_link("index_media_help", "qm", "random_picture", false, true);
            if ($PGV_BLOCKS["print_random_media"]["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;\">";
                    $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"{$pgv_lang['config_block']}\" /></a>";
                }
            }
            $title .= $pgv_lang["random_picture"];
            $content = "<div id=\"random_picture_container{$index}\">";
            if ($config['controls'] == 'yes') {
                if ($config['start'] == 'yes' || isset($_COOKIE['rmblockplay']) && $_COOKIE['rmblockplay'] == 'true') {
                    $image = "stop";
                } else {
                    $image = "rarrow";
                }
                $linkNextImage = "<a href=\"javascript: " . $pgv_lang["next_image"] . "\" onclick=\"return ajaxBlock('random_picture{$index}', 'print_random_media', '{$side}', {$index}, '{$ctype}', true);\"><img src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['rdarrow']['other']}\" border=\"0\" alt=\"{$pgv_lang['next_image']}\" title=\"{$pgv_lang['next_image']}\" /></a>";
                $content .= "<div class=\"center\" id=\"random_picture_controls{$index}\"><br />";
                if ($TEXT_DIRECTION == "rtl") {
                    $content .= $linkNextImage;
                }
                $content .= "<a href=\"javascript: " . $pgv_lang["play"] . "/" . $pgv_lang["stop"] . "\" onclick=\"togglePlay(); return false;\">";
                if (isset($PGV_IMAGES[$image]['other'])) {
                    $content .= "<img id=\"play_stop\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES[$image]['other']}\" border=\"0\" alt=\"{$pgv_lang['play']}/{$pgv_lang['stop']}\" title=\"{$pgv_lang['play']}/{$pgv_lang['stop']}\" />";
                } else {
                    $content .= $pgv_lang["play"] . "/" . $pgv_lang["stop"];
                }
                $content .= "</a>";
                if ($TEXT_DIRECTION == "ltr") {
                    $content .= $linkNextImage;
                }
                $content .= '
					</div>
					<script language="JavaScript" type="text/javascript">
					<!--
						var play = false;
						function togglePlay() {
							if (play) {
								play = false;
								imgid = document.getElementById("play_stop");
								imgid.src = \'' . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["rarrow"]['other'] . '\';
							}
							else {
								play = true;
								playSlideShow();
								imgid = document.getElementById("play_stop");
								imgid.src = \'' . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["stop"]['other'] . '\';
							}
						}

						function playSlideShow() {
							if (play) {
								ajaxBlock(\'random_picture' . $index . '\', \'print_random_media\', \'' . $side . '\', ' . $index . ', \'' . $ctype . '\', false);
								window.setTimeout(\'playSlideShow()\', 6000);
							}
						}
					//-->
					</script>';
            }
            if ($config['start'] == 'yes') {
                $content .= '
					<script language="JavaScript" type="text/javascript">
					<!--
						play = true;
						imgid = document.getElementById("play_stop");
						imgid.src = \'' . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["stop"]['other'] . '\';
						window.setTimeout("playSlideShow()", 6000);
					//-->
					</script>';
            }
            $content .= "<div class=\"center\" id=\"random_picture_content{$index}\">";
            $imgsize = findImageSize($medialist[$value]["FILE"]);
            $imgwidth = $imgsize[0] + 40;
            $imgheight = $imgsize[1] + 150;
            $content .= "<table id=\"random_picture_box\" width=\"100%\"><tr><td valign=\"top\"";
            if ($block) {
                $content .= " align=\"center\" class=\"details1\"";
            } else {
                $content .= " class=\"details2\"";
            }
            $mediaid = $medialist[$value]["XREF"];
            //LBox --------  change for Lightbox Album --------------------------------------------
            ?>
<script language="JavaScript" type="text/javascript">
<!--
function openPic(filename, width, height) {
		height=height+50;
		screenW = screen.width;
	 	screenH = screen.height;
	 	if (width>screenW-100) width=screenW-100;
	 	if (height>screenH-110) height=screenH-120;
		if ((filename.search(/\.je?pg$/gi)!=-1)||(filename.search(/\.gif$/gi)!=-1)||(filename.search(/\.png$/gi)!=-1)||(filename.search(/\.bmp$/gi)!=-1))
			win02 = window.open('imageview.php?filename='+filename,'win02','top=50,left=150,height='+height+',width='+width+',scrollbars=1,resizable=1');
			// win03.resizeTo(winWidth 2,winHeight 30);
		else window.open(unescape(filename),'win02','top=50,left=150,height='+height+',width='+width+',scrollbars=1,resizable=1');
		win02.focus();
	}
-->
</script><?php 
            if (PGV_USE_LIGHTBOX) {
                // $content .= " ><a href=\"javascript:;\" onclick=\"return openPic('".$medialist[$value]["FILE"]."', $imgwidth, $imgheight);\">";
                // $content .= " ><a href=\"javascript:;\" onclick=\"return openImage('".$medialist[$value]["FILE"]."', $imgwidth, $imgheight);\">";
                // $content .= "><a href=\"" . $medialist[$value]["FILE"] . "\" rel=\"clearbox[general_4]\" title=\"" . $mediaid . "\">" . "\n";
                $content .= " ><a href=\"mediaviewer.php?mid=" . $mediaid . "\">";
            } else {
                // ---------------------------------------------------------------------------------------------
                if ($USE_MEDIA_VIEWER) {
                    $content .= " ><a href=\"mediaviewer.php?mid=" . $mediaid . "\">";
                } else {
                    $content .= " ><a href=\"javascript:;\" onclick=\"return openImage('" . $medialist[$value]["FILE"] . "', {$imgwidth}, {$imgheight});\">";
                }
            }
            $mediaTitle = "";
            if (!empty($medialist[$value]["TITL"])) {
                $mediaTitle = PrintReady($medialist[$value]["TITL"]);
            } else {
                $mediaTitle = basename($medialist[$value]["FILE"]);
            }
            if ($block) {
                $content .= "<img src=\"" . $medialist[$value]["THUMB"] . "\" border=\"0\" class=\"thumbnail\"";
                if ($isExternal) {
                    $content .= " width=\"" . $THUMBNAIL_WIDTH . "\"";
                }
            } else {
                $content .= "<img src=\"" . $medialist[$value]["FILE"] . "\" border=\"0\" class=\"thumbnail\" ";
                $imgsize = findImageSize($medialist[$value]["FILE"]);
                if ($imgsize[0] > 175) {
                    $content .= "width=\"175\" ";
                }
            }
            $content .= " alt=\"{$mediaTitle}\" title=\"{$mediaTitle}\" />";
            $content .= "</a>";
            if ($block) {
                $content .= "<br />";
            } else {
                $content .= "</td><td class=\"details2\">";
            }
            $content .= "<a href=\"mediaviewer.php?mid=" . $mediaid . "\">";
            $content .= "<b>" . $mediaTitle . "</b>";
            $content .= "</a><br />";
            ob_start();
            PrintMediaLinks($medialist[$value]["LINKS"], "normal");
            $content .= ob_get_clean();
            $content .= "<br /><div class=\"indent" . ($TEXT_DIRECTION == "rtl" ? "_rtl" : "") . "\">";
            $content .= print_fact_notes($medialist[$value]["GEDCOM"], "1", false, true);
            $content .= "</div>";
            $content .= "</td></tr></table>";
            $content .= "</div>";
            // random_picture_content
            $content .= "</div>";
            // random_picture_container
            global $THEME_DIR;
            require $THEME_DIR . 'templates/block_main_temp.php';
        }
    }
Пример #12
0
    static function _getFavorites($isged = true)
    {
        global $GEDCOM, $pgv_lang;
        global $pgv_lang, $factarray, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $ctype, $TEXT_DIRECTION, $INDEX_DIRECTORY;
        global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE;
        // Override GEDCOM configuration temporarily
        if (isset($show_full)) {
            $saveShowFull = $show_full;
        }
        $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
        $show_full = 1;
        $PEDIGREE_FULL_DETAILS = 1;
        if ($isged) {
            $userfavs = getUserFavorites($GEDCOM);
        } else {
            $userfavs = getUserFavorites(PGV_USER_ID);
        }
        $content = '';
        if (!count($userfavs)) {
            if ($isged) {
                if (PGV_USER_GEDCOM_ADMIN) {
                    $content .= print_text('no_favorites', 0, 1);
                } else {
                    $content .= print_text('no_gedcom_favorites', 0, 1);
                }
            } else {
                print_text('no_favorites', 0, 1);
            }
        } else {
            if (!$isged) {
                $mygedcom = $GEDCOM;
                $current_gedcom = $GEDCOM;
            }
            $content .= "<table width=\"99%\" style=\"border:none\" cellspacing=\"3px\" class=\"center {$TEXT_DIRECTION}\">";
            foreach ($userfavs as $k => $favorite) {
                if (isset($favorite['id'])) {
                    $k = $favorite['id'];
                }
                $removeFavourite = "<a class=\"font9\" href=\"" . encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$k}") . "\" onclick=\"return confirm('{$pgv_lang['confirm_fav_remove']}');\">{$pgv_lang['remove']}</a><br />\n";
                if (!$isged) {
                    $current_gedcom = $GEDCOM;
                    $GEDCOM = $favorite['file'];
                }
                $content .= '<tr><td>';
                if ($favorite['type'] == 'URL') {
                    $content .= "<div id=\"boxurl{$k}.0\" class=\"person_box\">\n";
                    if ($ctype == 'user' || PGV_USER_GEDCOM_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    $content .= "<a href=\"{$favorite['url']}\"><b>" . PrintReady($favorite['title']) . '</b></a>';
                    $content .= "<br />\n" . PrintReady($favorite['note'], false, true);
                    $content .= "</div>\n";
                } else {
                    if (displayDetailsById($favorite['gid'], $favorite['type'])) {
                        require "{$INDEX_DIRECTORY}{$GEDCOM}_conf.php";
                        switch ($favorite['type']) {
                            case 'INDI':
                                $indirec = find_person_record($favorite['gid']);
                                $content .= "<div id=\"box{$favorite['gid']}.0\" class=\"person_box";
                                if (preg_match("/1 SEX F/", $indirec) > 0) {
                                    $content .= 'F';
                                } elseif (preg_match("/1 SEX M/", $indirec) > 0) {
                                    $content .= '';
                                } else {
                                    $content .= 'NN';
                                }
                                $content .= "\">\n";
                                if ($ctype == 'user' || PGV_USER_GEDCOM_ADMIN) {
                                    $content .= $removeFavourite;
                                }
                                ob_start();
                                print_pedigree_person($favorite['gid'], 2, 1, $k);
                                $content .= ob_get_clean();
                                $content .= PrintReady($favorite['note'], false, true);
                                $content .= "</div>\n";
                                break;
                            default:
                                $record = GedcomRecord::getInstance($favorite['gid']);
                                $content .= "<div id=\"box{$favorite['gid']}.0\" class=\"person_box\">\n";
                                if ($ctype == 'user' || PGV_USER_GEDCOM_ADMIN) {
                                    $content .= $removeFavourite;
                                }
                                $content .= $record->format_list('span');
                                $content .= "<br />\n" . PrintReady($favorite['note'], false, true);
                                $content .= "</div>\n";
                                break;
                        }
                        if (!$isged) {
                            $GEDCOM = $mygedcom;
                            require "{$INDEX_DIRECTORY}{$GEDCOM}_conf.php";
                        }
                    }
                }
                $content .= "</div>\n" . "</td></tr>\n";
            }
            $content .= "</table>\n";
        }
        if ($isged && PGV_USER_GEDCOM_ADMIN || !$isged) {
            $content .= '
				<script language="JavaScript" type="text/javascript">
				var pastefield;
				function paste_id(value) {
					pastefield.value=value;
				}
				</script>
				<br />
				';
            $uniqueID = floor(microtime() * 1000000);
            if ($isged) {
                $content .= print_help_link('index_add_favorites_help', 'qm', '', false, true) . "<b><a href=\"javascript://{$pgv_lang['add_favorite']} \" onclick=\"expand_layer('add_ged_fav'); return false;\"><img id=\"add_ged_fav_img\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['plus']['other']}\" border=\"0\" alt=\"\" />&nbsp;{$pgv_lang['add_favorite']}</a></b>" . "<br />\n<div id=\"add_ged_fav\" style=\"display: none;\">\n" . "<form name=\"addgfavform\" method=\"post\" action=\"index.php\">\n" . "<input type=\"hidden\" name=\"favtype\" value=\"gedcom\" />\n";
            } else {
                $content .= print_help_link('index_add_favorites_help', 'qm', '', false, true) . "<b><a href=\"javascript://{$pgv_lang['add_favorite']} \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['plus']['other']}\" border=\"0\" alt=\"\" />&nbsp;{$pgv_lang['add_favorite']}</a></b>" . "<br />\n<div id=\"add_user_fav\" style=\"display: none;\">\n" . "<form name=\"addufavform\" method=\"post\" action=\"index.php\">\n" . "<input type=\"hidden\" name=\"favtype\" value=\"user\" />\n";
            }
            $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />\n" . "<input type=\"hidden\" name=\"ctype\" value=\"{$ctype}\" />\n" . "<input type=\"hidden\" name=\"ged\" value=\"{$GEDCOM}\" />\n" . "<table width=\"99%\" style=\"border:none\" cellspacing=\"3px\" class=\"center {$TEXT_DIRECTION}\">" . "<tr><td>{$pgv_lang['add_fav_enter_id']}<br />\n" . "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />" . print_findindi_link("gid{$uniqueID}", '', true) . print_findfamily_link("gid{$uniqueID}", '', true) . print_findsource_link("gid{$uniqueID}", '', true) . print_findrepository_link("gid{$uniqueID}", '', true) . print_findnote_link("gid{$uniqueID}", '', true) . print_findmedia_link("gid{$uniqueID}", '1', '', true) . "<br />\n{$pgv_lang['add_fav_or_enter_url']}" . "<table><tr><td>{$pgv_lang['url']}</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>" . "<tr><td>{$pgv_lang['title']}</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>" . "\n</td><td>" . "\n{$pgv_lang['add_fav_enter_note']}" . "<br />\n<textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>" . "</td></tr></table>\n" . "<br />\n<input type=\"submit\" value=\"{$pgv_lang['add']}\" style=\"font-size: 8pt; \" />" . "\n</form></div>\n";
        }
        // Restore GEDCOM configuration
        unset($show_full);
        if (isset($saveShowFull)) {
            $show_full = $saveShowFull;
        }
        $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
        return $content;
    }
Пример #13
0
 function _longlifeQuery($type = 'full', $sex = 'F')
 {
     global $TBLPREFIX, $pgv_lang, $SHOW_ID_NUMBERS, $listDir;
     $sex_search = ' 1=1';
     if ($sex == 'F') {
         $sex_search = " i_sex='F'";
     } elseif ($sex == 'M') {
         $sex_search = " i_sex='M'";
     }
     $rows = self::_runSQL('' . ' SELECT' . ' death.d_gid AS id,' . ' death.d_julianday2-birth.d_julianday1 AS age' . ' FROM' . " {$TBLPREFIX}dates AS death," . " {$TBLPREFIX}dates AS birth," . " {$TBLPREFIX}individuals AS indi" . ' WHERE' . ' indi.i_id=birth.d_gid AND' . ' birth.d_gid=death.d_gid AND' . " death.d_file={$this->_ged_id} AND" . ' birth.d_file=death.d_file AND' . ' birth.d_file=indi.i_file AND' . " birth.d_fact IN ('BIRT', 'CHR', 'BAPM', '_BRTM') AND" . " death.d_fact IN ('DEAT', 'BURI', 'CREM') AND" . ' birth.d_julianday1!=0 AND' . ' death.d_julianday1>birth.d_julianday2 AND' . $sex_search . ' ORDER BY' . ' age DESC', 1);
     if (!isset($rows[0])) {
         return '';
     }
     $row = $rows[0];
     $person = Person::getInstance($row['id']);
     switch ($type) {
         default:
         case 'full':
             if (displayDetailsById($row['id'])) {
                 $result = $person->format_list('span', false, $person->getFullName());
             } else {
                 $result = $pgv_lang['privacy_error'];
             }
             break;
         case 'age':
             $result = floor($row['age'] / 365.25);
             break;
         case 'name':
             $id = '';
             if ($SHOW_ID_NUMBERS) {
                 if ($listDir == 'rtl') {
                     $id = "&nbsp;&nbsp;" . getRLM() . "({$row['id']})" . getRLM();
                 } else {
                     $id = "&nbsp;&nbsp;({$row['id']})";
                 }
             }
             $result = "<a href=\"" . $person->getLinkUrl() . "\">" . $person->getFullName() . "{$id}</a>";
             break;
     }
     return str_replace('<a href="', '<a href="' . $this->_server_url, $result);
 }
Пример #14
0
 function print_time_fact($event)
 {
     global $basexoffset, $baseyoffset, $factcount, $TEXT_DIRECTION;
     global $factarray, $pgv_lang, $lang_short_cut, $LANGUAGE, $PGV_IMAGE_DIR, $PGV_IMAGES, $SHOW_PEDIGREE_PLACES, $placements;
     global $familyfacts, $GEDCOM;
     /* @var $event Event */
     $factrec = $event->getGedComRecord();
     $fact = $event->getTag();
     $desc = $event->getDetail();
     if ($fact == "EVEN" || $fact == "FACT") {
         $fact = $event->getType();
     }
     //-- check if this is a family fact
     $famid = $event->getFamilyId();
     if ($famid != null) {
         //-- if we already showed this family fact then don't print it
         if (isset($familyfacts[$famid . $fact]) && $familyfacts[$famid . $fact] != $event->temp) {
             return;
         }
         $familyfacts[$famid . $fact] = $event->temp;
     }
     $gdate = $event->getDate();
     $date = $gdate->MinDate();
     $date = $date->convert_to_cal('gregorian');
     $year = $date->y;
     $month = max(1, $date->m);
     $day = max(1, $date->d);
     $xoffset = $basexoffset + 22;
     $yoffset = $baseyoffset + ($year - $this->baseyear) * $this->scale - $this->scale;
     $yoffset = $yoffset + $month / 12 * $this->scale;
     $yoffset = $yoffset + $day / 30 * ($this->scale / 12);
     $yoffset = floor($yoffset);
     $place = round($yoffset / $this->bheight);
     $i = 1;
     $j = 0;
     $tyoffset = 0;
     while (isset($placements[$place])) {
         if ($i == $j) {
             $tyoffset = $this->bheight * $i;
             $i++;
         } else {
             $tyoffset = -1 * $this->bheight * $j;
             $j++;
         }
         $place = round(($yoffset + $tyoffset) / $this->bheight);
     }
     $yoffset += $tyoffset;
     $xoffset += abs($tyoffset);
     $placements[$place] = $yoffset;
     print "\n\t\t<div id=\"fact{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . $xoffset : "right: " . $xoffset) . "px; top:" . $yoffset . "px; font-size: 8pt; height: " . $this->bheight . "px; \" onmousedown=\"factMD(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">\n";
     print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"cursor: hand;\"><tr><td>\n";
     print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" name=\"boxline{$factcount}\" id=\"boxline{$factcount}\" height=\"3\" align=\"left\" hspace=\"0\" width=\"10\" vspace=\"0\" alt=\"\" style=\"padding-";
     if ($TEXT_DIRECTION == "ltr") {
         print "left";
     } else {
         print "right";
     }
     print ": 3px;\" />\n";
     $col = $event->temp % 6;
     print "</td><td valign=\"top\" class=\"person" . $col . "\">\n";
     if (count($this->pids) > 6) {
         print $event->getParentObject()->getFullName() . " - ";
     }
     $indi = $event->getParentObject();
     if ($fact == "_AKAN" || $fact == "_AKA" || $fact == "ALIA" || $fact == "_INTE") {
         // Allow special processing for different languages
         $func = "fact_AKA_localisation_{$lang_short_cut[$LANGUAGE]}";
         if (function_exists($func) && get_class($indi) == "Person") {
             // Localise the facts
             $func($fact, $indi->getXref());
             print $factarray[$fact];
         } else {
             print $event->getLabel();
         }
     } else {
         print $event->getLabel();
     }
     print " -- ";
     if (get_class($indi) == "Person") {
         print format_fact_date($event);
     }
     if (get_class($indi) == "Family") {
         print $gdate->Display(false);
         $family = $indi;
         $husbid = $family->getHusbId();
         $wifeid = $family->getWifeId();
         //-- Retrieve husband and wife age
         for ($p = 0; $p < count($this->pids); $p++) {
             if ($this->pids[$p] == $husbid) {
                 $husb = $family->getHusband();
                 if (is_null($husb)) {
                     $husb = new Person('');
                 }
                 $hdate = $husb->getBirthDate();
                 if ($hdate->isOK()) {
                     $ageh = get_age_at_event(GedcomDate::GetAgeGedcom($hdate, $gdate), false);
                 }
             } else {
                 if ($this->pids[$p] == $wifeid) {
                     $wife = $family->getWife();
                     if (is_null($wife)) {
                         $wife = new Person('');
                     }
                     $wdate = $wife->getBirthDate();
                     if ($wdate->isOK()) {
                         $agew = get_age_at_event(GedcomDate::GetAgeGedcom($wdate, $gdate), false);
                     }
                 }
             }
         }
         if (!empty($ageh) && $ageh > 0) {
             if (empty($agew)) {
                 print '<span class="age"> ' . PrintReady("({$pgv_lang["age"]} {$ageh})") . '</span>';
             } else {
                 print '<span class="age"> ' . PrintReady("({$pgv_lang["husb_age"]} {$ageh},") . ' ';
             }
         }
         if (!empty($agew) && $agew > 0) {
             if (empty($ageh)) {
                 print '<span class="age"> ' . PrintReady("({$pgv_lang["age"]} {$agew})") . '</span>';
             } else {
                 print PrintReady("{$pgv_lang["wife_age"]} {$agew})") . '</span>';
             }
         }
     }
     print " " . PrintReady($desc);
     if ($SHOW_PEDIGREE_PLACES > 0) {
         $place = $event->getPlace();
         if ($place != null) {
             if ($desc != null) {
                 print " - ";
             }
             $plevels = explode(',', $place);
             for ($plevel = 0; $plevel < $SHOW_PEDIGREE_PLACES; $plevel++) {
                 if (!empty($plevels[$plevel])) {
                     if ($plevel > 0) {
                         print ", ";
                     }
                     print PrintReady($plevels[$plevel]);
                 }
             }
         }
     }
     //-- print spouse name for marriage events
     $spouse = Person::getInstance($event->getSpouseId());
     if ($spouse) {
         for ($p = 0; $p < count($this->pids); $p++) {
             if ($this->pids[$p] == $spouse->getXref()) {
                 break;
             }
         }
         if ($p == count($this->pids)) {
             $p = $event->temp;
         }
         $col = $p % 6;
         if ($spouse->getXref() != $this->pids[$p]) {
             echo ' <a href="', $spouse->getLinkUrl(), '">', $spouse->getFullName(), '</a>';
         } else {
             $ct = preg_match("/2 _PGVFS @(.*)@/", $factrec, $match);
             if ($ct > 0) {
                 print " <a href=\"" . encode_url("family.php?famid={$match[1]}&ged={$GEDCOM}") . "\">";
                 if (displayDetailsById($match[1]) || showLivingNameById($match[1])) {
                     print $event->getParentObject()->getFullName();
                 } else {
                     print $pgv_lang["private"];
                 }
                 print "</a>";
             }
         }
     }
     print "</td></tr></table>\n";
     print "</div>";
     if ($TEXT_DIRECTION == 'ltr') {
         $img = "dline2";
         $ypos = "0%";
     } else {
         $img = "dline";
         $ypos = "100%";
     }
     $dyoffset = $yoffset - $tyoffset + $this->bheight / 3;
     if ($tyoffset < 0) {
         $dyoffset = $yoffset + $this->bheight / 3;
         if ($TEXT_DIRECTION == 'ltr') {
             $img = "dline";
             $ypos = "100%";
         } else {
             $img = "dline2";
             $ypos = "0%";
         }
     }
     //-- print the diagnal line
     print "\n\t\t<div id=\"dbox{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . ($basexoffset + 25) : "right: " . ($basexoffset + 25)) . "px; top:" . $dyoffset . "px; font-size: 8pt; height: " . abs($tyoffset) . "px; width: " . abs($tyoffset) . "px;";
     print " background-image: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES[$img]["other"] . "');";
     print " background-position: 0% {$ypos}; \" >\n";
     print "</div>\n";
 }
Пример #15
0
function print_gedcom_favorites($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $factarray, $PGV_IMAGE_DIR, $PGV_IMAGES, $ctype, $TEXT_DIRECTION;
    global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
    // Override GEDCOM configuration temporarily
    if (isset($show_full)) {
        $saveShowFull = $show_full;
    }
    $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
    $show_full = 1;
    $PEDIGREE_FULL_DETAILS = 1;
    $userfavs = getUserFavorites(PGV_GEDCOM);
    if (!is_array($userfavs)) {
        $userfavs = array();
    }
    $id = "gedcom_favorites";
    $title = print_help_link("index_favorites_help", "qm", "", false, true);
    $title .= $pgv_lang["gedcom_favorites"] . "&nbsp;&nbsp;";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    $title .= "(" . count($userfavs) . ")";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    if (PGV_USER_IS_ADMIN && $ENABLE_AUTOCOMPLETE) {
        $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script>
		<script type="text/javascript">
		jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/
		jQuery(document).ready(function($){
			$("input[name^=gid]").autocomplete("autocomplete.php", {
				extraParams: {field:"IFSRO"},
				formatItem: function(row, i) {
					return row[0] + " (" + row[1] + ")";
				},
				formatResult: function(row) {
					return row[1];
				},
				width: 400,
				minChars: 2
			});
		});
		</script>';
    } else {
        $content = '';
    }
    if ($block) {
        $style = 2;
        // 1 means "regular box", 2 means "wide box"
        $tableWidth = $BROWSERTYPE == "msie" ? "95%" : "99%";
        // IE needs to have room for vertical scroll bar inside the box
        $cellSpacing = "1px";
    } else {
        $style = 2;
        $tableWidth = "99%";
        $cellSpacing = "3px";
    }
    if (count($userfavs) == 0) {
        if (PGV_USER_GEDCOM_ADMIN) {
            $content .= print_text("no_favorites", 0, 1);
        } else {
            $content .= print_text("no_gedcom_favorites", 0, 1);
        }
    } else {
        $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
        foreach ($userfavs as $key => $favorite) {
            if (isset($favorite["id"])) {
                $key = $favorite["id"];
            }
            $removeFavourite = "<a class=\"font9\" href=\"" . encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$key}") . "\" onclick=\"return confirm('" . $pgv_lang["confirm_fav_remove"] . "');\">" . $pgv_lang["remove"] . "</a><br />\n";
            $content .= "<tr><td>";
            if ($favorite["type"] == "URL") {
                $content .= "<div id=\"boxurl" . $key . ".0\" class=\"person_box\">\n";
                if ($ctype == "user" || PGV_USER_GEDCOM_ADMIN) {
                    $content .= $removeFavourite;
                }
                $content .= "<a href=\"" . $favorite["url"] . "\"><b>" . PrintReady($favorite["title"]) . "</b></a>";
                $content .= "<br />" . PrintReady($favorite["note"]);
                $content .= "</div>\n";
            } else {
                if (displayDetailsById($favorite["gid"], $favorite["type"])) {
                    if ($favorite["type"] == "INDI") {
                        $indirec = find_person_record($favorite["gid"], PGV_GED_ID);
                        $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box";
                        if (strpos($indirec, "\n1 SEX F") !== false) {
                            $content .= "F";
                        } elseif (strpos($indirec, "\n1 SEX M") !== false) {
                            $content .= "";
                        } else {
                            $content .= "NN";
                        }
                        $content .= "\">\n";
                        if ($ctype == "user" || PGV_USER_GEDCOM_ADMIN) {
                            $content .= $removeFavourite;
                        }
                        ob_start();
                        print_pedigree_person($favorite["gid"], $style, 1, $key);
                        $content .= ob_get_clean();
                        $content .= PrintReady($favorite["note"]);
                        $content .= "</div>\n";
                    } else {
                        $record = GedcomRecord::getInstance($favorite['gid']);
                        $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box\">";
                        if ($ctype == "user" || PGV_USER_GEDCOM_ADMIN) {
                            $content .= $removeFavourite;
                        }
                        if ($record) {
                            $content .= $record->format_list('span');
                        } else {
                            $content .= $pgv_lang['invalid_id'];
                        }
                        $content .= "<br />" . PrintReady($favorite["note"]);
                        $content .= "</div>";
                    }
                }
            }
            $content .= "</td></tr>\n";
        }
        $content .= "</table>\n";
    }
    if (PGV_USER_GEDCOM_ADMIN) {
        $content .= '
		<script language="JavaScript" type="text/javascript">
		<!--
		var pastefield;
		function paste_id(value) {
			pastefield.value=value;
		}
		-->
		</script>
		<br />
		';
        $uniqueID = floor(microtime() * 1000000);
        $content .= print_help_link("index_add_favorites_help", "qm", "", false, true);
        $content .= "<b><a href=\"javascript://" . $pgv_lang["add_favorite"] . " \" onclick=\"expand_layer('add_ged_fav'); return false;\"><img id=\"add_ged_fav_img\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["plus"]["other"] . "\" border=\"0\" alt=\"\" />&nbsp;" . $pgv_lang["add_favorite"] . "</a></b>";
        $content .= "<br /><div id=\"add_ged_fav\" style=\"display: none;\">\n";
        $content .= "<form name=\"addgfavform\" method=\"post\" action=\"index.php\">\n";
        $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />\n";
        $content .= "<input type=\"hidden\" name=\"ctype\" value=\"{$ctype}\" />\n";
        $content .= "<input type=\"hidden\" name=\"favtype\" value=\"gedcom\" />\n";
        $content .= "<input type=\"hidden\" name=\"ged\" value=\"" . PGV_GEDCOM . "\" />\n";
        $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
        $content .= "<tr><td>" . $pgv_lang["add_fav_enter_id"] . " <br />";
        $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
        $content .= print_findindi_link("gid{$uniqueID}", '', true) . "\n";
        $content .= print_findfamily_link("gid{$uniqueID}", '', true) . "\n";
        $content .= print_findsource_link("gid{$uniqueID}", '', true) . "\n";
        $content .= print_findrepository_link("gid{$uniqueID}", '', true) . "\n";
        $content .= print_findnote_link("gid{$uniqueID}", '', true) . "\n";
        $content .= print_findmedia_link("gid{$uniqueID}", '1', '', true) . "\n";
        $content .= "\n<br />" . $pgv_lang["add_fav_or_enter_url"];
        $content .= "\n<table><tr><td>" . $pgv_lang["url"] . "</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
        $content .= "\n<tr><td>" . $pgv_lang["title"] . "</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
        if ($block) {
            $content .= "\n</td></tr><tr><td><br />";
        } else {
            $content .= "\n</td><td>";
        }
        $content .= "\n" . $pgv_lang["add_fav_enter_note"];
        $content .= "\n<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
        $content .= "</td></tr></table>\n";
        $content .= "\n<br /><input type=\"submit\" value=\"" . $pgv_lang["add"] . "\" style=\"font-size: 8pt; \" />";
        $content .= "\n</form></div>\n";
    }
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
    // Restore GEDCOM configuration
    unset($show_full);
    if (isset($saveShowFull)) {
        $show_full = $saveShowFull;
    }
    $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
}
/**
 * print a media row in a table
 * @param string $rtype whether this is a 'new', 'old', or 'normal' media row... this is used to determine if the rows should be printed with an outline color
 * @param array $rowm        An array with the details about this media item
 * @param string $pid        The record id this media item was attached to
 */
function media_reorder_row($rtype, $rowm, $pid)
{
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $view, $MEDIA_DIRECTORY, $TEXT_DIRECTION;
    global $SHOW_ID_NUMBERS, $GEDCOM, $factarray, $pgv_lang, $THUMBNAIL_WIDTH, $USE_MEDIA_VIEWER;
    global $SEARCH_SPIDER;
    global $t, $n, $item, $items, $p, $edit, $SERVER_URL, $reorder, $LB_AL_THUMB_LINKS, $note, $rowm;
    global $LB_URL_WIDTH, $LB_URL_HEIGHT, $order1, $mediaType;
    if (!isset($rowm)) {
        $rowm = $row;
    }
    print "<li class=\"facts_value\" style=\"list-style:none;cursor:move;margin-bottom:2px;\" id=\"li_" . $rowm['m_media'] . "\" >";
    //print $rtype." ".$rowm["m_media"]." ".$pid;
    if (!displayDetailsById($rowm['m_media'], 'OBJE') || FactViewRestricted($rowm['m_media'], $rowm['m_gedrec'])) {
        //print $rowm['m_media']." no privacy ";
        return false;
    }
    $styleadd = "";
    if ($rtype == 'new') {
        $styleadd = "change_new";
    }
    if ($rtype == 'old') {
        $styleadd = "change_old";
    }
    // NOTE Start printing the media details
    $thumbnail = thumbnail_file($rowm["m_file"], true, false, $pid);
    // $isExternal = stristr($thumbnail,"://");
    $isExternal = isFileExternal($thumbnail);
    $linenum = 0;
    // NOTE Get the title of the media
    if (showFactDetails("OBJE", $pid)) {
        $mediaTitle = $rowm["m_titl"];
        $subtitle = get_gedcom_value("TITL", 2, $rowm["mm_gedrec"]);
        if (!empty($subtitle)) {
            $mediaTitle = $subtitle;
        }
        $mainMedia = check_media_depth($rowm["m_file"], "NOTRUNC");
        if ($mediaTitle == "") {
            $mediaTitle = basename($rowm["m_file"]);
        }
        print "\n" . "<table class=\"pic\"><tr>" . "\n";
        print "<td width=\"80\" valign=\"top\" align=\"center\" >" . "\n";
        // Get info on how to handle this media file
        $mediaInfo = mediaFileInfo($mainMedia, $thumbnail, $rowm["m_media"], $mediaTitle, '');
        //-- Thumbnail field
        print "<img src=\"" . $mediaInfo['thumb'] . "\" height=\"38\" border=\"0\" ";
        if (eregi("1 SOUR", $rowm['m_gedrec'])) {
            print " alt=\"" . PrintReady($mediaTitle) . "\" title=\"" . PrintReady($mediaTitle) . "\nSource info available\" />";
        } else {
            print " alt=\"" . PrintReady($mediaTitle) . "\" title=\"" . PrintReady($mediaTitle) . "\" />";
        }
        //print media info
        $ttype2 = preg_match("/\\d TYPE (.*)/", $rowm["m_gedrec"], $match);
        if ($ttype2 > 0) {
            $mediaType = trim($match[1]);
            $varName = "TYPE__" . strtolower($mediaType);
            if (isset($pgv_lang[$varName])) {
                $mediaType = $pgv_lang[$varName];
            }
            //		print "\n\t\t\t<br /><span class=\"label\">".$pgv_lang["type"].": </span> <span class=\"field\">$mediaType</span>";
        }
        print "\n" . "</td><td>&nbsp;</td>" . "\n";
        print "<td valign=\"top\" align=\"left\">";
        //print "<font color=\"blue\">";
        print $rowm['m_media'];
        //print "</font>";
        print "<b>";
        print "&nbsp;&nbsp;" . $mediaType;
        print "</b>";
        print "<br>" . "\n";
        print $mediaTitle . "\n";
        print "</td>" . "\n";
        print "</tr>";
        print "</table>" . "\n";
    }
    if (!isset($j)) {
        $j = 0;
    } else {
        $j = $j;
    }
    $media_data = $rowm['m_media'];
    print "<input type=\"hidden\" name=\"order1[{$media_data}]\" value=\"{$j}\" />";
    print "</li>";
    print "\n\n";
    return true;
}
Пример #17
0
}
//-- 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"];
    //-- display messages as to why the editing access was denied
    if (!PGV_USER_CAN_EDIT) {
        echo "<br />", $pgv_lang["user_cannot_edit"];
    }
    if (!$ALLOW_EDIT_GEDCOM) {
        echo "<br />", $pgv_lang["gedcom_editing_disabled"];
    }
Пример #18
0
/**
 * print ancestors on a fan chart
 *
 * @param array $treeid ancestry pid
 * @param int $fanw fan width in px (default=640)
 * @param int $fandeg fan size in deg (default=270)
 */
function print_fan_chart($treeid, $fanw = 640, $fandeg = 270)
{
    global $PEDIGREE_GENERATIONS, $fan_width, $fan_style;
    global $name, $pgv_lang, $SHOW_ID_NUMBERS, $view, $TEXT_DIRECTION;
    global $stylesheet, $print_stylesheet;
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $LINK_ICONS, $GEDCOM;
    // check for GD 2.x library
    if (!defined("IMG_ARC_PIE")) {
        print "<span class=\"error\">" . $pgv_lang["gd_library"] . "</span>";
        print " <a href=\"" . $pgv_lang["gd_helplink"] . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["help"]["small"] . "\" class=\"icon\" alt=\"\" /></a><br /><br />";
        return false;
    }
    if (!function_exists("ImageTtfBbox")) {
        print "<span class=\"error\">" . $pgv_lang["gd_freetype"] . "</span>";
        print " <a href=\"" . $pgv_lang["gd_helplink"] . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["help"]["small"] . "\" class=\"icon\" alt=\"\" /></a><br /><br />";
        return false;
    }
    // parse CSS file
    include "includes/cssparser.inc.php";
    $css = new cssparser(false);
    if ($view == "preview") {
        $css->Parse($print_stylesheet);
    } else {
        $css->Parse($stylesheet);
    }
    // check for fontfile
    $fontfile = $css->Get(".fan_chart", "font-family");
    $fontsize = $css->Get(".fan_chart", "font-size");
    $fontfile = str_replace("url(", "", $fontfile);
    $fontfile = str_replace(")", "", $fontfile);
    if (!file_exists($fontfile)) {
        if (!empty($fontfile)) {
            print "<span class=\"error\">" . $pgv_lang["fontfile_error"] . " : {$fontfile}</span>";
        }
        $fontfile = "./includes/fonts/DejaVuSans.ttf";
    }
    if ($fontfile[0] != '/') {
        $fontfile = dirname(__FILE__) . "/" . $fontfile;
    }
    if (!file_exists($fontfile)) {
        print "<span class=\"error\">" . $pgv_lang["fontfile_error"] . " : {$fontfile}</span>";
        return false;
    }
    if (intval($fontsize) < 2) {
        $fontsize = 7;
    }
    $treesize = count($treeid);
    if ($treesize < 1) {
        return;
    }
    // generations count
    $gen = log($treesize) / log(2) - 1;
    $sosa = $treesize - 1;
    // fan size
    if ($fandeg == 0) {
        $fandeg = 360;
    }
    $fandeg = min($fandeg, 360);
    $fandeg = max($fandeg, 90);
    $cx = $fanw / 2 - 1;
    // center x
    $cy = $cx;
    // center y
    $rx = $fanw - 1;
    $rw = $fanw / ($gen + 1);
    $fanh = $fanw;
    // fan height
    if ($fandeg == 180) {
        $fanh = round($fanh * ($gen + 1) / ($gen * 2));
    }
    if ($fandeg == 270) {
        $fanh = round($fanh * 0.86);
    }
    $scale = $fanw / 640;
    // image init
    $image = ImageCreate($fanw, $fanh);
    $black = ImageColorAllocate($image, 0, 0, 0);
    $white = ImageColorAllocate($image, 0xff, 0xff, 0xff);
    ImageFilledRectangle($image, 0, 0, $fanw, $fanh, $white);
    ImageColorTransparent($image, $white);
    $rgb = $css->Get(".fan_chart", "color");
    if (empty($rgb)) {
        $rgb = "#000000";
    }
    $color = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2)));
    $rgb = $css->Get(".fan_chart", "background-color");
    if (empty($rgb)) {
        $rgb = "#EEEEEE";
    }
    $bgcolor = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2)));
    $rgb = $css->Get(".fan_chart_box", "background-color");
    if (empty($rgb)) {
        $rgb = "#D0D0AC";
    }
    $bgcolorM = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2)));
    $rgb = $css->Get(".fan_chart_boxF", "background-color");
    if (empty($rgb)) {
        $rgb = "#D0ACD0";
    }
    $bgcolorF = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2)));
    // imagemap
    $imagemap = "<map id=\"fanmap\" name=\"fanmap\">";
    // loop to create fan cells
    while ($gen >= 0) {
        // clean current generation area
        $deg2 = 360 + ($fandeg - 180) / 2;
        $deg1 = $deg2 - $fandeg;
        ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bgcolor, IMG_ARC_PIE);
        $rx -= 3;
        // calculate new angle
        $p2 = pow(2, $gen);
        $angle = $fandeg / $p2;
        $deg2 = 360 + ($fandeg - 180) / 2;
        $deg1 = $deg2 - $angle;
        // special case for rootid cell
        if ($gen == 0) {
            $deg1 = 90;
            $deg2 = 360 + $deg1;
        }
        // draw each cell
        while ($sosa >= $p2) {
            $pid = $treeid[$sosa];
            if (!empty($pid)) {
                $indirec = find_person_record($pid);
                if (!$indirec) {
                    $indirec = find_updated_record($pid);
                }
                if ($sosa % 2) {
                    $bg = $bgcolorF;
                } else {
                    $bg = $bgcolorM;
                }
                if ($sosa == 1) {
                    $bg = $bgcolor;
                    // sex unknown
                    if (preg_match("/1 SEX F/", $indirec) > 0) {
                        $bg = $bgcolorF;
                    } else {
                        if (preg_match("/1 SEX M/", $indirec) > 0) {
                            $bg = $bgcolorM;
                        }
                    }
                }
                ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE);
                $person = Person::getInstance($pid);
                $name = $person->getFullName();
                $addname = $person->getAddName();
                //$name = str_replace(array('<span class="starredname">', '</span>'), '', $name);
                //$addname = str_replace(array('<span class="starredname">', '</span>'), '', $addname);
                //$name = str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $name); //@@
                //$addname = str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $addname); //@@
                // ToDo - print starred names underlined - 1985154
                // Todo - print Arabic letters combined - 1360209
                $text = reverseText($name) . "\n";
                if (!empty($addname)) {
                    $text .= reverseText($addname) . "\n";
                }
                if (displayDetailsById($pid)) {
                    $birthrec = get_sub_record(1, "1 BIRT", $indirec);
                    $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", $birthrec, $match);
                    if ($ct > 0) {
                        $text .= trim($match[1]);
                    }
                    $deathrec = get_sub_record(1, "1 DEAT", $indirec);
                    $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", $deathrec, $match);
                    if ($ct > 0) {
                        $text .= "-" . trim($match[1]);
                    }
                }
                $text = unhtmlentitiesrtl($text);
                $text = strip_tags($text);
                //Do we still need?
                // split and center text by lines
                $wmax = floor($angle * 7 / $fontsize * $scale);
                $wmax = min($wmax, 35 * $scale);
                if ($gen == 0) {
                    $wmax = min($wmax, 17 * $scale);
                }
                $text = split_align_text($text, $wmax);
                // text angle
                $tangle = 270 - ($deg1 + $angle / 2);
                if ($gen == 0) {
                    $tangle = 0;
                }
                // calculate text position
                $bbox = ImageTtfBbox((double) $fontsize, 0, $fontfile, $text);
                $textwidth = $bbox[4];
                $deg = $deg1 + 0.44;
                if ($deg2 - $deg1 > 40) {
                    $deg = $deg1 + ($deg2 - $deg1) / 11;
                }
                if ($deg2 - $deg1 > 80) {
                    $deg = $deg1 + ($deg2 - $deg1) / 7;
                }
                if ($deg2 - $deg1 > 140) {
                    $deg = $deg1 + ($deg2 - $deg1) / 4;
                }
                if ($gen == 0) {
                    $deg = 180;
                }
                $rad = deg2rad($deg);
                $mr = ($rx - $rw / 4) / 2;
                if ($gen > 0 and $deg2 - $deg1 > 80) {
                    $mr = $rx / 2;
                }
                $tx = $cx + $mr * cos($rad);
                $ty = $cy - $mr * -sin($rad);
                if ($sosa == 1) {
                    $ty -= $mr / 2;
                }
                // print text
                ImageTtfText($image, (double) $fontsize, $tangle, $tx, $ty, $color, $fontfile, $text);
                $imagemap .= "<area shape=\"poly\" coords=\"";
                // plot upper points
                $mr = $rx / 2;
                $deg = $deg1;
                while ($deg <= $deg2) {
                    $rad = deg2rad($deg);
                    $tx = round($cx + $mr * cos($rad));
                    $ty = round($cy - $mr * -sin($rad));
                    $imagemap .= "{$tx}, {$ty}, ";
                    $deg += ($deg2 - $deg1) / 6;
                }
                // plot lower points
                $mr = ($rx - $rw) / 2;
                $deg = $deg2;
                while ($deg >= $deg1) {
                    $rad = deg2rad($deg);
                    $tx = round($cx + $mr * cos($rad));
                    $ty = round($cy - $mr * -sin($rad));
                    $imagemap .= "{$tx}, {$ty}, ";
                    $deg -= ($deg2 - $deg1) / 6;
                }
                // join first point
                $mr = $rx / 2;
                $deg = $deg1;
                $rad = deg2rad($deg);
                $tx = round($cx + $mr * cos($rad));
                $ty = round($cy - $mr * -sin($rad));
                $imagemap .= "{$tx}, {$ty}";
                // add action url
                $tempURL = "javascript://" . htmlspecialchars(strip_tags($name));
                if ($SHOW_ID_NUMBERS) {
                    $tempURL .= " (" . $pid . ")";
                }
                $imagemap .= "\" href=\"{$tempURL}\" ";
                $tempURL = "fanchart.php?rootid={$pid}&PEDIGREE_GENERATIONS={$PEDIGREE_GENERATIONS}&fan_width={$fan_width}&fan_style={$fan_style}";
                if (!empty($view)) {
                    $tempURL .= "&view={$view}";
                }
                $count = 0;
                $lbwidth = 200;
                print "<div id=\"I" . $pid . "." . $count . "links\" style=\"position:absolute; >";
                print "left:" . $tx . "px; top:" . $ty . "px; width: " . $lbwidth . "px; visibility:hidden; z-index:'100';\">";
                print "<table class=\"person_box\"><tr><td class=\"details1\">";
                print "<a href=\"individual.php?pid={$pid}\" class=\"name1\">" . PrintReady($name);
                if (!empty($addname)) {
                    print "<br />" . PrintReady($addname);
                }
                print "</a>";
                print "<br /><a href=\"pedigree.php?rootid={$pid}\" >" . $pgv_lang["index_header"] . "</a>";
                print "<br /><a href=\"descendancy.php?pid={$pid}\" >" . $pgv_lang["descend_chart"] . "</a>";
                if (PGV_USER_GEDCOM_ID) {
                    print "<br /><a href=\"" . encode_url("relationship.php?pid1=" . PGV_USER_GEDCOM_ID . "&pid2={$pid}&ged={$GEDCOM}") . "\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["relationship_to_me"] . "</a>";
                }
                print "<br /><a href=\"ancestry.php?rootid={$pid}\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["ancestry_chart"] . "</a>";
                print "<br /><a href=\"compact.php?rootid={$pid}\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["compact_chart"] . "</a>";
                print "<br /><a href=\"" . encode_url($tempURL) . "\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["fan_chart"] . "</a>";
                print "<br /><a href=\"hourglass.php?pid={$pid}\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["hourglass_chart"] . "</a>";
                if ($sosa >= 1) {
                    $famids = find_sfamily_ids($pid);
                    //-- make sure there is more than 1 child in the family with parents
                    $cfamids = find_family_ids($pid);
                    $num = 0;
                    for ($f = 0; $f < count($cfamids); $f++) {
                        $famrec = find_family_record($cfamids[$f]);
                        if ($famrec) {
                            $num += preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
                        }
                    }
                    if ($famids || $num > 1) {
                        //-- spouse(s) and children
                        for ($f = 0; $f < count($famids); $f++) {
                            $famrec = find_family_record(trim($famids[$f]));
                            if ($famrec) {
                                $parents = find_parents($famids[$f]);
                                if ($parents) {
                                    if ($pid != $parents["HUSB"]) {
                                        $spid = $parents["HUSB"];
                                    } else {
                                        $spid = $parents["WIFE"];
                                    }
                                    $person = Person::getInstance($spid);
                                    if ($person) {
                                        echo '<br /><a href="', $person->getLinkUrl(), '" class="name1">', $person->getFullName(), '</a>';
                                    }
                                }
                                $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
                                for ($i = 0; $i < $num; $i++) {
                                    $person = Person::getInstance($smatch[$i][1]);
                                    if ($person) {
                                        echo '<br />&nbsp;&nbsp;<a href="', $person->getLinkUrl(), '" class="name1">&lt; ', $person->getFullName(), '</a>';
                                    }
                                }
                            }
                        }
                        //-- siblings
                        for ($f = 0; $f < count($cfamids); $f++) {
                            $famrec = find_family_record($cfamids[$f]);
                            if ($famrec) {
                                $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
                                if ($num > 2) {
                                    print "<br /><span class=\"name1\">" . $pgv_lang["siblings"] . "</span>";
                                }
                                if ($num == 2) {
                                    print "<br /><span class=\"name1\">" . $pgv_lang["sibling"] . "</span>";
                                }
                                for ($i = 0; $i < $num; $i++) {
                                    $cpid = $smatch[$i][1];
                                    if ($cpid != $pid) {
                                        $person = Person::getInstance($cpid);
                                        if ($person) {
                                            echo '<br />&nbsp;&nbsp;<a href="', $person->getLinkUrl(), '" class="name1"> ', $person->getFullName(), '</a>';
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                print "</td></tr></table>";
                print "</div>";
                $imagemap .= " onclick=\"show_family_box('" . $pid . "." . $count . "', 'relatives'); return false;\"";
                $imagemap .= " onmouseout=\"family_box_timeout('" . $pid . "." . $count . "'); return false;\"";
                $imagemap .= " alt=\"" . PrintReady(strip_tags($name)) . "\" title=\"" . PrintReady(strip_tags($name)) . "\" />";
            }
            $deg1 -= $angle;
            $deg2 -= $angle;
            $sosa--;
        }
        $rx -= $rw;
        $gen--;
    }
    $imagemap .= "</map>";
    echo $imagemap;
    // PGV banner ;-)
    ImageStringUp($image, 1, $fanw - 10, $fanh / 3, PGV_PHPGEDVIEW_URL, $color);
    // here we cannot send image to browser ('header already sent')
    // and we dont want to use a tmp file
    // step 1. save image data in a session variable
    ob_start();
    ImagePng($image);
    $image_data = ob_get_contents();
    ob_end_clean();
    $image_data = serialize($image_data);
    unset($_SESSION['image_data']);
    $_SESSION['image_data'] = $image_data;
    // step 2. call imageflush.php to read this session variable and display image
    // note: arg "image_name=" is to avoid image miscaching
    $image_name = "V" . time();
    unset($_SESSION[$image_name]);
    // statisticsplot.php uses this to hold a file name to send to browser
    $image_title = preg_replace("~<.*>~", "", $name) . " " . $pgv_lang["fan_chart"];
    echo "<p align=\"center\" >";
    echo "<img src=\"imageflush.php?image_type=png&amp;image_name={$image_name}&amp;height={$fanh}&amp;width={$fanw}\" width=\"{$fanw}\" height=\"{$fanh}\" border=\"0\" alt=\"{$image_title}\" title=\"{$image_title}\" usemap=\"#fanmap\" />";
    echo "</p>";
    ImageDestroy($image);
}
Пример #19
0
 function init()
 {
     global $Dbwidth, $bwidth, $pbwidth, $pbheight, $bheight, $GEDCOM, $pgv_lang, $CONTACT_EMAIL, $show_famlink, $pgv_changes;
     $bwidth = $Dbwidth;
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     $show_famlink = $this->view != 'preview';
     $this->famid = safe_GET_xref('famid');
     $this->family = Family::getInstance($this->famid);
     if (empty($this->famrec)) {
         $ct = preg_match("/(\\w+):(.+)/", $this->famid, $match);
         if ($ct > 0) {
             $servid = trim($match[1]);
             $remoteid = trim($match[2]);
             include_once 'includes/classes/class_serviceclient.php';
             $service = ServiceClient::getInstance($servid);
             if (!is_null($service)) {
                 $newrec = $service->mergeGedcomRecord($remoteid, "0 @" . $this->famid . "@ FAM\n1 RFN " . $this->famid, false);
                 $this->famrec = $newrec;
             }
         }
         //-- if no record was found create a default empty one
         if (isset($pgv_changes[$this->famid . "_" . $GEDCOM])) {
             $this->famrec = "0 @" . $this->famid . "@ FAM\n";
             $this->family = new Family($this->famrec);
         } else {
             if (empty($this->family)) {
                 return false;
             }
         }
     }
     $this->famrec = $this->family->getGedcomRecord();
     $this->display = displayDetailsById($this->famid, 'FAM');
     //-- if the user can edit and there are changes then get the new changes
     if ($this->show_changes && PGV_USER_CAN_EDIT && isset($pgv_changes[$this->famid . "_" . $GEDCOM])) {
         $newrec = find_updated_record($this->famid);
         if (empty($newrec)) {
             $newrec = find_family_record($this->famid);
         }
         $this->difffam = new Family($newrec);
         $this->difffam->setChanged(true);
         $this->family->diffMerge($this->difffam);
         //$this->famrec = $newrec;
         //$this->family = new Family($this->famrec);
     }
     $this->parents = array('HUSB' => $this->family->getHusbId(), 'WIFE' => $this->family->getWifeId());
     //-- check if we can display both parents
     if ($this->display == false) {
         $this->showLivingHusb = showLivingNameById($this->parents['HUSB']);
         $this->showLivingWife = showLivingNameById($this->parents['WIFE']);
     }
     //-- add favorites action
     if ($this->action == 'addfav' && !empty($_REQUEST['gid']) && PGV_USER_NAME) {
         $_REQUEST['gid'] = strtoupper($_REQUEST['gid']);
         $indirec = find_family_record($_REQUEST['gid']);
         if ($indirec) {
             $favorite = array('username' => PGV_USER_NAME, 'gid' => $_REQUEST['gid'], 'type' => 'FAM', 'file' => $GEDCOM, 'url' => '', 'note' => '', 'title' => '');
             addFavorite($favorite);
         }
     }
     if (PGV_USER_CAN_ACCEPT) {
         if ($this->action == 'accept') {
             if (accept_changes($_REQUEST['famid'] . '_' . $GEDCOM)) {
                 $this->show_changes = false;
                 $this->accept_success = true;
                 //-- check if we just deleted the record and redirect to index
                 $famrec = find_family_record($_REQUEST['famid']);
                 if (empty($famrec)) {
                     header("Location: index.php?ctype=gedcom");
                     exit;
                 }
                 $this->family = new Family($famrec);
                 $this->parents = find_parents($_REQUEST['famid']);
             }
         }
         if ($this->action == 'undo') {
             $this->family->undoChange();
             $this->parents = find_parents($_REQUEST['famid']);
         }
     }
     //-- make sure we have the true id from the record
     $ct = preg_match("/0 @(.*)@/", $this->famrec, $match);
     if ($ct > 0) {
         $this->famid = trim($match[1]);
     }
     if ($this->showLivingHusb == false && $this->showLivingWife == false) {
         print_header($pgv_lang['private'] . " " . $pgv_lang['family_info']);
         print_privacy_error($CONTACT_EMAIL);
         print_footer();
         exit;
     }
     $this->title = $this->family->getFullName();
     if (empty($this->parents['HUSB']) || empty($this->parents['WIFE'])) {
         $this->link_relation = 0;
     } else {
         $this->link_relation = 1;
     }
 }
Пример #20
0
    if (!isset($pgv_changes[$pid . "_" . $GEDCOM])) {
        $gedrec = find_media_record($pid);
    } else {
        $gedrec = find_updated_record($pid);
    }
    $disp = displayDetailsById($pid, "OBJE");
}
if ($action == "update" || $action == "newentry") {
    if (!isset($linktoid) || $linktoid == "new") {
        $linktoid = "";
    }
    if (empty($linktoid) && !empty($gid)) {
        $linktoid = $gid;
    }
    if (!empty($linktoid)) {
        $disp = displayDetailsById($linktoid);
    }
}
if (!PGV_USER_CAN_EDIT || !$disp || !$ALLOW_EDIT_GEDCOM) {
    print $pgv_lang["access_denied"];
    //-- display messages as to why the editing access was denied
    if (!PGV_USER_CAN_EDIT) {
        print "<br />" . $pgv_lang["user_cannot_edit"];
    }
    if (!$ALLOW_EDIT_GEDCOM) {
        print "<br />" . $pgv_lang["gedcom_editing_disabled"];
    }
    if (!$disp) {
        print "<br />" . $pgv_lang["privacy_prevented_editing"];
        if (!empty($pid)) {
            print "<br />" . $pgv_lang["privacy_not_granted"] . " pid {$pid}.";
Пример #21
0
 function GedcomRecord($data, $simple = false)
 {
     if (is_array($data)) {
         // Construct from a row from the database
         $this->xref = $data['xref'];
         $this->type = $data['type'];
         $this->ged_id = $data['ged_id'];
         $this->gedrec = $data['gedrec'];
     } else {
         // Construct from raw GEDCOM data
         $this->gedrec = $data;
         if (preg_match('/^0 (?:@(' . PGV_REGEX_XREF . ')@ )?(' . PGV_REGEX_TAG . ')/', $data, $match)) {
             $this->xref = $match[1];
             $this->type = $match[2];
         }
     }
     //-- lookup the record from another gedcom
     $remoterfn = get_gedcom_value('RFN', 1, $this->gedrec);
     if (!empty($remoterfn)) {
         $parts = explode(':', $remoterfn);
         if (count($parts) == 2) {
             $servid = $parts[0];
             $aliaid = $parts[1];
             if (!empty($servid) && !empty($aliaid)) {
                 $serviceClient = ServiceClient::getInstance($servid);
                 if (!is_null($serviceClient)) {
                     if (!$simple || $serviceClient->type == 'local') {
                         $this->gedrec = $serviceClient->mergeGedcomRecord($aliaid, $this->gedrec, true);
                     }
                 }
             }
         }
     }
     //-- set the gedcom record a privatized version
     $this->gedrec = privatize_gedcom($this->gedrec);
     if ($this->xref && $this->type) {
         $this->disp = displayDetailsById($this->xref, $this->type);
     }
 }