Exemplo n.º 1
0
/**
 * print first major fact for an Individual
 *
 * @param string $key	indi pid
 */
function print_first_major_fact($key, $majorfacts = array("BIRT", "CHR", "BAPM", "DEAT", "BURI", "BAPL", "ADOP"))
{
    global $pgv_lang, $factarray, $LANGUAGE, $TEXT_DIRECTION;
    $indirec = find_person_record($key);
    if (!$indirec) {
        $indirec = find_family_record($key);
    }
    foreach ($majorfacts as $indexval => $fact) {
        $factrec = get_sub_record(1, "1 {$fact}", $indirec);
        if (strlen($factrec) > 7 and showFact("{$fact}", $key) and !FactViewRestricted($key, $factrec)) {
            print "<span dir=\"{$TEXT_DIRECTION}\">";
            echo "<br /><i>";
            //print " -- <i>";
            if (isset($pgv_lang[$fact])) {
                print $pgv_lang[$fact];
            } else {
                if (isset($factarray[$fact])) {
                    print $factarray[$fact];
                } else {
                    print $fact;
                }
            }
            print " ";
            print_fact_date($factrec);
            print_fact_place($factrec);
            print "</i>";
            print "</span>";
            break;
        }
    }
    return $fact;
}
Exemplo n.º 2
0
 /**
  * Check whether or not this event can be shown
  *
  * @return boolean
  */
 function canShow()
 {
     if (is_null($this->canShow)) {
         if (empty($this->gedcomRecord)) {
             $this->canShow = false;
         } else {
             if (!is_null($this->parentObject)) {
                 $this->canShow = showFact($this->tag, $this->parentObject->getXref()) && !FactViewRestricted($this->parentObject->getXref(), $this->gedcomRecord);
             } else {
                 $this->canShow = true;
             }
         }
     }
     return $this->canShow;
 }
Exemplo n.º 3
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>";
}
Exemplo n.º 4
0
/**
 * find all of the level 1 subrecords of the given record
 * @param string $gedrec the gedcom record to get the subrecords from
 * @param string $ignore a list of tags to ignore
 * @param boolean $families whether to include any records from the family
 * @param boolean $sort whether or not to sort the record by date
 * @param boolean $ApplyPriv whether to apply privacy right now or later
 * @return array an array of the raw subrecords to return
 */
