Exemplo n.º 1
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype;
     require_once WT_ROOT . 'includes/functions/functions_print_lists.php';
     $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     $sortStyle = get_block_setting($block_id, 'sortStyle', 'date_desc');
     $hide_empty = get_block_setting($block_id, 'hide_empty', false);
     $block = get_block_setting($block_id, 'block', true);
     if ($cfg) {
         foreach (array('days', 'infoStyle', 'show_parents', 'sortStyle', 'hide_empty', 'block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     $found_facts = get_recent_changes(WT_CLIENT_JD - $days);
     if (!$found_facts && $hide_empty) {
         return '';
     }
     // Print block header
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
         $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
     } else {
         $title = '';
     }
     $title .= WT_I18N::plural('Changes in the last day', 'Changes in the last %s days', $days, WT_I18N::number($days));
     $content = '';
     // Print block content
     if (count($found_facts) == 0) {
         $content .= WT_I18N::translate('There have been no changes within the last %s days.', WT_I18N::number($days));
     } else {
         ob_start();
         switch ($infoStyle) {
             case 'list':
                 $content .= print_changes_list($found_facts, $sortStyle);
                 break;
             case 'table':
                 // sortable table
                 $content .= print_changes_table($found_facts, $sortStyle);
                 break;
         }
         $content .= ob_get_clean();
     }
     if ($template) {
         if ($block) {
             require WT_THEME_DIR . 'templates/block_small_temp.php';
         } else {
             require WT_THEME_DIR . 'templates/block_main_temp.php';
         }
     } else {
         return $content;
     }
 }
Exemplo n.º 2
0
/**
 * Prints Exection Statistics
 *
 * prints out the execution time and the databse queries
 */
function execution_stats()
{
    global $start_time;
    return '<div class="execution_stats">' . WT_I18N::translate('Execution time: %1$s seconds. Database queries: %2$s. Memory usage: %3$s KB.', WT_I18N::number(microtime(true) - $start_time, 3), WT_I18N::number(WT_DB::getQueryCount()), WT_I18N::number(memory_get_peak_usage(true) / 1024)) . '</div>';
}
Exemplo n.º 3
0
			<input type="hidden" name="action" value="register">
			<h4>', WT_I18N::translate('All fields must be completed.'), '</h4><hr>
			<div>
				<label for="user_realname">', WT_I18N::translate('Real name'), help_link('real_name'), '<input type="text" id="user_realname" name="user_realname" required maxlength="64" value="', WT_Filter::escapeHtml($user_realname), '" autofocus>
				</label>
			</div>
			<div>
				<label for="user_email">', WT_I18N::translate('Email address'), help_link('email'), '<input type="email" id="user_email" name="user_email" required maxlength="64" value="', WT_Filter::escapeHtml($user_email), '">
				</label>
			</div>
			<div>
				<label for="username">', WT_I18N::translate('Desired user name'), help_link('username'), '<input type="text" id="username" name="user_name" required maxlength="32" value="', WT_Filter::escapeHtml($user_name), '">
				</label>
			</div>
			<div>
				<label for="user_password01">', WT_I18N::translate('Desired password'), help_link('password'), '<input type="password" id="user_password01" name="user_password01" value="', WT_Filter::escapeHtml($user_password01), '" required placeholder="', WT_I18N::plural('Use at least %s character.', 'Use at least %s characters.', WT_MINIMUM_PASSWORD_LENGTH, WT_I18N::number(WT_MINIMUM_PASSWORD_LENGTH)), '" pattern="' . WT_REGEX_PASSWORD . '" onchange="form.user_password02.pattern = regex_quote(this.value);">
				</label>
			</div>
			<div>
				<label for="user_password02">', WT_I18N::translate('Confirm password'), help_link('password_confirm'), '<input type="password" id="user_password02" name="user_password02" value="', WT_Filter::escapeHtml($user_password02), '" required placeholder="', WT_I18N::translate('Type the password again.'), '" pattern="' . WT_REGEX_PASSWORD . '">
				</label>
			</div>
			<div>
				<label for="user_comments">', WT_I18N::translate('Comments'), help_link('register_comments'), '<textarea cols="50" rows="5" id="user_comments" name="user_comments" required placeholder="', WT_I18N::translate('Explain why you are requesting an account.'), '">', WT_Filter::escapeHtml($user_comments), '</textarea>
				</label>
			</div>
			<hr>
			<div id="registration-submit">
				<input type="submit" value="', WT_I18N::translate('continue'), '">
			</div>
		</form>
Exemplo n.º 4
0
    private function adminPlaceCheck()
    {
        require_once WT_ROOT . 'includes/functions/functions_edit.php';
        $action = WT_Filter::get('action', '', 'go');
        $gedcom_id = WT_Filter::get('gedcom_id', null, WT_GED_ID);
        $country = WT_Filter::get('country', '.+', 'XYZ');
        $state = WT_Filter::get('state', '.+', 'XYZ');
        $matching = WT_Filter::getBool('matching');
        $controller = new WT_Controller_Page();
        $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Google Maps™'))->pageHeader();
        echo '
			<table id="gm_config">
				<tr>
					<th>
						<a href="module.php?mod=googlemap&amp;mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>
					</th>
					<th>
						<a href="module.php?mod=googlemap&amp;mod_action=admin_places">
							', WT_I18N::translate('Geographic data'), '
						</a>
					</th>
					<th>
						<a class="current" href="module.php?mod=googlemap&amp;mod_action=admin_placecheck">
							', WT_I18N::translate('Place check'), '
						</a>
					</th>
				</tr>
			</table>';
        //Start of User Defined options
        echo '
			<form method="get" name="placecheck" action="module.php">
				<input type="hidden" name="mod" value="', $this->getName(), '">
				<input type="hidden" name="mod_action" value="admin_placecheck">
				<div class="gm_check">
					<label>', WT_I18N::translate('Family tree'), '</label>';
        echo select_edit_control('gedcom_id', WT_Tree::getIdList(), null, $gedcom_id, ' onchange="this.form.submit();"');
        echo '<label>', WT_I18N::translate('Country'), '</label>
					<select name="country" onchange="this.form.submit();">
						<option value="XYZ" selected="selected">', WT_I18N::translate('&lt;select&gt;'), '</option>
						<option value="XYZ">', WT_I18N::translate('All'), '</option>';
        $rows = WT_DB::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place")->fetchAssoc();
        foreach ($rows as $id => $place) {
            echo '<option value="', WT_Filter::escapeHtml($place), '"';
            if ($place == $country) {
                echo ' selected="selected"';
                $par_id = $id;
            }
            echo '>', WT_Filter::escapeHtml($place), '</option>';
        }
        echo '</select>';
        if ($country != 'XYZ') {
            echo '<label>', WT_I18N::translate('Subdivision'), '</label>
							<select name="state" onchange="this.form.submit();">
								<option value="XYZ" selected="selected">', WT_I18N::translate('&lt;select&gt;'), '</option>
								<option value="XYZ">', WT_I18N::translate('All'), '</option>';
            $places = WT_DB::prepare("SELECT pl_place FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place")->execute(array($par_id))->fetchOneColumn();
            foreach ($places as $place) {
                echo '<option value="', WT_Filter::escapeHtml($place), '"', $place == $state ? ' selected="selected"' : '', '>', WT_Filter::escapeHtml($place), '</option>';
            }
            echo '</select>';
        }
        echo '<label>', WT_I18N::translate('Include fully matched places: '), '</label>';
        echo '<input type="checkbox" name="matching" value="1" onchange="this.form.submit();"';
        if ($matching) {
            echo ' checked="checked"';
        }
        echo '>';
        echo '</div>';
        // close div gm_check
        echo '<input type="hidden" name="action" value="go">';
        echo '</form>';
        //close form placecheck
        echo '<hr>';
        switch ($action) {
            case 'go':
                //Identify gedcom file
                $trees = WT_Tree::getAll();
                echo '<div id="gm_check_title">', $trees[$gedcom_id]->tree_title_html, '</div>';
                //Select all '2 PLAC ' tags in the file and create array
                $place_list = array();
                $ged_data = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?")->execute(array("%\n2 PLAC %", $gedcom_id))->fetchOneColumn();
                foreach ($ged_data as $ged_datum) {
                    preg_match_all('/\\n2 PLAC (.+)/', $ged_datum, $matches);
                    foreach ($matches[1] as $match) {
                        $place_list[$match] = true;
                    }
                }
                $ged_data = WT_DB::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?")->execute(array("%\n2 PLAC %", $gedcom_id))->fetchOneColumn();
                foreach ($ged_data as $ged_datum) {
                    preg_match_all('/\\n2 PLAC (.+)/', $ged_datum, $matches);
                    foreach ($matches[1] as $match) {
                        $place_list[$match] = true;
                    }
                }
                // Unique list of places
                $place_list = array_keys($place_list);
                // Apply_filter
                if ($country == 'XYZ') {
                    $filter = '.*$';
                } else {
                    $filter = preg_quote($country) . '$';
                    if ($state != 'XYZ') {
                        $filter = preg_quote($state) . ', ' . $filter;
                    }
                }
                $place_list = preg_grep('/' . $filter . '/', $place_list);
                //sort the array, limit to unique values, and count them
                usort($place_list, array('WT_I18N', 'strcasecmp'));
                $i = count($place_list);
                //calculate maximum no. of levels to display
                $x = 0;
                $max = 0;
                while ($x < $i) {
                    $levels = explode(",", $place_list[$x]);
                    $parts = count($levels);
                    if ($parts > $max) {
                        $max = $parts;
                    }
                    $x++;
                }
                $x = 0;
                //scripts for edit, add and refresh
                ?>
			<script>
			function edit_place_location(placeid) {
				window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid, '_blank', gmap_window_specs);
				return false;
			}

			function add_place_location(placeid) {
				window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid, '_blank', gmap_window_specs);
				return false;
			}
			</script>
			<?php 
                //start to produce the display table
                $cols = 0;
                $span = $max * 3 + 3;
                echo '<div class="gm_check_details">';
                echo '<table class="gm_check_details"><tr>';
                echo '<th rowspan="3">', WT_I18N::translate('Place'), '</th>';
                echo '<th colspan="', $span, '">', WT_I18N::translate('Geographic data'), '</th></tr>';
                echo '<tr>';
                while ($cols < $max) {
                    if ($cols == 0) {
                        echo '<th colspan="3">', WT_I18N::translate('Country'), '</th>';
                    } else {
                        echo '<th colspan="3">', WT_I18N::translate('Level'), '&nbsp;', $cols + 1, '</th>';
                    }
                    $cols++;
                }
                echo '</tr><tr>';
                $cols = 0;
                while ($cols < $max) {
                    echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th><th>', WT_I18N::translate('Latitude'), '</th><th>', WT_I18N::translate('Longitude'), '</th>';
                    $cols++;
                }
                echo '</tr>';
                $countrows = 0;
                $matched = array();
                while ($x < $i) {
                    $placestr = "";
                    $levels = explode(",", $place_list[$x]);
                    $parts = count($levels);
                    $levels = array_reverse($levels);
                    $placestr .= "<a href=\"placelist.php?action=show";
                    foreach ($levels as $pindex => $ppart) {
                        $ppart = urlencode(trim($ppart));
                        $placestr .= "&amp;parent[{$pindex}]=" . $ppart . "";
                    }
                    $placestr .= "\">" . $place_list[$x] . "</a>";
                    $gedplace = "<tr><td>" . $placestr . "</td>";
                    $z = 0;
                    $id = 0;
                    $level = 0;
                    $matched[$x] = 0;
                    // used to exclude places where the gedcom place is matched at all levels
                    $mapstr_edit = "<a href=\"#\" onclick=\"edit_place_location('";
                    $mapstr_add = "<a href=\"#\" onclick=\"add_place_location('";
                    $mapstr3 = "";
                    $mapstr4 = "";
                    $mapstr5 = "')\" title='";
                    $mapstr6 = "' >";
                    $mapstr7 = "')\">";
                    $mapstr8 = "</a>";
                    $plac = array();
                    $lati = array();
                    $long = array();
                    while ($z < $parts) {
                        if ($levels[$z] == ' ' || $levels[$z] == '') {
                            $levels[$z] = "unknown";
                        }
                        // GoogleMap module uses "unknown" while GEDCOM uses , ,
                        $levels[$z] = rtrim(ltrim($levels[$z]));
                        $placelist = $this->createPossiblePlaceNames($levels[$z], $z + 1);
                        // add the necessary prefix/postfix values to the place name
                        foreach ($placelist as $key => $placename) {
                            $row = WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")->execute(array($z, $id, $placename))->fetchOneRow(PDO::FETCH_ASSOC);
                            if (!empty($row['pl_id'])) {
                                $row['pl_placerequested'] = $levels[$z];
                                // keep the actual place name that was requested so we can display that instead of what is in the db
                                break;
                            }
                        }
                        if ($row['pl_id'] != '') {
                            $id = $row['pl_id'];
                        }
                        if ($row['pl_place'] != '') {
                            $placestr2 = $mapstr_edit . $id . "&amp;level=" . $level . $mapstr3 . $mapstr5 . WT_I18N::translate('Zoom=') . $row['pl_zoom'] . $mapstr6 . $row['pl_placerequested'] . $mapstr8;
                            if ($row['pl_place'] == 'unknown') {
                                $matched[$x]++;
                            }
                        } else {
                            if ($levels[$z] == "unknown") {
                                $placestr2 = $mapstr_add . $id . "&amp;level=" . $level . $mapstr3 . $mapstr7 . "<strong>" . rtrim(ltrim(WT_I18N::translate('unknown'))) . "</strong>" . $mapstr8;
                                $matched[$x]++;
                            } else {
                                $placestr2 = $mapstr_add . $id . "&amp;place_name=" . urlencode($levels[$z]) . "&amp;level=" . $level . $mapstr3 . $mapstr7 . '<span class="error">' . rtrim(ltrim($levels[$z])) . '</span>' . $mapstr8;
                                $matched[$x]++;
                            }
                        }
                        $plac[$z] = "<td>" . $placestr2 . "</td>\n";
                        if ($row['pl_lati'] == '0') {
                            $lati[$z] = "<td class='error'><strong>" . $row['pl_lati'] . "</strong></td>";
                        } elseif ($row['pl_lati'] != '') {
                            $lati[$z] = "<td>" . $row['pl_lati'] . "</td>";
                        } else {
                            $lati[$z] = "<td class='error center'><strong>X</strong></td>";
                            $matched[$x]++;
                        }
                        if ($row['pl_long'] == '0') {
                            $long[$z] = "<td class='error'><strong>" . $row['pl_long'] . "</strong></td>";
                        } elseif ($row['pl_long'] != '') {
                            $long[$z] = "<td>" . $row['pl_long'] . "</td>";
                        } else {
                            $long[$z] = "<td class='error center'><strong>X</strong></td>";
                            $matched[$x]++;
                        }
                        $level++;
                        $mapstr3 = $mapstr3 . "&amp;parent[" . $z . "]=" . WT_Filter::escapeJs($row['pl_placerequested']);
                        $mapstr4 = $mapstr4 . "&amp;parent[" . $z . "]=" . WT_Filter::escapeJs($levels[$z]);
                        $z++;
                    }
                    if ($matching) {
                        $matched[$x] = 1;
                    }
                    if ($matched[$x] != 0) {
                        echo $gedplace;
                        $z = 0;
                        while ($z < $max) {
                            if ($z < $parts) {
                                echo $plac[$z];
                                echo $lati[$z];
                                echo $long[$z];
                            } else {
                                echo '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
                            }
                            $z++;
                        }
                        echo '</tr>';
                        $countrows++;
                    }
                    $x++;
                }
                // echo final row of table
                echo '<tr><td colspan="2" class="accepted">', WT_I18N::translate('Total places: %s', WT_I18N::number($countrows)), '</td></tr></table></div>';
                break;
            default:
                // Do not run until user selects a gedcom/place/etc.
                // Instead, show some useful help info.
                echo '<div class="gm_check_top accepted">', WT_I18N::translate('This will list all the places from the selected GEDCOM file. By default this will NOT INCLUDE places that are fully matched between the GEDCOM file and the GoogleMap tables'), '</div>';
                break;
        }
    }
