Example #1
0
 static function ageDifference(WT_Date $prev, WT_Date $next, $child_number = 0)
 {
     if ($prev->isOK() && $next->isOK()) {
         $days = $next->MaxJD() - $prev->MinJD();
         if ($days < 0) {
             // Show warning triangle if dates in reverse order
             $diff = '<i class="icon-warning"></i> ';
         } elseif ($child_number > 1 && $days > 1 && $days < 240) {
             // Show warning triangle if children born too close together
             $diff = '<i class="icon-warning"></i> ';
         } else {
             $diff = '';
         }
         $months = round($days * 12 / 365.25);
         // Approximate - we do not know the calendar
         if (abs($months) == 12 || abs($months) >= 24) {
             $diff .= WT_I18N::plural('%d year', '%d years', round($months / 12), round($months / 12));
         } elseif ($months != 0) {
             $diff .= WT_I18N::plural('%d month', '%d months', $months, $months);
         }
         return '<div class="elderdate age">' . $diff . '</div>';
     } else {
         return '';
     }
 }
Example #2
0
function get_age_at_event($age_string, $show_years)
{
    switch (strtoupper($age_string)) {
        case 'CHILD':
            return WT_I18N::translate('Child');
        case 'INFANT':
            return WT_I18N::translate('Infant');
        case 'STILLBORN':
            return WT_I18N::translate('Stillborn');
        default:
            return preg_replace_callback(array('/(\\d+)([ymwd])/'), function ($match) use($age_string, $show_years) {
                switch (WT_LOCALE) {
                    case 'pl':
                        $show_years = true;
                }
                switch ($match[2]) {
                    case 'y':
                        if ($show_years || preg_match('/[dm]/', $age_string)) {
                            return WT_I18N::plural('%s year', '%s years', $match[1], WT_I18N::digits($match[1]));
                        } else {
                            return WT_I18N::digits($match[1]);
                        }
                    case 'm':
                        return WT_I18N::plural('%s month', '%s months', $match[1], WT_I18N::digits($match[1]));
                    case 'w':
                        return WT_I18N::plural('%s week', '%s weeks', $match[1], WT_I18N::digits($match[1]));
                    case 'd':
                        return WT_I18N::plural('%s day', '%s days', $match[1], WT_I18N::digits($match[1]));
                }
            }, $age_string);
    }
}
Example #3
0
    private function pedigreeMap()
    {
        global $controller, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS;
        // Default is show for both of these.
        $hideflags = WT_Filter::get('hideflags');
        $hidelines = WT_Filter::get('hidelines');
        $controller = new WT_Controller_Pedigree();
        // Start of internal configuration variables
        // Limit this to match available number of icons.
        // 8 generations equals 255 individuals
        $MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8);
        // End of internal configuration variables
        $controller->setPageTitle(WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()))->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
        echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet">';
        echo '<div id="pedigreemap-page">
				<h2>', $controller->getPageTitle(), '</h2>';
        // -- print the form to change the number of displayed generations
        ?>
		<form name="people" method="get" action="?">
			<input type="hidden" name="ged" value="<?php 
        echo WT_Filter::escapeHtml(WT_GEDCOM);
        ?>
">
			<input type="hidden" name="mod" value="googlemap">
			<input type="hidden" name="mod_action" value="pedigree_map">
			<table class="list_table" width="555">
				<tr>
					<td class="descriptionbox wrap">
						<?php 
        echo WT_I18N::translate('Individual');
        ?>
					</td>
					<td class="descriptionbox wrap">
						<?php 
        echo WT_I18N::translate('Generations');
        ?>
					</td>
					<td class="descriptionbox wrap">
						<?php 
        echo WT_I18N::translate('Hide flags'), help_link('PEDIGREE_MAP_hideflags', 'googlemap');
        ?>
					</td>
					<td class="descriptionbox wrap">
						<?php 
        echo WT_I18N::translate('Hide lines'), help_link('PEDIGREE_MAP_hidelines', 'googlemap');
        ?>
					</td>
				</tr>
				<tr>
					<td class="optionbox">
						<input class="pedigree_form" data-autocomplete-type="INDI" type="text" id="rootid" name="rootid" size="3" value="<?php 
        echo $controller->root->getXref();
        ?>
">
						<?php 
        echo print_findindi_link('rootid');
        ?>
					</td>
					<td class="optionbox">
						<select name="PEDIGREE_GENERATIONS">
						<?php 
        for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) {
            echo '<option value="', $p, '" ';
            if ($p == $controller->PEDIGREE_GENERATIONS) {
                echo 'selected="selected"';
            }
            echo '>', $p, '</option>';
        }
        ?>
						</select>
					</td>
					<td class="optionbox">
						<?php 
        echo '<input name="hideflags" type="checkbox"';
        if ($hideflags) {
            echo ' checked="checked"';
        }
        echo '>';
        ?>
					</td>
					<td class="optionbox">
						<?php 
        echo '<input name="hidelines" type="checkbox"';
        if ($hidelines) {
            echo ' checked="checked"';
        }
        echo '>';
        ?>
					</td>
				</tr>
				<tr>
					<td class="topbottombar" colspan="5">
						<input type="submit" value="<?php 
        echo WT_I18N::translate('View');
        ?>
