function print_user_favorites($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $TEXT_DIRECTION, $INDEX_DIRECTORY, $MEDIA_DIRECTORY, $MULTI_MEDIA, $MEDIA_DIRECTORY_LEVELS, $ctype;
    global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
    // Override GEDCOM configuration temporarily
    if (isset($show_full)) {
        $saveShowFull = $show_full;
    }
    $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
    $show_full = 1;
    $PEDIGREE_FULL_DETAILS = 1;
    $userfavs = getUserFavorites(PGV_USER_NAME);
    if (!is_array($userfavs)) {
        $userfavs = array();
    }
    $id = "user_favorites";
    $title = print_help_link("mygedview_favorites_help", "qm", "", false, true);
    $title .= $pgv_lang["my_favorites"] . "  ";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    $title .= "(" . count($userfavs) . ")";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    if ($ENABLE_AUTOCOMPLETE) {
        $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script>
		<script type="text/javascript">
		jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/
		jQuery(document).ready(function($){
			$("input[name^=gid]").autocomplete("autocomplete.php", {
				extraParams: {field:"IFSRO"},
				formatItem: function(row, i) {
					return row[0] + " (" + row[1] + ")";
				},
				formatResult: function(row) {
					return row[1];
				},
				width: 400,
				minChars: 2
			});
		});
		</script>';
    } else {
        $content = '';
    }
    if ($block) {
        $style = 2;
        // 1 means "regular box", 2 means "wide box"
        $tableWidth = $BROWSERTYPE == "msie" ? "95%" : "99%";
        // IE needs to have room for vertical scroll bar inside the box
        $cellSpacing = "1px";
    } else {
        $style = 2;
        $tableWidth = "99%";
        $cellSpacing = "3px";
    }
    if (count($userfavs) == 0) {
        $content .= print_text("no_favorites", 0, 1);
    } else {
        $mygedcom = $GEDCOM;
        $current_gedcom = $GEDCOM;
        $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
        foreach ($userfavs as $key => $favorite) {
            if (isset($favorite["id"])) {
                $key = $favorite["id"];
            }
            $removeFavourite = "<a class=\"font9\" href=\"" . encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$key}") . "\" onclick=\"return confirm('" . $pgv_lang["confirm_fav_remove"] . "');\">" . $pgv_lang["remove"] . "</a><br />";
            $current_gedcom = $GEDCOM;
            $GEDCOM = $favorite["file"];
            $content .= "<tr><td>";
            if ($favorite["type"] == "URL") {
                $content .= "<div id=\"boxurl" . $key . ".0\" class=\"person_box\">";
                if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                    $content .= $removeFavourite;
                }
                $content .= "<a href=\"" . $favorite["url"] . "\">" . PrintReady($favorite["title"]) . "</a>";
                $content .= "<br />" . PrintReady($favorite["note"]);
            } else {
                require $INDEX_DIRECTORY . $GEDCOM . '_conf.php';
                $indirec = find_gedcom_record($favorite["gid"], PGV_GED_ID);
                if ($favorite["type"] == "INDI") {
                    $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box";
                    if (strpos($indirec, "\n1 SEX F") !== false) {
                        $content .= "F";
                    } elseif (strpos($indirec, "\n1 SEX M") !== false) {
                        $content .= "";
                    } else {
                        $content .= "NN";
                    }
                    $content .= "\">";
                    if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    ob_start();
                    print_pedigree_person($favorite["gid"], $style, 1, $key);
                    $content .= ob_get_clean();
                    $content .= PrintReady($favorite["note"]);
                } else {
                    $record = GedcomRecord::getInstance($favorite['gid']);
                    $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box\">";
                    if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    if ($record) {
                        $content .= $record->format_list('span');
                    } else {
                        $content .= $pgv_lang['invalid_id'];
                    }
                    $content .= "<br />" . PrintReady($favorite["note"]);
                }
            }
            $content .= "</div>";
            $content .= "</td></tr>";
            $GEDCOM = $mygedcom;
            require $INDEX_DIRECTORY . $GEDCOM . '_conf.php';
        }
        $content .= "</table>";
    }
    $content .= '
	<script language="JavaScript" type="text/javascript">
	var pastefield;
	function paste_id(value) {
		pastefield.value=value;
	}
	</script>
	<br />
	';
    $uniqueID = floor(microtime() * 1000000);
    $content .= print_help_link("index_add_favorites_help", "qm", "", false, true);
    $content .= "<b><a href=\"javascript: " . $pgv_lang["add_favorite"] . " \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["plus"]["other"] . "\" border=\"0\" alt=\"\" />&nbsp;" . $pgv_lang["add_favorite"] . "</a></b>";
    $content .= "<br /><div id=\"add_user_fav\" style=\"display: none;\">";
    $content .= "<form name=\"addufavform\" method=\"post\" action=\"index.php\">";
    $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />";
    $content .= "<input type=\"hidden\" name=\"ctype\" value=\"{$ctype}\" />";
    $content .= "<input type=\"hidden\" name=\"favtype\" value=\"user\" />";
    $content .= "<input type=\"hidden\" name=\"ged\" value=\"{$GEDCOM}\" />";
    $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
    $content .= "<tr><td>" . $pgv_lang["add_fav_enter_id"] . " <br />";
    $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
    $content .= print_findindi_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findfamily_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findsource_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findrepository_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findnote_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findmedia_link("gid{$uniqueID}", '1', '', true) . "\n";
    $content .= "<br />" . $pgv_lang["add_fav_or_enter_url"];
    $content .= "<table><tr><td>" . $pgv_lang["url"] . "</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
    $content .= "<tr><td>" . $pgv_lang["title"] . "</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
    if ($block) {
        $content .= "\n</td></tr><tr><td><br />";
    } else {
        $content .= "\n</td><td>";
    }
    $content .= $pgv_lang["add_fav_enter_note"];
    $content .= "<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
    $content .= "</td></tr></table>";
    $content .= "<br /><input type=\"submit\" value=\"" . $pgv_lang["add"] . "\" style=\"font-size: 8pt; \" />";
    $content .= "</form></div>";
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
    // Restore GEDCOM configuration
    unset($show_full);
    if (isset($saveShowFull)) {
        $show_full = $saveShowFull;
    }
    $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
}
Example #2
0
 print "&nbsp;&nbsp;<a href=\"" . encode_url("editconfig_gedcom.php?source=replace_form&path=" . get_gedcom_setting($ged_id, 'path')) . "&oldged=" . get_gedcom_setting($ged_id, 'gedcom') . "\">" . $pgv_lang['upload_replacement'] . "</a>\n";
 print "</td>";
 print "</tr>";
 // Row 2: GEDCOM file name & functions
 print "<tr>";
 print "<td valign=\"top\">";
 // Column 1 (row legend)
 print_text("ged_gedcom");
 print "</td>";
 print "<td valign=\"top\">";
 // Column 2 (file name & notices)
 if (file_exists(get_gedcom_setting($ged_id, 'path'))) {
     if ($TEXT_DIRECTION == "ltr") {
         print get_gedcom_setting($ged_id, 'path') . " (";
     } else {
         print getLRM() . get_gedcom_setting($ged_id, 'path') . " " . getRLM() . "(";
     }
     printf("%.2fKb", filesize(get_gedcom_setting($ged_id, 'path')) / 1024);
     print ")";
     /** deactivate [ 1573749 ]
      * -- activating based on a request parameter instead of a config parameter
      */
     if (!empty($_REQUEST['check_download'])) {
         $url = check_gedcom_downloadable(get_gedcom_setting($ged_id, 'path'));
         if ($url !== false) {
             print "<br />\n";
             print "<span class=\"error\">" . $pgv_lang["gedcom_downloadable"] . " :</span>";
             print "<br /><a href=\"{$url}\">{$url}</a>";
         } else {
             print "<br /><b>" . str_replace("#GEDCOM#", get_gedcom_setting($ged_id, 'path'), $pgv_lang['gedcom_download_secure']) . "</b><br />";
         }
Example #3
0
/**
* add a new tag input field
*
* called for each fact to be edited on a form.
* Fact level=0 means a new empty form : data are POSTed by name
* else data are POSTed using arrays :
* glevels[] : tag level
*  islink[] : tag is a link
*     tag[] : tag name
*    text[] : tag value
*
* @param string $tag fact record to edit (eg 2 DATE xxxxx)
* @param string $upperlevel optional upper level tag (eg BIRT)
* @param string $label An optional label to echo instead of the default from the $factarray
* @param string $readOnly optional, when "READONLY", fact data can't be changed
* @param string $noClose optional, when "NOCLOSE", final "</td></tr>" won't be printed
* (so that additional text can be printed in the box)
* @param boolean $rowDisplay True to have the row displayed by default, false to hide it by default
*/
function add_simple_tag($tag, $upperlevel = "", $label = "", $readOnly = "", $noClose = "", $rowDisplay = true)
{
    global $factarray, $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $MEDIA_DIRECTORY, $TEMPLE_CODES;
    global $assorela, $tags, $emptyfacts, $main_fact, $TEXT_DIRECTION, $pgv_changes, $GEDCOM;
    global $NPFX_accept, $SPFX_accept, $NSFX_accept, $FILE_FORM_accept, $upload_count;
    global $tabkey, $STATUS_CODES, $SPLIT_PLACES, $pid, $linkToID;
    global $bdm, $PRIVACY_BY_RESN;
    global $lang_short_cut, $LANGUAGE;
    global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $PREFER_LEVEL2_SOURCES;
    if (substr($tag, 0, strpos($tag, "PLAC"))) {
        ?>
<script type="text/javascript">
		<!--
		function valid_lati_long(field, pos, neg) {
			// valid LATI or LONG according to Gedcom standard
			// pos (+) : N or E
			// neg (-) : S or W
			txt=field.value.toUpperCase();
			txt=txt.replace(/(^\s*)|(\s*$)/g,''); // trim
			txt=txt.replace(/ /g,':'); // N12 34 ==> N12.34
			txt=txt.replace(/\+/g,''); // +17.1234 ==> 17.1234
			txt=txt.replace(/-/g,neg); // -0.5698 ==> W0.5698
			txt=txt.replace(/,/g,'.'); // 0,5698 ==> 0.5698
			// 0�34'11 ==> 0:34:11
			txt=txt.replace(/\uB0/g,':'); // �
			txt=txt.replace(/\u27/g,':'); // '
			// 0:34:11.2W ==> W0.5698
			txt=txt.replace(/^([0-9]+):([0-9]+):([0-9.]+)(.*)/g, function($0, $1, $2, $3, $4) { var n=parseFloat($1); n+=($2/60); n+=($3/3600); n=Math.round(n*1E4)/1E4; return $4+n; });
			// 0:34W ==> W0.5667
			txt=txt.replace(/^([0-9]+):([0-9]+)(.*)/g, function($0, $1, $2, $3) { var n=parseFloat($1); n+=($2/60); n=Math.round(n*1E4)/1E4; return $3+n; });
			// 0.5698W ==> W0.5698
			txt=txt.replace(/(.*)([N|S|E|W]+)$/g,'$2$1');
			// 17.1234 ==> N17.1234
			if (txt!='' && txt.charAt(0)!=neg && txt.charAt(0)!=pos) txt=pos+txt;
			field.value = txt;
		}

		function toggle_lati_long() {
			tr = document.getElementsByTagName('tr');
			for (var i=0; i<tr.length; i++) {
				if (tr[i].id.indexOf("LATI")>=0 || tr[i].id.indexOf("LONG")>=0) {
					var disp = tr[i].style.display;
					if (disp=="none") {
						disp="table-row";
						if (document.all && !window.opera) disp = "inline"; // IE
					}
					else disp="none";
					tr[i].style.display=disp;
				}
			}
		}
		//-->
		</script>
		<?php 
    }
    if (!isset($noClose) && isset($readOnly) && $readOnly == "NOCLOSE") {
        $noClose = "NOCLOSE";
        $readOnly = "";
    }
    if (!isset($noClose) || $noClose != "NOCLOSE") {
        $noClose = "";
    }
    if (!isset($readOnly) || $readOnly != "READONLY") {
        $readOnly = "";
    }
    if (!isset($tabkey)) {
        $tabkey = 1;
    }
    if (empty($linkToID)) {
        $linkToID = $pid;
    }
    $subnamefacts = array("NPFX", "GIVN", "SPFX", "SURN", "NSFX", "_MARNM_SURN");
    @(list($level, $fact, $value) = explode(" ", $tag));
    // element name : used to POST data
    if ($level == 0) {
        if ($upperlevel) {
            $element_name = $upperlevel . "_" . $fact;
        } else {
            $element_name = $fact;
        }
        // ex: OCCU
    } else {
        $element_name = "text[]";
    }
    if ($level == 1) {
        $main_fact = $fact;
    }
    // element id : used by javascript functions
    if ($level == 0) {
        $element_id = $fact;
    } else {
        $element_id = $fact . floor(microtime() * 1000000);
    }
    // ex: SOUR56402
    if ($upperlevel) {
        $element_id = $upperlevel . "_" . $fact;
    }
    // ex: BIRT_DATE | DEAT_DATE ...
    // field value
    $islink = (substr($value, 0, 1) == "@" and substr($value, 0, 2) != "@#");
    if ($islink) {
        $value = trim(trim(substr($tag, strlen($fact) + 3)), " @\r");
    } else {
        $value = trim(substr($tag, strlen($fact) + 3));
    }
    if ($fact == 'REPO' || $fact == 'SOUR' || $fact == 'OBJE' || $fact == 'FAMC') {
        $islink = true;
    }
    // rows & cols
    switch ($fact) {
        case 'FORM':
            $rows = 1;
            $cols = 5;
            break;
        case 'LATI':
        case 'LONG':
        case 'NPFX':
        case 'SPFX':
        case 'NSFX':
            $rows = 1;
            $cols = 12;
            break;
        case 'DATE':
        case 'TIME':
        case 'TYPE':
            $rows = 1;
            $cols = 20;
            break;
        case 'GIVN':
        case 'SURN':
        case '_MARNM':
            $rows = 1;
            $cols = 25;
            break;
        case '_UID':
            $rows = 1;
            $cols = 50;
            break;
        case 'TEXT':
        case 'PUBL':
            $rows = 10;
            $cols = 70;
            break;
        case 'SHARED_NOTE_EDIT':
            $islink = 1;
            $fact = "NOTE";
            $rows = 15;
            $cols = 88;
            break;
        case 'SHARED_NOTE':
            $islink = 1;
            $fact = "NOTE";
            $rows = 1;
            $cols = $islink ? 8 : 40;
            break;
        case 'NOTE':
            if ($islink) {
                $rows = 1;
                $cols = $islink ? 8 : 40;
                break;
            } else {
                $rows = 10;
                $cols = 70;
                break;
            }
        case 'ADDR':
            $rows = 4;
            $cols = 40;
            break;
        case 'PAGE':
            $rows = 1;
            $cols = 50;
            break;
        default:
            $rows = 1;
            $cols = $islink ? 8 : 40;
            break;
    }
    // label
    $style = "";
    echo "<tr id=\"" . $element_id . "_tr\" ";
    if ($fact == "MAP" || $fact == "LATI" || $fact == "LONG") {
        echo " style=\"display:none;\"";
    }
    echo " >\n";
    if (in_array($fact, $subnamefacts) || $fact == "LATI" || $fact == "LONG") {
        echo "<td class=\"optionbox {$TEXT_DIRECTION} wrap width25\">";
    } else {
        echo "<td class=\"descriptionbox {$TEXT_DIRECTION} wrap width25\">";
    }
    // help link
    if (!in_array($fact, $emptyfacts)) {
        if ($fact == "DATE") {
            print_help_link("def_gedcom_date_help", "qm", "date");
        } else {
            if ($fact == "RESN") {
                print_help_link($fact . "_help", "qm");
            } else {
                if ($fact == "NOTE" && $islink) {
                    print_help_link("edit_add_SHARED_NOTE_help", "qm");
                } else {
                    print_help_link("edit_" . $fact . "_help", "qm");
                }
            }
        }
    }
    if ($fact == "_AKAN" || $fact == "_AKA" || $fact == "ALIA") {
        // Allow special processing for different languages
        $func = "fact_AKA_localisation_{$lang_short_cut[$LANGUAGE]}";
        if (function_exists($func)) {
            // Localise the AKA fact
            $func($fact, $pid);
        }
    } else {
        if ($fact == "AGNC" && !empty($main_fact)) {
            // Allow special processing for different languages
            $func = "fact_AGNC_localisation_{$lang_short_cut[$LANGUAGE]}";
            if (function_exists($func)) {
                // Localise the AGNC fact
                $func($fact, $main_fact);
            }
        }
    }
    if (PGV_DEBUG) {
        echo $element_name . "<br />\n";
    }
    // tag name
    if (!empty($label)) {
        if ($label == "Note" && $islink) {
            echo $pgv_lang["shared_note"];
        } else {
            echo $label;
        }
    } else {
        if ($fact == "NOTE" && $islink) {
            echo $pgv_lang["shared_note"];
        } else {
            if (isset($pgv_lang[$fact])) {
                echo $pgv_lang[$fact];
            } else {
                if (isset($factarray[$fact])) {
                    echo $factarray[$fact];
                } else {
                    echo $fact;
                }
            }
        }
    }
    echo "\n";
    // tag level
    if ($level > 0) {
        if ($fact == "TEXT" and $level > 1) {
            echo "<input type=\"hidden\" name=\"glevels[]\" value=\"" . ($level - 1) . "\" />";
            echo "<input type=\"hidden\" name=\"islink[]\" value=\"0\" />";
            echo "<input type=\"hidden\" name=\"tag[]\" value=\"DATA\" />";
            //-- leave data text[] value empty because the following TEXT line will
            //--- cause the DATA to be added
            echo "<input type=\"hidden\" name=\"text[]\" value=\"\" />";
        }
        echo "<input type=\"hidden\" name=\"glevels[]\" value=\"" . $level . "\" />\n";
        echo "<input type=\"hidden\" name=\"islink[]\" value=\"" . $islink . "\" />\n";
        echo "<input type=\"hidden\" name=\"tag[]\" value=\"" . $fact . "\" />\n";
        // Shared Notes Debug --------------------
        // echo "<br />Label = ".$label;
        // echo "<br />Level = ".$level;
        // echo "<br />Link = ".$islink;
        // echo "<br />Fact = ".$fact;
        // echo "<br />Value = ".$value;
        // End Debug -------------------
    }
    echo "\n</td>";
    // value
    echo "<td class=\"optionbox wrap\">\n";
    if (PGV_DEBUG) {
        echo $tag . "<br />\n";
    }
    // retrieve linked NOTE
    if ($fact == "NOTE" && $islink) {
        $noteid = $value;
    }
    if (in_array($fact, $emptyfacts) && (empty($value) || $value == "y" || $value == "Y")) {
        $value = strtoupper($value);
        //-- don't default anything to Y when adding events through people
        //-- default to Y when specifically adding one of these events
        if ($level == 1) {
            $value = "Y";
        }
        // default YES
        echo "<input type=\"hidden\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" value=\"" . $value . "\" />";
        if ($level <= 1) {
            echo "<input type=\"checkbox\" ";
            if ($value == "Y") {
                echo " checked=\"checked\"";
            }
            echo " onclick=\"if (this.checked) " . $element_id . ".value='Y'; else " . $element_id . ".value=''; \" />";
            echo $pgv_lang["yes"];
        }
    } else {
        if ($fact == "TEMP") {
            echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >\n";
            echo "<option value=''>" . $pgv_lang["no_temple"] . "</option>\n";
            foreach ($TEMPLE_CODES as $code => $temple) {
                echo "<option value=\"{$code}\"";
                if ($code == $value) {
                    echo " selected=\"selected\"";
                }
                echo ">{$temple} ({$code})</option>\n";
            }
            echo "</select>\n";
        } else {
            if ($fact == "ADOP") {
                echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >";
                foreach (array("BOTH" => $factarray["HUSB"] . "+" . $factarray["WIFE"], "HUSB" => $factarray["HUSB"], "WIFE" => $factarray["WIFE"]) as $k => $v) {
                    echo "<option value='{$k}'";
                    if ($value == $k) {
                        echo " selected=\"selected\"";
                    }
                    echo ">{$v}</option>";
                }
                echo "</select>\n";
            } else {
                if ($fact == "PEDI") {
                    echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >";
                    foreach (array("" => $pgv_lang["unknown"], "birth" => $factarray["BIRT"], "adopted" => $pgv_lang["adopted"], "foster" => $pgv_lang["foster"], "sealing" => $pgv_lang["sealing"]) as $k => $v) {
                        echo "<option value='{$k}'";
                        if (UTF8_strtolower($value) == $k) {
                            echo " selected=\"selected\"";
                        }
                        echo ">{$v}</option>";
                    }
                    echo "</select>\n";
                } else {
                    if ($fact == "STAT") {
                        echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >\n";
                        echo "<option value=''>No special status</option>\n";
                        foreach ($STATUS_CODES as $code => $status) {
                            echo "<option value=\"{$code}\"";
                            if ($code == $value) {
                                echo " selected=\"selected\"";
                            }
                            echo ">{$status}</option>\n";
                        }
                        echo "</select>\n";
                    } else {
                        if ($fact == "RELA") {
                            $text = strtolower($value);
                            // add current relationship if not found in default list
                            if (!array_key_exists($text, $assorela)) {
                                $assorela[$text] = $text;
                            }
                            echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" >\n";
                            foreach ($assorela as $key => $value) {
                                echo "<option value=\"" . $key . "\"";
                                if ($key == $text) {
                                    echo " selected=\"selected\"";
                                }
                                echo ">" . $assorela["{$key}"] . "</option>\n";
                            }
                            echo "</select>\n";
                        } else {
                            if ($fact == "_PGVU") {
                                $text = strtolower($value);
                                echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" >\n";
                                echo '<option value=""';
                                if ('' == $text) {
                                    echo ' selected="selected"';
                                }
                                echo ">-</option>\n";
                                foreach (get_all_users('asc', 'username') as $user_id => $user_name) {
                                    echo "<option value=\"" . $user_id . "\"";
                                    if ($user_id == $text) {
                                        echo " selected=\"selected\"";
                                    }
                                    echo ">" . $user_name . "</option>\n";
                                }
                                echo "</select>\n";
                            } else {
                                if ($fact == "RESN") {
                                    ?>
		<script type="text/javascript">
		<!--
		function update_RESN_img(resn_val) {
			document.getElementById("RESN_none").style.display="none";
			document.getElementById("RESN_locked").style.display="none";
			document.getElementById("RESN_privacy").style.display="none";
			document.getElementById("RESN_confidential").style.display="none";
			document.getElementById("RESN_"+resn_val).style.display="inline";
			if (resn_val=='none') resn_val='';
			document.getElementById("<?php 
                                    echo $element_id;
                                    ?>
").value=resn_val;
		}
		//-->
		</script>
		<?php 
                                    if (!$PRIVACY_BY_RESN && $level == 1) {
                                        // warn user that level 1 RESN tags have no effect when PRIVACY_BY_RESN is false
                                        echo "<small>" . $pgv_lang["resn_disabled"] . "</small>";
                                    }
                                    echo "<input type=\"hidden\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" value=\"" . $value . "\" />\n";
                                    echo "<table><tr valign=\"top\">\n";
                                    foreach (array("none", "locked", "privacy", "confidential") as $resn_index => $resn_val) {
                                        if ($resn_val == "none") {
                                            $resnv = "";
                                        } else {
                                            $resnv = $resn_val;
                                        }
                                        echo "<td><input tabindex=\"" . $tabkey . "\" type=\"radio\" name=\"RESN_radio\" onclick=\"update_RESN_img('" . $resn_val . "')\"";
                                        echo " value=\"" . $resnv . "\"";
                                        if ($value == $resnv) {
                                            echo " checked=\"checked\"";
                                        }
                                        echo " /><small>" . $pgv_lang[$resn_val] . "</small>";
                                        echo "<br />&nbsp;<img id=\"RESN_" . $resn_val . "\" src=\"images/RESN_" . $resn_val . ".gif\"  alt=\"" . $pgv_lang[$resn_val] . "\" title=\"" . $pgv_lang[$resn_val] . "\" border=\"0\"";
                                        if ($value == $resnv) {
                                            echo " style=\"display:inline\"";
                                        } else {
                                            echo " style=\"display:none\"";
                                        }
                                        echo " /></td>\n";
                                    }
                                    echo "</tr></table>\n";
                                } else {
                                    if ($fact == "_PRIM" or $fact == "_THUM") {
                                        echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" >\n";
                                        echo "<option value=\"\"></option>\n";
                                        echo "<option value=\"Y\"";
                                        if ($value == "Y") {
                                            echo " selected=\"selected\"";
                                        }
                                        echo ">" . $pgv_lang["yes"] . "</option>\n";
                                        echo "<option value=\"N\"";
                                        if ($value == "N") {
                                            echo " selected=\"selected\"";
                                        }
                                        echo ">" . $pgv_lang["no"] . "</option>\n";
                                        echo "</select>\n";
                                    } else {
                                        if ($fact == "SEX") {
                                            echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\">\n<option value=\"M\"";
                                            if ($value == "M") {
                                                echo " selected=\"selected\"";
                                            }
                                            echo ">" . $pgv_lang["male"] . "</option>\n<option value=\"F\"";
                                            if ($value == "F") {
                                                echo " selected=\"selected\"";
                                            }
                                            echo ">" . $pgv_lang["female"] . "</option>\n<option value=\"U\"";
                                            if ($value == "U" || empty($value)) {
                                                echo " selected=\"selected\"";
                                            }
                                            echo ">" . $pgv_lang["unknown"] . "</option>\n</select>\n";
                                        } else {
                                            if ($fact == "TYPE" && $level == '3') {
                                                //-- Build array of currently defined values for this Media Fact
                                                foreach ($pgv_lang as $varname => $typeValue) {
                                                    if (substr($varname, 0, 6) == "TYPE__") {
                                                        if ($varname != "TYPE__other") {
                                                            $type[strtolower(substr($varname, 6))] = $typeValue;
                                                        }
                                                    }
                                                }
                                                //-- Sort the array into a meaningful order
                                                array_flip($type);
                                                asort($type);
                                                array_flip($type);
                                                //-- Add "Other" at the end of the list
                                                $type["other"] = $pgv_lang["TYPE__other"];
                                                //-- Build the selector for the Media "TYPE" Fact
                                                echo "<select tabindex=\"" . $tabkey . "\" name=\"text[]\">";
                                                if ($value == "") {
                                                    echo "<option selected=\"selected\" value=\"\" > " . $pgv_lang["choose"] . " </option>";
                                                }
                                                $selectedValue = strtolower($value);
                                                foreach ($type as $typeName => $typeValue) {
                                                    echo "<option value=\"" . $typeName . "\" ";
                                                    if ($selectedValue == $typeName) {
                                                        echo "selected=\"selected\" ";
                                                    }
                                                    echo "> " . $typeValue . " </option>";
                                                }
                                                echo "</select>";
                                            } else {
                                                if ($fact == "NAME" && $upperlevel != 'REPO' || $fact == "_MARNM") {
                                                    // Populated in javascript from sub-tags
                                                    echo "<input type=\"hidden\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" onchange=\"updateTextName('" . $element_id . "');\" value=\"" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "\" />";
                                                    echo "<span id=\"" . $element_id . "_display\">" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "</span>";
                                                    echo " <a href=\"#edit_name\" onclick=\"convertHidden('" . $element_id . "'); return false;\"> ";
                                                    if (isset($PGV_IMAGES["edit_indi"]["small"])) {
                                                        echo "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["edit_indi"]["small"] . "\" border=\"0\" width=\"20\" alt=\"" . $pgv_lang["edit_name"] . "\" align=\"top\" />";
                                                    } else {
                                                        echo "<span class=\"age\">[" . $pgv_lang["edit_name"] . "]</span>";
                                                    }
                                                    echo "</a>";
                                                } else {
                                                    // textarea
                                                    if ($rows > 1) {
                                                        echo "<textarea tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" rows=\"" . $rows . "\" cols=\"" . $cols . "\">" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "</textarea><br />\n";
                                                    } else {
                                                        // text
                                                        echo "<input tabindex=\"" . $tabkey . "\" type=\"text\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" value=\"" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "\" size=\"" . $cols . "\" dir=\"ltr\"";
                                                        echo " class=\"{$fact}\"";
                                                        echo " autocomplete=\"off\"";
                                                        if (in_array($fact, $subnamefacts)) {
                                                            echo " onblur=\"updatewholename();\" onkeyup=\"updatewholename();\"";
                                                        }
                                                        if ($fact == "DATE") {
                                                            echo " onblur=\"valid_date(this);\" onmouseout=\"valid_date(this);\"";
                                                        }
                                                        if ($fact == "LATI") {
                                                            echo " onblur=\"valid_lati_long(this, 'N', 'S');\" onmouseout=\"valid_lati_long(this, 'N', 'S');\"";
                                                        }
                                                        if ($fact == "LONG") {
                                                            echo " onblur=\"valid_lati_long(this, 'E', 'W');\" onmouseout=\"valid_lati_long(this, 'E', 'W');\"";
                                                        }
                                                        //if ($fact=="FILE") echo " onchange=\"if (updateFormat) updateFormat(this.value);\"";
                                                        echo " " . $readOnly . " />\n";
                                                    }
                                                    // split PLAC
                                                    if ($fact == "PLAC" && $readOnly == "") {
                                                        echo "<div id=\"" . $element_id . "_pop\" style=\"display: inline;\">\n";
                                                        print_specialchar_link($element_id, false);
                                                        print_findplace_link($element_id);
                                                        echo "</div>\n";
                                                        echo "<a href=\"javascript:;\" onclick=\"toggle_lati_long();\"><img src=\"images/buttons/target.gif\" border=\"0\" align=\"middle\" alt=\"" . $factarray["LATI"] . " / " . $factarray["LONG"] . "\" title=\"" . $factarray["LATI"] . " / " . $factarray["LONG"] . "\" /></a>";
                                                        if ($SPLIT_PLACES) {
                                                            if (!function_exists("print_place_subfields")) {
                                                                require "includes/functions/functions_places.php";
                                                            }
                                                            setup_place_subfields($element_id);
                                                            print_place_subfields($element_id);
                                                        }
                                                    } else {
                                                        if (($cols > 20 || $fact == "NPFX") && $readOnly == "") {
                                                            print_specialchar_link($element_id, false);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // MARRiage TYPE : hide text field and show a selection list
    if ($fact == "TYPE" and $tags[0] == "MARR") {
        echo "<script type='text/javascript'>";
        echo "document.getElementById('" . $element_id . "').style.display='none'";
        echo "</script>";
        echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "_sel\" onchange=\"document.getElementById('" . $element_id . "').value=this.value;\" >\n";
        foreach (array("Unknown", "Civil", "Religious", "Partners") as $indexval => $key) {
            if ($key == "Unknown") {
                echo "<option value=\"\"";
            } else {
                echo "<option value=\"" . $key . "\"";
            }
            $a = strtolower($key);
            $b = strtolower($value);
            if (@strpos($a, $b) !== false or @strpos($b, $a) !== false) {
                echo " selected=\"selected\"";
            }
            echo ">" . $factarray["MARR_" . strtoupper($key)] . "</option>\n";
        }
        echo "</select>";
    }
    // popup links
    if ($readOnly == "") {
        if ($fact == "DATE") {
            print_calendar_popup($element_id);
        }
        if ($fact == "FAMC") {
            print_findfamily_link($element_id, "");
        }
        if ($fact == "FAMS") {
            print_findfamily_link($element_id, "");
        }
        if ($fact == "ASSO") {
            print_findindi_link($element_id, "");
        }
        if ($fact == "FILE") {
            print_findmedia_link($element_id, "0file");
        }
        if ($fact == "SOUR") {
            print_findsource_link($element_id);
            print_addnewsource_link($element_id);
            //print_autopaste_link($element_id, array("S1", "S2"), false, false, true);
            //-- checkboxes to apply '1 SOUR' to BIRT/MARR/DEAT as '2 SOUR'
            if ($level == 1) {
                echo '<br />';
                if ($PREFER_LEVEL2_SOURCES === '0') {
                    $level1_checked = '';
                    $level2_checked = '';
                } else {
                    if ($PREFER_LEVEL2_SOURCES === '1' || $PREFER_LEVEL2_SOURCES === true) {
                        $level1_checked = '';
                        $level2_checked = ' checked="checked"';
                    } else {
                        $level1_checked = ' checked="checked"';
                        $level2_checked = '';
                    }
                }
                if (strpos($bdm, 'B') !== false) {
                    echo '&nbsp;<input type="checkbox" name="SOUR_INDI" ', $level1_checked, ' value="Y" />';
                    echo $pgv_lang['individual'];
                    if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
                        foreach ($matches[1] as $match) {
                            if (!in_array($match, explode('|', PGV_EVENTS_DEAT))) {
                                echo '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="Y" />';
                                echo $factarray[$match];
                            }
                        }
                    }
                }
                if (strpos($bdm, 'D') !== false) {
                    if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
                        foreach ($matches[1] as $match) {
                            if (in_array($match, explode('|', PGV_EVENTS_DEAT))) {
                                echo '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="Y" />';
                                echo $factarray[$match];
                            }
                        }
                    }
                }
                if (strpos($bdm, 'M') !== false) {
                    echo '&nbsp;<input type="checkbox" name="SOUR_FAM" ', $level1_checked, ' value="Y" />';
                    echo $pgv_lang["family"];
                    if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) {
                        foreach ($matches[1] as $match) {
                            echo '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="Y" />';
                            echo $factarray[$match];
                        }
                    }
                }
            }
        }
        if ($fact == "REPO") {
            print_findrepository_link($element_id);
            print_addnewrepository_link($element_id);
        }
        // Shared Notes Icons ========================================
        // $record=GedcomRecord::getInstance($value);
        if ($fact == "NOTE" && $islink) {
            print_findnote_link($element_id);
            print_addnewnote_link($element_id);
            if ($value != "") {
                echo "&nbsp;&nbsp;&nbsp;";
                print_editnote_link($value);
            }
            // If GEDFAct_assistant/_CENS/ module exists && we are on the INDI page
            // Then show the add Shared note assisted icon, if not  ... do not show
            if ($pid) {
                $type_pid = GedcomRecord::getInstance($pid);
                if (file_exists('modules/GEDFact_assistant/_CENS/census_1_ctrl.php') && $type_pid->getType() == "INDI") {
                    echo "&nbsp;&nbsp;&nbsp;";
                    print_addnewnote_assisted_link($element_id);
                }
            }
            echo "<br />";
        }
        // ===========================================================
        if ($fact == "OBJE") {
            print_findmedia_link($element_id, "1media");
        }
        if ($fact == "OBJE" && !$value) {
            print_addnewmedia_link($element_id);
            $value = "new";
        }
    }
    // current value
    if ($TEXT_DIRECTION == "ltr") {
        if ($fact == "DATE") {
            $date = new GedcomDate($value);
            echo $date->Display(false);
        }
        if (($fact == "ASSO" || $fact == "SOUR" || $fact == "OBJE" || $fact == "NOTE" && $islink) && $value) {
            $record = GedcomRecord::getInstance($value);
            if ($record) {
                echo ' ', PrintReady($record->getFullName()), ' (', $value, ')';
            } else {
                if ($value != "new") {
                    echo ' ', $value;
                }
            }
        }
    } else {
        if ($fact == "DATE") {
            $date = new GedcomDate($value);
            echo getRLM(), $date->Display(false), getRLM();
        }
        if (($fact == "ASSO" || $fact == "SOUR" || $fact == "OBJE" || $fact == "NOTE" && $islink) && $value) {
            $record = GedcomRecord::getInstance($value);
            if ($record) {
                echo getRLM(), PrintReady($record->getFullName()), ' ', getLRM(), '(', $value, ') ', getLRM(), getRLM();
            } else {
                if ($value != "new") {
                    echo getRLM(), $value, ' ', getRLM();
                }
            }
        }
    }
    /*
    	if ($fact=="NOTE" && $islink && $value!="") {
    		include('includes/functions/functions_print_lists.php'); 
    		echo "<tr><td class=\"descriptionbox ".$TEXT_DIRECTION." wrap width25\">";
    				print_help_link("edit_add_SHARED_NOTE_help", "qm");
    			//	echo $pgv_lang["admin_override"];
    			echo "Shared Note Links<br /><br />";
    		echo "</td><td class=\"optionbox wrap\">\n";
    			print_indi_list(fetch_linked_indi($value, "NOTE", "1"));
    		echo "</td></tr>\n";
    	}
    */
    // pastable values
    if ($readOnly == "") {
        if ($fact == "SPFX") {
            print_autopaste_link($element_id, $SPFX_accept);
        }
        if ($fact == "NSFX") {
            print_autopaste_link($element_id, $NSFX_accept);
        }
        if ($fact == "FORM") {
            print_autopaste_link($element_id, $FILE_FORM_accept, false, false);
        }
    }
    if ($noClose != "NOCLOSE") {
        echo "</td></tr>\n";
    }
    $tabkey++;
    return $element_id;
}
Example #4
0
     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;";
     }
 }
 //-- name and size field
 echo "<td class=\"list_value {$TEXT_DIRECTION}\">";
 if ($media["TITL"] != "") {
     echo "<b>", PrintReady($media["TITL"]), "</b>&nbsp;&nbsp;";
     if ($TEXT_DIRECTION == "rtl") {
         echo getRLM();
     }
     echo "(", $media["XREF"], ")";
     if ($TEXT_DIRECTION == "rtl") {
         echo getRLM();
     }
     echo "<br />";
 }
 if (!$embed) {
     echo "<a href=\"javascript:;\" onclick=\"pasteid('", addslashes($media["FILE"]), "');\"><span dir=\"ltr\">", $media["FILE"], "</span></a> -- ";
 } else {
     echo "<a href=\"javascript:;\" onclick=\"pasteid('", $media["XREF"], "', '", addslashes($media["TITL"]), "', '", addslashes($media["THUMB"]), "');\"><span dir=\"ltr\">", $media["FILE"], "</span></a> -- ";
 }
 echo "<a href=\"javascript:;\" onclick=\"return openImage('", rawurlencode($media["FILE"]), "', {$imgwidth}, {$imgheight});\">", $pgv_lang["view"], "</a><br />";
 if (!$media["EXISTS"] && !isFileExternal($media["FILE"])) {
     echo $media["FILE"], "<br /><span class=\"error\">", $pgv_lang["file_not_exists"], "</span><br />";
 } else {
     if (!isFileExternal($media["FILE"]) && !empty($imgsize[0])) {
         echo "<br /><sub>&nbsp;&nbsp;", $pgv_lang["image_size"], " -- ", $imgsize[0], "x", $imgsize[1], "</sub><br />";
     }
Example #5
0
     if ($count > 18) {
         $col = 3;
     } else {
         if ($count > 6) {
             $col = 2;
         }
     }
 }
 $newcol = ceil($count / $col);
 print "<td class=\"list_label\" colspan=\"{$col}\">";
 print $TableTitle;
 print "</td></tr><tr>\n";
 print "<td class=\"list_value\" style=\"padding: 14px;\">\n";
 foreach ($surnames as $surname => $namecount) {
     if (begRTLText($namecount["name"])) {
         print "<div class =\"rtl\" dir=\"rtl\">&nbsp;<a href=\"aliveinyear.php?year={$year}&amp;alpha=" . $alpha . "&amp;surname_sublist={$surname_sublist}&amp;surname=" . urlencode($namecount["name"]) . "\">&nbsp;" . PrintReady($namecount["name"]) . getRLM() . " - [" . $namecount["match"] . "]" . getRLM();
     } else {
         if (substr($namecount["name"], 0, 5) == "@N.N.") {
             print "<div class =\"ltr\" dir=\"ltr\">&nbsp;<a href=\"aliveinyear.php?year={$year}&amp;alpha=" . $namecount["alpha"] . "&amp;surname_sublist={$surname_sublist}&amp;surname=@N.N.\">&nbsp;" . $pgv_lang["NN"] . getLRM() . " - [" . $namecount["match"] . "]" . getLRM() . "&nbsp;";
         } else {
             print "<div class =\"ltr\" dir=\"ltr\">&nbsp;<a href=\"aliveinyear.php?year={$year}&amp;alpha=" . $alpha . "&amp;surname_sublist={$surname_sublist}&amp;surname=" . urlencode($namecount["name"]) . "\">" . PrintReady($namecount["name"]) . getLRM() . " - [" . $namecount["match"] . "]" . getLRM();
         }
     }
     print "</a>&nbsp;</div>\n";
     $count_indi += $namecount["match"];
     $i++;
     if ($i == $newcol && $i < $count) {
         print "</td><td class=\"list_value\" style=\"padding: 14px;\">\n";
         $newcol = $i + ceil($count / $col);
     }
 }
Example #6
0
function print_user_messages($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $PGV_IMAGE_DIR, $TEXT_DIRECTION, $PGV_STORE_MESSAGES, $PGV_IMAGES;
    $usermessages = getUserMessages(PGV_USER_NAME);
    $id = "user_messages";
    $title = print_help_link("mygedview_message_help", "qm", "", false, true);
    $title .= $pgv_lang["my_messages"] . "&nbsp;&nbsp;";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    $title .= "(" . count($usermessages) . ")";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    $content = "";
    $content .= "<form name=\"messageform\" action=\"\" onsubmit=\"return confirm('" . $pgv_lang["confirm_message_delete"] . "');\">";
    if (count($usermessages) == 0) {
        $content .= $pgv_lang["no_messages"] . "<br />";
    } else {
        $content .= '
			<script language="JavaScript" type="text/javascript">
			<!--
				function select_all() {
					';
        foreach ($usermessages as $key => $message) {
            if (isset($message["id"])) {
                $key = $message["id"];
            }
            $content .= '
						var cb = document.getElementById("cb_message' . $key . '");
						if (cb) {
							if (!cb.checked) cb.checked = true;
							else cb.checked = false;
						}
						';
        }
        $content .= '
				return false;
			}
			//-->
			</script>
		';
        $content .= "<input type=\"hidden\" name=\"action\" value=\"deletemessage\" />";
        $content .= "<table class=\"list_table\"><tr>";
        $content .= "<td class=\"list_label\">" . $pgv_lang["delete"] . "<br /><a href=\"javascript:;\" onclick=\"return select_all();\">" . $pgv_lang["all"] . "</a></td>";
        $content .= "<td class=\"list_label\">" . $pgv_lang["message_subject"] . "</td>";
        $content .= "<td class=\"list_label\">" . $pgv_lang["date_created"] . "</td>";
        $content .= "<td class=\"list_label\">" . $pgv_lang["message_from"] . "</td>";
        $content .= "</tr>";
        foreach ($usermessages as $key => $message) {
            if (isset($message["id"])) {
                $key = $message["id"];
            }
            $content .= "<tr>";
            $content .= "<td class=\"list_value_wrap\"><input type=\"checkbox\" id=\"cb_message{$key}\" name=\"message_id[]\" value=\"{$key}\" /></td>";
            $showmsg = preg_replace("/(\\w)\\/(\\w)/", "\$1/<span style=\"font-size:1px;\"> </span>\$2", PrintReady($message["subject"]));
            $showmsg = str_replace("@", "@<span style=\"font-size:1px;\"> </span>", $showmsg);
            $content .= "<td class=\"list_value_wrap\"><a href=\"javascript:;\" onclick=\"expand_layer('message{$key}'); return false;\"><img id=\"message{$key}_img\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["plus"]["other"] . "\" border=\"0\" alt=\"" . $pgv_lang["show_details"] . "\" title=\"" . $pgv_lang["show_details"] . "\" /> <b>" . $showmsg . "</b></a></td>";
            if (!empty($message["created"])) {
                $time = strtotime($message["created"]);
            } else {
                $time = time();
            }
            $content .= "<td class=\"list_value_wrap\">" . format_timestamp($time) . "</td>";
            $content .= "<td class=\"list_value_wrap\">";
            $user_id = get_user_id($message["from"]);
            if ($user_id) {
                $content .= PrintReady(getUserFullName($user_id));
                if ($TEXT_DIRECTION == "ltr") {
                    $content .= " " . getLRM() . " - " . htmlspecialchars($user_id, ENT_COMPAT, 'UTF-8') . getLRM();
                } else {
                    $content .= " " . getRLM() . " - " . htmlspecialchars($user_id, ENT_COMPAT, 'UTF-8') . getRLM();
                }
            } else {
                $content .= "<a href=\"mailto:" . $message["from"] . "\">" . str_replace("@", "@<span style=\"font-size:1px;\"> </span>", $message["from"]) . "</a>";
            }
            $content .= "</td>";
            $content .= "</tr>";
            $content .= "<tr><td class=\"list_value_wrap\" colspan=\"5\"><div id=\"message{$key}\" style=\"display: none;\">";
            $message["body"] = nl2br(htmlspecialchars($message["body"], ENT_COMPAT, 'UTF-8'));
            $message["body"] = expand_urls($message["body"]);
            $content .= PrintReady($message["body"]) . "<br /><br />";
            if (strpos($message["subject"], "RE:") === false) {
                $message["subject"] = "RE:" . $message["subject"];
            }
            if ($user_id) {
                $content .= "<a href=\"javascript:;\" onclick=\"reply('" . $user_id . "', '" . $message["subject"] . "'); return false;\">" . $pgv_lang["reply"] . "</a> | ";
            }
            $content .= "<a href=\"" . encode_url("index.php?action=deletemessage&message_id={$key}") . "\" onclick=\"return confirm('" . $pgv_lang["confirm_message_delete"] . "');\">" . $pgv_lang["delete"] . "</a></div></td></tr>";
        }
        $content .= "</table>";
        $content .= "<input type=\"submit\" value=\"" . $pgv_lang["delete_selected_messages"] . "\" /><br /><br />";
    }
    if (get_user_count() > 1) {
        $content .= $pgv_lang["message"] . " <select name=\"touser\">";
        if (PGV_USER_IS_ADMIN) {
            $content .= "<option value=\"all\">" . $pgv_lang["broadcast_all"] . "</option>";
            $content .= "<option value=\"never_logged\">" . $pgv_lang["broadcast_never_logged_in"] . "</option>";
            $content .= "<option value=\"last_6mo\">" . $pgv_lang["broadcast_not_logged_6mo"] . "</option>";
        }
        foreach (get_all_users() as $user_id => $user_name) {
            if ($user_id != PGV_USER_ID && get_user_setting($user_id, 'verified_by_admin') == 'yes' && get_user_setting($user_id, 'contactmethod') != 'none') {
                $content .= "<option value=\"" . $user_name . "\">" . PrintReady(getUserFullName($user_id)) . " ";
                if ($TEXT_DIRECTION == "ltr") {
                    $content .= stripLRMRLM(getLRM() . " - " . $user_name . getLRM());
                } else {
                    $content .= stripLRMRLM(getRLM() . " - " . $user_name . getRLM());
                }
                $content .= "</option>";
            }
        }
        $content .= "</select><input type=\"button\" value=\"" . $pgv_lang["send"] . "\" onclick=\"message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, 'messaging2', ''); return false;\" />";
    }
    $content .= "</form>";
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
}
Example #7
0
    static function userMessages()
    {
        global $pgv_lang, $PGV_IMAGE_DIR, $TEXT_DIRECTION, $PGV_STORE_MESSAGES, $PGV_IMAGES;
        $usermessages = getUserMessages(PGV_USER_NAME);
        $content = "<form name=\"messageform\" action=\"\" onsubmit=\"return confirm('{$pgv_lang['confirm_message_delete']}');\">";
        if (count($usermessages) == 0) {
            $content .= "{$pgv_lang['no_messages']}<br />\n";
        } else {
            $content .= '
				<script language="JavaScript" type="text/javascript">
				<!--
					function select_all() {
			';
            foreach ($usermessages as $k => $message) {
                if (isset($message['id'])) {
                    $k = $message['id'];
                }
                $content .= '
					var cb = document.getElementById("cb_message' . $k . '");
					if (cb) {
						if (!cb.checked) cb.checked = true;
						else cb.checked = false;
					}
				';
            }
            $content .= '
					return false;
				}
				//-->
				</script>
			';
            $content .= '<input type="hidden" name="action" value="deletemessage" />' . '<table class="list_table"><tr>' . "<td class=\"list_label\">{$pgv_lang['delete']}<br />\n<a href=\"javascript:;\" onclick=\"return select_all();\">{$pgv_lang['all']}</a></td>\n" . "<td class=\"list_label\">{$pgv_lang['message_subject']}</td>\n" . "<td class=\"list_label\">{$pgv_lang['date_created']}</td>\n" . "<td class=\"list_label\">{$pgv_lang['message_from']}</td>\n" . "</tr>\n";
            foreach ($usermessages as $k => $message) {
                if (isset($message['id'])) {
                    $k = $message['id'];
                }
                $content .= "<tr>\n<td class=\"list_value_wrap\"><input type=\"checkbox\" id=\"cb_message{$k}\" name=\"message_id[]\" value=\"{$k}\" /></td>\n";
                $showmsg = preg_replace("/(\\w)\\/(\\w)/", "\$1/<span style=\"font-size:1px;\"> </span>\$2", PrintReady($message['subject']));
                $showmsg = preg_replace("/@/", "@<span style=\"font-size:1px;\"> </span>", $showmsg);
                $content .= "<td class=\"list_value_wrap\"><a href=\"javascript:;\" onclick=\"expand_layer('message{$k}'); return false;\"><b>{$showmsg}</b> <img id=\"message{$k}_img\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['plus']['other']}\" border=\"0\" alt=\"\" title=\"\" /></a></td>\n";
                if (!empty($message['created'])) {
                    $t = strtotime($message['created']);
                } else {
                    $t = time();
                }
                $content .= '<td class="list_value_wrap">' . format_timestamp($t) . "</td>\n" . '<td class="list_value_wrap">';
                $user_id = get_user_id($message['from']);
                if ($user_id) {
                    $content .= PrintReady(getUserFullName($user_id));
                    if ($TEXT_DIRECTION == 'ltr') {
                        $content .= ' ' . getLRM() . ' - ' . htmlspecialchars($user_id, ENT_COMPAT, 'UTF-8') . getLRM();
                    } else {
                        $content .= ' ' . getRLM() . ' - ' . htmlspecialchars($user_id, ENT_COMPAT, 'UTF-8') . getRLM();
                    }
                } else {
                    $content .= "<a href=\"mailto:{$user_id}\">" . preg_replace("/@/", "@<span style=\"font-size:1px;\"> </span>", $user_id) . '</a>';
                }
                $content .= "</td>\n" . "</tr>\n" . "<tr>\n<td class=\"list_value_wrap\" colspan=\"5\"><div id=\"message{$k}\" style=\"display: none;\">";
                $message['body'] = expand_urls(nl2br(htmlspecialchars($message['body'], ENT_COMPAT, 'UTF-8')));
                $content .= PrintReady($message['body']) . "<br />\n<br />\n";
                if (preg_match("/RE:/", $message["subject"]) == 0) {
                    $message['subject'] = "RE:{$message['subject']}";
                }
                if ($user_id) {
                    $content .= "<a href=\"javascript:;\" onclick=\"reply('{$user_id}', '{$message['subject']}'); return false;\">{$pgv_lang['reply']}</a> | ";
                }
                $content .= "<a href=\"" . encode_url("index.php?action=deletemessage&message_id={$k}") . "\" onclick=\"return confirm('{$pgv_lang['confirm_message_delete']}');\">{$pgv_lang['delete']}</a></div></td>\n</tr>\n";
            }
            $content .= "</table>\n" . "<input type=\"submit\" value=\"{$pgv_lang['delete_selected_messages']}\" /><br />\n<br />\n";
        }
        if (get_user_count() > 1) {
            $content .= "{$pgv_lang['message']} <select name=\"touser\">";
            if (PGV_USER_IS_ADMIN) {
                $content .= "<option value=\"all\">{$pgv_lang['broadcast_all']}</option>\n" . "<option value=\"never_logged\">{$pgv_lang['broadcast_never_logged_in']}</option>\n" . "<option value=\"last_6mo\">{$pgv_lang['broadcast_not_logged_6mo']}</option>\n";
            }
            foreach (get_all_users() as $user_id => $user_name) {
                if ($user_id != PGV_USER_ID && get_user_setting($user_id, 'verified_by_admin') == 'yes') {
                    $content .= "<option value=\"{$user_id}\">" . PrintReady(getUserFullName($user_id)) . ' ';
                    if ($TEXT_DIRECTION == 'ltr') {
                        $content .= getLRM() . " - {$user_id}" . getLRM();
                    } else {
                        $content .= getRLM() . " - {$user_id}" . getRLM();
                    }
                    $content .= "</option>\n";
                }
            }
            $content .= "</select>\n<input type=\"button\" value=\"{$pgv_lang['send']}\" onclick=\"message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, 'messaging2', ''); return false;\" />\n";
        }
        $content .= "</form>\n";
        return $content;
    }
Example #8
0
 function _eventQuery($type, $direction, $facts)
 {
     global $TBLPREFIX, $pgv_lang, $SHOW_ID_NUMBERS, $listDir;
     $eventTypes = array('BIRT' => $pgv_lang['htmlplus_block_birth'], 'DEAT' => $pgv_lang['htmlplus_block_death'], 'MARR' => $pgv_lang['htmlplus_block_marrage'], 'ADOP' => $pgv_lang['htmlplus_block_adoption'], 'BURI' => $pgv_lang['htmlplus_block_burial'], 'CENS' => $pgv_lang['htmlplus_block_census']);
     $fact_query = "IN ('" . str_replace('|', "','", $facts) . "')";
     if ($direction != 'ASC') {
         $direction = 'DESC';
     }
     $rows = self::_runSQL('' . ' SELECT' . ' d_gid AS id,' . ' d_year AS year,' . ' d_fact AS fact,' . ' d_type AS type' . ' FROM' . " {$TBLPREFIX}dates" . ' WHERE' . " d_file={$this->_ged_id} AND" . " d_gid!='HEAD' AND" . " d_fact {$fact_query} AND" . ' d_julianday1!=0' . ' ORDER BY' . " d_julianday1 {$direction}, d_type", 1);
     if (!isset($rows[0])) {
         return '';
     }
     $row = $rows[0];
     $record = GedcomRecord::getInstance($row['id']);
     switch ($type) {
         default:
         case 'full':
             if ($record->canDisplayDetails()) {
                 $result = $record->format_list('span', false, $record->getFullName());
             } else {
                 $result = $pgv_lang['privacy_error'];
             }
             break;
         case 'year':
             $date = new GedcomDate($row['type'] . ' ' . $row['year']);
             $result = $date->Display(true);
             break;
         case 'type':
             if (isset($eventTypes[$row['fact']])) {
                 $result = $eventTypes[$row['fact']];
             } else {
                 $result = '';
             }
             break;
         case 'name':
             $id = '';
             if ($SHOW_ID_NUMBERS) {
                 if ($listDir == 'rtl') {
                     $id = "&nbsp;&nbsp;" . getRLM() . "({$row['id']})" . getRLM();
                 } else {
                     $id = "&nbsp;&nbsp;({$row['id']})";
                 }
             }
             $result = "<a href=\"" . $record->getLinkUrl() . "\">" . PrintReady($record->getFullName()) . "{$id}</a>";
             break;
         case 'place':
             $result = format_fact_place($record->getFactByType($row['fact']), true, true, true);
             break;
     }
     return str_replace('<a href="', '<a href="' . $this->_server_url, $result);
 }