Exemplo n.º 5
0
function set_params($current, $indfam, $xg, $zg, $titstr, $xt, $yt, $gx, $gz, $myfunc)
{
    global $x_as, $y_as, $z_as, $n1, $months;
    global $legend, $xdata, $ydata, $xmax, $zmax, $zgrenzen, $xgiven, $zgiven, $percentage, $male_female;
    global $stats;
    if (!function_exists($myfunc)) {
        echo WT_I18N::translate('%s not implemented', $myfunc);
        exit;
    }
    $monthdata = array();
    for ($i = 0; $i < 12; ++$i) {
        $monthdata[$i] = WT_Date_Gregorian::monthNameNominativeCase($i + 1, false);
    }
    $months = array('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC');
    if ($x_as == $current) {
        if (($x_as == 13 || $x_as == 15) && $z_as == 301) {
            $z_as = 300;
        }
        $xgiven = $xg;
        $zgiven = $zg;
        $title = $titstr;
        $xtitle = $xt;
        $ytitle = WT_I18N::translate('numbers');
        $grenzen_xas = $gx;
        $grenzen_zas = $gz;
        if ($xg == true) {
            $xdata = $monthdata;
            $xmax = 12;
        } else {
            calc_axis($grenzen_xas);
        }
        if ($z_as != 300 && $z_as != 301) {
            calc_legend($grenzen_zas);
        }
        $percentage = false;
        if ($y_as == 201) {
            $percentage = false;
            if ($current == 13 || $current == 15 || $current == 16 || $current == 21) {
                $ytitle = WT_I18N::translate('Families');
            } else {
                if ($current == 14) {
                    $ytitle = WT_I18N::translate('Children');
                } else {
                    $ytitle = WT_I18N::translate('Individuals');
                }
            }
        } else {
            if ($y_as == 202) {
                $percentage = true;
                $ytitle = WT_I18N::translate('percentage');
            }
        }
        $male_female = false;
        if ($z_as == 300) {
            $zgiven = false;
            $legend[0] = 'all';
            $zmax = 1;
            $zgrenzen[0] = 100000;
        } else {
            if ($z_as == 301) {
                $male_female = true;
                $zgiven = true;
                $legend[0] = WT_I18N::translate('Male');
                $legend[1] = WT_I18N::translate('Female');
                $zmax = 2;
                $xtitle = $xtitle . WT_I18N::translate(' per gender');
            } else {
                if ($z_as == 302) {
                    $xtitle = $xtitle . WT_I18N::translate(' per time period');
                }
            }
        }
        //-- reset the data array
        for ($i = 0; $i < $zmax; $i++) {
            for ($j = 0; $j < $xmax; $j++) {
                $ydata[$i][$j] = 0;
            }
        }
        $myfunc();
        if ($indfam == 'IND') {
            $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalIndividuals();
        } else {
            if ($x_as == 21) {
                $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalChildren();
            } else {
                $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalFamilies();
            }
        }
        myplot($hstr, $zmax, $xdata, $xtitle, $ydata, $ytitle, $legend);
    }
}
Exemplo n.º 6
0
                    echo " onclick=\"statusDisable('zas-grenzen-periode');";
                    echo '"><label for="z_sex">', WT_I18N::translate('gender'), '</label><br>';
                    echo '<input type="radio" id="z_time" name="z-as" value="302"';
                    if ($plotshow == "302") {
                        echo ' checked="checked"';
                    }
                    echo " onclick=\"statusEnable('zas-grenzen-periode');";
                    echo '"><label for="z_time">', WT_I18N::translate('date periods'), '</label><br><br>';
                    echo WT_I18N::translate('Date range'), '<br>';
                    echo '<select id="zas-grenzen-periode" name="zas-grenzen-periode">
				<option value="1700,1750,1800,1850,1900,1950,2000" selected="selected">', WT_I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 50, WT_I18N::digits(1700), WT_I18N::number(50)), '</option>
				<option value="1800,1840,1880,1920,1950,1970,2000">', WT_I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 40, WT_I18N::digits(1800), WT_I18N::number(40)), '</option>
				<option value="1800,1850,1900,1950,2000">', WT_I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 50, WT_I18N::digits(1800), WT_I18N::number(50)), '</option>
				<option value="1900,1920,1940,1960,1980,1990,2000">', WT_I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 20, WT_I18N::digits(1900), WT_I18N::number(20)), '</option>
				<option value="1900,1925,1950,1975,2000">', WT_I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 25, WT_I18N::digits(1900), WT_I18N::number(25)), '</option>
				<option value="1940,1950,1960,1970,1980,1990,2000">', WT_I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 10, WT_I18N::digits(1940), WT_I18N::number(10)), '</option>
			</select>
			<br><br>';
                    echo WT_I18N::translate('results:'), '<br>';
                    echo '<input type="radio" id="y_num" name="y-as" value="201"';
                    if ($plotnp == "201") {
                        echo ' checked="checked"';
                    }
                    echo '><label for="y_num">', WT_I18N::translate('numbers'), '</label><br>';
                    echo '<input type="radio" id="y_perc" name="y-as" value="202"';
                    if ($plotnp == "202") {
                        echo ' checked="checked"';
                    }
                    echo '><label for="y_perc">', WT_I18N::translate('percentage'), '</label><br>';
                    echo '</td>
			</tr>