">
					</td>
				</tr>
			</table>
		</form>
		<!-- end of form -->

		<!-- count records by type -->
		<?php 
        $curgen = 1;
        $priv = 0;
        $count = 0;
        $miscount = 0;
        $missing = '';
        $latlongval = array();
        $lat = array();
        $lon = array();
        for ($i = 0; $i < $controller->treesize; $i++) {
            // -- check to see if we have moved to the next generation
            if ($i + 1 >= pow(2, $curgen)) {
                $curgen++;
            }
            $person = WT_Individual::getInstance($controller->treeid[$i]);
            if (!empty($person)) {
                $name = $person->getFullName();
                if ($name == WT_I18N::translate('Private')) {
                    $priv++;
                }
                $place = $person->getBirthPlace();
                if (empty($place)) {
                    $latlongval[$i] = null;
                } else {
                    $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace());
                }
                if ($latlongval[$i]) {
                    $lat[$i] = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]->pl_lati);
                    $lon[$i] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long);
                    if ($lat[$i] != null && $lon[$i] != null) {
                        $count++;
                    } else {
                        // The place is in the table but has empty values
                        if ($name) {
                            if ($missing) {
                                $missing .= ', ';
                            }
                            $missing .= '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>';
                            $miscount++;
                        }
                    }
                } else {
                    // There was no place, or not listed in the map table
                    if ($name) {
                        if ($missing) {
                            $missing .= ', ';
                        }
                        $missing .= '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>';
                        $miscount++;
                    }
                }
            }
        }
        //<!-- end of count records by type -->
        //<!-- start of map display -->
        echo '<div id="pedigreemap_chart">';
        echo '<table class="tabs_table" cellspacing="0" cellpadding="0" border="0" width="100%">';
        echo '<tr>';
        echo '<td valign="top">';
        echo '<div id="pm_map" style="border: 1px solid gray; height: ', $this->getSetting('GM_YSIZE'), 'px; font-size: 0.9em;';
        echo '"><i class="icon-loading-large"></i></div>';
        if (Auth::isAdmin()) {
            echo '<table width="100%">';
            echo '<tr><td align="left">';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>';
            echo '</td>';
            echo '<td align="center">';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_places">', WT_I18N::translate('Geographic data'), '</a>';
            echo '</td>';
            echo '<td align="right">';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_placecheck">', WT_I18N::translate('Place check'), '</a>';
            echo '</td></tr>';
            echo '</table>';
        }
        echo '</td><td width="15px">&nbsp;</td>';
        echo '<td width="310px" valign="top">';
        echo '<div id="side_bar" style="width:300px; font-size:0.9em; overflow:auto; overflow-x:hidden; overflow-y:auto; height:', $this->getSetting('GM_YSIZE'), 'px;"></div></td>';
        echo '</tr>';
        echo '</table>';
        // display info under map
        echo '<hr>';
        echo '<table cellspacing="0" cellpadding="0" border="0" width="100%">';
        echo '<tr>';
        echo '<td valign="top">';
        // print summary statistics
        if (isset($curgen)) {
            $total = pow(2, $curgen) - 1;
            echo WT_I18N::plural('%1$d individual displayed, out of the normal total of %2$d, from %3$d generations.', '%1$d individuals displayed, out of the normal total of %2$d, from %3$d generations.', $count, $count, $total, $curgen), '<br>';
            echo '</td>';
            echo '</tr>';
            echo '<tr>';
            echo '<td valign="top">';
            if ($priv) {
                echo WT_I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '<br>';
            }
            if ($count + $priv != $total) {
                if ($miscount == 0) {
                    echo WT_I18N::translate('No ancestors in the database.'), "<br>";
                } else {
                    echo WT_I18N::plural('%1$d individual is missing birthplace map coordinates: %2$s.', '%1$d individuals are missing birthplace map coordinates: %2$s.', $miscount, $miscount, $missing), '<br>';
                }
            }
        }
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        echo '</div>';
        // close #pedigreemap_chart
        echo '</div>';
        // close #pedigreemap-page
        ?>
		<!-- end of map display -->
		<!-- Start of map scripts -->
		<?php 
        echo '<script src="', $this->googleMapsScript(), '"></script>';
        $controller->addInlineJavascript($this->pedigreeMapJavascript($hideflags, $hidelines));
    }
        unset($xrefs[$old_xref]);
        WT_DB::exec("UNLOCK TABLES");
        WT_DB::exec("COMMIT");
        try {
            WT_DB::prepare("UPDATE `##favorite` SET xref = ? WHERE xref = ? AND gedcom_id = ?")->execute(array($new_xref, $old_xref, WT_GED_ID));
        } catch (Exception $ex) {
            // Perhaps the favorites module was not installed?
        }
        // How much time do we have left?
        if (microtime(true) - $start_time > ini_get('max_execution_time') - 5) {
            echo '<p>', WT_I18N::translate('The server’s time limit was reached.'), '</p>';
            break;
        }
    }
    if ($xrefs) {
    }
} else {
    echo '<p>', WT_I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or "R14".'), '</p>';
    echo '<p>', WT_I18N::translate('You can renumber a family tree so that these reference numbers are unique across all family trees.'), '</p>';
}
echo '<p>', WT_I18N::plural('This family tree has %s record which uses the same “XREF” as another family tree.', 'This family tree has %s records which use the same “XREF” as another family tree.', count($xrefs), count($xrefs)), '</p>';
if ($xrefs) {
    // We use GET (not POST) for this update operation - because we want the user to
    // be able to press F5 to continue after a timeout.
    echo '<form method="GET" action="', WT_SCRIPT_NAME, '">';
    echo '<p>', WT_I18N::translate('You can renumber this family tree.');
    echo '<input type="submit" name="go" value="', WT_I18N::translate('go'), '"></p>';
    echo '<input type="hidden" name="ged" value="', WT_Filter::escapeUrl(WT_GEDCOM), '">';
    echo '</form>';
    echo '<p>', WT_I18N::translate('Caution!  This may take a long time.  Be patient.'), '</p>';
}
Example #5
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;
     }
 }