function get_all_subrecords($gedrec, $ignore = "", $families = true, $ApplyPriv = true)
{
    $repeats = array();
    $id = "";
    $gt = preg_match('/0 @(' . PGV_REGEX_XREF . ')@/', $gedrec, $gmatch);
    if ($gt > 0) {
        $id = $gmatch[1];
    }
    $hasResn = strstr($gedrec, " RESN ");
    $prev_tags = array();
    $ct = preg_match_all('/\\n1 (' . PGV_REGEX_TAG . ')(.*)/', $gedrec, $match, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
    for ($i = 0; $i < $ct; $i++) {
        $fact = trim($match[$i][1][0]);
        $pos1 = $match[$i][0][1];
        if ($i < $ct - 1) {
            $pos2 = $match[$i + 1][0][1];
        } else {
            $pos2 = strlen($gedrec);
        }
        if (empty($ignore) || strpos($ignore, $fact) === false) {
            if (!$ApplyPriv || showFact($fact, $id) && showFactDetails($fact, $id)) {
                if (isset($prev_tags[$fact])) {
                    $prev_tags[$fact]++;
                } else {
                    $prev_tags[$fact] = 1;
                }
                $subrec = substr($gedrec, $pos1, $pos2 - $pos1);
                if (!$ApplyPriv || !$hasResn || !FactViewRestricted($id, $subrec)) {
                    if ($fact == "EVEN") {
                        $tt = preg_match("/2 TYPE (.*)/", $subrec, $tmatch);
                        if ($tt > 0) {
                            $type = trim($tmatch[1]);
                            if (!$ApplyPriv || showFact($type, $id) && showFactDetails($type, $id)) {
                                $repeats[] = trim($subrec) . "\n";
                            }
                        } else {
                            $repeats[] = trim($subrec) . "\n";
                        }
                    } else {
                        $repeats[] = trim($subrec) . "\n";
                    }
                }
            }
        }
    }
    //-- look for any records in FAMS records
    if ($families) {
        $ft = preg_match_all('/\\n1 FAMS @(' . PGV_REGEX_XREF . ')@/', $gedrec, $fmatch, PREG_SET_ORDER);
        for ($f = 0; $f < $ft; $f++) {
            $famid = $fmatch[$f][1];
            $famrec = find_family_record($fmatch[$f][1]);
            $parents = find_parents_in_record($famrec);
            if ($id == $parents["HUSB"]) {
                $spid = $parents["WIFE"];
            } else {
                $spid = $parents["HUSB"];
            }
            $prev_tags = array();
            $ct = preg_match_all('/\\n1 (' . PGV_REGEX_TAG . ')(.*)/', $famrec, $match, PREG_SET_ORDER);
            for ($i = 0; $i < $ct; $i++) {
                $fact = trim($match[$i][1]);
                if (empty($ignore) || strpos($ignore, $fact) === false) {
                    if (!$ApplyPriv || showFact($fact, $id) && showFactDetails($fact, $id)) {
                        if (isset($prev_tags[$fact])) {
                            $prev_tags[$fact]++;
                        } else {
                            $prev_tags[$fact] = 1;
                        }
                        $subrec = get_sub_record(1, "1 {$fact}", $famrec, $prev_tags[$fact]);
                        $subrec .= "\n2 _PGVS @{$spid}@\n2 _PGVFS @{$famid}@\n";
                        if ($fact == "EVEN") {
                            $ct = preg_match("/2 TYPE (.*)/", $subrec, $tmatch);
                            if ($ct > 0) {
                                $type = trim($tmatch[1]);
                                if (!$ApplyPriv or showFact($type, $id) && showFactDetails($type, $id)) {
                                    $repeats[] = trim($subrec) . "\n";
                                }
                            } else {
                                $repeats[] = trim($subrec) . "\n";
                            }
                        } else {
                            $repeats[] = trim($subrec) . "\n";
                        }
                    }
                }
            }
        }
    }
    return $repeats;
}
Exemplo n.º 5
0
/**
 * print the children table for a family
 *
 * @param string $famid family gedcom ID
 * @param string $childid optional child ID
 * @param int $sosa optional child sosa number
 * @param string $label optional indi label (descendancy booklet)
 */
function print_family_children($famid, $childid = "", $sosa = 0, $label = "", $personcount = "1")
{
    global $pgv_lang, $factarray, $pbwidth, $pbheight, $view, $show_famlink, $show_cousins;
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $show_changes, $pgv_changes, $GEDCOM, $SHOW_ID_NUMBERS, $TEXT_DIRECTION;
    $family = Family::getInstance($famid);
    $children = $family->getChildrenIds();
    print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\"><tr>";
    if ($sosa > 0) {
        print "<td></td>";
    }
    print "<td><span class=\"subheaders\">" . $pgv_lang["children"] . "</span></td>";
    if ($sosa > 0) {
        print "<td></td><td></td>";
    }
    print "</tr>\n";
    $newchildren = array();
    $oldchildren = array();
    if (PGV_USER_CAN_EDIT) {
        if (isset($_REQUEST['show_changes']) && $_REQUEST['show_changes'] == 'yes' && isset($pgv_changes[$famid . "_" . $GEDCOM])) {
            $newrec = find_updated_record($famid);
            $ct = preg_match_all("/1 CHIL @(.*)@/", $newrec, $match, PREG_SET_ORDER);
            if ($ct > 0) {
                $oldchil = array();
                for ($i = 0; $i < $ct; $i++) {
                    if (!in_array($match[$i][1], $children)) {
                        $newchildren[] = $match[$i][1];
                    } else {
                        $oldchil[] = $match[$i][1];
                    }
                }
                foreach ($children as $indexval => $chil) {
                    if (!in_array($chil, $oldchil)) {
                        $oldchildren[] = $chil;
                    }
                }
                //-- if there are no old or new children then the children were reordered
                if (count($newchildren) == 0 && count($oldchildren) == 0) {
                    $children = array();
                    for ($i = 0; $i < $ct; $i++) {
                        $children[] = $match[$i][1];
                    }
                }
            }
        }
    }
    $nchi = 1;
    if (count($children) > 0 || count($newchildren) > 0 || count($oldchildren) > 0) {
        foreach ($children as $indexval => $chil) {
            if (!in_array($chil, $oldchildren)) {
                print "<tr>\n";
                if ($sosa != 0) {
                    if ($chil == $childid) {
                        print_sosa_number($sosa, $childid);
                    } else {
                        if (empty($label)) {
                            print_sosa_number("");
                        } else {
                            print_sosa_number($label . $nchi++ . ".");
                        }
                    }
                }
                print "<td valign=\"middle\" >";
                print_pedigree_person($chil, 1, $show_famlink, 8, $personcount);
                $personcount++;
                print "</td>";
                if ($sosa != 0) {
                    // loop for all families where current child is a spouse
                    $famids = find_sfamily_ids($chil);
                    $maxfam = count($famids) - 1;
                    for ($f = 0; $f <= $maxfam; $f++) {
                        $famid = $famids[$f];
                        if (!$famid) {
                            continue;
                        }
                        $parents = find_parents($famid);
                        if (!$parents) {
                            continue;
                        }
                        if ($parents["HUSB"] == $chil) {
                            $spouse = $parents["WIFE"];
                        } else {
                            $spouse = $parents["HUSB"];
                        }
                        // multiple marriages
                        if ($f > 0) {
                            print "</tr>\n<tr><td>&nbsp;</td>";
                            print "<td valign=\"top\"";
                            if ($TEXT_DIRECTION == "rtl") {
                                print " align=\"left\">";
                            } else {
                                print " align=\"right\">";
                            }
                            //if ($f==$maxfam) print "<img height=\"50%\"";
                            //else print "<img height=\"100%\"";
                            if ($f == $maxfam) {
                                print "<img height=\"" . ($pbheight / 2 - 3) . "px\"";
                            } else {
                                print "<img height=\"" . $pbheight . "px\"";
                            }
                            print " width=\"3\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "\" alt=\"\" />";
                            print "</td>";
                        }
                        print "<td class=\"details1\" valign=\"middle\" align=\"center\">";
                        $divrec = "";
                        if (showFact("MARR", $famid)) {
                            // marriage date
                            $famrec = find_family_record($famid);
                            $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", get_sub_record(1, "1 MARR", $famrec), $match);
                            if ($ct > 0) {
                                print "<span class=\"date\">" . trim($match[1]) . "</span>";
                            }
                            // divorce date
                            $divrec = get_sub_record(1, "1 DIV", $famrec);
                            $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", $divrec, $match);
                            if ($ct > 0) {
                                print "-<span class=\"date\">" . trim($match[1]) . "</span>";
                            }
                        }
                        print "<br /><img width=\"100%\" height=\"3\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" alt=\"\" />";
                        // family link
                        if ($famid) {
                            print "<br />";
                            print "<a class=\"details1\" href=\"family.php?famid={$famid}\">";
                            if ($SHOW_ID_NUMBERS) {
                                print getLRM() . "&nbsp;({$famid})&nbsp;" . getLRM();
                            }
                            print "</a>";
                        }
                        print "</td>\n";
                        // spouse information
                        print "<td style=\"vertical-align: center;";
                        if (!empty($divrec) and $view != "preview") {
                            print " filter:alpha(opacity=40);-moz-opacity:0.4\">";
                        } else {
                            print "\">";
                        }
                        print_pedigree_person($spouse, 1, $show_famlink, 9, $personcount);
                        $personcount++;
                        print "</td>\n";
                        // cousins
                        if ($show_cousins) {
                            print_cousins($famid, $personcount);
                            $personcount++;
                        }
                    }
                }
                print "</tr>\n";
            }
        }
        foreach ($newchildren as $indexval => $chil) {
            print "<tr >";
            print "<td valign=\"top\" class=\"facts_valueblue\" style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\">\n";
            print_pedigree_person($chil, 1, $show_famlink, 0, $personcount);
            $personcount++;
            print "</td></tr>\n";
        }
        foreach ($oldchildren as $indexval => $chil) {
            print "<tr >";
            print "<td valign=\"top\" class=\"facts_valuered\" style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\">\n";
            print_pedigree_person($chil, 1, $show_famlink, 0, $personcount);
            $personcount++;
            print "</td></tr>\n";
        }
        // message 'no children' except for sosa
    } else {
        if ($sosa < 1) {
            print "<tr><td></td><td valign=\"top\" >";
            $nchi = "";
            if (isset($pgv_changes[$famid . "_" . $GEDCOM])) {
                $famrec = find_updated_record($famid);
            } else {
                $famrec = find_family_record($famid);
            }
            $ct = preg_match("/1 NCHI (\\w+)/", $famrec, $match);
            if ($ct > 0) {
                $nchi = $match[1];
            } else {
                $famrec = find_family_record($famid);
                $ct = preg_match("/1 NCHI (\\w+)/", $famrec, $match);
                if ($ct > 0) {
                    $nchi = $match[1];
                }
            }
            if ($nchi == "0") {
                print "<img src=\"images/small/childless.gif\" alt=\"" . $pgv_lang["childless_family"] . "\" title=\"" . $pgv_lang["childless_family"] . "\" /> " . $pgv_lang["childless_family"];
            } else {
                print $pgv_lang["no_children"];
            }
            print "</td></tr>";
        } else {
            print "<tr>\n";
            print_sosa_number($sosa, $childid);
            print "<td valign=\"top\">";
            print_pedigree_person($childid, 1, $show_famlink, 0, $personcount);
            $personcount++;
            print "</td></tr>\n";
        }
    }
    print "</table><br />";
    if ($view != "preview" && $sosa == 0 && PGV_USER_CAN_EDIT) {
        print_help_link("add_child_help", "qm", "add_child_to_family");
        print "<a href=\"javascript:;\" onclick=\"return addnewchild('{$famid}','');\">" . $pgv_lang["add_child_to_family"] . "</a>";
        print "<span style='white-space:nowrap;'>";
        print " <a href=\"javascript:;\" onclick=\"return addnewchild('{$famid}','M');\">[" . Person::sexImage('M', 'small', $pgv_lang['son']) . "]</a>";
        print " <a href=\"javascript:;\" onclick=\"return addnewchild('{$famid}','F');\">[" . Person::sexImage('F', 'small', $pgv_lang['daughter']) . "]</a>";
        print "</span>";
    }
}
Exemplo n.º 6
0
/**
* @todo add info
* @param array $attrs an array of key value pairs for the attributes
*/
function PGVRHighlightedImageSHandler($attrs)
{
    global $gedrec, $pgvreport, $PGVReportRoot;
    $id = "";
    $gmatch = array();
    $gt = preg_match("/0 @(.+)@/", $gedrec, $gmatch);
    if ($gt > 0) {
        $id = $gmatch[1];
    }
    // 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 = '';
    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"];
    }
    if (showFact("OBJE", $id)) {
        $media = find_highlighted_object($id, $gedrec);
        if (!empty($media["file"])) {
            if (preg_match("/(jpg)|(jpeg)|(png)\$/i", $media["file"]) > 0) {
                if (file_exists($media["file"])) {
                    $size = findImageSize($media["file"]);
                    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($media["file"], $left, $top, $width, $height, $align, $ln);
                    $pgvreport->addElement($image);
                }
            }
        }
    }
}
Exemplo n.º 7
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;
 }