Exemplo n.º 7
0
 /**
  * get image properties
  *
  * @param string $which     specify either 'main' or 'thumb'
  * @param int    $addWidth  amount to add to width
  * @param int    $addHeight amount to add to height
  *
  * @return array
  */
 public function getImageAttributes($which = 'main', $addWidth = 0, $addHeight = 0)
 {
     global $THUMBNAIL_WIDTH;
     $var = $which . 'imagesize';
     if (!empty($this->{$var})) {
         return $this->{$var};
     }
     $imgsize = array();
     if ($this->fileExists($which)) {
         $imgsize = @getimagesize($this->getServerFilename($which));
         // [0]=width [1]=height [2]=filetype ['mime']=mimetype
         if (is_array($imgsize) && !empty($imgsize['0'])) {
             // this is an image
             $imgsize[0] = $imgsize[0] + 0;
             $imgsize[1] = $imgsize[1] + 0;
             $imgsize['adjW'] = $imgsize[0] + $addWidth;
             // adjusted width
             $imgsize['adjH'] = $imgsize[1] + $addHeight;
             // adjusted height
             $imageTypes = array('', 'GIF', 'JPG', 'PNG', 'SWF', 'PSD', 'BMP', 'TIFF', 'TIFF', 'JPC', 'JP2', 'JPX', 'JB2', 'SWC', 'IFF', 'WBMP', 'XBM');
             $imgsize['ext'] = $imageTypes[0 + $imgsize[2]];
             // this is for display purposes, always show non-adjusted info
             $imgsize['WxH'] = WT_I18N::translate('%1$s × %2$s pixels', WT_I18N::number($imgsize['0']), WT_I18N::number($imgsize['1']));
             $imgsize['imgWH'] = ' width="' . $imgsize['adjW'] . '" height="' . $imgsize['adjH'] . '" ';
             if ($which == 'thumb' && $imgsize['0'] > $THUMBNAIL_WIDTH) {
                 // don’t let large images break the dislay
                 $imgsize['imgWH'] = ' width="' . $THUMBNAIL_WIDTH . '" ';
             }
         }
     }
     if (!is_array($imgsize) || empty($imgsize['0'])) {
         // this is not an image, OR the file doesn’t exist OR it is a url
         $imgsize[0] = 0;
         $imgsize[1] = 0;
         $imgsize['adjW'] = 0;
         $imgsize['adjH'] = 0;
         $imgsize['ext'] = '';
         $imgsize['mime'] = '';
         $imgsize['WxH'] = '';
         $imgsize['imgWH'] = '';
         if ($this->isExternal($which)) {
             // don’t let large external images break the dislay
             $imgsize['imgWH'] = ' width="' . $THUMBNAIL_WIDTH . '" ';
         }
     }
     if (empty($imgsize['mime'])) {
         // this is not an image, OR the file doesn’t exist OR it is a url
         // set file type equal to the file extension - can’t use parse_url because this may not be a full url
         $exp = explode('?', $this->file);
         $pathinfo = pathinfo($exp[0]);
         $imgsize['ext'] = @strtoupper($pathinfo['extension']);
         // all mimetypes we wish to serve with the media firewall must be added to this array.
         $mime = array('DOC' => 'application/msword', 'MOV' => 'video/quicktime', 'MP3' => 'audio/mpeg', 'PDF' => 'application/pdf', 'PPT' => 'application/vnd.ms-powerpoint', 'RTF' => 'text/rtf', 'SID' => 'image/x-mrsid', 'TXT' => 'text/plain', 'XLS' => 'application/vnd.ms-excel', 'WMV' => 'video/x-ms-wmv');
         if (empty($mime[$imgsize['ext']])) {
             // if we don’t know what the mimetype is, use something ambiguous
             $imgsize['mime'] = 'application/octet-stream';
             if ($this->fileExists($which)) {
                 // alert the admin if we cannot determine the mime type of an existing file
                 // as the media firewall will be unable to serve this file properly
                 Log::addMediaLog('Media Firewall error: >Unknown Mimetype< for file >' . $this->file . '<');
             }
         } else {
             $imgsize['mime'] = $mime[$imgsize['ext']];
         }
     }
     $this->{$var} = $imgsize;
     return $this->{$var};
 }