Example #6
0
							<td>
								<input type="submit" name="search" value="<?php 
echo WT_I18N::translate('Search');
?>
">
							</td>
							<td>
								<input type="button" value="<?php 
echo WT_I18N::translate('Clear chart');
?>
" onclick="window.location='lifespan.php?clear=1';">
							</td>
						</tr>
					</table>
					<b><?php 
echo WT_I18N::plural('%s individual', '%s individuals', $people, $people);
?>
</b>
				</form>
			</td>
		</tr>
	</table>
	<div dir="ltr" id="lifespan_chart" class="lifespan_outer">
		<div dir="ltr" id="topInner"  class="lifespan_timeline" onmousedown="pandiv(); return false;">';
			<?php 
$controller->PrintTimeline($controller->timelineMinYear, $controller->timelineMaxYear);
?>
		</div>
		<div id="inner" class="lifespan_people" onmousedown="pandiv(); return false;">
			<?php 
$maxY = $controller->fillTL($controller->people, $controller->minYear, $controller->YrowLoc);
Example #7
0
					<option value="5" <?php 
        if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 5) {
            echo "selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::plural('±%d year', '±%d years', 5, 5);
        ?>
</option>
					<option value="10" <?php 
        if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 10) {
            echo "selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::plural('±%d year', '±%d years', 10, 10);
        ?>
</option>
				</select>
			<?php 
    }
    ?>
		</td>
		<?php 
    //-- relative fields
    if ($i == 0 && $fct > 4) {
        $j = $fct;
        // Get the current options for Father’s and Mother’s name searches
        $fatherGivnOption = 'SDX';
        $fatherSurnOption = 'SDX';
        $motherGivnOption = 'SDX';
/**
 * 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;
}
Example #9
0
 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7));
         set_block_setting($block_id, 'filter', WT_Filter::postBool('filter'));
         set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM'));
         set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
         set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $days = get_block_setting($block_id, 'days', 7);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>';
     echo '</td></tr>';
     $filter = get_block_setting($block_id, 'filter', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Show only events of living individuals?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('filter', $filter);
     echo '</td></tr>';
     $onlyBDM = get_block_setting($block_id, 'onlyBDM', false);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Show only births, deaths, and marriages?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('onlyBDM', $onlyBDM);
     echo '</td></tr>';
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo select_edit_control('sortStyle', array('alpha' => WT_I18N::translate('sort by name'), 'anniv' => WT_I18N::translate('sort by date')), null, $sortStyle, '');
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
 }
Example #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;
     }
 }
Example #11
0
 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7));
         set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
         set_block_setting($block_id, 'calendar', WT_Filter::post('calendar', 'jewish|gregorian', 'jewish'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $days = get_block_setting($block_id, 'days', 7);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="' . $days . '">';
     echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>';
     echo '</td></tr>';
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     $calendar = get_block_setting($block_id, 'calendar');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Calendar');
     echo '</td><td class="optionbox">';
     echo select_edit_control('calendar', array('jewish' => WT_Date_Jewish::calendarName(), 'gregorian' => WT_Date_Gregorian::calendarName()), null, $calendar, '');
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
 }
Example #12
0
 static function _usersLoggedIn($type = 'nolist')
 {
     $content = '';
     // List active users
     $NumAnonymous = 0;
     $loggedusers = array();
     foreach (User::allLoggedIn() as $user) {
         if (Auth::isAdmin() || $user->getSetting('visibleonline')) {
             $loggedusers[] = $user;
         } else {
             $NumAnonymous++;
         }
     }
     $LoginUsers = count($loggedusers);
     if ($LoginUsers == 0 && $NumAnonymous == 0) {
         return WT_I18N::translate('No logged-in and no anonymous users');
     }
     if ($NumAnonymous > 0) {
         $content .= '<b>' . WT_I18N::plural('%d anonymous logged-in user', '%d anonymous logged-in users', $NumAnonymous, $NumAnonymous) . '</b>';
     }
     if ($LoginUsers > 0) {
         if ($NumAnonymous) {
             if ($type == 'list') {
                 $content .= "<br><br>";
             } else {
                 $content .= " " . WT_I18N::translate('and') . " ";
             }
         }
         $content .= '<b>' . WT_I18N::plural('%d logged-in user', '%d logged-in users', $LoginUsers, $LoginUsers) . '</b>';
         if ($type == 'list') {
             $content .= '<ul>';
         } else {
             $content .= ': ';
         }
     }
     if (Auth::check()) {
         foreach ($loggedusers as $user) {
             if ($type == 'list') {
                 $content .= "<li>" . WT_Filter::escapeHtml($user->getRealName()) . ' - ' . WT_Filter::escapeHtml($user->getUserName());
             } else {
                 $content .= WT_Filter::escapeHtml($user->getRealName()) . ' - ' . WT_Filter::escapeHtml($user->getUserName());
             }
             if (WT_USER_ID != $user->getUserId() && $user->getSetting('contactmethod') != 'none') {
                 if ($type == 'list') {
                     $content .= '<br><a class="icon-email" href="#" onclick="return message(\'' . $user->getUserId() . '\', \'\', \'' . WT_Filter::escapeJs(get_query_url()) . '\');" title="' . WT_I18N::translate('Send message') . '"></a>';
                 } else {
                     $content .= ' <a class="icon-email" href="#" onclick="return message(\'' . $user->getUserId() . '\', \'\', \'' . WT_Filter::escapeJs(get_query_url()) . '\');" title="' . WT_I18N::translate('Send message') . '"></a>';
                 }
             }
             if ($type == 'list') {
                 $content .= '</li>';
             }
         }
     }
     if ($type == 'list') {
         $content .= '</ul>';
     }
     return $content;
 }
Example #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;
        }
    }
Example #14
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>
Example #15
0
     $text = WT_I18N::translate('You only need to enter a Login URL if you want to redirect to a different site or location when your users login.  This is very useful if you need to switch from http to https when your users login.  Include the full URL to <i>login.php</i>.  For example, https://www.yourserver.com/webtrees/login.php .');
     break;
 case 'MAX_ALIVE_AGE':
     $title = WT_I18N::translate('Age at which to assume an individual is dead');
     $text = WT_I18N::translate('If this individual has any events other than death, burial, or cremation more recent than this number of years, he is considered to be “alive”.  Children’s birth dates are considered to be such events for this purpose.');
     break;
 case 'MAX_DESCENDANCY_GENERATIONS':
     $title = WT_I18N::translate('Maximum descendancy generations');
     $text = WT_I18N::translate('Set the maximum number of generations to display on descendancy charts.');
     break;
 case 'MAX_EXECUTION_TIME':
     // Find the default value for max_execution_time
     ini_restore('max_execution_time');
     $dflt_cpu = ini_get('max_execution_time');
     $title = WT_I18N::translate('PHP time limit');
     $text = WT_I18N::plural('By default, your server allows scripts to run for %s second.', 'By default, your server allows scripts to run for %s seconds.', $dflt_cpu, $dflt_cpu) . ' ' . WT_I18N::translate('You can request a higher or lower limit, although the server may ignore this request.') . ' ' . WT_I18N::translate('If you leave this setting empty, the default value will be used.');
     break;
 case 'MAX_PEDIGREE_GENERATIONS':
     $title = WT_I18N::translate('Maximum pedigree generations');
     $text = WT_I18N::translate('Set the maximum number of generations to display on pedigree charts.');
     break;
 case 'MEDIA_DIRECTORY':
     $title = WT_I18N::translate('Media folder');
     $text = '<p>' . WT_I18N::translate('This folder will be used to store the media files for this family tree.') . '</p><p>' . WT_I18N::translate('If you select a different folder, you must also move any media files from the existing folder to the new one.') . '</p><p>' . WT_I18N::translate('If two family trees use the same media folder, then they will be able to share media files.  If they use different media folders, then their media files will be kept separate.') . '</p>';
     break;
 case 'MEDIA_ID_PREFIX':
     $title = WT_I18N::translate('Media ID prefix');
     $text = WT_I18N::translate('When a new media record is added online in <b>webtrees</b>, a new ID for that media will be generated automatically. The media ID will have this prefix.');
     break;
 case 'MEDIA_UPLOAD':
     $title = WT_I18N::translate('Who can upload new media files?');
Example #16
0
function whoisonline()
{
    $NumAnonymous = 0;
    $loggedusers = array();
    $content = '';
    foreach (User::allLoggedIn() as $user) {
        if (Auth::isAdmin() || $user->getSetting('visibleonline')) {
            $loggedusers[] = $user;
        } else {
            $NumAnonymous++;
        }
    }
    $LoginUsers = count($loggedusers);
    $content .= '<div class="logged_in_count">';
    if ($NumAnonymous) {
        $content .= WT_I18N::plural('%d anonymous logged-in user', '%d anonymous logged-in users', $NumAnonymous, $NumAnonymous);
        if ($LoginUsers) {
            $content .= '&nbsp;|&nbsp;';
        }
    }
    if ($LoginUsers) {
        $content .= WT_I18N::plural('%d logged-in user', '%d logged-in users', $LoginUsers, $LoginUsers);
    }
    $content .= '</div>';
    $content .= '<div class="logged_in_list">';
    if (WT_USER_ID) {
        foreach ($loggedusers as $user) {
            $content .= '<div class="logged_in_name">';
            $content .= WT_Filter::escapeHtml($user->getRealName()) . ' - ' . WT_Filter::escapeHtml($user->getUserName());
            if (WT_USER_ID != $user->getUserId() && $user->getSetting('contactmethod') != 'none') {
                $content .= ' <a class="icon-email" href="#" onclick="return message(\'' . WT_Filter::escapeJs($user->getUserName()) . '\', \'\', \'' . WT_Filter::escapeJs(get_query_url()) . '\');" title="' . WT_I18N::translate('Send message') . '"></a>';
            }
            $content .= '</div>';
        }
    }
    $content .= '</div>';
    return $content;
}
Example #17
0
 /**
  * Generate both the HTML and PNG components of the fan chart
  *
  * The HTML and PNG components both require the same co-ordinate calculations,
  * so we generate them using the same code, but we send them in separate
  * HTTP requests.
  *
  * @param string   $what     "png" or "html"
  * @param string[] $fanChart Presentation parameters, provided by the theme.
  *
  * @return string
  */
 public function generate_fan_chart($what, $fanChart)
 {
     $treeid = ancestry_array($this->root->getXref(), $this->generations);
     $fanw = 640 * $this->fan_width / 100;
     $fandeg = 90 * $this->fan_style;
     $html = '';
     $treesize = count($treeid);
     // generations count
     $gen = log($treesize) / log(2) - 1;
     $sosa = $treesize - 1;
     // fan size
     if ($fandeg == 0) {
         $fandeg = 360;
     }
     $fandeg = min($fandeg, 360);
     $fandeg = max($fandeg, 90);
     $cx = $fanw / 2 - 1;
     // center x
     $cy = $cx;
     // center y
     $rx = $fanw - 1;
     $rw = $fanw / ($gen + 1);
     $fanh = $fanw;
     // fan height
     if ($fandeg == 180) {
         $fanh = round($fanh * ($gen + 1) / ($gen * 2));
     }
     if ($fandeg == 270) {
         $fanh = round($fanh * 0.86);
     }
     $scale = $fanw / 640;
     // image init
     $image = ImageCreate($fanw, $fanh);
     $white = ImageColorAllocate($image, 0xff, 0xff, 0xff);
     ImageFilledRectangle($image, 0, 0, $fanw, $fanh, $white);
     ImageColorTransparent($image, $white);
     $color = ImageColorAllocate($image, hexdec(substr($fanChart['color'], 1, 2)), hexdec(substr($fanChart['color'], 3, 2)), hexdec(substr($fanChart['color'], 5, 2)));
     $bgcolor = ImageColorAllocate($image, hexdec(substr($fanChart['bgColor'], 1, 2)), hexdec(substr($fanChart['bgColor'], 3, 2)), hexdec(substr($fanChart['bgColor'], 5, 2)));
     $bgcolorM = ImageColorAllocate($image, hexdec(substr($fanChart['bgMColor'], 1, 2)), hexdec(substr($fanChart['bgMColor'], 3, 2)), hexdec(substr($fanChart['bgMColor'], 5, 2)));
     $bgcolorF = ImageColorAllocate($image, hexdec(substr($fanChart['bgFColor'], 1, 2)), hexdec(substr($fanChart['bgFColor'], 3, 2)), hexdec(substr($fanChart['bgFColor'], 5, 2)));
     // imagemap
     $imagemap = '<map id="fanmap" name="fanmap">';
     // loop to create fan cells
     while ($gen >= 0) {
         // clean current generation area
         $deg2 = 360 + ($fandeg - 180) / 2;
         $deg1 = $deg2 - $fandeg;
         ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bgcolor, IMG_ARC_PIE);
         $rx -= 3;
         // calculate new angle
         $p2 = pow(2, $gen);
         $angle = $fandeg / $p2;
         $deg2 = 360 + ($fandeg - 180) / 2;
         $deg1 = $deg2 - $angle;
         // special case for rootid cell
         if ($gen == 0) {
             $deg1 = 90;
             $deg2 = 360 + $deg1;
         }
         // draw each cell
         while ($sosa >= $p2) {
             $pid = $treeid[$sosa];
             $person = WT_Individual::getInstance($pid);
             if ($person) {
                 $name = $person->getFullName();
                 $addname = $person->getAddName();
                 $text = WT_I18N::reverseText($name);
                 if ($addname) {
                     $text .= "\n" . WT_I18N::reverseText($addname);
                 }
                 $text .= "\n" . WT_I18N::reverseText($person->getLifeSpan());
                 switch ($person->getSex()) {
                     case 'M':
                         $bg = $bgcolorM;
                         break;
                     case 'F':
                         $bg = $bgcolorF;
                         break;
                     case 'U':
                         $bg = $bgcolor;
                         break;
                 }
                 ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE);
                 // split and center text by lines
                 $wmax = (int) ($angle * 7 / $fanChart['size'] * $scale);
                 $wmax = min($wmax, 35 * $scale);
                 if ($gen == 0) {
                     $wmax = min($wmax, 17 * $scale);
                 }
                 $text = $this->split_align_text($text, $wmax);
                 // text angle
                 $tangle = 270 - ($deg1 + $angle / 2);
                 if ($gen == 0) {
                     $tangle = 0;
                 }
                 // calculate text position
                 $deg = $deg1 + 0.44;
                 if ($deg2 - $deg1 > 40) {
                     $deg = $deg1 + ($deg2 - $deg1) / 11;
                 }
                 if ($deg2 - $deg1 > 80) {
                     $deg = $deg1 + ($deg2 - $deg1) / 7;
                 }
                 if ($deg2 - $deg1 > 140) {
                     $deg = $deg1 + ($deg2 - $deg1) / 4;
                 }
                 if ($gen == 0) {
                     $deg = 180;
                 }
                 $rad = deg2rad($deg);
                 $mr = ($rx - $rw / 4) / 2;
                 if ($gen > 0 && $deg2 - $deg1 > 80) {
                     $mr = $rx / 2;
                 }
                 $tx = $cx + $mr * cos($rad);
                 $ty = $cy - $mr * -sin($rad);
                 if ($sosa == 1) {
                     $ty -= $mr / 2;
                 }
                 // print text
                 ImageTtfText($image, (double) $fanChart['size'], $tangle, $tx, $ty, $color, $fanChart['font'], $text);
                 $imagemap .= '<area shape="poly" coords="';
                 // plot upper points
                 $mr = $rx / 2;
                 $deg = $deg1;
                 while ($deg <= $deg2) {
                     $rad = deg2rad($deg);
                     $tx = round($cx + $mr * cos($rad));
                     $ty = round($cy - $mr * -sin($rad));
                     $imagemap .= "{$tx},{$ty},";
                     $deg += ($deg2 - $deg1) / 6;
                 }
                 // plot lower points
                 $mr = ($rx - $rw) / 2;
                 $deg = $deg2;
                 while ($deg >= $deg1) {
                     $rad = deg2rad($deg);
                     $tx = round($cx + $mr * cos($rad));
                     $ty = round($cy - $mr * -sin($rad));
                     $imagemap .= "{$tx},{$ty},";
                     $deg -= ($deg2 - $deg1) / 6;
                 }
                 // join first point
                 $mr = $rx / 2;
                 $deg = $deg1;
                 $rad = deg2rad($deg);
                 $tx = round($cx + $mr * cos($rad));
                 $ty = round($cy - $mr * -sin($rad));
                 $imagemap .= "{$tx},{$ty}";
                 // add action url
                 $imagemap .= '" href="#' . $pid . '"';
                 $tempURL = 'fanchart.php?rootid=' . $pid . '&amp;generations=' . $this->generations . '&amp;fan_width=' . $this->fan_width . '&amp;fan_style=' . $this->fan_style . '&amp;ged=' . WT_GEDURL;
                 $html .= '<div id="' . $pid . '" class="fan_chart_menu">';
                 $html .= '<div class="person_box"><div class="details1">';
                 $html .= '<a href="' . $person->getHtmlUrl() . '" class="name1">' . $name;
                 if ($addname) {
                     $html .= $addname;
                 }
                 $html .= '</a>';
                 $html .= '<ul class="charts">';
                 $html .= "<li><a href=\"pedigree.php?rootid={$pid}&amp;amp;ged=" . WT_GEDURL . "\" >" . WT_I18N::translate('Pedigree') . "</a></li>";
                 if (array_key_exists('googlemap', WT_Module::getActiveModules())) {
                     $html .= "<li><a href=\"module.php?mod=googlemap&amp;mod_action=pedigree_map&amp;rootid=" . $pid . "&amp;ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Pedigree map') . "</a></li>";
                 }
                 if (WT_USER_GEDCOM_ID && WT_USER_GEDCOM_ID != $pid) {
                     $html .= "<li><a href=\"relationship.php?pid1=" . WT_USER_GEDCOM_ID . "&amp;pid2={$pid}&amp;ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Relationship to me') . "</a></li>";
                 }
                 $html .= "<li><a href=\"descendancy.php?rootid={$pid}&amp;ged=" . WT_GEDURL . "\" >" . WT_I18N::translate('Descendants') . "</a></li>";
                 $html .= "<li><a href=\"ancestry.php?rootid={$pid}&amp;ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Ancestors') . "</a></li>";
                 $html .= "<li><a href=\"compact.php?rootid={$pid}&amp;ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Compact tree') . "</a></li>";
                 $html .= "<li><a href=\"" . $tempURL . "\">" . WT_I18N::translate('Fan chart') . "</a></li>";
                 $html .= "<li><a href=\"hourglass.php?rootid={$pid}&amp;ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Hourglass chart') . "</a></li>";
                 if (array_key_exists('tree', WT_Module::getActiveModules())) {
                     $html .= '<li><a href="module.php?mod=tree&amp;mod_action=treeview&amp;ged=' . WT_GEDURL . '&amp;rootid=' . $pid . '">' . WT_I18N::translate('Interactive tree') . '</a></li>';
                 }
                 $html .= '</ul>';
                 // spouse(s) and children
                 foreach ($person->getSpouseFamilies() as $family) {
                     $spouse = $family->getSpouse($person);
                     if ($spouse) {
                         $html .= '<a href="' . $spouse->getHtmlUrl() . '" class="name1">' . $spouse->getFullName() . '</a>';
                         $kids = $family->getChildren();
                         if ($kids) {
                             $html .= '<ul class="children">';
                             foreach ($kids as $child) {
                                 $html .= '<li><a href="' . $child->getHtmlUrl() . '" class="name1">' . $child->getFullName() . '</a></li>';
                             }
                             $html .= '</ul>';
                         }
                     }
                 }
                 // siblings
                 foreach ($person->getChildFamilies() as $family) {
                     $children = $family->getChildren();
                     if ($children) {
                         $html .= '<div class="name1">' . WT_I18N::plural('Sibling', 'Siblings', count($children) - 1) . '</div>';
                         $html .= '<ul class="siblings">';
                         foreach ($children as $sibling) {
                             if ($sibling !== $person) {
                                 $html .= '<li><a href="' . $sibling->getHtmlUrl() . '" class="name1"> ' . $sibling->getFullName() . '</a></li>';
                             }
                         }
                         $html .= '</ul>';
                     }
                 }
                 $html .= '</div></div>';
                 $html .= '</div>';
                 $imagemap .= ' alt="' . strip_tags($person->getFullName()) . '" title="' . strip_tags($person->getFullName()) . '">';
             }
             $deg1 -= $angle;
             $deg2 -= $angle;
             $sosa--;
         }
         $rx -= $rw;
         $gen--;
     }
     $imagemap .= '</map>';
     switch ($what) {
         case 'html':
             $image_title = WT_I18N::translate('Fan chart of %s', strip_tags($person->getFullName()));
             return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->rootid . '&amp;fan_style=' . $this->fan_style . '&amp;generations=' . $this->generations . '&amp;fan_width=' . $this->fan_width . '&amp;img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . $image_title . '" title="' . $image_title . '" usemap="#fanmap"></div>';
         case 'png':
             header('Content-Type: image/png');
             ImageStringUp($image, 1, $fanw - 10, $fanh / 3, WT_SERVER_NAME . WT_SCRIPT_PATH, $color);
             ImagePng($image);
             ImageDestroy($image);
     }
 }
