Example #1
0
function print_td_person($n)
{
    global $treeid, $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang;
    global $TEXT_DIRECTION, $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $USE_SILHOUETTE, $PGV_IMAGES;
    global $showids, $showthumbs;
    $text = "";
    $pid = $treeid[$n];
    if ($TEXT_DIRECTION == "ltr") {
        $title = $pgv_lang["indi_info"] . ": " . $pid;
    } else {
        $title = $pid . " :" . $pgv_lang["indi_info"];
    }
    if ($pid) {
        $indi = Person::getInstance($pid);
        $name = $indi->getFullName();
        $addname = $indi->getAddName();
        if ($showthumbs && $MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) {
            if (showFact("OBJE", $pid)) {
                $object = find_highlighted_object($pid, PGV_GED_ID, $indi->gedrec);
                if (!empty($object)) {
                    $whichFile = thumb_or_main($object);
                    // Do we send the main image or a thumbnail?
                    $size = findImageSize($whichFile);
                    $class = "pedigree_image_portrait";
                    if ($size[0] > $size[1]) {
                        $class = "pedigree_image_landscape";
                    }
                    if ($TEXT_DIRECTION == "rtl") {
                        $class .= "_rtl";
                    }
                    // NOTE: IMG ID
                    $imgsize = findImageSize($object["file"]);
                    $imgwidth = $imgsize[0] + 50;
                    $imgheight = $imgsize[1] + 150;
                    if (PGV_USE_LIGHTBOX) {
                        $text .= "<a href=\"" . $object["file"] . "\" rel=\"clearbox[general]\" rev=\"" . $object['mid'] . "::" . PGV_GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_QUOTES, 'UTF-8')) . "\">" . "\n";
                    } else {
                        $text .= "<a href=\"javascript:;\" onclick=\"return openImage('" . rawurlencode($object["file"]) . "',{$imgwidth}, {$imgheight});\">";
                    }
                    $birth_date = $indi->getBirthDate();
                    $death_date = $indi->getDeathDate();
                    $text .= "<img id=\"box-{$pid}\" src=\"" . $whichFile . "\"vspace=\"0\" hspace=\"0\" class=\"{$class}\" alt =\"\" title=\"" . PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8')) . " - " . strip_tags(html_entity_decode($birth_date->Display(false) . " - " . $death_date->Display(false), ENT_QUOTES, 'UTF-8')) . "\"";
                    if ($imgsize) {
                        $text .= " /></a>\n";
                    } else {
                        $text .= " />\n";
                    }
                } else {
                    if ($USE_SILHOUETTE && isset($PGV_IMAGES["default_image_U"]["other"])) {
                        $class = "pedigree_image_portrait";
                        if ($TEXT_DIRECTION == "rtl") {
                            $class .= "_rtl";
                        }
                        $sex = $indi->getSex();
                        $text = "<img src=\"";
                        if ($sex == 'F') {
                            $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_F"]["other"];
                        } else {
                            if ($sex == 'M') {
                                $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_M"]["other"];
                            } else {
                                $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_U"]["other"];
                            }
                        }
                        $text .= "\" class=\"" . $class . "\" border=\"none\" alt=\"\" />";
                    }
                }
            } else {
                if ($USE_SILHOUETTE && isset($PGV_IMAGES["default_image_U"]["other"])) {
                    $class = "pedigree_image_portrait";
                    if ($TEXT_DIRECTION == "rtl") {
                        $class .= "_rtl";
                    }
                    $sex = $indi->getSex();
                    $text = "<img src=\"";
                    if ($sex == 'F') {
                        $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_F"]["other"];
                    } else {
                        if ($sex == 'M') {
                            $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_M"]["other"];
                        } else {
                            $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_U"]["other"];
                        }
                    }
                    $text .= "\" class=\"" . $class . "\" border=\"none\" alt=\"\" />";
                }
            }
        }
        $text .= "<a class=\"name1\" href=\"individual.php?pid={$pid}\" title=\"{$title}\"> ";
        $text .= PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8'));
        if ($addname) {
            $text .= "<br />" . PrintReady($addname);
        }
        $text .= "</a>";
        if ($showids) {
            $text .= " <span class='details1' ";
            if ($TEXT_DIRECTION == "ltr") {
                $text .= "dir=\"ltr\">";
            } else {
                $text .= "dir=\"rtl\">";
            }
            $text .= "(" . $pid . ")</span>";
        }
        $text .= "<br />";
        if ($indi->canDisplayDetails()) {
            $text .= "<span class='details1'>";
            $text .= $indi->getBirthYear() . '-' . $indi->getDeathYear();
            $age = GedcomDate::GetAgeYears($indi->getBirthDate(), $indi->getDeathDate());
            if ($age) {
                $text .= " <span class=\"age\">" . PrintReady("({$age})") . "</span>";
            }
            $text .= "</span>";
        }
    }
    //Removed by BH causing problems with nicknames not printing
    //$text = unhtmlentities($text);
    // -- empty box
    if (empty($text)) {
        $text = "&nbsp;<br />&nbsp;<br />";
    }
    // -- box color
    $isF = "";
    if ($n == 1) {
        if ($indi->getSex() == 'F') {
            $isF = "F";
        }
    } elseif ($n % 2) {
        $isF = "F";
    }
    // -- box size
    if ($n == 1) {
        echo "<td";
    } else {
        echo "<td width='15%'";
    }
    // -- print box content
    echo " class=\"person_box", $isF, "\" style=\"text-align:center; vertical-align:top;\" >";
    echo $text;
    echo "</td>";
}
Example #2
0
/**
 * print the information for an individual chart box
 *
 * find and print a given individuals information for a pedigree chart
 * @param string $pid	the Gedcom Xref ID of the   to print
 * @param int $style	the style to print the box in, 1 for smaller boxes, 2 for larger boxes
 * @param boolean $show_famlink	set to true to show the icons for the popup links and the zoomboxes
 * @param int $count	on some charts it is important to keep a count of how many boxes were printed
 */