Exemplo n.º 8
0
function media_file_info($media_folder, $media_path, $file)
{
    $html = '<b>' . WT_Filter::escapeHtml($file) . '</b>';
    $full_path = WT_DATA_DIR . $media_folder . $media_path . $file;
    if ($file && file_exists($full_path)) {
        $size = @filesize($full_path);
        if ($size !== false) {
            $size = (int) (($size + 1023) / 1024);
            // Round up to next KB
            $size = WT_I18N::translate('%s KB', WT_I18N::number($size));
            $html .= WT_Gedcom_Tag::getLabelValue('__FILE_SIZE__', $size);
            $imgsize = @getimagesize($full_path);
            if (is_array($imgsize)) {
                $imgsize = WT_I18N::translate('%1$s × %2$s pixels', WT_I18N::number($imgsize['0']), WT_I18N::number($imgsize['1']));
                $html .= WT_Gedcom_Tag::getLabelValue('__IMAGE_SIZE__', $imgsize);
            }
        } else {
            $html .= '<div class="error">' . WT_I18N::translate('This media file exists, but cannot be accessed.') . '</div>';
        }
    } else {
        $html .= '<div class="error">' . WT_I18N::translate('This media file does not exist.') . '</div>';
    }
    return $html;
}
Exemplo n.º 9
0
    case 'repo.php':
        $page_parameter = WT_Filter::get('rid', WT_REGEX_XREF);
        break;
    case 'note.php':
        $page_parameter = WT_Filter::get('nid', WT_REGEX_XREF);
        break;
    case 'mediaviewer.php':
        $page_parameter = WT_Filter::get('mid', WT_REGEX_XREF);
        break;
    default:
        $page_parameter = '';
        break;
}
if ($page_parameter) {
    $hitCount = WT_DB::prepare("SELECT page_count FROM `##hit_counter`" . " WHERE gedcom_id=? AND page_name=? AND page_parameter=?")->execute(array(WT_GED_ID, WT_SCRIPT_NAME, $page_parameter))->fetchOne();
    // Only record one hit per session
    if ($page_parameter && empty($WT_SESSION->SESSION_PAGE_HITS[WT_SCRIPT_NAME . $page_parameter])) {
        $WT_SESSION->SESSION_PAGE_HITS[WT_SCRIPT_NAME . $page_parameter] = true;
        if (is_null($hitCount)) {
            $hitCount = 1;
            WT_DB::prepare("INSERT INTO `##hit_counter` (gedcom_id, page_name, page_parameter, page_count) VALUES (?, ?, ?, ?)")->execute(array(WT_GED_ID, WT_SCRIPT_NAME, $page_parameter, $hitCount));
        } else {
            $hitCount++;
            WT_DB::prepare("UPDATE `##hit_counter` SET page_count=?" . " WHERE gedcom_id=? AND page_name=? AND page_parameter=?")->execute(array($hitCount, WT_GED_ID, WT_SCRIPT_NAME, $page_parameter));
        }
    }
} else {
    $hitCount = 1;
}
$hitCount = '<span class="hit-counter">' . WT_I18N::number($hitCount) . '</span>';
unset($page_name, $page_parameter);
Exemplo n.º 10
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype;
     require_once WT_ROOT . 'includes/functions/functions_print_facts.php';
     // Block actions
     $action = WT_Filter::get('action');
     $message_id = WT_Filter::getArray('message_id');
     if ($action == 'deletemessage') {
         foreach ($message_id as $msg_id) {
             deleteMessage($msg_id);
         }
     }
     $block = get_block_setting($block_id, 'block', true);
     if ($cfg) {
         foreach (array('block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     $messages = getUserMessages(WT_USER_ID);
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = WT_I18N::plural('%s message', '%s messages', count($messages), WT_I18N::number(count($messages)));
     $content = '<form name="messageform" action="index.php?ctype=' . $ctype . '" method="get" onsubmit="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this message?  It cannot be retrieved later.') . '\');">';
     if (count(User::all()) > 1) {
         $content .= '<br>' . WT_I18N::translate('Send message') . " <select name=\"touser\">";
         $content .= '<option value="">' . WT_I18N::translate('&lt;select&gt;') . '</option>';
         foreach (User::all() as $user) {
             if ($user->getUserId() != WT_USER_ID && $user->getSetting('verified_by_admin') && $user->getSetting('contactmethod') != 'none') {
                 $content .= '<option value="' . WT_Filter::escapeHtml($user->getUserName()) . '">';
                 $content .= '<span dir="auto">' . WT_Filter::escapeHtml($user->getRealName()) . '</span> - <span dir="auto">' . WT_Filter::escapeHtml($user->getUserName()) . '</span>';
                 $content .= '</option>';
             }
         }
         $content .= '</select> <input type="button" value="' . WT_I18N::translate('Send') . '" onclick="message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, \'messaging2\', \'\'); return false;"><br><br>';
     }
     if (count($messages) == 0) {
         $content .= WT_I18N::translate('You have no pending messages.') . "<br>";
     } else {
         $content .= '<input type="hidden" name="action" value="deletemessage">';
         $content .= '<table class="list_table"><tr>';
         $content .= '<td class="list_label">' . WT_I18N::translate('Delete') . '<br><a href="#" onclick="jQuery(\'#' . $this->getName() . $block_id . ' :checkbox\').prop(\'checked\', true); return false;">' . WT_I18N::translate('All') . '</a></td>';
         $content .= '<td class="list_label">' . WT_I18N::translate('Subject:') . '</td>';
         $content .= '<td class="list_label">' . WT_I18N::translate('Date sent:') . '</td>';
         $content .= '<td class="list_label">' . WT_I18N::translate('Email address:') . '</td>';
         $content .= '</tr>';
         foreach ($messages as $message) {
             $content .= '<tr>';
             $content .= '<td class="list_value_wrap"><input type="checkbox" id="cb_message' . $message->message_id . '" name="message_id[]" value="' . $message->message_id . '"></td>';
             $content .= '<td class="list_value_wrap"><a href="#" onclick="return expand_layer(\'message' . $message->message_id . '\');"><i id="message' . $message->message_id . '_img" class="icon-plus"></i> <b dir="auto">' . WT_Filter::escapeHtml($message->subject) . '</b></a></td>';
             $content .= '<td class="list_value_wrap">' . format_timestamp($message->created) . '</td>';
             $content .= '<td class="list_value_wrap">';
             $user = User::findByIdentifier($message->sender);
             if ($user) {
                 $content .= '<span dir="auto">' . $user->getRealName() . '</span>';
                 $content .= '  - <span dir="auto">' . $user->getEmail() . '</span>';
             } else {
                 $content .= '<a href="mailto:' . WT_Filter::escapeHtml($message->sender) . '">' . WT_Filter::escapeHtml($message->sender) . '</a>';
             }
             $content .= '</td>';
             $content .= '</tr>';
             $content .= '<tr><td class="list_value_wrap" colspan="5"><div id="message' . $message->message_id . '" style="display:none;">';
             $content .= '<div dir="auto" style="white-space: pre-wrap;">' . WT_Filter::expandUrls($message->body) . '</div><br>';
             if (strpos($message->subject, WT_I18N::translate('RE: ')) !== 0) {
                 $message->subject = WT_I18N::translate('RE: ') . $message->subject;
             }
             if ($user) {
                 $content .= '<a href="#" onclick="reply(\'' . WT_Filter::escapeJs($message->sender) . '\', \'' . WT_Filter::escapeJs($message->subject) . '\'); return false;">' . WT_I18N::translate('Reply') . '</a> | ';
             }
             $content .= '<a href="index.php?action=deletemessage&amp;message_id[]=' . $message->message_id . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this message?  It cannot be retrieved later.') . '\');">' . WT_I18N::translate('Delete') . '</a></div></td></tr>';
         }
         $content .= '</table>';
         $content .= '<input type="submit" value="' . WT_I18N::translate('Delete selected messages') . '"><br>';
     }
     $content .= '</form>';
     if ($template) {
         if ($block) {
             require WT_THEME_DIR . 'templates/block_small_temp.php';
         } else {
             require WT_THEME_DIR . 'templates/block_main_temp.php';
         }
     } else {
         return $content;
     }
 }
Exemplo n.º 11
0
				<tr>
					<th colspan="2">
						<?php 
echo WT_I18N::translate('Places');
?>
					</th>
				</tr>
				<tr>
					<td>
						<?php 
echo WT_I18N::translate('Abbreviate place names'), help_link('SHOW_PEDIGREE_PLACES');
?>
					</td>
					<td>
						<?php 
echo WT_I18N::translate('Show the %1$s %2$s parts of a place name.', select_edit_control('NEW_SHOW_PEDIGREE_PLACES_SUFFIX', array(false => WT_I18N::translate_c('Show the [first/last] [N] parts of a place name.', 'first'), true => WT_I18N::translate_c('Show the [first/last] [N] parts of a place name.', 'last')), null, get_gedcom_setting(WT_GED_ID, 'SHOW_PEDIGREE_PLACES_SUFFIX')), select_edit_control('NEW_SHOW_PEDIGREE_PLACES', array(1 => WT_I18N::number(1), 2 => WT_I18N::number(2), 3 => WT_I18N::number(3), 4 => WT_I18N::number(4), 5 => WT_I18N::number(5), 6 => WT_I18N::number(6), 7 => WT_I18N::number(7), 8 => WT_I18N::number(8), 9 => WT_I18N::number(9)), null, get_gedcom_setting(WT_GED_ID, 'SHOW_PEDIGREE_PLACES')));
?>
					</td>
				</tr>
				<tr>
					<th colspan="2">
						<?php 
echo WT_I18N::translate('Format');
?>
					</th>
				</tr>
				<tr>
					<td>
						<?php 
echo WT_I18N::translate('Format text and notes'), help_link('FORMAT_TEXT');
?>
Exemplo n.º 12
0
 private static function _centuryName($century)
 {
     if ($century < 0) {
         return str_replace(-$century, WT_Stats::_centuryName(-$century), WT_I18N::translate('%s BCE', WT_I18N::number(-$century)));
     }
     // The current chart engine (Google charts) can't handle <sup></sup> markup
     switch ($century) {
         case 21:
             return strip_tags(WT_I18N::translate_c('CENTURY', '21st'));
         case 20:
             return strip_tags(WT_I18N::translate_c('CENTURY', '20th'));
         case 19:
             return strip_tags(WT_I18N::translate_c('CENTURY', '19th'));
         case 18:
             return strip_tags(WT_I18N::translate_c('CENTURY', '18th'));
         case 17:
             return strip_tags(WT_I18N::translate_c('CENTURY', '17th'));
         case 16:
             return strip_tags(WT_I18N::translate_c('CENTURY', '16th'));
         case 15:
             return strip_tags(WT_I18N::translate_c('CENTURY', '15th'));
         case 14:
             return strip_tags(WT_I18N::translate_c('CENTURY', '14th'));
         case 13:
             return strip_tags(WT_I18N::translate_c('CENTURY', '13th'));
         case 12:
             return strip_tags(WT_I18N::translate_c('CENTURY', '12th'));
         case 11:
             return strip_tags(WT_I18N::translate_c('CENTURY', '11th'));
         case 10:
             return strip_tags(WT_I18N::translate_c('CENTURY', '10th'));
         case 9:
             return strip_tags(WT_I18N::translate_c('CENTURY', '9th'));
         case 8:
             return strip_tags(WT_I18N::translate_c('CENTURY', '8th'));
         case 7:
             return strip_tags(WT_I18N::translate_c('CENTURY', '7th'));
         case 6:
             return strip_tags(WT_I18N::translate_c('CENTURY', '6th'));
         case 5:
             return strip_tags(WT_I18N::translate_c('CENTURY', '5th'));
         case 4:
             return strip_tags(WT_I18N::translate_c('CENTURY', '4th'));
         case 3:
             return strip_tags(WT_I18N::translate_c('CENTURY', '3rd'));
         case 2:
             return strip_tags(WT_I18N::translate_c('CENTURY', '2nd'));
         case 1:
             return strip_tags(WT_I18N::translate_c('CENTURY', '1st'));
         default:
             return $century - 1 . '01-' . $century . '00';
     }
 }
Exemplo n.º 13
0
    public function getBlock($block_id, $template = true, $cfg = null)
    {
        global $TEXT_DIRECTION, $ctype, $controller;
        $num = get_block_setting($block_id, 'num', 10);
        $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
        $block = get_block_setting($block_id, 'block', false);
        if ($cfg) {
            foreach (array('num', 'infoStyle', 'block') as $name) {
                if (array_key_exists($name, $cfg)) {
                    ${$name} = $cfg[$name];
                }
            }
        }
        $stats = new WT_Stats(WT_GEDCOM);
        $id = $this->getName() . $block_id;
        $class = $this->getName() . '_block';
        if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
            $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
        } else {
            $title = '';
        }
        if ($num == 1) {
            // I18N: i.e. most popular given name.
            $title .= WT_I18N::translate('Top given name');
        } else {
            // I18N: Title for a list of the most common given names, %s is a number.  Note that a separate translation exists when %s is 1
            $title .= WT_I18N::plural('Top %s given name', 'Top %s given names', $num, WT_I18N::number($num));
        }
        $content = '<div class="normal_inner_block">';
        //Select List or Table
        switch ($infoStyle) {
            case "list":
                // Output style 1:  Simple list style.  Better suited to left side of page.
                if ($TEXT_DIRECTION == 'ltr') {
                    $padding = 'padding-left: 15px';
                } else {
                    $padding = 'padding-right: 15px';
                }
                $params = array(1, $num, 'rcount');
                //List Female names
                $totals = $stats->commonGivenFemaleTotals($params);
                if ($totals) {
                    $content .= '<b>' . WT_I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
                }
                //List Male names
                $totals = $stats->commonGivenMaleTotals($params);
                if ($totals) {
                    $content .= '<b>' . WT_I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
                }
                break;
            case "table":
                // Style 2: Tabular format.  Narrow, 2 or 3 column table, good on right side of page
                $params = array(1, $num, 'rcount');
                $content .= '<table style="margin:auto;">
						<tr valign="top">
						<td>' . $stats->commonGivenFemaleTable($params) . '</td>
						<td>' . $stats->commonGivenMaleTable($params) . '</td>';
                $content .= '</tr></table>';
                break;
        }
        $content .= "</div>";
        if ($template) {
            if ($block) {
                require WT_THEME_DIR . 'templates/block_small_temp.php';
            } else {
                require WT_THEME_DIR . 'templates/block_main_temp.php';
            }
        } else {
            return $content;
        }
    }