Example #18
0
 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, self::MAX_DAYS, self::DEFAULT_DAYS));
         set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
         set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'name|date_asc|date_desc', 'date_desc'));
         set_block_setting($block_id, 'hide_empty', WT_Filter::postBool('hide_empty'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', self::MAX_DAYS, self::MAX_DAYS), '</em>';
     echo '</td></tr>';
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     $sortStyle = get_block_setting($block_id, 'sortStyle', 'date');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo select_edit_control('sortStyle', array('name' => WT_I18N::translate('sort by name'), 'date_asc' => WT_I18N::translate('sort by date, oldest first'), 'date_desc' => WT_I18N::translate('sort by date, newest first')), null, $sortStyle, '');
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
     $hide_empty = get_block_setting($block_id, 'hide_empty', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Should this block be hidden when it is empty?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('hide_empty', $hide_empty);
     echo '</td></tr>';
     echo '<tr><td colspan="2" class="optionbox wrap">';
     echo '<span class="error">', WT_I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
     echo '</td></tr>';
 }
Example #19
0
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
define('WT_SCRIPT_NAME', 'admin_trees_merge.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Merge family trees'))->pageHeader();
echo '<h2>', $controller->getPageTitle(), '</h2>';
$ged2_id = WT_Filter::post('ged2_id');
if ($ged2_id && $ged2_id != WT_GED_ID) {
    // Every XREF used by both trees
    $xrefs = WT_DB::prepare("SELECT xref, type FROM (" . " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . "  UNION " . " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . "  UNION " . " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . "  UNION " . " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . "  UNION " . " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS this_tree JOIN (" . " SELECT xref FROM `##change` WHERE gedcom_id = ?" . "  UNION " . " SELECT i_id AS xref FROM `##individuals` WHERE i_file = ?" . "  UNION " . " SELECT f_id AS xref FROM `##families` WHERE f_file = ?" . "  UNION " . " SELECT s_id AS xref FROM `##sources` WHERE s_file = ?" . "  UNION " . " SELECT m_id AS xref FROM `##media` WHERE m_file = ?" . "  UNION " . " SELECT o_id AS xref FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS other_trees USING (xref)")->execute(array(WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, $ged2_id, $ged2_id, $ged2_id, $ged2_id, $ged2_id, $ged2_id))->fetchAssoc();
    if ($xrefs) {
        echo '<p class="error">', WT_I18N::plural('The two family trees have %1$s record which uses the same “XREF”.', 'The two family trees have %1$s records which uses the same “XREF”.', count($xrefs), count($xrefs)), '</p>', '<p class="error">', WT_I18N::translate('You must renumber the records in one of the trees before you can merge them.'), '</p>';
    } else {
        WT_DB::exec("START TRANSACTION");
        WT_DB::exec("LOCK TABLE" . " `##individuals` WRITE," . " `##individuals` AS individuals2 READ," . " `##families` WRITE," . " `##families` AS families2 READ," . " `##sources` WRITE," . " `##sources` AS sources2 READ," . " `##media` WRITE," . " `##media` AS media2 READ," . " `##other` WRITE," . " `##other` AS other2 READ," . " `##name` WRITE," . " `##name` AS name2 READ," . " `##placelinks` WRITE," . " `##placelinks` AS placelinks2 READ," . " `##change` WRITE," . " `##change` AS change2 READ," . " `##dates` WRITE," . " `##dates` AS dates2 READ," . " `##default_resn` WRITE," . " `##default_resn` AS default_resn2 READ," . " `##hit_counter` WRITE," . " `##hit_counter` AS hit_counter2 READ," . " `##link` WRITE," . " `##link` AS link2 READ");
        try {
            WT_DB::prepare("INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom)" . " SELECT m_id, m_ext, m_type, m_titl, m_filename, ?, m_gedcom FROM `##media` AS media2 WHERE m_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom)" . " SELECT o_id, ?, o_type, o_gedcom FROM `##other` AS other2 WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##name` (n_file, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm)" . " SELECT ?, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm FROM `##name` AS name2 WHERE n_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##placelinks` (pl_p_id, pl_gid, pl_file)" . " SELECT pl_p_id, pl_gid, ? FROM `##placelinks` AS placelinks2 WHERE pl_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##dates` (d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, d_file, d_type)" . " SELECT d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, ?, d_type FROM `##dates` AS dates2 WHERE d_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##default_resn` (gedcom_id, xref, tag_type, resn, comment, updated)" . " SELECT ?, xref, tag_type, resn, comment, updated FROM `##default_resn` AS default_resn2 WHERE gedcom_id = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##link` (l_file, l_from, l_type, l_to)" . " SELECT ?, l_from, l_type, l_to FROM `##link` AS link2 WHERE l_file = ?")->execute(array($ged2_id, WT_GED_ID));
            // This table may contain old (deleted) references, which could clash.  IGNORE these.
Example #20
0
/**
 * print the children table for a family
 *
 * @param WT_Family $family  family
 * @param string    $childid child ID
 * @param int       $sosa    child sosa number
 * @param string    $label   indi label (descendancy booklet)
 * @param int       $personcount
 */
function print_family_children(WT_Family $family, $childid = '', $sosa = 0, $label = '', $personcount = 1)
{
    global $bheight, $pbheight, $cbheight, $show_cousins, $WT_IMAGES, $TEXT_DIRECTION;
    $children = $family->getChildren();
    $numchil = count($children);
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\"><tr>";
    if ($sosa > 0) {
        echo "<td></td>";
    }
    echo "<td><span class=\"subheaders\">";
    if ($numchil == 0) {
        echo WT_I18N::translate('No children');
    } else {
        echo WT_I18N::plural('%s child', '%s children', $numchil, $numchil);
    }
    echo '</span>';
    if ($sosa == 0 && WT_USER_CAN_EDIT) {
        echo '<br>';
        echo "<a href=\"#\" onclick=\"return add_child_to_family('", $family->getXref(), "', 'U');\">" . WT_I18N::translate('Add a child to this family') . "</a>";
        echo ' <a class="icon-sex_m_15x15" href="#" onclick="return add_child_to_family(\'', $family->getXref(), '\', \'M\');" title="', WT_I18N::translate('son'), '"></a>';
        echo ' <a class="icon-sex_f_15x15" href="#" onclick="return add_child_to_family(\'', $family->getXref(), '\', \'F\');" title="', WT_I18N::translate('daughter'), '"></a>';
        echo '<br><br>';
    }
    echo '</td>';
    if ($sosa > 0) {
        echo '<td></td><td></td>';
    }
    echo '</tr>';
    $nchi = 1;
    if ($children) {
        foreach ($children as $child) {
            echo '<tr>';
            if ($sosa != 0) {
                if ($child->getXref() == $childid) {
                    print_sosa_number($sosa, $childid);
                } elseif (empty($label)) {
                    print_sosa_number("");
                } else {
                    print_sosa_number($label . $nchi++ . ".");
                }
            }
            if ($child->isNew()) {
                echo '<td valign="middle" class="new">';
            } elseif ($child->isOld()) {
                echo '<td valign="middle" class="old">';
            } else {
                echo '<td valign="middle">';
            }
            print_pedigree_person($child, 1, 8, $personcount++);
            echo "</td>";
            if ($sosa != 0) {
                // loop for all families where current child is a spouse
                $famids = $child->getSpouseFamilies();
                $maxfam = count($famids) - 1;
                for ($f = 0; $f <= $maxfam; $f++) {
                    $famid_child = $famids[$f]->getXref();
                    // multiple marriages
                    if ($f > 0) {
                        echo "</tr><tr><td>&nbsp;</td>";
                        echo "<td valign=\"top\"";
                        if ($TEXT_DIRECTION == "rtl") {
                            echo " align=\"left\">";
                        } else {
                            echo " align=\"right\">";
                        }
                        //if ($f==$maxfam) echo "<img height=\"50%\"";
                        //else echo "<img height=\"100%\"";
                        //find out how many cousins there are to establish vertical line on second families
                        $fchildren = $famids[$f]->getChildren();
                        $kids = count($fchildren);
                        $Pheader = $cbheight * $kids - $bheight;
                        $PBadj = 6;
                        // default
                        if ($show_cousins > 0) {
                            if ($cbheight * $kids > $bheight) {
                                $PBadj = $Pheader / 2 + $kids * 4.5;
                            }
                        }
                        if ($PBadj < 0) {
                            $PBadj = 0;
                        }
                        if ($f == $maxfam) {
                            echo "<img height=\"" . ($bheight / 2 + $PBadj) . "px\"";
                        } else {
                            echo "<img height=\"" . $pbheight . "px\"";
                        }
                        echo " width=\"3\" src=\"" . $WT_IMAGES["vline"] . "\" alt=\"\">";
                        echo "</td>";
                    }
                    echo "<td class=\"details1\" valign=\"middle\" align=\"center\">";
                    $spouse = $famids[$f]->getSpouse($child);
                    $marr = $famids[$f]->getFirstFact('MARR');
                    $div = $famids[$f]->getFirstFact('DIV');
                    if ($marr) {
                        // marriage date
                        echo $marr->getDate()->minDate()->format('%Y');
                        // divorce date
                        if ($div) {
                            echo '–', $div->getDate()->minDate()->format('%Y');
                        }
                    }
                    echo "<br><img width=\"100%\" class=\"line5\" height=\"3\" src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\">";
                    echo "</td>";
                    // spouse information
                    echo "<td style=\"vertical-align: center;";
                    if (!empty($divrec)) {
                        echo " filter:alpha(opacity=40);opacity:0.4;\">";
                    } else {
                        echo "\">";
                    }
                    print_pedigree_person($spouse, 1, 9, $personcount++);
                    echo "</td>";
                    // cousins
                    if ($show_cousins) {
                        print_cousins($famid_child, $personcount++);
                    }
                }
            }
            echo "</tr>";
        }
    } elseif ($sosa < 1) {
        // message 'no children' except for sosa
        if (preg_match('/\\n1 NCHI (\\d+)/', $family->getGedcom(), $match) && $match[1] == 0) {
            echo '<tr><td><i class="icon-childless"></i> ' . WT_I18N::translate('This family remained childless') . '</td></tr>';
        }
    } else {
        echo "<tr>";
        print_sosa_number($sosa, $child);
        echo "<td valign=\"top\">";
        print_pedigree_person(WT_Individual::getInstance($childid), 1, 0, $personcount);
        echo "</td></tr>";
    }
    echo "</table><br>";
}
Example #21
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;
Example #22
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>
Example #23
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>