function print_pedigree_person($pid, $style = 1, $show_famlink = true, $count = 0, $personcount = "1")
{
    global $HIDE_LIVE_PEOPLE, $SHOW_LIVING_NAMES, $PRIV_PUBLIC, $factarray, $ZOOM_BOXES, $LINK_ICONS, $view, $SCRIPT_NAME, $GEDCOM;
    global $pgv_lang, $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $bwidth, $bheight, $show_full, $PEDIGREE_FULL_DETAILS, $SHOW_ID_NUMBERS, $SHOW_PEDIGREE_PLACES;
    global $CONTACT_EMAIL, $CONTACT_METHOD, $TEXT_DIRECTION, $DEFAULT_PEDIGREE_GENERATIONS, $OLD_PGENS, $talloffset, $PEDIGREE_LAYOUT, $MEDIA_DIRECTORY;
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $ABBREVIATE_CHART_LABELS, $USE_MEDIA_VIEWER;
    global $chart_style, $box_width, $generations, $show_spouse, $show_full;
    global $CHART_BOX_TAGS, $SHOW_LDS_AT_GLANCE;
    global $SEARCH_SPIDER;
    if ($style != 2) {
        $style = 1;
    }
    flush();
    if (!isset($OLD_PGENS)) {
        $OLD_PGENS = $DEFAULT_PEDIGREE_GENERATIONS;
    }
    if (!isset($talloffset)) {
        $talloffset = $PEDIGREE_LAYOUT;
    }
    if (!isset($show_full)) {
        $show_full = $PEDIGREE_FULL_DETAILS;
    }
    // NOTE: Start div out-rand()
    if ($pid == false) {
        print "\n\t\t\t<div id=\"out-" . rand() . "\" class=\"person_boxNN\" style=\"width: " . $bwidth . "px; height: " . $bheight . "px; padding: 2px; overflow: hidden;\">";
        print "<br />";
        print "\n\t\t\t</div>";
        return false;
    }
    if ($count == 0) {
        $count = rand();
    }
    $lbwidth = $bwidth * 0.75;
    if ($lbwidth < 150) {
        $lbwidth = 150;
    }
    $indirec = find_person_record($pid);
    if (!$indirec) {
        $indirec = find_updated_record($pid);
    }
    $isF = "NN";
    if (preg_match("/1 SEX F/", $indirec) > 0) {
        $isF = "F";
    } else {
        if (preg_match("/1 SEX M/", $indirec) > 0) {
            $isF = "";
        }
    }
    $disp = displayDetailsByID($pid, "INDI");
    $boxID = $pid . "." . $personcount . "." . $count;
    $mouseAction1 = "onmouseover=\"clear_family_box_timeout('" . $boxID . "');\" onmouseout=\"family_box_timeout('" . $boxID . "');\"";
    $mouseAction2 = " onmouseover=\"expandbox('" . $boxID . "', {$style}); return false;\" onmouseout=\"restorebox('" . $boxID . "', {$style}); return false;\"";
    $mouseAction3 = " onmousedown=\"expandbox('" . $boxID . "', {$style}); return false;\" onmouseup=\"restorebox('" . $boxID . "', {$style}); return false;\"";
    $mouseAction4 = " onclick=\"expandbox('" . $boxID . "', {$style}); return false;\"";
    if ($disp || showLivingNameByID($pid)) {
        if ($show_famlink && empty($SEARCH_SPIDER)) {
            if ($LINK_ICONS != "disabled") {
                //-- draw a box for the family popup
                // NOTE: Start div I.$pid.$personcount.$count.links
                print "\n\t\t<div id=\"I" . $boxID . "links\" style=\"position:absolute; ";
                print "left: 0px; top:0px; width: " . $lbwidth . "px; visibility:hidden; z-index:'100';\">";
                print "\n\t\t\t<table class=\"person_box{$isF}\"><tr><td class=\"details1\">";
                // NOTE: Zoom
                if ($TEXT_DIRECTION == "ltr") {
                    $title = $pgv_lang["pedigree_chart"] . ": " . $pid;
                } else {
                    $title = $pid . " :" . $pgv_lang["pedigree_chart"];
                }
                print "<a href=\"pedigree.php?rootid={$pid}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;talloffset={$talloffset}&amp;ged={$GEDCOM}\" title=\"{$title}\" {$mouseAction1}><b>" . $pgv_lang["index_header"] . "</b></a>\n";
                if ($TEXT_DIRECTION == "ltr") {
                    $title = $pgv_lang["descend_chart"] . ": " . $pid;
                } else {
                    $title = $pid . " :" . $pgv_lang["descend_chart"];
                }
                print "<br /><a href=\"descendancy.php?pid={$pid}&amp;show_full={$show_full}&amp;generations={$generations}&amp;box_width={$box_width}&amp;ged={$GEDCOM}\" title=\"{$title}\" {$mouseAction1}><b>" . $pgv_lang["descend_chart"] . "</b></a><br />\n";
                //					$username = getUserName();
                /*					if (!empty($username)) {
                						 $tuser=getUser($username);
                						 if (!empty($tuser["gedcomid"][$GEDCOM])) {
                	 						  if ($TEXT_DIRECTION=="ltr") $title = $pgv_lang["relationship_chart"].": ".$pid;
                	 						  else $title = $pid." :".$pgv_lang["relationship_chart"];
                							  print "<a href=\"relationship.php?pid1=".$tuser["gedcomid"][$GEDCOM]."&amp;pid2=".$pid."&amp;ged=$GEDCOM\" title=\"$title\" ".$mouseAction1."><b>".$pgv_lang["relationship_to_me"]."</b></a><br />\n";
                						 }
                					}
                */
                // NOTE: Zoom
                if (file_exists("ancestry.php")) {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang["ancestry_chart"] . ": " . $pid;
                    } else {
                        $title = $pid . " :" . $pgv_lang["ancestry_chart"];
                    }
                    print "<a href=\"ancestry.php?rootid={$pid}&amp;chart_style={$chart_style}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;box_width={$box_width}&amp;ged={$GEDCOM}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["ancestry_chart"] . "</b></a><br />\n";
                }
                if (file_exists("compact.php")) {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang["compact_chart"] . ": " . $pid;
                    } else {
                        $title = $pid . " :" . $pgv_lang["compact_chart"];
                    }
                    print "<a href=\"compact.php?rootid={$pid}&amp;ged={$GEDCOM}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["compact_chart"] . "</b></a><br />\n";
                }
                if (file_exists("fanchart.php") and defined("IMG_ARC_PIE") and function_exists("imagettftext")) {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang["fan_chart"] . ": " . $pid;
                    } else {
                        $title = $pid . " :" . $pgv_lang["fan_chart"];
                    }
                    print "<a href=\"fanchart.php?rootid={$pid}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;ged={$GEDCOM}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["fan_chart"] . "</b></a><br />\n";
                }
                if (file_exists("hourglass.php")) {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang["hourglass_chart"] . ": " . $pid;
                    } else {
                        $title = $pid . " :" . $pgv_lang["hourglass_chart"];
                    }
                    print "<a href=\"hourglass.php?pid={$pid}&amp;chart_style={$chart_style}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;box_width={$box_width}&amp;ged={$GEDCOM}&amp;show_spouse={$show_spouse}&amp;show_full={$show_full}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["hourglass_chart"] . "</b></a><br />\n";
                }
                $ct = preg_match_all("/1\\s*FAMS\\s*@(.*)@/", $indirec, $match, PREG_SET_ORDER);
                for ($i = 0; $i < $ct; $i++) {
                    $famid = $match[$i][1];
                    $famrec = find_family_record($famid);
                    if ($famrec) {
                        $parents = find_parents_in_record($famrec);
                        $spouse = "";
                        if ($pid == $parents["HUSB"]) {
                            $spouse = $parents["WIFE"];
                        }
                        if ($pid == $parents["WIFE"]) {
                            $spouse = $parents["HUSB"];
                        }
                        $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
                        if (!empty($spouse) || $num > 0) {
                            if ($TEXT_DIRECTION == "ltr") {
                                $title = $pgv_lang["familybook_chart"] . ": " . $famid;
                            } else {
                                $title = $famid . " :" . $pgv_lang["familybook_chart"];
                            }
                            print "<a href=\"family.php?famid={$famid}&amp;ged={$GEDCOM}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["fam_spouse"] . "</b></a><br /> \n";
                            if (!empty($spouse)) {
                                if ($TEXT_DIRECTION == "ltr") {
                                    $title = $pgv_lang["indi_info"] . ": " . $spouse;
                                } else {
                                    $title = $spouse . " :" . $pgv_lang["indi_info"];
                                }
                                print "<a href=\"individual.php?pid={$spouse}&amp;ged={$GEDCOM}\" title=\"{$title}\" {$mouseAction1}>";
                                if ($SHOW_LIVING_NAMES >= $PRIV_PUBLIC || displayDetailsByID($spouse) || showLivingNameByID($spouse)) {
                                    print PrintReady(get_person_name($spouse));
                                } else {
                                    print $pgv_lang["private"];
                                }
                                print "</a><br />\n";
                            }
                        }
                        for ($j = 0; $j < $num; $j++) {
                            $cpid = $smatch[$j][1];
                            if ($TEXT_DIRECTION == "ltr") {
                                $title = $pgv_lang["indi_info"] . ": " . $cpid;
                            } else {
                                $title = $cpid . " :" . $pgv_lang["indi_info"];
                            }
                            print "\n\t\t\t\t&nbsp;&nbsp;<a href=\"individual.php?pid={$cpid}&amp;ged={$GEDCOM}\" title=\"{$title}\" {$mouseAction1}>";
                            if ($SHOW_LIVING_NAMES >= $PRIV_PUBLIC || displayDetailsByID($cpid) || showLivingNameByID($cpid)) {
                                print PrintReady(get_person_name($cpid));
                            } else {
                                print $pgv_lang["private"];
                            }
                            print "<br /></a>";
                        }
                    }
                }
                print "</td></tr></table>\n\t\t</div>";
            }
            // NOTE: Start div out-$pid.$personcount.$count
            print "\n\t\t\t<div id=\"out-{$boxID}\"";
            if ($style == 1) {
                print " class=\"person_box{$isF}\" style=\"width: " . $bwidth . "px; height: " . $bheight . "px; padding: 2px; overflow: hidden; z-index:'-1';\"";
            } else {
                print " style=\"padding: 2px;\"";
            }
            // NOTE: Zoom
            if ($ZOOM_BOXES != "disabled" && !$show_full) {
                if ($ZOOM_BOXES == "mouseover") {
                    print $mouseAction2;
                }
                if ($ZOOM_BOXES == "mousedown") {
                    print $mouseAction3;
                }
                if ($ZOOM_BOXES == "click" && $view != "preview") {
                    print $mouseAction4;
                }
            }
            print "><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\">";
            //-- links and zoom icons
            // NOTE: Start div icons-$personcount.$pid.$count
            if ($TEXT_DIRECTION == "rtl") {
                print "<div id=\"icons-{$boxID}\" style=\"float:left; width: 25px; height: 50px;";
            } else {
                print "<div id=\"icons-{$boxID}\" style=\"float:right; width: 25px; height: 50px;";
            }
            if ($show_full) {
                print " display: block;";
            } else {
                print " display: none;";
            }
            print "\">";
            // NOTE: Zoom
            if ($ZOOM_BOXES != "disabled" && $show_full) {
                print "<a href=\"javascript:;\"";
                if ($ZOOM_BOXES == "mouseover") {
                    print $mouseAction2;
                }
                if ($ZOOM_BOXES == "mousedown") {
                    print $mouseAction3;
                }
                if ($ZOOM_BOXES == "click") {
                    print $mouseAction4;
                }
                print "><img id=\"iconz-{$boxID}\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["zoomin"]["other"] . "\" width=\"25\" height=\"25\" border=\"0\" alt=\"" . $pgv_lang["zoom_box"] . "\" title=\"" . $pgv_lang["zoom_box"] . "\" /></a>";
            }
            if ($LINK_ICONS != "disabled") {
                $click_link = "javascript:;";
                $whichChart = "";
                if (preg_match("/pedigree.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "pedigree.php?rootid={$pid}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;talloffset={$talloffset}&amp;ged={$GEDCOM}";
                    $whichChart = "pedigree_chart";
                    $whichID = $pid;
                }
                if (preg_match("/hourglass.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "hourglass.php?pid={$pid}&amp;generations={$generations}&amp;box_width={$box_width}&amp;ged={$GEDCOM}";
                    $whichChart = "hourglass_chart";
                    $whichID = $pid;
                }
                if (preg_match("/ancestry.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "ancestry.php?rootid={$pid}&amp;chart_style={$chart_style}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;box_width={$box_width}&amp;ged={$GEDCOM}";
                    $whichChart = "ancestry_chart";
                    $whichID = $pid;
                }
                if (preg_match("/descendancy.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "descendancy.php?pid={$pid}&amp;show_full={$show_full}&amp;generations={$generations}&amp;box_width={$box_width}&amp;ged={$GEDCOM}";
                    $whichChart = "descend_chart";
                    $whichID = $pid;
                }
                if (preg_match("/family.php/", $SCRIPT_NAME) > 0 && !empty($famid)) {
                    $click_link = "family.php?famid={$famid}&amp;ged={$GEDCOM}";
                    $whichChart = "familybook_chart";
                    $whichID = $famid;
                }
                if (preg_match("/individual.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "individual.php?pid={$pid}&amp;ged={$GEDCOM}";
                    $whichChart = "indi_info";
                    $whichID = $pid;
                }
                if (empty($whichChart)) {
                    $title = "";
                } else {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang[$whichChart] . ": " . $whichID;
                    } else {
                        $title = $whichID . " :" . $pgv_lang[$whichChart];
                    }
                }
                print "<a href=\"{$click_link}\" title=\"{$title}\"";
                // NOTE: Zoom
                if ($LINK_ICONS == "mouseover") {
                    print "onmouseover=\"show_family_box('" . $boxID . "', '";
                }
                if ($LINK_ICONS == "click") {
                    print "onclick=\"toggle_family_box('" . $boxID . "', '";
                }
                if ($style == 1) {
                    print "box{$pid}";
                } else {
                    print "relatives";
                }
                print "');";
                print " return false;\" ";
                // NOTE: Zoom
                print "onmouseout=\"family_box_timeout('" . $boxID . "');";
                print " return false;\"";
                if ($click_link == "#" && $LINK_ICONS != "click") {
                    print "onclick=\"return false;\"";
                }
                print "><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["pedigree"]["small"] . "\" width=\"25\" border=\"0\" vspace=\"0\" hspace=\"0\" alt=\"" . $pgv_lang["person_links"] . "\" title=\"" . $pgv_lang["person_links"] . "\" /></a>";
            }
            // NOTE: Close div icons-$personcount.$pid.$count
            print "</div>\n";
        } else {
            if ($style == 1) {
                print "\n\t\t\t<div id=\"out-{$boxID}\" class=\"person_box{$isF}\" style=\"width: " . $bwidth . "px; height: " . $bheight . "px; padding: 2px; overflow: hidden;\"";
            } else {
                print "\n\t\t\t<div id=\"out-{$boxID}\" class=\"person_box{$isF}\" style=\"padding: 2px; overflow: hidden;\"";
            }
            // NOTE: Zoom
            if ($ZOOM_BOXES != "disabled" && empty($SEARCH_SPIDER)) {
                if ($ZOOM_BOXES == "mouseover") {
                    print $mouseAction2;
                }
                if ($ZOOM_BOXES == "mousedown") {
                    print $mouseAction3;
                }
                if ($ZOOM_BOXES == "click" && $view != "preview") {
                    print $mouseAction4;
                }
            }
            print "><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\">";
        }
    } else {
        if ($style == 1) {
            print "\n\t\t\t<div id=\"out-{$boxID}\" class=\"person_box{$isF}\" style=\"width: " . $bwidth . "px; height: " . $bheight . "px; padding: 2px; overflow: hidden;\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\">";
        } else {
            print "\n\t\t\t<div id=\"out-{$boxID}\" class=\"person_box{$isF}\" style=\"padding: 2px; overflow: hidden;\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\">";
        }
    }
    //-- find the name
    $name = get_person_name($pid);
    if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES && showFact("OBJE", $pid)) {
        $object = find_highlighted_object($pid, $indirec);
        if (!empty($object["thumb"])) {
            $size = findImageSize($object["thumb"]);
            $class = "pedigree_image_portrait";
            if ($size[0] > $size[1]) {
                $class = "pedigree_image_landscape";
            }
            if ($TEXT_DIRECTION == "rtl") {
                $class .= "_rtl";
            }
            // NOTE: IMG ID
            $imgsize = findImageSize($object["file"]);
            $imgwidth = $imgsize[0] + 50;
            $imgheight = $imgsize[1] + 150;
            if (!empty($object['mid']) && $USE_MEDIA_VIEWER) {
                print "<a href=\"mediaviewer.php?mid=" . $object['mid'] . "\" >";
            } else {
                print "<a href=\"javascript:;\" onclick=\"return openImage('" . rawurlencode($object["file"]) . "',{$imgwidth}, {$imgheight});\">";
            }
            print "<img id=\"box-{$boxID}-thumb\" src=\"" . $object["thumb"] . "\" vspace=\"0\" hspace=\"0\" class=\"{$class}\" alt =\"\" title=\"\" ";
            if (!$show_full) {
                print " style=\"display: none;\"";
            }
            if ($imgsize) {
                print " /></a>\n";
            } else {
                print " />\n";
            }
        }
    }
    //-- find additional name
    $addname = get_add_person_name($pid);
    //-- check if the persion is visible
    if (!$disp) {
        if (showLivingName($indirec)) {
            // NOTE: Start span namedef-$personcount.$pid.$count
            if ($TEXT_DIRECTION == "ltr") {
                $title = $pgv_lang["indi_info"] . ": " . $pid;
            } else {
                $title = $pid . " :" . $pgv_lang["indi_info"];
            }
            print "<a href=\"individual.php?pid={$pid}&amp;ged={$GEDCOM}\" title=\"{$title}\" onmouseover=\"change_class('namedef-{$boxID}','name" . $style . "Hover'); return false;\" onmouseout=\"change_class('namedef-{$boxID}','name{$style}'); return false;\"><span id=\"namedef-{$boxID}\" class=\"name{$style}\">";
            print PrintReady($name);
            // NOTE: IMG ID
            print "<img id=\"box-{$boxID}-sex\" src=\"{$PGV_IMAGE_DIR}/";
            if ($isF == "") {
                print $PGV_IMAGES["sex"]["small"] . "\" title=\"" . $pgv_lang["male"] . "\" alt=\"" . $pgv_lang["male"];
            } else {
                if ($isF == "F") {
                    print $PGV_IMAGES["sexf"]["small"] . "\" title=\"" . $pgv_lang["female"] . "\" alt=\"" . $pgv_lang["female"];
                } else {
                    print $PGV_IMAGES["sexn"]["small"] . "\" title=\"" . $pgv_lang["unknown"] . "\" alt=\"" . $pgv_lang["unknown"];
                }
            }
            print "\" class=\"sex_image\" />";
            if ($SHOW_ID_NUMBERS) {
                print "</span><span class=\"details{$style}\">";
                if ($TEXT_DIRECTION == "ltr") {
                    print "&lrm;({$pid})&lrm;";
                } else {
                    print "&rlm;({$pid})&rlm;";
                }
                // NOTE: Close span namedef-$personcount.$pid.$count
                print "</span>";
            }
            if (strlen($addname) > 0) {
                print "<br />";
                // NOTE: Start span addnamedef-$personcount.$pid.$count
                // NOTE: Close span addnamedef-$personcount.$pid.$count
                //				   if (hasRTLText($addname) && $style=="1") print "<span id=\"addnamedef-$boxID\" class=\"name2\"> ";
                //				   else
                print "<span id=\"addnamedef-{$boxID}\" class=\"name{$style}\"> ";
                print PrintReady($addname) . "</span><br />";
            }
            print "</a>";
        } else {
            if (empty($SEARCH_SPIDER)) {
                $user = getUser($CONTACT_EMAIL);
                print "<a href=\"javascript:;\" onclick=\"if (confirm('" . preg_replace("'<br />'", " ", $pgv_lang["privacy_error"]) . "\\n\\n" . str_replace("#user[fullname]#", $user["firstname"] . " " . $user["lastname"], $pgv_lang["clicking_ok"]) . "')) ";
                if ($CONTACT_METHOD != "none") {
                    if ($CONTACT_METHOD == "mailto") {
                        print "window.location = 'mailto:" . $user["email"] . "'; ";
                    } else {
                        print "message('{$CONTACT_EMAIL}', '{$CONTACT_METHOD}'); ";
                    }
                }
                // NOTE: Start span namedef-$pid.$personcount.$count
                // NOTE: Close span namedef-$pid.$personcount.$count
                print "return false;\">";
            }
            print "<span id=\"namedef-{$boxID}\" class=\"name{$style}\">" . $pgv_lang["private"] . "</span>";
            if (empty($SEARCH_SPIDER)) {
                print "</a>\n";
            }
        }
        if ($show_full && empty($SEARCH_SPIDER)) {
            // NOTE: Start span fontdef-$pid.$personcount.$count
            // NOTE: Close span fontdef-$pid.$personcount.$count
            print "<br /><span id=\"fontdef-{$boxID}\" class=\"details{$style}\">";
            print $pgv_lang["private"];
            print "</span>";
        }
        // NOTE: Close div out-$pid.$personcount.$count
        print "\n\t\t\t</td></tr></table></div>";
        return;
    }
    if ($TEXT_DIRECTION == "ltr") {
        $title = $pgv_lang["indi_info"] . ": " . $pid;
    } else {
        $title = $pid . " :" . $pgv_lang["indi_info"];
    }
    print "<a href=\"individual.php?pid={$pid}&amp;ged={$GEDCOM}\" title=\"{$title}\" onmouseover=\"change_class('namedef-{$boxID}','name" . $style . "Hover'); return false;\" onmouseout=\"change_class('namedef-{$boxID}','name{$style}'); return false;\"";
    if (!$show_full) {
        //not needed or wanted for mouseover //if ($ZOOM_BOXES=="mouseover") print " onmouseover=\"event.cancelBubble = true;\"";
        if ($ZOOM_BOXES == "mousedown") {
            print "onmousedown=\"event.cancelBubble = true;\"";
        }
        if ($ZOOM_BOXES == "click") {
            print "onclick=\"event.cancelBubble = true;\"";
        }
    }
    // NOTE: Start span namedef-$pid.$personcount.$count
    print "><span id=\"namedef-{$boxID}\" class=\"name{$style}";
    // add optional CSS style for each fact
    $cssfacts = array("BIRT", "CHR", "DEAT", "BURI", "CREM", "ADOP", "BAPM", "BARM", "BASM", "BLES", "CHRA", "CONF", "FCOM", "ORDN", "NATU", "EMIG", "IMMI", "CENS", "PROB", "WILL", "GRAD", "RETI", "CAST", "DSCR", "EDUC", "IDNO", "NATI", "NCHI", "NMR", "OCCU", "PROP", "RELI", "RESI", "SSN", "TITL", "BAPL", "CONL", "ENDL", "SLGC", "_MILI");
    foreach ($cssfacts as $indexval => $fact) {
        $ct = preg_match_all("/1 {$fact}/", $indirec, $nmatch, PREG_SET_ORDER);
        if ($ct > 0) {
            print " {$fact}";
        }
    }
    print "\">";
    print PrintReady($name);
    // NOTE: Close span namedef-$pid.$personcount.$count
    print "</span>";
    print "<span class=\"name{$style}\">";
    // NOTE: IMG ID
    print "<img id=\"box-{$boxID}-sex\" src=\"{$PGV_IMAGE_DIR}/";
    if ($isF == "") {
        print $PGV_IMAGES["sex"]["small"] . "\" title=\"" . $pgv_lang["male"] . "\" alt=\"" . $pgv_lang["male"];
    } else {
        if ($isF == "F") {
            print $PGV_IMAGES["sexf"]["small"] . "\" title=\"" . $pgv_lang["female"] . "\" alt=\"" . $pgv_lang["female"];
        } else {
            print $PGV_IMAGES["sexn"]["small"] . "\" title=\"" . $pgv_lang["unknown"] . "\" alt=\"" . $pgv_lang["unknown"];
        }
    }
    print "\" class=\"sex_image\" />";
    print "</span>\r\n";
    if ($SHOW_ID_NUMBERS) {
        if ($TEXT_DIRECTION == "ltr") {
            print "<span class=\"details{$style}\">&lrm;({$pid})&lrm; </span>";
        } else {
            print "<span class=\"details{$style}\">&rlm;({$pid})&rlm; </span>";
        }
    }
    if ($SHOW_LDS_AT_GLANCE) {
        print "<span class=\"details{$style}\">" . get_lds_glance($indirec) . "</span>";
    }
    if (strlen($addname) > 0) {
        print "<br />";
        //		   if (hasRTLText($addname) && $style=="1")
        //				print "<span id=\"addnamedef-$pid.$count\" class=\"name2\"> ";
        //		   else
        print "<span id=\"addnamedef-{$pid}.{$count}\" class=\"name{$style}\"> ";
        print PrintReady($addname) . "</span><br />";
    }
    print "</a>";
    if (empty($SEARCH_SPIDER)) {
        // NOTE: Start div inout-$pid.$personcount.$count
        //if (!$show_full) print "\n<div id=\"inout-$boxID\" style=\"display: none;\">\n";
        // NOTE: Start div fontdev-$pid.$personcount.$count
        print "<div id=\"fontdef-{$boxID}\" class=\"details{$style}\">";
        // NOTE: Start div inout2-$pid.$personcount.$count
        //	 if ($show_full) print "\n<div id=\"inout2-$boxID\" style=\"display: block;\">\n";
        if ($show_full) {
            print "\n<div id=\"inout2-{$boxID}\" ";
            print " style=\"display: block;\">\n";
            $birttag = "BIRT";
            $bpos1 = strpos($indirec, "1 BIRT");
            if ($bpos1) {
                if (showFact($birttag, $pid)) {
                    print_simple_fact($indirec, $birttag, $pid);
                }
            } else {
                $bpos1 = strpos($indirec, "1 CHR");
                if ($bpos1) {
                    $birttag = "CHR";
                    if (showFact($birttag, $pid)) {
                        print_simple_fact($indirec, $birttag, $pid);
                    }
                } else {
                    $bpos1 = strpos($indirec, "1 BAPM");
                    if ($bpos1) {
                        $birttag = "BAPM";
                        if (showFact($birttag, $pid)) {
                            print_simple_fact($indirec, $birttag, $pid);
                        }
                    }
                }
            }
            //-- section to display optional tags in the boxes
            if (!empty($CHART_BOX_TAGS)) {
                $opt_tags = preg_split("/[, ]+/", $CHART_BOX_TAGS);
                foreach ($opt_tags as $indexval => $tag) {
                    if (!empty($tag) && $tag != "BURI" && $tag != "CREM") {
                        if (showFact($tag, $pid)) {
                            print_simple_fact($indirec, $tag, $pid);
                        }
                    }
                }
            }
            $bpos1 = strpos($indirec, "1 DEAT");
            if ($bpos1) {
                if (showFact("DEAT", $pid)) {
                    print_simple_fact($indirec, "DEAT", $pid);
                }
            }
            foreach (array("BURI", "CREM") as $indexval => $tag) {
                if (strpos($CHART_BOX_TAGS, $tag) !== false && showFact($tag, $pid)) {
                    print_simple_fact($indirec, $tag, $pid);
                }
            }
            print "</div>\n";
        }
        // NOTE: Close div inout2-$pid.$personcount.$count
        //if ($show_full) print "</div>\n";
        print "</div>\n";
    }
    // SEARCH_SPIDER
    //	 -- find all level 1 sub records
    //	  $skipfacts = array("SEX","FAMS","FAMC","NAME","TITL","NOTE","SOUR","SSN","OBJE","HUSB","WIFE","CHIL","ALIA","ADDR","PHON","SUBM","_EMAIL","CHAN","URL","EMAIL","WWW","RESI","_UID","_TODO");
    //	  $subfacts = get_all_subrecords($indirec, implode(",", $skipfacts));
    //	   NOTE: Open div inout-$pid.$personcount.$count
    //   --All code to load information has been moved to expand_view.php
    if (empty($SEARCH_SPIDER)) {
        print "\n<div id=\"inout-{$boxID}\" style=\"display: none;\">\n";
        print "<div id=\"LOADING-inout-{$boxID}\">";
        print $pgv_lang['loading'];
        print "</div></div>";
    }
    // SEARCH_SPIDER
    // NOTE: Close div out-rand()
    print "\n\t\t\t</td></tr></table></div>";
}
Example #3
0
function mediaFileInfo($fileName, $thumbName, $mid, $name = '', $notes = '', $obeyViewerOption = true)
{
    global $THUMBNAIL_WIDTH, $PGV_IMAGE_DIR, $PGV_IMAGES;
    global $LB_URL_WIDTH, $LB_URL_HEIGHT;
    global $SERVER_URL, $GEDCOM, $USE_MEDIA_VIEWER, $USE_MEDIA_FIREWALL, $MEDIA_FIREWALL_THUMBS;
    $result = array();
    // -- Classify the incoming media file
    if (eregi("^https?://", $fileName)) {
        $type = "url_";
    } else {
        $type = "local_";
    }
    if ((eregi("\\.flv\$", $fileName) || eregi("^https?://.*\\.youtube\\..*/watch\\?", $fileName)) && is_dir('modules/JWplayer')) {
        $type .= "flv";
    } else {
        if (eregi("^https?://picasaweb*\\.google\\..*/.*/", $fileName)) {
            $type .= "picasa";
        } else {
            if (eregi("\\.(jpg|jpeg|gif|png)\$", $fileName)) {
                $type .= "image";
            } else {
                if (eregi("\\.(pdf|avi|txt)\$", $fileName)) {
                    $type .= "page";
                } else {
                    if (eregi("\\.mp3\$", $fileName)) {
                        $type .= "audio";
                    } else {
                        if (eregi("\\.wmv\$", $fileName)) {
                            $type .= "wmv";
                        } else {
                            $type .= "other";
                        }
                    }
                }
            }
        }
    }
    // $type is now: (url | local) _ (flv | picasa | image | page | audio | other)
    $result['type'] = $type;
    // -- Determine the correct URL to open this media file
    while (true) {
        if (file_exists("modules/lightbox/album.php")) {
            // Lightbox is installed
            include_once 'modules/lightbox/lb_defaultconfig.php';
            if (file_exists('modules/lightbox/lb_config.php')) {
                include_once 'modules/lightbox/lb_config.php';
            }
            switch ($type) {
                case 'url_flv':
                    $url = encode_url('module.php?mod=JWplayer&pgvaction=flvVideo&flvVideo=' . encrypt($fileName)) . "\" rel='clearbox(500,392,click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'local_flv':
                    $url = encode_url('module.php?mod=JWplayer&pgvaction=flvVideo&flvVideo=' . encrypt($SERVER_URL . $fileName)) . "\" rel='clearbox(500,392,click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'url_wmv':
                    $url = encode_url('module.php?mod=JWplayer&pgvaction=wmvVideo&wmvVideo=' . encrypt($fileName)) . "\" rel='clearbox(500,392,click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'local_audio':
                case 'local_wmv':
                    $url = encode_url('module.php?mod=JWplayer&pgvaction=wmvVideo&wmvVideo=' . encrypt($SERVER_URL . $fileName)) . "\" rel='clearbox(500,392,click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'url_image':
                case 'local_image':
                    $url = encode_url($fileName) . "\" rel=\"clearbox[general]\" rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
                case 'url_picasa':
                case 'url_page':
                case 'url_other':
                case 'local_page':
                    // case 'local_other':
                    $url = encode_url($fileName) . "\" rel='clearbox({$LB_URL_WIDTH},{$LB_URL_HEIGHT},click)' rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_COMPAT, 'UTF-8')) . "::" . htmlspecialchars($notes, ENT_COMPAT, 'UTF-8');
                    break 2;
            }
        }
        // Lightbox is not installed or Lightbox is not appropriate for this media type
        switch ($type) {
            case 'url_flv':
                $url = "javascript:;\" onclick=\" var winflv = window.open('" . encode_url('module.php?mod=JWplayer&pgvaction=flvVideo&flvVideo=' . encrypt($fileName)) . "', 'winflv', 'width=500, height=392, left=600, top=200'); if (window.focus) {winflv.focus();}";
                break 2;
            case 'local_flv':
                $url = "javascript:;\" onclick=\" var winflv = window.open('" . encode_url('module.php?mod=JWplayer&pgvaction=flvVideo&flvVideo=' . encrypt($SERVER_URL . $fileName)) . "', 'winflv', 'width=500, height=392, left=600, top=200'); if (window.focus) {winflv.focus();}";
                break 2;
            case 'url_wmv':
                $url = "javascript:;\" onclick=\" var winwmv = window.open('" . encode_url('module.php?mod=JWplayer&pgvaction=wmvVideo&wmvVideo=' . encrypt($fileName)) . "', 'winwmv', 'width=500, height=392, left=600, top=200'); if (window.focus) {winwmv.focus();}";
                break 2;
            case 'local_wmv':
            case 'local_audio':
                $url = "javascript:;\" onclick=\" var winwmv = window.open('" . encode_url('module.php?mod=JWplayer&pgvaction=wmvVideo&wmvVideo=' . encrypt($SERVER_URL . $fileName)) . "', 'winwmv', 'width=500, height=392, left=600, top=200'); if (window.focus) {winwmv.focus();}";
                break 2;
            case 'url_image':
                $imgsize = findImageSize($fileName);
                $imgwidth = $imgsize[0] + 40;
                $imgheight = $imgsize[1] + 150;
                $url = "javascript:;\" onclick=\"var winimg = window.open('" . encode_url($fileName) . "', 'winimg', 'width=" . $imgwidth . ", height=" . $imgheight . ", left=200, top=200'); if (window.focus) {winimg.focus();}";
                break 2;
            case 'url_picasa':
            case 'url_page':
            case 'url_other':
            case 'local_other':
                $url = "javascript:;\" onclick=\"var winurl = window.open('" . encode_url($fileName) . "', 'winurl', 'width=900, height=600, left=200, top=200'); if (window.focus) {winurl.focus();}";
                break 2;
            case 'local_page':
                $url = "javascript:;\" onclick=\"var winurl = window.open('" . encode_url($SERVER_URL . $fileName) . "', 'winurl', 'width=900, height=600, left=200, top=200'); if (window.focus) {winurl.focus();}";
                break 2;
        }
        if ($USE_MEDIA_VIEWER && $obeyViewerOption) {
            $url = encode_url('mediaviewer.php?mid=' . $mid);
        } else {
            $imgsize = findImageSize($fileName);
            $imgwidth = $imgsize[0] + 40;
            $imgheight = $imgsize[1] + 150;
            $url = "javascript:;\" onclick=\"return openImage('" . encode_url(encrypt($fileName)) . "', {$imgwidth}, {$imgheight});";
        }
        break;
    }
    // At this point, $url describes how to handle the image when its thumbnail is clicked
    $result['url'] = $url;
    // -- Determine the correct thumbnail or pseudo-thumbnail
    $width = '';
    switch ($type) {
        case 'url_flv':
            $thumb = isset($PGV_IMAGES["media"]["flashrem"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["flashrem"] : 'images/media/flashrem.png';
            break;
        case 'local_flv':
            $thumb = isset($PGV_IMAGES["media"]["flash"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["flash"] : 'images/media/flash.png';
            break;
        case 'url_wmv':
            $thumb = isset($PGV_IMAGES["media"]["wmvrem"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["wmvrem"] : 'images/media/wmvrem.png';
            break;
        case 'local_wmv':
            $thumb = isset($PGV_IMAGES["media"]["wmv"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["wmv"] : 'images/media/wmv.png';
            break;
        case 'url_picasa':
            $thumb = isset($PGV_IMAGES["media"]["picasa"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["picasa"] : 'images/media/picasa.png';
            break;
        case 'url_page':
        case 'url_other':
            $thumb = isset($PGV_IMAGES["media"]["globe"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["globe"] : 'images/media/globe.png';
            break;
        case 'local_page':
            $thumb = $PGV_IMAGES["media"]["doc"] ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["doc"] : 'images/media/doc.gif';
            break;
        case 'url_audio':
        case 'local_audio':
            $thumb = isset($PGV_IMAGES["media"]["audio"]) ? $PGV_IMAGE_DIR . '/' . $PGV_IMAGES["media"]["audio"] : 'images/media/audio.png';
            break;
        default:
            $thumb = $thumbName;
            if (substr($type, 0, 4) == 'url_') {
                $width = ' width="' . $THUMBNAIL_WIDTH . '"';
            }
    }
    // -- Use an overriding thumbnail if one has been provided
    // Don't accept any overriding thumbnails that are in the "images" or "themes" directories
    if (substr($thumbName, 0, 7) != 'images/' && substr($thumbName, 0, 7) != 'themes/') {
        if ($USE_MEDIA_FIREWALL && $MEDIA_FIREWALL_THUMBS) {
            $tempThumbName = get_media_firewall_path($thumbName);
        } else {
            $tempThumbName = $thumbName;
        }
        if (file_exists($tempThumbName)) {
            $thumb = $thumbName;
        }
    }
    // -- Use the theme-specific media icon if nothing else works
    $realThumb = $thumb;
    if (substr($type, 0, 6) == 'local_' && !file_exists($thumb)) {
        if (!$USE_MEDIA_FIREWALL || !$MEDIA_FIREWALL_THUMBS) {
            $thumb = $PGV_IMAGE_DIR . '/' . $PGV_IMAGES['media']['large'];
            $realThumb = $thumb;
        } else {
            $realThumb = get_media_firewall_path($thumb);
            if (!file_exists($realThumb)) {
                $thumb = $PGV_IMAGE_DIR . '/' . $PGV_IMAGES['media']['large'];
                $realThumb = $thumb;
            }
        }
        $width = '';
    }
    // At this point, $width, $realThumb, and $thumb describe the thumbnail to be displayed
    $result['thumb'] = $thumb;
    $result['realThumb'] = $realThumb;
    $result['width'] = $width;
    return $result;
}
Example #4
0
 /**
  * get the highlighted object HTML
  * @return string HTML string for the <img> tag
  */
 function getHighlightedObject()
 {
     global $USE_THUMBS_MAIN, $THUMBNAIL_WIDTH, $USE_MEDIA_VIEWER, $GEDCOM;
     if ($this->canShowHighlightedObject()) {
         $firstmediarec = $this->indi->findHighlightedMedia();
         if (!empty($firstmediarec)) {
             $filename = thumb_or_main($firstmediarec);
             // Do we send the main image or a thumbnail?
             if (!$USE_THUMBS_MAIN || $firstmediarec["_THUM"] == 'Y') {
                 $class = "image";
             } else {
                 $class = "thumbnail";
             }
             $isExternal = isFileExternal($filename);
             if ($isExternal && $class == "thumbnail") {
                 $class .= "\" width=\"" . $THUMBNAIL_WIDTH;
             }
             if (!empty($filename)) {
                 $result = "";
                 $imgsize = findImageSize($firstmediarec["file"]);
                 $imgwidth = $imgsize[0] + 40;
                 $imgheight = $imgsize[1] + 150;
                 //Gets the Media View Link Information and Concatenate
                 $mid = $firstmediarec['mid'];
                 $name = $this->indi->getFullName();
                 if (file_exists("modules/lightbox/album.php")) {
                     print "<a href=\"" . $firstmediarec["file"] . "\" rel=\"clearbox[general_1]\" rev=\"" . $mid . "::" . $GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_QUOTES, 'UTF-8')) . "\">" . "\n";
                 } else {
                     if (!$USE_MEDIA_VIEWER && $imgsize) {
                         $result .= "<a href=\"javascript:;\" onclick=\"return openImage('" . encode_url(encrypt($firstmediarec["file"])) . "',{$imgwidth}, {$imgheight});\">";
                     } else {
                         $result .= "<a href=\"mediaviewer.php?mid={$mid}\">";
                     }
                 }
                 $result .= "<img src=\"{$filename}\" align=\"left\" class=\"" . $class . "\" border=\"none\" title=\"" . PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8')) . "\" alt=\"" . PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8')) . "\" />";
                 $result .= "</a>";
                 return $result;
             }
         }
     }
 }
Example #5
0
 if ($ct <= $level + 1 && $external_links != "http" && !isFileExternal($media["FILE"]) || isFileExternal($media["FILE"]) && $external_links == "http") {
     // simple filter to reduce the number of items to view
     $isvalid = filterMedia($media, $filter, 'http');
     if ($isvalid && $chooseType != "all") {
         if ($chooseType == "0file" && !empty($media["XREF"])) {
             $isvalid = false;
         }
         // skip linked media files
         if ($chooseType == "media" && empty($media["XREF"])) {
             $isvalid = false;
         }
         // skip unlinked media files
     }
     if ($isvalid) {
         if ($media["EXISTS"] && media_filesize($media["FILE"]) != 0) {
             $imgsize = findImageSize($media["FILE"]);
             $imgwidth = $imgsize[0] + 40;
             $imgheight = $imgsize[1] + 150;
         } else {
             $imgwidth = 0;
             $imgheight = 0;
         }
         echo "<tr>";
         //-- thumbnail field
         if ($showthumb) {
             echo "<td class=\"list_value {$TEXT_DIRECTION} width10\">";
             if (isset($media["THUMB"])) {
                 echo "<a href=\"javascript:;\" onclick=\"return openImage('", rawurlencode($media["FILE"]), "', {$imgwidth}, {$imgheight});\"><img src=\"", filename_decode($media["THUMB"]), "\" border=\"0\" width=\"50\" alt=\"\" /></a>";
             } else {
                 echo "&nbsp;";
             }
Example #6
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';
        }
    }
Example #7
0
 function gedcomHighlightRight()
 {
     $highlight = false;
     if (file_exists("images/gedcoms/{$this->_gedcom}.jpg")) {
         $highlight = "images/gedcoms/{$this->_gedcom}.jpg";
     } else {
         if (file_exists("images/gedcoms/{$this->_gedcom}.png")) {
             $highlight = "images/gedcoms/{$this->_gedcom}.png";
         }
     }
     if (!$highlight) {
         return '';
     }
     $imgsize = findImageSize($highlight);
     return "<a href=\"" . encode_url("{$this->_server_url}index.php?ctype=gedcom&ged={$this->_gedcom_url}") . "\" style=\"border-style:none;\"><img src=\"{$highlight}\" {$imgsize[3]} style=\"border:none; padding:2px 6px 2px 2px;\" align=\"right\" class=\"gedcom_highlight\" alt=\"\" /></a>";
 }
/**
* @todo add info
* @param array $attrs an array of key value pairs for the attributes
*/
function PGVRImageSHandler($attrs)
{
    global $gedrec, $pgvreport, $MEDIA_DIRECTORY, $PGVReportRoot;
    // mixed Position the top corner of this box on the page. the default is the current position
    $top = '.';
    if (isset($attrs['top'])) {
        if ($attrs['top'] === '0') {
            $top = 0;
        } else {
            if ($attrs['top'] === '.') {
                $top = '.';
            } else {
                if (!empty($attrs['top'])) {
                    $top = (int) $attrs['top'];
                }
            }
        }
    }
    // mixed Position the left corner of this box on the page. the default is the current position
    $left = '.';
    if (isset($attrs['left'])) {
        if ($attrs['left'] === '0') {
            $left = 0;
        } else {
            if ($attrs['left'] === '.') {
                $left = '.';
            } else {
                if (!empty($attrs['left'])) {
                    $left = (int) $attrs['left'];
                }
            }
        }
    }
    // string Align the image in left, center, right
    $align = '';
    if (!empty($attrs["align"])) {
        $align = $attrs["align"];
    }
    // string Next Line should be T:next to the image, N:next line
    $ln = 'T';
    if (!empty($attrs["ln"])) {
        $ln = $attrs["ln"];
    }
    $width = 0;
    $height = 0;
    if (!empty($attrs["width"])) {
        $width = (int) $attrs["width"];
    }
    if (!empty($attrs["height"])) {
        $height = (int) $attrs["height"];
    }
    $file = "";
    if (!empty($attrs["file"])) {
        $file = $attrs["file"];
    }
    if ($file == "@FILE") {
        $match = array();
        $ct = preg_match("/\\d OBJE @(.+)@/", $gedrec, $match);
        if ($ct > 0) {
            $orec = find_gedcom_record($match[1]);
        } else {
            $orec = $gedrec;
        }
        if (!empty($orec)) {
            $fullpath = extract_fullpath($orec);
            $filename = "";
            $filename = extract_filename($fullpath);
            $filename = $MEDIA_DIRECTORY . $filename;
            $filename = trim($filename);
            if (!empty($filename)) {
                if (preg_match("/(jpg)|(jpeg)|(png)\$/i", $filename) > 0) {
                    if (file_exists($filename)) {
                        $size = findImageSize($filename);
                        if ($width > 0 and $height == 0) {
                            $perc = $width / $size[0];
                            $height = round($size[1] * $perc);
                        } else {
                            if ($height > 0 and $width == 0) {
                                $perc = $height / $size[1];
                                $width = round($size[0] * $perc);
                            } else {
                                $width = $size[0];
                                $height = $size[1];
                            }
                        }
                        $image = $PGVReportRoot->createImage($filename, $left, $top, $width, $height, $align, $ln);
                        $pgvreport->addElement($image);
                    }
                }
            }
        }
    } else {
        $filename = $file;
        if (preg_match("/(jpg)|(jpeg)|(png)|(gif)\$/i", $filename) > 0) {
            if (file_exists($filename)) {
                $size = findImageSize($filename);
                if ($width > 0 && $height == 0) {
                    $perc = $width / $size[0];
                    $height = round($size[1] * $perc);
                } else {
                    if ($height > 0 && $width == 0) {
                        $perc = $height / $size[1];
                        $width = round($size[0] * $perc);
                    } else {
                        $width = $size[0];
                        $height = $size[1];
                    }
                }
                $image = $PGVReportRoot->createImage($filename, $left, $top, $width, $height, $align, $ln);
                $pgvreport->addElement($image);
            }
        }
    }
}
Example #9
0
 /**
  * Get the thumbnail image for the given person
  *
  * @param Person $person
  * @return string
  */
 function getThumbnail(&$person)
 {
     global $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $TEXT_DIRECTION, $USE_MEDIA_VIEWER, $SERVER_URL;
     $thumbnail = "";
     if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES && showFact("OBJE", $person->getXref())) {
         $object = $person->findHighlightedMedia();
         if (!empty($object)) {
             $whichFile = thumb_or_main($object);
             // Do we send the main image or a thumbnail?
             $size = findImageSize($whichFile);
             $class = "pedigree_image_portrait";
             if ($size[0] > $size[1]) {
                 $class = "pedigree_image_landscape";
             }
             if ($TEXT_DIRECTION == "rtl") {
                 $class .= "_rtl";
             }
             // NOTE: IMG ID
             $imgsize = findImageSize($object["file"]);
             $imgwidth = $imgsize[0] + 50;
             $imgheight = $imgsize[1] + 150;
             if (!empty($object['mid']) && $USE_MEDIA_VIEWER) {
                 $thumbnail .= "<a href=\"" . encode_url("mediaviewer.php?mid=" . $object['mid']) . "\" >";
             } else {
                 $thumbnail .= "<a href=\"javascript:;\" onclick=\"return openImage('" . rawurlencode($object["file"]) . "',{$imgwidth}, {$imgheight});\">";
             }
             $thumbnail .= "<img src=\"" . $SERVER_URL . $whichFile . "\" vspace=\"0\" hspace=\"0\" class=\"{$class}\" alt=\"\" title=\"\"";
             if ($imgsize) {
                 $thumbnail .= " /></a>";
             } else {
                 $thumbnail .= " />";
             }
         }
     }
     return $thumbnail;
 }