Exemplo n.º 14
0
 static function getAge(WT_Date $d1, WT_Date $d2 = null, $format)
 {
     if ($d2) {
         if ($d2->MaxJD() >= $d1->MinJD() && $d2->MinJD() <= $d1->MinJD()) {
             // Overlapping dates
             $jd = $d1->MinJD();
         } else {
             // Non-overlapping dates
             $jd = $d2->MinJD();
         }
     } else {
         // If second date not specified, use today’s date
         $jd = WT_CLIENT_JD;
     }
     switch ($format) {
         case 0:
             // Years - integer only (for statistics, rather than for display)
             if ($jd && $d1->MinJD() && $d1->MinJD() <= $jd) {
                 return $d1->MinDate()->GetAge(false, $jd, false);
             } else {
                 return -1;
             }
         case 1:
             // Days - integer only (for sorting, rather than for display)
             if ($jd && $d1->MinJD()) {
                 return $jd - $d1->MinJD();
             } else {
                 return -1;
             }
         case 2:
             // Just years, in local digits, with warning for negative/
             if ($jd && $d1->MinJD()) {
                 if ($d1->MinJD() > $jd) {
                     return '<i class="icon-warning"></i>';
                 } else {
                     return WT_I18N::number($d1->MinDate()->GetAge(false, $jd));
                 }
             } else {
                 return '&nbsp;';
             }
             // TODO: combine GetAgeGedcom() into this function
     }
 }
Exemplo n.º 15
0
			</tr>
			<tr>
				<td class="descriptionbox">
					<?php 
echo WT_I18N::translate('Generations');
?>
				</td>
				<td class="optionbox">
					<select name="PEDIGREE_GENERATIONS">
						<?php 
for ($i = 2; $i <= $MAX_PEDIGREE_GENERATIONS; $i++) {
    echo '<option value="', $i, '"';
    if ($i == $OLD_PGENS) {
        echo ' selected="selected"';
    }
    echo '>', WT_I18N::number($i), '</option>';
}
?>
					</select>
				</td>
				<td class="descriptionbox">
					<?php 
echo WT_I18N::translate('Show details');
?>
				</td>
				<td class="optionbox">
					<input type="checkbox" value="<?php 
if ($controller->show_full) {
    echo '1" checked="checked" onclick="document.people.show_full.value=\'0\';';
} else {
    echo '0" onclick="document.people.show_full.value=\'1\';';
Exemplo n.º 16
0
function edit_field_integers($name, $selected = '', $min, $max, $extra = '')
{
    $array = array();
    for ($i = $min; $i <= $max; ++$i) {
        $array[$i] = WT_I18N::number($i);
    }
    return select_edit_control($name, $array, null, $selected, $extra);
}
Exemplo n.º 17
0
/**
 * print a list of events
 *
 * This performs the same function as print_events_table(), but formats the output differently.
 */
function print_events_list($startjd, $endjd, $events = 'BIRT MARR DEAT', $only_living = false, $sort_by = 'anniv')
{
    // Did we have any output?  Did we skip anything?
    $output = 0;
    $filter = 0;
    $filtered_events = array();
    $html = '';
    foreach (get_events_list($startjd, $endjd, $events) as $fact) {
        $record = $fact->getParent();
        //-- only living people ?
        if ($only_living) {
            if ($record instanceof WT_Individual && $record->isDead()) {
                $filter++;
                continue;
            }
            if ($record instanceof WT_Family) {
                $husb = $record->getHusband();
                if (is_null($husb) || $husb->isDead()) {
                    $filter++;
                    continue;
                }
                $wife = $record->getWife();
                if (is_null($wife) || $wife->isDead()) {
                    $filter++;
                    continue;
                }
            }
        }
        $output++;
        $filtered_events[] = $fact;
    }
    // Now we've filtered the list, we can sort by event, if required
    switch ($sort_by) {
        case 'anniv':
            uasort($filtered_events, function ($x, $y) {
                return WT_Date::compare($y->getDate(), $x->getDate());
                // most recent first
            });
            break;
        case 'alpha':
            uasort($filtered_events, function ($x, $y) {
                return WT_GedcomRecord::compare($x->getParent(), $y->getParent());
            });
            break;
    }
    foreach ($filtered_events as $fact) {
        $record = $fact->getParent();
        $html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item name2">' . $record->getFullName() . '</a>';
        if ($record instanceof WT_Individual) {
            $html .= $record->getSexImage();
        }
        $html .= '<br><div class="indent">';
        $html .= $fact->getLabel() . ' — ' . $fact->getDate()->Display(true);
        if ($fact->anniv) {
            $html .= ' (' . WT_I18N::translate('%s year anniversary', $fact->anniv) . ')';
        }
        if (!$fact->getPlace()->isEmpty()) {
            $html .= ' — <a href="' . $fact->getPlace()->getURL() . '">' . $fact->getPlace()->getFullName() . '</a>';
        }
        $html .= '</div>';
    }
    // Print a final summary message about restricted/filtered facts
    $summary = '';
    if ($endjd == WT_CLIENT_JD) {
        // We're dealing with the Today’s Events block
        if ($output == 0) {
            if ($filter == 0) {
                $summary = WT_I18N::translate('No events exist for today.');
            } else {
                $summary = WT_I18N::translate('No events for living individuals exist for today.');
            }
        }
    } else {
        // We're dealing with the Upcoming Events block
        if ($output == 0) {
            if ($filter == 0) {
                if ($endjd == $startjd) {
                    $summary = WT_I18N::translate('No events exist for tomorrow.');
                } else {
                    // I18N: translation for %s==1 is unused; it is translated separately as “tomorrow”
                    $summary = WT_I18N::plural('No events exist for the next %s day.', 'No events exist for the next %s days.', $endjd - $startjd + 1, WT_I18N::number($endjd - $startjd + 1));
                }
            } else {
                if ($endjd == $startjd) {
                    $summary = WT_I18N::translate('No events for living individuals exist for tomorrow.');
                } else {
                    // I18N: translation for %s==1 is unused; it is translated separately as “tomorrow”
                    $summary = WT_I18N::plural('No events for living people exist for the next %s day.', 'No events for living people exist for the next %s days.', $endjd - $startjd + 1, WT_I18N::number($endjd - $startjd + 1));
                }
            }
        }
    }
    if ($summary) {
        $html .= "<b>" . $summary . "</b>";
    }
    return $html;
}
Exemplo n.º 18
0
// The wiki tells people how to customize webtrees by modifying various files.
// Create a backup of these, just in case the user forgot!
@copy('library/WT/Gedcom/Code/Rela.php', 'library/WT/Gedcom/Code/Rela' . date('-Y-m-d') . '.php');
@copy('library/WT/Gedcom/Tag.php', 'library/WT/Gedcom/Tag' . date('-Y-m-d') . '.php');
reset_timeout();
$start_time = microtime(true);
$res = $archive->extract(PCLZIP_OPT_PATH, WT_ROOT, PCLZIP_OPT_REMOVE_PATH, 'webtrees', PCLZIP_OPT_REPLACE_NEWER);
$end_time = microtime(true);
if (is_array($res)) {
    foreach ($res as $result) {
        // Note that most of the folders will already exist, so it is not an error if we cannot create them
        if ($result['status'] != 'ok' && !substr($result['filename'], -1) == '/') {
            echo '<br>', WT_I18N::translate('The file %s could not be created.', '<span dir="ltr">' . $result['filename'] . '</span>'), $icon_failure;
        }
    }
    echo '<br>', WT_I18N::plural('%1$s file was extracted in %2$s seconds.', '%1$s files were extracted in %2$s seconds.', count($res), count($res), WT_I18N::number($end_time - $start_time, 2)), $icon_success;
} else {
    echo '<br>', WT_I18N::translate('An error occurred when unzipping the file.'), $icon_failure;
    echo '</li></ul></form>';
    exit;
}
echo '</li>';
flush();
////////////////////////////////////////////////////////////////////////////////
// All done - put the site back online
////////////////////////////////////////////////////////////////////////////////
echo '<li>', WT_I18N::translate('Place the site online, by deleting the file %s…', $lock_file_html);
if (WT_File::delete($lock_file)) {
    echo '<br>', WT_I18N::translate('The file %s was deleted.', '<span dir="ltr">' . $lock_file . '</span>'), $icon_success;
} else {
    echo '<br>', WT_I18N::translate('The file %s could not be deleted.', '<span dir="ltr">' . $lock_file . '</span>'), $icon_failure;
Exemplo n.º 19
0
 $show = $falpha || $show_all_firstnames == 'yes' ? 'indi' : 'none';
 $list = array();
 foreach ($givn_initials as $givn_initial => $count) {
     switch ($givn_initial) {
         case '@':
             $html = $UNKNOWN_PN;
             break;
         default:
             $html = WT_Filter::escapeHtml($givn_initial);
             break;
     }
     if ($count) {
         if ($show == 'indi' && $givn_initial == $falpha && $show_all_firstnames == 'no') {
             $list[] = '<a class="warning" href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
         } else {
             $list[] = '<a href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
         }
     } else {
         $list[] = $html;
     }
 }
 // Search spiders don't get the "show all" option as the other links give them everything.
 if (!$SEARCH_SPIDER) {
     if ($show_all_firstnames == 'yes') {
         $list[] = '<span class="warning">' . WT_I18N::translate('All') . '</span>';
     } else {
         $list[] = '<a href="' . $url . '&amp;show_all_firstnames=yes">' . WT_I18N::translate('All') . '</a>';
     }
 }
 if ($show_all == 'no') {
     echo '<h2 class="center">', WT_I18N::translate('Individuals with surname %s', $legend), '</h2>';
Exemplo n.º 20
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype, $SURNAME_LIST_STYLE;
     require_once WT_ROOT . 'includes/functions/functions_print_lists.php';
     $COMMON_NAMES_REMOVE = get_gedcom_setting(WT_GED_ID, 'COMMON_NAMES_REMOVE');
     $COMMON_NAMES_THRESHOLD = get_gedcom_setting(WT_GED_ID, 'COMMON_NAMES_THRESHOLD');
     $num = get_block_setting($block_id, 'num', 10);
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     $block = get_block_setting($block_id, 'block', false);
     if ($cfg) {
         foreach (array('num', 'infoStyle', 'block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     // This next function is a bit out of date, and doesn't cope well with surname variants
     $top_surnames = get_top_surnames(WT_GED_ID, $COMMON_NAMES_THRESHOLD, $num);
     // Remove names found in the "Remove Names" list
     if ($COMMON_NAMES_REMOVE) {
         foreach (preg_split("/[,; ]+/", $COMMON_NAMES_REMOVE) as $delname) {
             unset($top_surnames[$delname]);
             unset($top_surnames[WT_I18N::strtoupper($delname)]);
         }
     }
     $all_surnames = array();
     $i = 0;
     foreach (array_keys($top_surnames) as $top_surname) {
         $all_surnames = array_merge($all_surnames, WT_Query_Name::surnames($top_surname, '', false, false, WT_GED_ID));
         if (++$i == $num) {
             break;
         }
     }
     if ($i < $num) {
         $num = $i;
     }
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
         $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
     } else {
         $title = '';
     }
     if ($num == 1) {
         // I18N: i.e. most popular surname.
         $title .= WT_I18N::translate('Top surname');
     } else {
         // I18N: Title for a list of the most common surnames, %s is a number.  Note that a separate translation exists when %s is 1
         $title .= WT_I18N::plural('Top %s surname', 'Top %s surnames', $num, WT_I18N::number($num));
     }
     switch ($infoStyle) {
         case 'tagcloud':
             uksort($all_surnames, array('WT_I18N', 'strcasecmp'));
             $content = format_surname_tagcloud($all_surnames, 'indilist.php', true);
             break;
         case 'list':
             uasort($all_surnames, array('top10_surnames_WT_Module', 'top_surname_sort'));
             $content = format_surname_list($all_surnames, '1', true, 'indilist.php');
             break;
         case 'array':
             uasort($all_surnames, array('top10_surnames_WT_Module', 'top_surname_sort'));
             $content = format_surname_list($all_surnames, '2', true, 'indilist.php');
             break;
         case 'table':
         default:
             uasort($all_surnames, array('top10_surnames_WT_Module', 'top_surname_sort'));
             $content = format_surname_table($all_surnames, 'indilist.php');
             break;
     }
     if ($template) {
         if ($block) {
             require WT_THEME_DIR . 'templates/block_small_temp.php';
         } else {
             require WT_THEME_DIR . 'templates/block_main_temp.php';
         }
     } else {
         return $content;
     }
 }
Exemplo n.º 21
0
			</tr>
			<tr>
				<td>', WT_I18N::translate('Username'), help_link('username'), '</td>
				<td><input type="text" name="username" style="width:95%;" required maxlength="32" value="', WT_Filter::escapeHtml($username), '"></td>
				<td>', WT_I18N::translate('Approved by administrator'), help_link('useradmin_verification'), '</td>
				<td><input type="checkbox" name="verified_by_admin" value="1" checked="checked"></td>
			</tr>
			<tr>
				<td>', WT_I18N::translate('Email address'), help_link('email'), '</td>
				<td><input type="email" name="emailaddress" style="width:95%;" required maxlength="64" value="', WT_Filter::escapeHtml($emailaddress), '"></td>
				<td>', WT_I18N::translate('Email verified'), help_link('useradmin_verification'), '</td>
				<td><input type="checkbox" name="verified" value="1" checked="checked"></td>
			</tr>
			<tr>
				<td>', WT_I18N::translate('Password'), help_link('password'), '</td>
				<td><input type="password" name="pass1" style="width:95%;" value="', WT_Filter::escapeHtml($pass1), '" required placeholder="', WT_I18N::plural('Use at least %s character.', 'Use at least %s characters.', WT_MINIMUM_PASSWORD_LENGTH, WT_I18N::number(WT_MINIMUM_PASSWORD_LENGTH)), '" pattern="', WT_REGEX_PASSWORD, '" onchange="form.pass2.pattern = regex_quote(this.value);"></td>
				<td>', WT_I18N::translate('Automatically approve changes made by this user'), help_link('useradmin_auto_accept'), '</td>
				<td><input type="checkbox" name="new_auto_accept" value="1"></td>
			</tr>
				<td>', WT_I18N::translate('Confirm password'), help_link('password_confirm'), '</td>
				<td><input type="password" name="pass2" style="width:95%;" value="', WT_Filter::escapeHtml($pass2), '" required placeholder="', WT_I18N::translate('Type the password again.'), '" pattern="', WT_REGEX_PASSWORD, '"></td>
				<td>', WT_I18N::translate('Allow this user to edit his account information'), help_link('useradmin_editaccount'), '</td>
				<td><input type="checkbox" name="editaccount" value="1" checked="checked"></td>
			<tr>
				<td>', WT_I18N::translate('Preferred contact method'), '</td>
				<td>';
        echo edit_field_contact('new_contact_method', $new_contact_method);
        echo '</td>
				<td>', WT_I18N::translate('Visible to other users when online'), help_link('useradmin_visibleonline'), '</td>
				<td><input type="checkbox" name="visibleonline" value="1" checked="checked"></td>
			</tr>
Exemplo n.º 22
0
			</tr>
			<tr>
				<td class="descriptionbox">
					<?php 
echo WT_I18N::translate('Generations');
?>
				</td>
				<td class="optionbox">
					<select name="generations">
						<?php 
for ($i = 2; $i <= $MAX_DESCENDANCY_GENERATIONS; $i++) {
    echo "<option value=\"" . $i . "\"";
    if ($i == $controller->generations) {
        echo " selected=\"selected\"";
    }
    echo ">" . WT_I18N::number($i) . "</option>";
}
?>
					</select>
				</td>
				<td class="descriptionbox">
					<?php 
echo WT_I18N::translate('Show spouses'), help_link('show_spouse');
?>
				</td>
				<td class="optionbox">
					<input type="checkbox" value="1" name="show_spouse" <?php 
if ($controller->show_spouse) {
    echo " checked=\"checked\"";
}
?>