/**
  * Manage updates sent from the AdminConfig@index form.
  */
 protected function update()
 {
     if (Auth::isAdmin()) {
         $ihooks = HookProvider::getInstance()->getInstalledHooks();
         $module_names = Database::prepare("SELECT module_name FROM `##module` WHERE status='disabled'")->fetchOneColumn();
         if ($ihooks !== null) {
             foreach ($ihooks as $ihook => $params) {
                 if (Filter::post('hook-' . $params['id']) === 'yes') {
                     $array_hook = explode('#', $ihook);
                     //Update status
                     $new_status = Filter::postBool('status-' . $params['id']);
                     if (in_array($array_hook[0], $module_names)) {
                         $new_status = false;
                     }
                     $previous_status = $params['status'];
                     if ($new_status !== null) {
                         $new_status = $new_status ? 'enabled' : 'disabled';
                         if ($new_status != $previous_status) {
                             $chook = new Hook($array_hook[1], $array_hook[2]);
                             switch ($new_status) {
                                 case 'enabled':
                                     $chook->enable($array_hook[0]);
                                     break;
                                 case 'disabled':
                                     $chook->disable($array_hook[0]);
                                     break;
                                 default:
                                     break;
                             }
                         }
                     }
                     //Update priority
                     $new_priority = Filter::postInteger("moduleorder-{$params['id']}");
                     $previous_priority = $params['priority'];
                     if ($new_priority !== null) {
                         if ($new_priority != $previous_priority) {
                             $chook = new Hook($array_hook[1], $array_hook[2]);
                             $chook->setPriority($array_hook[0], $new_priority);
                         }
                     }
                 }
             }
         }
     }
 }
 public function modAction($mod_action)
 {
     switch ($mod_action) {
         case 'admin_config':
             if (Filter::postBool('save')) {
                 $this->setSetting('FRL_PLUGINS', serialize(Filter::post('NEW_FRL_PLUGINS')));
                 Log::addConfigurationLog($this->getTitle() . ' config updated');
             }
             $template = new AdminTemplate();
             return $template->pageContent();
         case 'admin_reset':
             Database::prepare("DELETE FROM `##module_setting` WHERE setting_name LIKE 'FRL%'")->execute();
             Log::addConfigurationLog($this->getTitle() . ' reset to default values');
             header('Location: ' . $this->getConfigLink());
             break;
         default:
             http_response_code(404);
             break;
     }
 }
    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'show_other', Filter::postBool('show_other'));
            $this->setBlockSetting($block_id, 'show_unassigned', Filter::postBool('show_unassigned'));
            $this->setBlockSetting($block_id, 'show_future', Filter::postBool('show_future'));
            $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
        }
        $show_other = $this->getBlockSetting($block_id, 'show_other', self::DEFAULT_SHOW_OTHER);
        $show_unassigned = $this->getBlockSetting($block_id, 'show_unassigned', self::DEFAULT_SHOW_UNASSIGNED);
        $show_future = $this->getBlockSetting($block_id, 'show_future', self::DEFAULT_SHOW_FUTURE);
        $block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
        ?>
		<tr>
			<td colspan="2">
				<?php 
        echo I18N::translate('Research tasks are special events, added to individuals in your family tree, which identify the need for further research. You can use them as a reminder to check facts against more reliable sources, to obtain documents or photographs, to resolve conflicting information, etc.');
        ?>
				<?php 
        echo I18N::translate('To create new research tasks, you must first add “research task” to the list of facts and events in the family tree’s preferences.');
        ?>
				<?php 
        echo I18N::translate('Research tasks are stored using the custom GEDCOM tag “_TODO”. Other genealogy applications may not recognize this tag.');
        ?>
			</td>
		</tr>
		<?php 
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Show research tasks that are assigned to other users');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('show_other', $show_other);
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Show research tasks that are not assigned to any user');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('show_unassigned', $show_unassigned);
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Show research tasks that have a date in the future');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('show_future', $show_future);
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Add a scrollbar when block contents grow');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('block', $block);
        echo '</td></tr>';
    }
Beispiel #4
0
    private function edit()
    {
        global $WT_TREE;
        if (webtrees\Filter::postBool('save') && webtrees\Filter::checkCsrf()) {
            $block_id = webtrees\Filter::post('block_id');
            if ($block_id) {
                webtrees\Database::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, ''), block_order=? WHERE block_id=?")->execute(array(webtrees\Filter::post('gedcom_id'), (int) webtrees\Filter::post('block_order'), $block_id));
            } else {
                webtrees\Database::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, ''), ?, ?)")->execute(array(webtrees\Filter::post('gedcom_id'), $this->getName(), (int) webtrees\Filter::post('block_order')));
                $block_id = webtrees\Database::getInstance()->lastInsertId();
            }
            $this->setBlockSetting($block_id, 'menu_title', webtrees\Filter::post('menu_title'));
            $this->setBlockSetting($block_id, 'menu_address', webtrees\Filter::post('menu_address'));
            $this->setBlockSetting($block_id, 'menu_access', webtrees\Filter::post('menu_access'));
            $languages = array();
            foreach (webtrees\I18N::installedLocales() as $locale) {
                if (webtrees\Filter::postBool('lang_' . $locale->languageTag())) {
                    $languages[] = $locale->languageTag();
                }
            }
            $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
            $this->config();
        } else {
            $block_id = webtrees\Filter::get('block_id');
            $controller = new webtrees\Controller\PageController();
            $controller->restrictAccess(webtrees\Auth::isEditor($WT_TREE));
            if ($block_id) {
                $controller->setPageTitle(webtrees\I18N::translate('Edit menu'));
                $menu_title = $this->getBlockSetting($block_id, 'menu_title');
                $menu_address = $this->getBlockSetting($block_id, 'menu_address');
                $menu_access = $this->getBlockSetting($block_id, 'menu_access');
                $block_order = webtrees\Database::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
                $gedcom_id = webtrees\Database::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
            } else {
                $controller->setPageTitle(webtrees\I18N::translate('Add menu'));
                $menu_access = 1;
                $menu_title = '';
                $menu_address = '';
                $block_order = webtrees\Database::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
                $gedcom_id = $WT_TREE->getTreeId();
            }
            $controller->pageHeader();
            ?>
			
			<ol class="breadcrumb small">
				<li><a href="admin.php"><?php 
            echo webtrees\I18N::translate('Control panel');
            ?>
</a></li>
				<li><a href="admin_modules.php"><?php 
            echo webtrees\I18N::translate('Module administration');
            ?>
</a></li>
				<li><a href="module.php?mod=<?php 
            echo $this->getName();
            ?>
&mod_action=admin_config"><?php 
            echo webtrees\I18N::translate($this->getTitle());
            ?>
</a></li>
				<li class="active"><?php 
            echo $controller->getPageTitle();
            ?>
</li>
			</ol>
			
			<form class="form-horizontal" method="POST" action="#" name="menu" id="menuForm">
				<?php 
            echo webtrees\Filter::getCsrf();
            ?>
				<input type="hidden" name="save" value="1">
				<input type="hidden" name="block_id" value="<?php 
            echo $block_id;
            ?>
">
				<h3><?php 
            echo webtrees\I18N::translate('General');
            ?>
</h3>
				
				<div class="form-group">
					<label class="control-label col-sm-3" for="menu_title">
						<?php 
            echo webtrees\I18N::translate('Title');
            ?>
					</label>
					<div class="col-sm-9">
						<input
							class="form-control"
							id="menu_title"
							size="90"
							name="menu_title"
							required
							type="text"
							value="<?php 
            echo webtrees\Filter::escapeHtml($menu_title);
            ?>
"
							>
					</div>
					<span class="help-block col-sm-9 col-sm-offset-3 small text-muted">
						<?php 
            echo webtrees\I18N::translate('Add your menu title here');
            ?>
					</span>
				</div>
				<div class="form-group">
					<label class="control-label col-sm-3" for="menu_address">
						<?php 
            echo webtrees\I18N::translate('Menu address');
            ?>
					</label>
					<div class="col-sm-9">
						<input
							class="form-control"
							id="menu_address"
							size="90"
							name="menu_address"
							required
							type="text"
							value="<?php 
            echo webtrees\Filter::escapeHtml($menu_address);
            ?>
"
							>
					</div>
					<span class="help-block col-sm-9 col-sm-offset-3 small text-muted">
						<?php 
            echo webtrees\I18N::translate('Add your menu address here');
            ?>
					</span>
				</div>
				
				<h3><?php 
            echo webtrees\I18N::translate('Languages');
            ?>
</h3>
				
				<div class="form-group">
					<label class="control-label col-sm-3" for="lang_*">
						<?php 
            echo webtrees\I18N::translate('Show this menu for which languages?');
            ?>
					</label>
					<div class="col-sm-9">
						<?php 
            $accepted_languages = explode(',', $this->getBlockSetting($block_id, 'languages'));
            foreach (webtrees\I18N::installedLocales() as $locale) {
                ?>
								<div class="checkbox">
									<label title="<?php 
                echo $locale->languageTag();
                ?>
">
										<input type="checkbox" name="lang_<?php 
                echo $locale->languageTag();
                ?>
" <?php 
                echo in_array($locale->languageTag(), $accepted_languages) ? 'checked' : '';
                ?>
 ><?php 
                echo $locale->endonym();
                ?>
									</label>
								</div>
						<?php 
            }
            ?>
					</div>
				</div>
				
				<h3><?php 
            echo webtrees\I18N::translate('Visibility and Access');
            ?>
</h3>
				
				<div class="form-group">
					<label class="control-label col-sm-3" for="block_order">
						<?php 
            echo webtrees\I18N::translate('Menu position');
            ?>
					</label>
					<div class="col-sm-9">
						<input
							class="form-control"
							id="position"
							name="block_order"
							size="3"
							required
							type="number"
							value="<?php 
            echo webtrees\Filter::escapeHtml($block_order);
            ?>
"
						>
					</div>
					<span class="help-block col-sm-9 col-sm-offset-3 small text-muted">
						<?php 
            echo webtrees\I18N::translate('This field controls the order in which the menu items are displayed.'), '<br><br>', webtrees\I18N::translate('You do not have to enter the numbers sequentially. If you leave holes in the numbering scheme, you can insert other menu items later. For example, if you use the numbers 1, 6, 11, 16, you can later insert menu items with the missing sequence numbers. Negative numbers and zero are allowed, and can be used to insert menu items in front of the first one.'), '<br><br>', webtrees\I18N::translate('When more than one menu item has the same position number, only one of these menu items will be visible.');
            ?>
					</span>
				</div>
				<div class="form-group">
					<label class="control-label col-sm-3" for="block_order">
						<?php 
            echo webtrees\I18N::translate('Menu visibility');
            ?>
					</label>
					<div class="col-sm-9">
						<?php 
            echo webtrees\Functions\FunctionsEdit::selectEditControl('gedcom_id', webtrees\Tree::getIdList(), webtrees\I18N::translate('All'), $WT_TREE->getTreeId(), 'class="form-control"');
            ?>
					</div>
					<span class="help-block col-sm-9 col-sm-offset-3 small text-muted">
						<?php 
            echo webtrees\I18N::translate('You can determine whether this menu item will be visible regardless of family tree, or whether it will be visible only to the current family tree.');
            ?>
					</span>
				</div>
				<div class="form-group">
					<label class="control-label col-sm-3" for="menu_access">
						<?php 
            echo webtrees\I18N::translate('Access level');
            ?>
					</label>
					<div class="col-sm-9">
						<?php 
            echo webtrees\Functions\FunctionsEdit::editFieldAccessLevel('menu_access', $menu_access, 'class="form-control"');
            ?>
					</div>
				</div>
				
				<div class="row col-sm-9 col-sm-offset-3">
					<button class="btn btn-primary" type="submit">
						<i class="fa fa-check"></i>
						<?php 
            echo webtrees\I18N::translate('save');
            ?>
					</button>
					<button class="btn" type="button" onclick="window.location='<?php 
            echo $this->getConfigLink();
            ?>
';">
						<i class="fa fa-close"></i>
						<?php 
            echo webtrees\I18N::translate('cancel');
            ?>
					</button>
				</div>
			</form>
<?php 
        }
    }
Beispiel #5
0
        echo I18N::translate('sort by date of marriage');
        ?>
">
			<input type="button" class="cancel" value="<?php 
        echo I18N::translate('close');
        ?>
" onclick="window.close();">
		</p>
	</form>
	</div>
	<?php 
        break;
    case 'reorder_fams_update':
        $xref = Filter::post('xref', WT_REGEX_XREF);
        $order = Filter::post('order');
        $keep_chan = Filter::postBool('keep_chan');
        if (!Filter::checkCsrf()) {
            header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=reorder_fams&xref=' . $xref);
            return;
        }
        $person = Individual::getInstance($xref, $WT_TREE);
        check_record_access($person);
        $controller->setPageTitle(I18N::translate('Re-order families'))->pageHeader();
        if (is_array($order)) {
            $gedcom = array('0 @' . $person->getXref() . '@ INDI');
            $facts = $person->getFacts();
            // Move families to the end of the record
            foreach ($order as $family => $num) {
                foreach ($facts as $n => $fact) {
                    if ($fact->getValue() === '@' . $family . '@') {
                        $facts[] = $fact;
Beispiel #6
0
    header('Location: ' . WT_BASE_URL);
    return;
}
// Extract form variables
$form_action = Filter::post('form_action');
$form_username = Filter::post('form_username');
$form_realname = Filter::post('form_realname');
$form_pass1 = Filter::post('form_pass1', WT_REGEX_PASSWORD);
$form_pass2 = Filter::post('form_pass2', WT_REGEX_PASSWORD);
$form_email = Filter::postEmail('form_email');
$form_rootid = Filter::post('form_rootid', WT_REGEX_XREF);
$form_theme = Filter::post('form_theme');
$form_language = Filter::post('form_language');
$form_timezone = Filter::post('form_timezone');
$form_contact_method = Filter::post('form_contact_method');
$form_visible_online = Filter::postBool('form_visible_online');
// Respond to form action
if ($form_action && Filter::checkCsrf()) {
    switch ($form_action) {
        case 'update':
            if ($form_username !== Auth::user()->getUserName() && User::findByUserName($form_username)) {
                FlashMessages::addMessage(I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.'));
            } elseif ($form_email !== Auth::user()->getEmail() && User::findByEmail($form_email)) {
                FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.'));
            } else {
                // Change username
                if ($form_username !== Auth::user()->getUserName()) {
                    Log::addAuthenticationLog('User ' . Auth::user()->getUserName() . ' renamed to ' . $form_username);
                    Auth::user()->setUserName($form_username);
                }
                // Change password
 case 'site':
     if (Filter::checkCsrf()) {
         $INDEX_DIRECTORY = Filter::post('INDEX_DIRECTORY');
         if (substr($INDEX_DIRECTORY, -1) !== '/') {
             $INDEX_DIRECTORY .= '/';
         }
         if (File::mkdir($INDEX_DIRECTORY)) {
             Site::setPreference('INDEX_DIRECTORY', $INDEX_DIRECTORY);
         } else {
             FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Filter::escapeHtml($INDEX_DIRECTORY)), 'danger');
         }
         Site::setPreference('MEMORY_LIMIT', Filter::post('MEMORY_LIMIT'));
         Site::setPreference('MAX_EXECUTION_TIME', Filter::post('MAX_EXECUTION_TIME'));
         Site::setPreference('ALLOW_USER_THEMES', Filter::postBool('ALLOW_USER_THEMES'));
         Site::setPreference('THEME_DIR', Filter::post('THEME_DIR'));
         Site::setPreference('ALLOW_CHANGE_GEDCOM', Filter::postBool('ALLOW_CHANGE_GEDCOM'));
         Site::setPreference('SESSION_TIME', Filter::post('SESSION_TIME'));
         Site::setPreference('SERVER_URL', Filter::post('SERVER_URL'));
         Site::setPreference('TIMEZONE', Filter::post('TIMEZONE'));
         FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success');
     }
     header('Location: ' . WT_BASE_URL . 'admin.php');
     return;
 case 'email':
     if (Filter::checkCsrf()) {
         Site::setPreference('SMTP_ACTIVE', Filter::post('SMTP_ACTIVE'));
         Site::setPreference('SMTP_FROM_NAME', Filter::post('SMTP_FROM_NAME'));
         Site::setPreference('SMTP_HOST', Filter::post('SMTP_HOST'));
         Site::setPreference('SMTP_PORT', Filter::post('SMTP_PORT'));
         Site::setPreference('SMTP_AUTH', Filter::post('SMTP_AUTH'));
         Site::setPreference('SMTP_AUTH_USER', Filter::post('SMTP_AUTH_USER'));
    /**
     * Action from the configuration page
     */
    private function edit()
    {
        global $WT_TREE;
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $block_id = Filter::postInteger('block_id');
            if ($block_id) {
                Database::prepare("UPDATE `##block` SET gedcom_id = NULLIF(:tree_id, '0'), block_order = :block_order WHERE block_id = :block_id")->execute(array('tree_id' => Filter::postInteger('gedcom_id'), 'block_order' => Filter::postInteger('block_order'), 'block_id' => $block_id));
            } else {
                Database::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(:tree_id, '0'), :module_name, :block_order)")->execute(array('tree_id' => Filter::postInteger('gedcom_id'), 'module_name' => $this->getName(), 'block_order' => Filter::postInteger('block_order')));
                $block_id = Database::getInstance()->lastInsertId();
            }
            $this->setBlockSetting($block_id, 'header', Filter::post('header'));
            $this->setBlockSetting($block_id, 'faqbody', Filter::post('faqbody'));
            $languages = Filter::postArray('lang');
            $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
            $this->config();
        } else {
            $block_id = Filter::getInteger('block_id');
            $controller = new PageController();
            if ($block_id) {
                $controller->setPageTitle(I18N::translate('Edit FAQ item'));
                $header = $this->getBlockSetting($block_id, 'header');
                $faqbody = $this->getBlockSetting($block_id, 'faqbody');
                $block_order = Database::prepare("SELECT block_order FROM `##block` WHERE block_id = :block_id")->execute(array('block_id' => $block_id))->fetchOne();
                $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##block` WHERE block_id = :block_id")->execute(array('block_id' => $block_id))->fetchOne();
            } else {
                $controller->setPageTitle(I18N::translate('Add an FAQ item'));
                $header = '';
                $faqbody = '';
                $block_order = Database::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name = :module_name")->execute(array('module_name' => $this->getName()))->fetchOne();
                $gedcom_id = $WT_TREE->getTreeId();
            }
            $controller->pageHeader();
            if (Module::getModuleByName('ckeditor')) {
                CkeditorModule::enableEditor($controller);
            }
            ?>
			<ol class="breadcrumb small">
				<li><a href="admin.php"><?php 
            echo I18N::translate('Control panel');
            ?>
</a></li>
				<li><a href="admin_modules.php"><?php 
            echo I18N::translate('Module administration');
            ?>
</a></li>
				<li><a
						href="module.php?mod=<?php 
            echo $this->getName();
            ?>
&mod_action=admin_config"><?php 
            echo I18N::translate('Frequently asked questions');
            ?>
</a>
				</li>
				<li class="active"><?php 
            echo $controller->getPageTitle();
            ?>
</li>
			</ol>
			<h1><?php 
            echo $controller->getPageTitle();
            ?>
</h1>

			<form name="faq" class="form-horizontal" method="post" action="module.php?mod=<?php 
            echo $this->getName();
            ?>
&amp;mod_action=admin_edit">
			<?php 
            echo Filter::getCsrf();
            ?>
			<input type="hidden" name="save" value="1">
			<input type="hidden" name="block_id" value="<?php 
            echo $block_id;
            ?>
">

			<div class="form-group">
				<label for="header" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('Question');
            ?>
				</label>

				<div class="col-sm-9">
					<input type="text" class="form-control" name="header" id="header"
					       value="<?php 
            echo Filter::escapeHtml($header);
            ?>
">
				</div>
			</div>

			<div class="form-group">
				<label for="faqbody" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('Answer');
            ?>
				</label>

				<div class="col-sm-9">
					<textarea name="faqbody" id="faqbody" class="form-control html-edit"
					          rows="10"><?php 
            echo Filter::escapeHtml($faqbody);
            ?>
</textarea>
				</div>
			</div>

			<div class="form-group">
				<label for="xref" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('Show this block for which languages?');
            ?>
				</label>

				<div class="col-sm-9">
					<?php 
            echo FunctionsEdit::editLanguageCheckboxes('lang', explode(',', $this->getBlockSetting($block_id, 'languages')));
            ?>
				</div>
			</div>

			<div class="form-group">
				<label for="block_order" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('FAQ position');
            ?>
				</label>

				<div class="col-sm-9">
					<input type="text" name="block_order" id="block_order" class="form-control" value="<?php 
            echo $block_order;
            ?>
">
				</div>
			</div>

			<div class="form-group">
				<label for="gedcom_id" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('FAQ visibility');
            ?>
				</label>

				<div class="col-sm-9">
					<?php 
            echo FunctionsEdit::selectEditControl('gedcom_id', Tree::getIdList(), I18N::translate('All'), $gedcom_id, 'class="form-control"');
            ?>
					<p class="small text-muted">
						<?php 
            echo I18N::translate('A FAQ item can be displayed on just one of the family trees, or on all the family trees.');
            ?>
					</p>
				</div>
			</div>

			<div class="form-group">
				<div class="col-sm-offset-3 col-sm-9">
					<button type="submit" class="btn btn-primary">
						<i class="fa fa-check"></i>
						<?php 
            echo I18N::translate('save');
            ?>
					</button>
				</div>
			</div>

		</form>
		<?php 
        }
    }
 /** {@inheritdoc} */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
         $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc'));
         $this->setBlockSetting($block_id, 'show_user', Filter::postBool('show_user'));
         $this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
     $show_user = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
     $block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
     $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', I18N::number(self::MAX_DAYS), I18N::number(self::MAX_DAYS)), '</em>';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('sortStyle', array('name' => I18N::translate('sort by name'), 'date_asc' => I18N::translate('sort by date, oldest first'), 'date_desc' => I18N::translate('sort by date, newest first')), null, $sortStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show the user who made the change');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('show_user', $show_user);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Should this block be hidden when it is empty');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('hide_empty', $hide_empty);
     echo '</td></tr>';
     echo '<tr><td colspan="2" class="optionbox wrap">';
     echo '<span class="error">', 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>';
 }
Beispiel #10
0
    /**
     * Show and process a form to edit a story.
     */
    private function edit()
    {
        global $WT_TREE;
        if (Auth::isEditor($WT_TREE)) {
            if (Filter::postBool('save') && Filter::checkCsrf()) {
                $block_id = Filter::postInteger('block_id');
                if ($block_id) {
                    Database::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(Filter::postInteger('gedcom_id'), Filter::post('xref', WT_REGEX_XREF), $block_id));
                } else {
                    Database::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(Filter::postInteger('gedcom_id'), Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0));
                    $block_id = Database::getInstance()->lastInsertId();
                }
                $this->setBlockSetting($block_id, 'title', Filter::post('title'));
                $this->setBlockSetting($block_id, 'story_body', Filter::post('story_body'));
                $languages = Filter::postArray('lang');
                $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
                $this->config();
            } else {
                $block_id = Filter::getInteger('block_id');
                $controller = new PageController();
                if ($block_id) {
                    $controller->setPageTitle(I18N::translate('Edit story'));
                    $title = $this->getBlockSetting($block_id, 'title');
                    $story_body = $this->getBlockSetting($block_id, 'story_body');
                    $xref = Database::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
                } else {
                    $controller->setPageTitle(I18N::translate('Add a story'));
                    $title = '';
                    $story_body = '';
                    $xref = Filter::get('xref', WT_REGEX_XREF);
                }
                $controller->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
                if (Module::getModuleByName('ckeditor')) {
                    CkeditorModule::enableEditor($controller);
                }
                $individual = Individual::getInstance($xref, $WT_TREE);
                ?>
				<ol class="breadcrumb small">
					<li><a href="admin.php"><?php 
                echo I18N::translate('Control panel');
                ?>
</a></li>
					<li><a href="admin_modules.php"><?php 
                echo I18N::translate('Module administration');
                ?>
</a></li>
					<li><a href="module.php?mod=<?php 
                echo $this->getName();
                ?>
&mod_action=admin_config"><?php 
                echo $this->getTitle();
                ?>
</a></li>
					<li class="active"><?php 
                echo $controller->getPageTitle();
                ?>
</li>
				</ol>

				<h1><?php 
                echo $controller->getPageTitle();
                ?>
</h1>

				<form class="form-horizontal" method="post" action="module.php?mod=<?php 
                echo $this->getName();
                ?>
&amp;mod_action=admin_edit">
					<?php 
                echo Filter::getCsrf();
                ?>
					<input type="hidden" name="save" value="1">
					<input type="hidden" name="block_id" value="<?php 
                echo $block_id;
                ?>
">
					<input type="hidden" name="gedcom_id" value="<?php 
                echo $WT_TREE->getTreeId();
                ?>
">

					<div class="form-group">
						<label for="title" class="col-sm-3 control-label">
							<?php 
                echo I18N::translate('Story title');
                ?>
						</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" name="title" id="title" value="<?php 
                echo Filter::escapeHtml($title);
                ?>
">
						</div>
					</div>

					<div class="form-group">
						<label for="story_body" class="col-sm-3 control-label">
							<?php 
                echo I18N::translate('Story');
                ?>
						</label>
						<div class="col-sm-9">
							<textarea name="story_body" id="story_body" class="html-edit form-control" rows="10"><?php 
                echo Filter::escapeHtml($story_body);
                ?>
</textarea>
						</div>
					</div>

					<div class="form-group">
						<label for="xref" class="col-sm-3 control-label">
							<?php 
                echo I18N::translate('Individual');
                ?>
						</label>
						<div class="col-sm-9">
							<input data-autocomplete-type="INDI" type="text" name="xref" id="xref" size="4" value="<?php 
                echo $xref;
                ?>
">
							<?php 
                echo FunctionsPrint::printFindIndividualLink('xref');
                ?>
							<?php 
                if ($individual) {
                    ?>
								<?php 
                    echo $individual->formatList('span');
                    ?>
							<?php 
                }
                ?>
						</div>
					</div>

					<div class="form-group">
						<label for="xref" class="col-sm-3 control-label">
							<?php 
                echo I18N::translate('Show this block for which languages?');
                ?>
						</label>
						<div class="col-sm-9">
							<?php 
                echo FunctionsEdit::editLanguageCheckboxes('lang', explode(',', $this->getBlockSetting($block_id, 'languages')));
                ?>
						</div>
					</div>

					<div class="form-group">
						<div class="col-sm-offset-3 col-sm-9">
							<button type="submit" class="btn btn-primary">
								<i class="fa fa-check"></i>
								<?php 
                echo I18N::translate('save');
                ?>
							</button>
						</div>
					</div>

				</form>
				<?php 
            }
        } else {
            header('Location: ' . WT_BASE_URL);
        }
    }
Beispiel #11
0
    /**
     * Edit the configuration
     */
    private function admin()
    {
        $controller = new PageController();
        $controller->restrictAccess(Auth::isAdmin())->setPageTitle($this->getTitle())->pageHeader();
        // Save the updated preferences
        if (Filter::post('action') == 'save') {
            foreach (Tree::getAll() as $tree) {
                $tree->setPreference('include_in_sitemap', Filter::postBool('include' . $tree->getTreeId()));
            }
            // Clear cache and force files to be regenerated
            Database::prepare("DELETE FROM `##module_setting` WHERE setting_name LIKE 'sitemap%'")->execute();
        }
        $include_any = false;
        ?>
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>
		<h1><?php 
        echo $controller->getPageTitle();
        ?>
</h1>
		<?php 
        echo '<p>', I18N::translate('Sitemaps are a way for webmasters to tell search engines about the pages on a website that are available for crawling. All major search engines support sitemaps. For more information, see <a href="http://www.sitemaps.org/">www.sitemaps.org</a>.') . '</p>', '<p>', I18N::translate('Which family trees should be included in the sitemaps'), '</p>', '<form method="post" action="module.php?mod=' . $this->getName() . '&amp;mod_action=admin">', '<input type="hidden" name="action" value="save">';
        foreach (Tree::getAll() as $tree) {
            echo '<div class="checkbox"><label><input type="checkbox" name="include', $tree->getTreeId(), '" ';
            if ($tree->getPreference('include_in_sitemap')) {
                echo 'checked';
                $include_any = true;
            }
            echo '>', $tree->getTitleHtml(), '</label></div>';
        }
        echo '<input type="submit" value="', I18N::translate('save'), '">', '</form>', '<hr>';
        if ($include_any) {
            $site_map_url1 = WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&amp;mod_action=generate&amp;file=sitemap.xml';
            $site_map_url2 = rawurlencode(WT_BASE_URL . 'module.php?mod=' . $this->getName() . '&mod_action=generate&file=sitemap.xml');
            echo '<p>', I18N::translate('To tell search engines that sitemaps are available, you should add the following line to your robots.txt file.'), '</p>', '<pre>Sitemap: ', $site_map_url1, '</pre>', '<hr>', '<p>', I18N::translate('To tell search engines that sitemaps are available, you can use the following links.'), '</p>', '<ul>', '<li><a href="http://www.bing.com/webmaster/ping.aspx?siteMap=' . $site_map_url2 . '">Bing</a></li>', '<li><a href="http://www.google.com/webmasters/tools/ping?sitemap=' . $site_map_url2 . '">Google</a></li>', '</ul>';
        }
    }
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
         $this->setBlockSetting($block_id, 'count_placement', Filter::post('count_placement', 'before|after', 'before'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $num = $this->getBlockSetting($block_id, 'num', '10');
     $count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before');
     $block = $this->getBlockSetting($block_id, 'block', '0');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of items to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="num" size="2" value="', $num, '">';
     echo '</td></tr>';
     echo "<tr><td class=\"descriptionbox wrap width33\">";
     echo I18N::translate('Place counts before or after name?');
     echo "</td><td class=\"optionbox\">";
     echo FunctionsEdit::selectEditControl('count_placement', array('before' => I18N::translate('before'), 'after' => I18N::translate('after')), null, $count_placement, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
Beispiel #13
0
 /**
  * Create a form to add a new fact.
  *
  * @param string $fact
  *
  * @return string
  */
 public static function addNewFact($fact)
 {
     global $WT_TREE;
     $FACT = Filter::post($fact);
     $DATE = Filter::post($fact . '_DATE');
     $PLAC = Filter::post($fact . '_PLAC');
     if ($DATE || $PLAC || $FACT && $FACT !== 'Y') {
         if ($FACT && $FACT !== 'Y') {
             $gedrec = "\n1 " . $fact . ' ' . $FACT;
         } else {
             $gedrec = "\n1 " . $fact;
         }
         if ($DATE) {
             $gedrec .= "\n2 DATE " . $DATE;
         }
         if ($PLAC) {
             $gedrec .= "\n2 PLAC " . $PLAC;
             if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('ADVANCED_PLAC_FACTS'), $match)) {
                 foreach ($match[1] as $tag) {
                     $TAG = Filter::post($fact . '_' . $tag);
                     if ($TAG) {
                         $gedrec .= "\n3 " . $tag . ' ' . $TAG;
                     }
                 }
             }
             $LATI = Filter::post($fact . '_LATI');
             $LONG = Filter::post($fact . '_LONG');
             if ($LATI || $LONG) {
                 $gedrec .= "\n3 MAP\n4 LATI " . $LATI . "\n4 LONG " . $LONG;
             }
         }
         if (Filter::postBool('SOUR_' . $fact)) {
             return self::updateSource($gedrec, 2);
         } else {
             return $gedrec;
         }
     } elseif ($FACT === 'Y') {
         if (Filter::postBool('SOUR_' . $fact)) {
             return self::updateSource("\n1 " . $fact . ' Y', 2);
         } else {
             return "\n1 " . $fact . ' Y';
         }
     } else {
         return '';
     }
 }
Beispiel #14
0
 /** {@inheritdoc} */
 public function modAction($mod_action)
 {
     Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
     switch ($mod_action) {
         case 'admin_config':
             $template = new AdminTemplate();
             return $template->pageContent();
         case 'admin_search':
             // new settings
             $surname = Filter::post('SURNAME');
             $pid = Filter::post('PID');
             if ($surname) {
                 $soundex_std = Filter::postBool('soundex_std');
                 $soundex_dm = Filter::postBool('soundex_dm');
                 $indis = $this->module()->indisArray($surname, $soundex_std, $soundex_dm);
                 usort($indis, 'Fisharebest\\Webtrees\\Individual::compareBirthDate');
                 if (isset($indis) && count($indis) > 0) {
                     $pid = $indis[0]->getXref();
                 } else {
                     $result['error'] = I18N::translate('Error: The surname you entered doesn’t exist in this tree.');
                 }
             }
             if (isset($pid)) {
                 $FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS'));
                 if ($this->module()->searchArray($this->module()->searchArray($FTV_SETTINGS, 'TREE', Filter::getInteger('tree')), 'PID', $pid)) {
                     if ($surname) {
                         $result['error'] = I18N::translate('Error: The root person belonging to this surname already exists');
                     } else {
                         $result['error'] = I18N::translate('Error: A root person with ID %s already exists', $pid);
                     }
                 } else {
                     $record = Individual::getInstance($pid, $this->tree);
                     if ($record) {
                         $root = $record->getFullName() . ' (' . $record->getLifeSpan() . ')';
                         $title = $this->module()->getPageLink($pid);
                         $result = array('access_level' => '2', 'pid' => $pid, 'root' => $root, 'sort' => count($this->module()->searchArray($FTV_SETTINGS, 'TREE', Filter::getInteger('tree'))) + 1, 'surname' => $this->module()->getSurname($pid), 'title' => $title, 'tree' => Filter::getInteger('tree'));
                     } else {
                         if (empty($result['error'])) {
                             $result['error'] = I18N::translate('Error: A person with ID %s does not exist in this tree', $pid);
                         }
                     }
                 }
             }
             echo json_encode($result);
             break;
         case 'admin_add':
             $FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS'));
             $NEW_FTV_SETTINGS = $FTV_SETTINGS;
             $NEW_FTV_SETTINGS[] = array('TREE' => Filter::getInteger('tree'), 'SURNAME' => Filter::post('surname'), 'PID' => Filter::post('pid'), 'ACCESS_LEVEL' => Filter::postInteger('access_level'), 'SORT' => Filter::postInteger('sort'));
             $this->setSetting('FTV_SETTINGS', serialize(array_values($NEW_FTV_SETTINGS)));
             Log::addConfigurationLog($this->getTitle() . ' config updated');
             break;
         case 'admin_update':
             $FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS'));
             $new_surname = Filter::postArray('surname');
             $new_access_level = Filter::postArray('access_level');
             $new_sort = Filter::postArray('sort');
             foreach ($new_surname as $key => $new_surname) {
                 $FTV_SETTINGS[$key]['SURNAME'] = $new_surname;
             }
             foreach ($new_access_level as $key => $new_access_level) {
                 $FTV_SETTINGS[$key]['ACCESS_LEVEL'] = $new_access_level;
             }
             foreach ($new_sort as $key => $new_sort) {
                 $FTV_SETTINGS[$key]['SORT'] = $new_sort;
             }
             $NEW_FTV_SETTINGS = $this->module()->sortArray($FTV_SETTINGS, 'SORT');
             $this->setSetting('FTV_SETTINGS', serialize($NEW_FTV_SETTINGS));
             break;
         case 'admin_save':
             $FTV_OPTIONS = unserialize($this->getSetting('FTV_OPTIONS'));
             $FTV_OPTIONS[Filter::getInteger('tree')] = Filter::postArray('NEW_FTV_OPTIONS');
             $this->setSetting('FTV_OPTIONS', serialize($FTV_OPTIONS));
             Log::addConfigurationLog($this->getTitle() . ' config updated');
             // the cache has to be recreated because the image options could have been changed
             $this->module()->emptyCache();
             break;
         case 'admin_reset':
             $FTV_OPTIONS = unserialize($this->getSetting('FTV_OPTIONS'));
             unset($FTV_OPTIONS[Filter::getInteger('tree')]);
             $this->setSetting('FTV_OPTIONS', serialize($FTV_OPTIONS));
             Log::addConfigurationLog($this->getTitle() . ' options set to default');
             break;
         case 'admin_delete':
             $FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS'));
             unset($FTV_SETTINGS[Filter::getInteger('key')]);
             $this->setSetting('FTV_SETTINGS', serialize($FTV_SETTINGS));
             Log::addConfigurationLog($this->getTitle() . ' item deleted');
             break;
         case 'page':
             $template = new PageTemplate();
             return $template->pageContent();
             // See mediafirewall.php
         // See mediafirewall.php
         case 'thumbnail':
             $mid = Filter::get('mid', WT_REGEX_XREF);
             $media = Media::getInstance($mid, $this->tree);
             $mimetype = $media->mimeType();
             $cache_filename = $this->module()->cacheFileName($media);
             $filetime = filemtime($cache_filename);
             $filetimeHeader = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';
             $expireOffset = 3600 * 24 * 7;
             // tell browser to cache this image for 7 days
             $expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $expireOffset) . ' GMT';
             $etag = $media->getEtag();
             $filesize = filesize($cache_filename);
             // parse IF_MODIFIED_SINCE header from client
             $if_modified_since = 'x';
             if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
                 $if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
             }
             // parse IF_NONE_MATCH header from client
             $if_none_match = 'x';
             if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
                 $if_none_match = str_replace('"', '', $_SERVER['HTTP_IF_NONE_MATCH']);
             }
             // add caching headers.  allow browser to cache file, but not proxy
             header('Last-Modified: ' . $filetimeHeader);
             header('ETag: "' . $etag . '"');
             header('Expires: ' . $expireHeader);
             header('Cache-Control: max-age=' . $expireOffset . ', s-maxage=0, proxy-revalidate');
             // if this file is already in the user’s cache, don’t resend it
             // first check if the if_modified_since param matches
             if ($if_modified_since === $filetimeHeader) {
                 // then check if the etag matches
                 if ($if_none_match === $etag) {
                     http_response_code(304);
                     return;
                 }
             }
             // send headers for the image
             header('Content-Type: ' . $mimetype);
             header('Content-Disposition: filename="' . basename($cache_filename) . '"');
             header('Content-Length: ' . $filesize);
             // Some servers disable fpassthru() and readfile()
             if (function_exists('readfile')) {
                 readfile($cache_filename);
             } else {
                 $fp = fopen($cache_filename, 'rb');
                 if (function_exists('fpassthru')) {
                     fpassthru($fp);
                 } else {
                     while (!feof($fp)) {
                         echo fread($fp, 65536);
                     }
                 }
                 fclose($fp);
             }
             break;
         case 'show_pdf':
             $template = new PdfTemplate();
             return $template->pageBody();
         case 'pdf_data':
             $template = new PdfTemplate();
             return $template->pageData();
         case 'pdf_thumb_data':
             $xref = Filter::get('mid');
             $mediaobject = Media::getInstance($xref, $this->tree);
             $thumb = Filter::get('thumb');
             if ($thumb === '2') {
                 // Fancy thumb
                 echo $this->module()->cacheFileName($mediaobject);
             } else {
                 echo $mediaobject->getServerFilename('thumb');
             }
             break;
         default:
             http_response_code(404);
             break;
     }
 }
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
         $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
         $this->setBlockSetting($block_id, 'onlyBDM', Filter::postBool('onlyBDM'));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
         $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $days = $this->getBlockSetting($block_id, 'days', '7');
     $filter = $this->getBlockSetting($block_id, 'filter', '1');
     $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '0');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', 30, I18N::number(30)), '</em>';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only events of living individuals');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('filter', $filter);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only births, deaths, and marriages');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('onlyBDM', $onlyBDM);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('sortStyle', array('alpha' => I18N::translate('sort by name'), 'anniv' => I18N::translate('sort by date')), null, $sortStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
         $this->setBlockSetting($block_id, 'onlyBDM', Filter::postBool('onlyBDM'));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
         $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $filter = $this->getBlockSetting($block_id, 'filter', '1');
     $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '1');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only events of living individuals?');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('filter', $filter);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only births, deaths, and marriages?');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('onlyBDM', $onlyBDM);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('sortStyle', array('alpha' => I18N::translate('sort by name'), 'anniv' => I18N::translate('sort by date')), null, $sortStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
 $WT_TREE->setPreference('SHOW_NO_WATERMARK', Filter::post('SHOW_NO_WATERMARK'));
 $WT_TREE->setPreference('SHOW_PARENTS_AGE', Filter::postBool('SHOW_PARENTS_AGE'));
 $WT_TREE->setPreference('SHOW_PEDIGREE_PLACES', Filter::post('SHOW_PEDIGREE_PLACES'));
 $WT_TREE->setPreference('SHOW_PEDIGREE_PLACES_SUFFIX', Filter::postBool('SHOW_PEDIGREE_PLACES_SUFFIX'));
 $WT_TREE->setPreference('SHOW_RELATIVES_EVENTS', implode(',', Filter::postArray('SHOW_RELATIVES_EVENTS')));
 $WT_TREE->setPreference('SOURCE_ID_PREFIX', Filter::post('SOURCE_ID_PREFIX'));
 $WT_TREE->setPreference('SOUR_FACTS_ADD', str_replace(' ', '', Filter::post('SOUR_FACTS_ADD')));
 $WT_TREE->setPreference('SOUR_FACTS_QUICK', str_replace(' ', '', Filter::post('SOUR_FACTS_QUICK')));
 $WT_TREE->setPreference('SOUR_FACTS_UNIQUE', str_replace(' ', '', Filter::post('SOUR_FACTS_UNIQUE')));
 $WT_TREE->setPreference('SUBLIST_TRIGGER_I', Filter::post('SUBLIST_TRIGGER_I', WT_REGEX_INTEGER, 200));
 $WT_TREE->setPreference('SURNAME_LIST_STYLE', Filter::post('SURNAME_LIST_STYLE'));
 $WT_TREE->setPreference('SURNAME_TRADITION', Filter::post('SURNAME_TRADITION'));
 $WT_TREE->setPreference('THEME_DIR', Filter::post('THEME_DIR'));
 $WT_TREE->setPreference('THUMBNAIL_WIDTH', Filter::post('THUMBNAIL_WIDTH'));
 $WT_TREE->setPreference('USE_SILHOUETTE', Filter::postBool('USE_SILHOUETTE'));
 $WT_TREE->setPreference('WATERMARK_THUMB', Filter::postBool('WATERMARK_THUMB'));
 $WT_TREE->setPreference('WEBMASTER_USER_ID', Filter::post('WEBMASTER_USER_ID'));
 $WT_TREE->setPreference('WEBTREES_EMAIL', Filter::post('WEBTREES_EMAIL'));
 $WT_TREE->setPreference('title', Filter::post('title'));
 // Only accept valid folders for MEDIA_DIRECTORY
 $MEDIA_DIRECTORY = preg_replace('/[\\/\\\\]+/', '/', Filter::post('MEDIA_DIRECTORY') . '/');
 if (substr($MEDIA_DIRECTORY, 0, 1) === '/') {
     $MEDIA_DIRECTORY = substr($MEDIA_DIRECTORY, 1);
 }
 if ($MEDIA_DIRECTORY) {
     if (is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
         $WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
     } elseif (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
         $WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
         FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'info');
     } else {
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'limit', Filter::post('limit'));
         $this->setBlockSetting($block_id, 'flag', Filter::post('flag'));
     }
     $limit = $this->getBlockSetting($block_id, 'limit', 'nolimit');
     $flag = $this->getBlockSetting($block_id, 'flag', 0);
     echo '<tr><td class="descriptionbox wrap width33">', I18N::translate('Limit display by'), '</td><td class="optionbox"><select name="limit"><option value="nolimit" ', ($limit == 'nolimit' ? 'selected' : '') . ">", I18N::translate('No limit') . "</option>", '<option value="date" ' . ($limit == 'date' ? 'selected' : '') . ">" . I18N::translate('Age of item') . "</option>", '<option value="count" ' . ($limit == 'count' ? 'selected' : '') . ">" . I18N::translate('Number of items') . "</option>", '</select></td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Limit');
     echo '</td><td class="optionbox"><input type="text" name="flag" size="4" maxlength="4" value="' . $flag . '"></td></tr>';
 }
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $block = $this->getBlockSetting($block_id, 'block', '1');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
         $this->setBlockSetting($block_id, 'calendar', Filter::post('calendar', 'jewish|gregorian', 'jewish'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $days = $this->getBlockSetting($block_id, 'days', '7');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $calendar = $this->getBlockSetting($block_id, 'calendar', 'jewish');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="' . $days . '">';
     echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', 30, I18N::number(30)), '</em>';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Calendar');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('calendar', array('jewish' => I18N::translate('Jewish'), 'gregorian' => I18N::translate('Gregorian')), null, $calendar, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
Beispiel #21
0
define('WT_SCRIPT_NAME', 'addmedia.php');
require './includes/session.php';
$NO_UPDATE_CHAN = $WT_TREE->getPreference('NO_UPDATE_CHAN');
$MEDIA_DIRECTORY = $WT_TREE->getPreference('MEDIA_DIRECTORY');
$pid = Filter::get('pid', WT_REGEX_XREF, Filter::post('pid', WT_REGEX_XREF));
// edit this media object
$linktoid = Filter::get('linktoid', WT_REGEX_XREF, Filter::post('linktoid', WT_REGEX_XREF));
// create a new media object, linked to this record
$action = Filter::get('action', null, Filter::post('action'));
$filename = Filter::get('filename', null, Filter::post('filename'));
$text = Filter::postArray('text');
$tag = Filter::postArray('tag', WT_REGEX_TAG);
$islink = Filter::postArray('islink');
$glevels = Filter::postArray('glevels', '[0-9]');
$folder = Filter::post('folder');
$update_CHAN = !Filter::postBool('preserve_last_changed');
$controller = new SimpleController();
$controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->restrictAccess(Auth::isMember($WT_TREE));
$disp = true;
$media = Media::getInstance($pid, $WT_TREE);
if ($media) {
    $disp = $media->canShow();
}
if ($action == 'update' || $action == 'create') {
    if ($linktoid) {
        $disp = GedcomRecord::getInstance($linktoid, $WT_TREE)->canShow();
    }
}
if (!Auth::isEditor($WT_TREE) || !$disp) {
    $controller->pageHeader()->addInlineJavascript('closePopupAndReloadParent();');
    return;
    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        global $WT_TREE;
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $languages = Filter::postArray('lang');
            $this->setBlockSetting($block_id, 'gedcom', Filter::post('gedcom'));
            $this->setBlockSetting($block_id, 'title', Filter::post('title'));
            $this->setBlockSetting($block_id, 'html', Filter::post('html'));
            $this->setBlockSetting($block_id, 'show_timestamp', Filter::postBool('show_timestamp'));
            $this->setBlockSetting($block_id, 'timestamp', Filter::post('timestamp'));
            $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
        }
        $templates = array(I18N::translate('Keyword examples') => '#getAllTagsTable#', I18N::translate('Narrative description') => I18N::translate('This family tree was last updated on #gedcomUpdated#. There are #totalSurnames# surnames in this family tree. The earliest recorded event is the #firstEventType# of #firstEventName# in #firstEventYear#. The most recent event is the #lastEventType# of #lastEventName# in #lastEventYear#.<br><br>If you have any comments or feedback please contact #contactWebmaster#.'), I18N::translate('Statistics') => '<div class="gedcom_stats">
				<span style="font-weight: bold;"><a href="index.php?command=gedcom">#gedcomTitle#</a></span><br>
				' . I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') . '
				<table id="keywords">
					<tr>
						<td valign="top" class="width20">
							<table cellspacing="1" cellpadding="0">
								<tr>
									<td class="facts_label">' . I18N::translate('Individuals') . '</td>
									<td class="facts_value" align="right"><a href="indilist.php?surname_sublist=no">#totalIndividuals#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Males') . '</td>
									<td class="facts_value" align="right">#totalSexMales#<br>#totalSexMalesPercentage#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Females') . '</td>
									<td class="facts_value" align="right">#totalSexFemales#<br>#totalSexFemalesPercentage#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Total surnames') . '</td>
									<td class="facts_value" align="right"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged=' . $WT_TREE->getNameUrl() . '">#totalSurnames#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Families') . '</td>
									<td class="facts_value" align="right"><a href="famlist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalFamilies#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Sources') . '</td>
									<td class="facts_value" align="right"><a href="sourcelist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalSources#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Media objects') . '</td>
									<td class="facts_value" align="right"><a href="medialist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalMedia#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Repositories') . '</td>
									<td class="facts_value" align="right"><a href="repolist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalRepositories#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Total events') . '</td>
									<td class="facts_value" align="right">#totalEvents#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Total users') . '</td>
									<td class="facts_value" align="right">#totalUsers#</td>
								</tr>
							</table>
						</td>
						<td><br></td>
						<td valign="top">
							<table cellspacing="1" cellpadding="0" border="0">
								<tr>
									<td class="facts_label">' . I18N::translate('Earliest birth year') . '</td>
									<td class="facts_value" align="right">#firstBirthYear#</td>
									<td class="facts_value">#firstBirth#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Latest birth year') . '</td>
									<td class="facts_value" align="right">#lastBirthYear#</td>
									<td class="facts_value">#lastBirth#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Earliest death year') . '</td>
									<td class="facts_value" align="right">#firstDeathYear#</td>
									<td class="facts_value">#firstDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Latest death year') . '</td>
									<td class="facts_value" align="right">#lastDeathYear#</td>
									<td class="facts_value">#lastDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Individual who lived the longest') . '</td>
									<td class="facts_value" align="right">#longestLifeAge#</td>
									<td class="facts_value">#longestLife#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Average age at death') . '</td>
									<td class="facts_value" align="right">#averageLifespan#</td>
									<td class="facts_value"></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Family with the most children') . '</td>
									<td class="facts_value" align="right">#largestFamilySize#</td>
									<td class="facts_value">#largestFamily#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Average number of children per family') . '</td>
									<td class="facts_value" align="right">#averageChildren#</td>
									<td class="facts_value"></td>
								</tr>
							</table>
						</td>
					</tr>
				</table><br>
				<span style="font-weight: bold;">' . I18N::translate('Most common surnames') . '</span><br>
				#commonSurnames#
			</div>');
        $title = $this->getBlockSetting($block_id, 'title');
        $html = $this->getBlockSetting($block_id, 'html');
        $gedcom = $this->getBlockSetting($block_id, 'gedcom');
        $show_timestamp = $this->getBlockSetting($block_id, 'show_timestamp', '0');
        $languages = explode(',', $this->getBlockSetting($block_id, 'languages'));
        echo '<tr><td class="descriptionbox wrap">', GedcomTag::getLabel('TITL'), '</td><td class="optionbox"><input type="text" name="title" size="30" value="', Filter::escapeHtml($title), '"></td></tr>';
        // templates
        echo '<tr><td class="descriptionbox wrap">', I18N::translate('Templates'), '</td><td class="optionbox wrap">';
        // The CK editor needs lots of help to load/save data :-(
        if (Module::getModuleByName('ckeditor')) {
            $ckeditor_onchange = 'CKEDITOR.instances.html.setData(document.block.html.value);';
        } else {
            $ckeditor_onchange = '';
        }
        echo '<select name="template" onchange="document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;', $ckeditor_onchange, '">';
        echo '<option value="', Filter::escapeHtml($html), '">', I18N::translate('Custom'), '</option>';
        foreach ($templates as $title => $template) {
            echo '<option value="', Filter::escapeHtml($template), '">', $title, '</option>';
        }
        echo '</select>';
        if (!$html) {
            echo '<p>', I18N::translate('To assist you in getting started with this block, we have created several standard templates. When you select one of these templates, the text area will contain a copy that you can then alter to suit your site’s requirements.'), '</p>';
        }
        echo '</td></tr>';
        if (count(Tree::getAll()) > 1) {
            if ($gedcom == '__current__') {
                $sel_current = 'selected';
            } else {
                $sel_current = '';
            }
            if ($gedcom == '__default__') {
                $sel_default = 'selected';
            } else {
                $sel_default = '';
            }
            echo '<tr><td class="descriptionbox wrap">', I18N::translate('Family tree'), '</td><td class="optionbox">', '<select name="gedcom">', '<option value="__current__" ', $sel_current, '>', I18N::translate('Current'), '</option>', '<option value="__default__" ', $sel_default, '>', I18N::translate('Default'), '</option>';
            foreach (Tree::getAll() as $tree) {
                if ($tree->getName() === $gedcom) {
                    $sel = 'selected';
                } else {
                    $sel = '';
                }
                echo '<option value="', $tree->getNameHtml(), '" ', $sel, '>', $tree->getTitleHtml(), '</option>';
            }
            echo '</select>';
            echo '</td></tr>';
        }
        // html
        echo '<tr><td colspan="2" class="descriptionbox">', I18N::translate('Content');
        if (!$html) {
            echo '<p>', I18N::translate('As well as using the toolbar to apply HTML formatting, you can insert database fields which are updated automatically. These special fields are marked with <b>#</b> characters. For example <b>#totalFamilies#</b> will be replaced with the actual number of families in the database. Advanced users may wish to apply CSS classes to their text, so that the formatting matches the currently selected theme.'), '</p>';
        }
        echo '</td></tr><tr>', '<td colspan="2" class="optionbox">';
        echo '<textarea name="html" class="html-edit" rows="10" style="width:98%;">', Filter::escapeHtml($html), '</textarea>';
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap">';
        echo I18N::translate('Show the date and time of update');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('show_timestamp', $show_timestamp);
        echo '<input type="hidden" name="timestamp" value="', WT_TIMESTAMP, '">';
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap">';
        echo I18N::translate('Show this block for which languages?');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editLanguageCheckboxes('lang', $languages);
        echo '</td></tr>';
    }
Beispiel #23
0
    /**
     * Places administration.
     */
    private function adminPlaces()
    {
        global $WT_TREE;
        $action = Filter::get('action');
        $parent = Filter::get('parent');
        $inactive = Filter::getBool('inactive');
        $deleteRecord = Filter::get('deleteRecord');
        if (!isset($parent)) {
            $parent = 0;
        }
        $controller = new PageController();
        $controller->restrictAccess(Auth::isAdmin());
        if ($action == 'ExportFile' && Auth::isAdmin()) {
            $tmp = $this->placeIdToHierarchy($parent);
            $maxLevel = $this->getHighestLevel();
            if ($maxLevel > 8) {
                $maxLevel = 8;
            }
            $tmp[0] = 'places';
            $outputFileName = preg_replace('/[:;\\/\\\\(\\)\\{\\}\\[\\] $]/', '_', implode('-', $tmp)) . '.csv';
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename="' . $outputFileName . '"');
            echo '"', I18N::translate('Level'), '";"', I18N::translate('Country'), '";';
            if ($maxLevel > 0) {
                echo '"', I18N::translate('State'), '";';
            }
            if ($maxLevel > 1) {
                echo '"', I18N::translate('County'), '";';
            }
            if ($maxLevel > 2) {
                echo '"', I18N::translate('City'), '";';
            }
            if ($maxLevel > 3) {
                echo '"', I18N::translate('Place'), '";';
            }
            if ($maxLevel > 4) {
                echo '"', I18N::translate('Place'), '";';
            }
            if ($maxLevel > 5) {
                echo '"', I18N::translate('Place'), '";';
            }
            if ($maxLevel > 6) {
                echo '"', I18N::translate('Place'), '";';
            }
            if ($maxLevel > 7) {
                echo '"', I18N::translate('Place'), '";';
            }
            echo '"', I18N::translate('Longitude'), '";"', I18N::translate('Latitude'), '";';
            echo '"', I18N::translate('Zoom level'), '";"', I18N::translate('Icon'), '";', WT_EOL;
            $this->outputLevel($parent);
            exit;
        }
        $controller->setPageTitle(I18N::translate('Google Maps™'))->pageHeader();
        ?>
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>

		<ul class="nav nav-tabs nav-justified" role="tablist">
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_config" role="tab">
					<?php 
        echo I18N::translate('Google Maps™ preferences');
        ?>
				</a>
			</li>
			<li role="presentation" class="active">
				<a href="#">
					<?php 
        echo I18N::translate('Geographic data');
        ?>
				</a>
			</li>
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_placecheck">
					<?php 
        echo I18N::translate('Place check');
        ?>
				</a>
			</li>
		</ul>

		<h2><?php 
        echo I18N::translate('Geographic data');
        ?>
</h2>
		<?php 
        if ($action == 'ImportGedcom') {
            $placelist = array();
            $j = 0;
            $gedcom_records = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchOneColumn();
            foreach ($gedcom_records as $gedrec) {
                $i = 1;
                $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i);
                while (!empty($placerec)) {
                    if (preg_match("/2 PLAC (.+)/", $placerec, $match)) {
                        $placelist[$j] = array();
                        $placelist[$j]['place'] = trim($match[1]);
                        if (preg_match("/4 LATI (.*)/", $placerec, $match)) {
                            $placelist[$j]['lati'] = trim($match[1]);
                            if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') {
                                if ($placelist[$j]['lati'] < 0) {
                                    $placelist[$j]['lati'][0] = 'S';
                                } else {
                                    $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati'];
                                }
                            }
                        } else {
                            $placelist[$j]['lati'] = null;
                        }
                        if (preg_match("/4 LONG (.*)/", $placerec, $match)) {
                            $placelist[$j]['long'] = trim($match[1]);
                            if ($placelist[$j]['long'][0] != 'E' && $placelist[$j]['long'][0] != 'W') {
                                if ($placelist[$j]['long'] < 0) {
                                    $placelist[$j]['long'][0] = 'W';
                                } else {
                                    $placelist[$j]['long'] = 'E' . $placelist[$j]['long'];
                                }
                            }
                        } else {
                            $placelist[$j]['long'] = null;
                        }
                        $j = $j + 1;
                    }
                    $i = $i + 1;
                    $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i);
                }
            }
            asort($placelist);
            $prevPlace = '';
            $prevLati = '';
            $prevLong = '';
            $placelistUniq = array();
            $j = 0;
            foreach ($placelist as $k => $place) {
                if ($place['place'] != $prevPlace) {
                    $placelistUniq[$j] = array();
                    $placelistUniq[$j]['place'] = $place['place'];
                    $placelistUniq[$j]['lati'] = $place['lati'];
                    $placelistUniq[$j]['long'] = $place['long'];
                    $j = $j + 1;
                } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) {
                    if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) {
                        $placelistUniq[$j - 1]['lati'] = $place['lati'];
                        $placelistUniq[$j - 1]['long'] = $place['long'];
                    } elseif ($place['lati'] != '0' || $place['long'] != '0') {
                        echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>';
                    }
                }
                $prevPlace = $place['place'];
                $prevLati = $place['lati'];
                $prevLong = $place['long'];
            }
            $highestIndex = $this->getHighestIndex();
            $default_zoom_level = array(4, 7, 10, 12);
            foreach ($placelistUniq as $k => $place) {
                $parent = preg_split('/ *, */', $place['place']);
                $parent = array_reverse($parent);
                $parent_id = 0;
                for ($i = 0; $i < count($parent); $i++) {
                    if (!isset($default_zoom_level[$i])) {
                        $default_zoom_level[$i] = $default_zoom_level[$i - 1];
                    }
                    $escparent = $parent[$i];
                    if ($escparent == '') {
                        $escparent = 'Unknown';
                    }
                    $row = Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?")->execute(array($i, $parent_id, $escparent))->fetchOneRow();
                    if ($i < count($parent) - 1) {
                        // Create higher-level places, if necessary
                        if (empty($row)) {
                            $highestIndex++;
                            Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i]));
                            echo Filter::escapeHtml($escparent), '<br>';
                            $parent_id = $highestIndex;
                        } else {
                            $parent_id = $row->pl_id;
                        }
                    } else {
                        // Create lowest-level place, if necessary
                        if (empty($row->pl_id)) {
                            $highestIndex++;
                            Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i]));
                            echo Filter::escapeHtml($escparent), '<br>';
                        } else {
                            if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') {
                                Database::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $row->pl_id));
                                echo Filter::escapeHtml($escparent), '<br>';
                            }
                        }
                    }
                }
            }
            $parent = 0;
        }
        if ($action === 'ImportFile') {
            $placefiles = $this->findFiles(WT_MODULES_DIR . 'googlemap/extra');
            sort($placefiles);
            ?>
		<form class="form-horizontal" method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&amp;mod_action=admin_places&amp;action=ImportFile2">

			<!-- PLACES FILE -->
			<div class="form-group">
				<label class="control-label col-sm-4" for="placesfile">
					<?php 
            echo I18N::translate('File containing places (CSV)');
            ?>
				</label>
				<div class="col-sm-8">
					<div class="btn btn-default">
					<input id="placesfile" type="file" name="placesfile">
					</div>
				</div>
			</div>

			<!-- LOCAL FILE -->
			<?php 
            if (count($placefiles) > 0) {
                ?>
			<div class="form-group">
				<label class="control-label col-sm-4" for="localfile">
					<?php 
                echo I18N::translate('Server file containing places (CSV)');
                ?>
				</label>
				<div class="col-sm-8">
					<div class="input-group">
						<span class="input-group-addon">
							<?php 
                echo WT_MODULES_DIR . 'googlemap/extra/';
                ?>
						</span>
						<?php 
                foreach ($placefiles as $p => $placefile) {
                    unset($placefiles[$p]);
                    $p = Filter::escapeHtml($placefile);
                    if (substr($placefile, 0, 1) == "/") {
                        $placefiles[$p] = substr($placefile, 1);
                    } else {
                        $placefiles[$p] = $placefile;
                    }
                }
                echo FunctionsEdit::selectEditControl('localfile', $placefiles, '', '', 'class="form-control"');
                ?>
					</div>
				</div>
			</div>
			<?php 
            }
            ?>

			<!-- CLEAR DATABASE -->
			<fieldset class="form-group">
				<legend class="control-label col-sm-4">
					<?php 
            echo I18N::translate('Delete all existing geographic data before importing the file.');
            ?>
				</legend>
				<div class="col-sm-8">
					<?php 
            echo FunctionsEdit::editFieldYesNo('cleardatabase', 0, 'class="radio-inline"');
            ?>
				</div>
			</fieldset>

			<!-- UPDATE ONLY -->
			<fieldset class="form-group">
				<legend class="control-label col-sm-4">
					<?php 
            echo I18N::translate('Do not create new locations, just import coordinates for existing locations.');
            ?>
				</legend>
				<div class="col-sm-8">
					<?php 
            echo FunctionsEdit::editFieldYesNo('updateonly', 0, 'class="radio-inline"');
            ?>
				</div>
			</fieldset>

			<!-- OVERWRITE DATA -->
			<fieldset class="form-group">
				<legend class="control-label col-sm-4">
					<?php 
            echo I18N::translate('Overwrite existing coordinates.');
            ?>
				</legend>
				<div class="col-sm-8">
					<?php 
            echo FunctionsEdit::editFieldYesNo('overwritedata', 0, 'class="radio-inline"');
            ?>
				</div>
			</fieldset>

			<!-- SAVE BUTTON -->
			<div class="form-group">
				<div class="col-sm-offset-4 col-sm-8">
					<button type="submit" class="btn btn-primary">
						<i class="fa fa-check"></i>
						<?php 
            echo I18N::translate('Continue adding');
            ?>
					</button>
				</div>
			</div>
		</form>
		<?php 
            exit;
        }
        if ($action === 'ImportFile2') {
            $country_names = array();
            $stats = new Stats($WT_TREE);
            foreach ($stats->iso3166() as $key => $value) {
                $country_names[$key] = I18N::translate($key);
            }
            if (Filter::postBool('cleardatabase')) {
                Database::exec("DELETE FROM `##placelocation` WHERE 1=1");
            }
            if (!empty($_FILES['placesfile']['tmp_name'])) {
                $lines = file($_FILES['placesfile']['tmp_name']);
            } elseif (!empty($_REQUEST['localfile'])) {
                $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']);
            }
            // Strip BYTE-ORDER-MARK, if present
            if (!empty($lines[0]) && substr($lines[0], 0, 3) === WT_UTF8_BOM) {
                $lines[0] = substr($lines[0], 3);
            }
            asort($lines);
            $highestIndex = $this->getHighestIndex();
            $placelist = array();
            $j = 0;
            $maxLevel = 0;
            foreach ($lines as $p => $placerec) {
                $fieldrec = explode(';', $placerec);
                if ($fieldrec[0] > $maxLevel) {
                    $maxLevel = $fieldrec[0];
                }
            }
            $fields = count($fieldrec);
            $set_icon = true;
            if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) {
                $set_icon = false;
            }
            foreach ($lines as $p => $placerec) {
                $fieldrec = explode(';', $placerec);
                if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) {
                    $placelist[$j] = array();
                    $placelist[$j]['place'] = '';
                    for ($ii = $fields - 4; $ii > 1; $ii--) {
                        if ($fieldrec[0] > $ii - 2) {
                            $placelist[$j]['place'] .= $fieldrec[$ii] . ',';
                        }
                    }
                    foreach ($country_names as $countrycode => $countryname) {
                        if ($countrycode == strtoupper($fieldrec[1])) {
                            $fieldrec[1] = $countryname;
                            break;
                        }
                    }
                    $placelist[$j]['place'] .= $fieldrec[1];
                    $placelist[$j]['long'] = $fieldrec[$fields - 4];
                    $placelist[$j]['lati'] = $fieldrec[$fields - 3];
                    $placelist[$j]['zoom'] = $fieldrec[$fields - 2];
                    if ($set_icon) {
                        $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]);
                    } else {
                        $placelist[$j]['icon'] = '';
                    }
                    $j = $j + 1;
                }
            }
            $prevPlace = '';
            $prevLati = '';
            $prevLong = '';
            $placelistUniq = array();
            $j = 0;
            foreach ($placelist as $k => $place) {
                if ($place['place'] != $prevPlace) {
                    $placelistUniq[$j] = array();
                    $placelistUniq[$j]['place'] = $place['place'];
                    $placelistUniq[$j]['lati'] = $place['lati'];
                    $placelistUniq[$j]['long'] = $place['long'];
                    $placelistUniq[$j]['zoom'] = $place['zoom'];
                    $placelistUniq[$j]['icon'] = $place['icon'];
                    $j = $j + 1;
                } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) {
                    if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) {
                        $placelistUniq[$j - 1]['lati'] = $place['lati'];
                        $placelistUniq[$j - 1]['long'] = $place['long'];
                        $placelistUniq[$j - 1]['zoom'] = $place['zoom'];
                        $placelistUniq[$j - 1]['icon'] = $place['icon'];
                    } elseif ($place['lati'] != '0' || $place['long'] != '0') {
                        echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>';
                    }
                }
                $prevPlace = $place['place'];
                $prevLati = $place['lati'];
                $prevLong = $place['long'];
            }
            $default_zoom_level = array();
            $default_zoom_level[0] = 4;
            $default_zoom_level[1] = 7;
            $default_zoom_level[2] = 10;
            $default_zoom_level[3] = 12;
            foreach ($placelistUniq as $k => $place) {
                $parent = explode(',', $place['place']);
                $parent = array_reverse($parent);
                $parent_id = 0;
                for ($i = 0; $i < count($parent); $i++) {
                    $escparent = $parent[$i];
                    if ($escparent == '') {
                        $escparent = 'Unknown';
                    }
                    $row = Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")->execute(array($i, $parent_id, $escparent))->fetchOneRow();
                    if (empty($row)) {
                        // this name does not yet exist: create entry
                        if (!Filter::postBool('updateonly')) {
                            $highestIndex = $highestIndex + 1;
                            if ($i + 1 == count($parent)) {
                                $zoomlevel = $place['zoom'];
                            } elseif (isset($default_zoom_level[$i])) {
                                $zoomlevel = $default_zoom_level[$i];
                            } else {
                                $zoomlevel = $this->getSetting('GM_MAX_ZOOM');
                            }
                            if ($place['lati'] == '0' || $place['long'] == '0' || $i + 1 < count($parent)) {
                                Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon']));
                            } else {
                                //delete leading zero
                                $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']);
                                $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']);
                                if ($pl_lati >= 0) {
                                    $place['lati'] = 'N' . abs($pl_lati);
                                } elseif ($pl_lati < 0) {
                                    $place['lati'] = 'S' . abs($pl_lati);
                                }
                                if ($pl_long >= 0) {
                                    $place['long'] = 'E' . abs($pl_long);
                                } elseif ($pl_long < 0) {
                                    $place['long'] = 'W' . abs($pl_long);
                                }
                                Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon']));
                            }
                            $parent_id = $highestIndex;
                        }
                    } else {
                        $parent_id = $row->pl_id;
                        if (Filter::postBool('overwritedata') && $i + 1 == count($parent)) {
                            Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ?, pl_zoom = ?, pl_icon = ? WHERE pl_id = ?")->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id));
                        } else {
                            // Update only if existing data is missing
                            if (!$row->pl_long && !$row->pl_lati) {
                                Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ? WHERE pl_id = ?")->execute(array($place['lati'], $place['long'], $parent_id));
                            }
                            if (!$row->pl_icon && $place['icon']) {
                                Database::prepare("UPDATE `##placelocation` SET pl_icon = ? WHERE pl_id = ?")->execute(array($place['icon'], $parent_id));
                            }
                        }
                    }
                }
            }
            $parent = 0;
        }
        if ($action == 'DeleteRecord') {
            $exists = Database::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($deleteRecord))->fetchOne();
            if (!$exists) {
                Database::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")->execute(array($deleteRecord));
            } else {
                echo '<table class="facts_table"><tr><td>', I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>';
            }
        }
        ?>
		<script>
		function updateList(inactive) {
			window.location.href='<?php 
        if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) {
            $uri = strstr($_SERVER['REQUEST_URI'], '&inactive', true);
        } else {
            $uri = $_SERVER['REQUEST_URI'];
        }
        echo $uri, '&inactive=';
        ?>
'+inactive;
		}

		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;
		}

		function delete_place(placeid) {
			var answer=confirm('<?php 
        echo I18N::translate('Remove this location?');
        ?>
');
			if (answer == true) {
				window.location = '<?php 
        echo Functions::getQueryUrl(array('action' => 'DeleteRecord'));
        ?>
&action=DeleteRecord&deleteRecord=' + placeid;
			}
		}
		</script>
		<p id="gm_breadcrumb">
			<?php 
        $where_am_i = $this->placeIdToHierarchy($parent);
        foreach (array_reverse($where_am_i, true) as $id => $place) {
            if ($id == $parent) {
                if ($place != 'Unknown') {
                    echo Filter::escapeHtml($place);
                } else {
                    echo I18N::translate('unknown');
                }
            } else {
                echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">';
                if ($place != 'Unknown') {
                    echo Filter::escapeHtml($place), '</a>';
                } else {
                    echo I18N::translate('unknown'), '</a>';
                }
            }
            echo ' - ';
        }
        ?>
			<a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '"><?php 
        echo I18N::translate('Top level');
        ?>
</a>
		</p>

		<form class="form-inline" name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '">
			<div class="checkbox">
				<label for="inactive">
				   <?php 
        echo FunctionsEdit::checkbox('inactive', $inactive, 'onclick="updateList(this.checked)"');
        ?>
				   <?php 
        echo I18N::translate('Show inactive places');
        ?>
				</label>
			</div>
			<p class="small text-muted">
				<?php 
        echo I18N::translate('By default, the list shows only those places which can be found in your family trees.  You may have details for other places, such as those imported in bulk from an external file.  Selecting this option will show all places, including ones that are not currently used.');
        ?>
				<?php 
        echo I18N::translate('If you have a large number of inactive places, it can be slow to generate the list.');
        ?>
			</p>
		</form>

		<?php 
        $placelist = $this->getPlaceListLocation($parent, $inactive);
        echo '<div class="gm_plac_edit">';
        echo '<table class="table table-bordered table-condensed table-hover"><tr>';
        echo '<th>', GedcomTag::getLabel('PLAC'), '</th>';
        echo '<th>', GedcomTag::getLabel('LATI'), '</th>';
        echo '<th>', GedcomTag::getLabel('LONG'), '</th>';
        echo '<th>', I18N::translate('Zoom level'), '</th>';
        echo '<th>', I18N::translate('Icon'), '</th>';
        echo '<th>';
        echo I18N::translate('Edit'), '</th><th>', I18N::translate('Delete'), '</th></tr>';
        if (count($placelist) == 0) {
            echo '<tr><td colspan="7">', I18N::translate('No places found'), '</td></tr>';
        }
        foreach ($placelist as $place) {
            echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">';
            if ($place['place'] != 'Unknown') {
                echo Filter::escapeHtml($place['place']), '</a></td>';
            } else {
                echo I18N::translate('unknown'), '</a></td>';
            }
            echo '<td>', $place['lati'], '</td>';
            echo '<td>', $place['long'], '</td>';
            echo '<td>', $place['zoom'], '</td>';
            echo '<td>';
            if ($place['icon']) {
                echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">';
            } else {
                if ($place['lati'] || $place['long']) {
                    echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_red.png">';
                } else {
                    echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">';
                }
            }
            echo '</td>';
            echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', I18N::translate('Edit'), '"></a></td>';
            $noRows = Database::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($place['place_id']))->fetchOne();
            if ($noRows == 0) {
                ?>
				<td><a href="#" onclick="delete_place(<?php 
                echo $place['place_id'];
                ?>
);return false;" class="icon-delete" title="<?php 
                echo I18N::translate('Remove');
                ?>
"></a></td>
		<?php 
            } else {
                ?>
				<td><i class="icon-delete-grey"></i></td>
		<?php 
            }
            ?>
			</tr>
			<?php 
        }
        ?>
		</table>
		</div>

		<hr>
		<form class="form-horizontal" action="?" onsubmit="add_place_location(this.parent_id.options[this.parent_id.selectedIndex].value); return false;">
			<div class="form-group">
				<label class="form-control-static col-sm-4" for="parent_id">
					<?php 
        echo I18N::translate('Add a new geographic location');
        ?>
				</label>
				<div class="col-sm-8">
					<div class="col-sm-6">
						<?php 
        echo FunctionsEdit::selectEditControl('parent_id', $where_am_i, I18N::translate('Top level'), $parent, 'class="form-control"');
        ?>
					</div>
					<button type="submit" class="btn btn-default">
						<i class="fa fa-plus"></i>
						<?php 
        echo I18N::translate('Add');
        ?>
					</button>
				</div>
			</div>
		</form>

		<form class="form-horizontal" action="module.php" method="get">
			<input type="hidden" name="mod" value="googlemap">
			<input type="hidden" name="mod_action" value="admin_places">
			<input type="hidden" name="action" value="ImportGedcom">
			<div class="form-group">
				<label class="form-control-static col-sm-4" for="ged">
					<?php 
        echo I18N::translate('Import all places from a family tree');
        ?>
				</label>
				<div class="col-sm-8">
					<div class="col-sm-6">
						<?php 
        echo FunctionsEdit::selectEditControl('ged', Tree::getNameList(), null, $WT_TREE->getName(), 'class="form-control"');
        ?>
					</div>
					<button type="submit" class="btn btn-default">
						<i class="fa fa-upload"></i>
						<?php 
        echo I18N::translate('Import');
        ?>
					</button>
				</div>
			</div>
		</form>

		<form class="form-horizontal" action="module.php" method="get">
			<input type="hidden" name="mod" value="googlemap">
			<input type="hidden" name="mod_action" value="admin_places">
			<input type="hidden" name="action" value="ImportFile">
			<div class="form-group">
				<label class="form-control-static col-sm-4">
					<?php 
        echo I18N::translate('Upload geographic data');
        ?>
				</label>
				<div class="col-sm-8">
					<div class="col-sm-6">
						<button type="submit" class="btn btn-default">
							<i class="fa fa-upload"></i>
							<?php 
        echo I18N::translate('Upload');
        ?>
						</button>
					</div>
				</div>
			</div>
		</form>

		<form class="form-horizontal" action="module.php" method="get">
			<input type="hidden" name="mod" value="googlemap">
			<input type="hidden" name="mod_action" value="admin_places">
			<input type="hidden" name="action" value="ExportFile">
			<div class="form-group">
				<label class="form-control-static col-sm-4">
					<?php 
        echo I18N::translate('Download geographic data');
        ?>
				</label>
				<div class="col-sm-8">
					<div class="col-sm-6">
						<?php 
        echo FunctionsEdit::selectEditControl('parent', $where_am_i, I18N::translate('All'), $WT_TREE->getTreeId(), 'class="form-control"');
        ?>
					</div>
					<button type="submit" class="btn btn-default">
						<i class="fa fa-download"></i>
						<?php 
        echo I18N::translate('Download');
        ?>
					</button>
				</div>
			</div>
		</form>
		<?php 
    }
    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'days', Filter::postInteger('num', 1, 180, 1));
            $this->setBlockSetting($block_id, 'sendmail', Filter::postBool('sendmail'));
            $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
        }
        $sendmail = $this->getBlockSetting($block_id, 'sendmail', '1');
        $days = $this->getBlockSetting($block_id, 'days', '1');
        $block = $this->getBlockSetting($block_id, 'block', '1');
        ?>
	<tr>
		<td colspan="2">
			<?php 
        echo I18N::translate('This block will show editors a list of records with pending changes that need to be approved by a moderator. It also generates daily emails to moderators whenever pending changes exist.');
        ?>
		</td>
	</tr>

	<?php 
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Send out reminder emails?');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('sendmail', $sendmail);
        echo '<br>';
        echo I18N::translate('Reminder email frequency (days)') . "&nbsp;<input type='text' name='days' value='" . $days . "' size='2'>";
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Add a scrollbar when block contents grow');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('block', $block);
        echo '</td></tr>';
    }
    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'show_last_update', Filter::postBool('show_last_update'));
            $this->setBlockSetting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames'));
            $this->setBlockSetting($block_id, 'stat_indi', Filter::postBool('stat_indi'));
            $this->setBlockSetting($block_id, 'stat_fam', Filter::postBool('stat_fam'));
            $this->setBlockSetting($block_id, 'stat_sour', Filter::postBool('stat_sour'));
            $this->setBlockSetting($block_id, 'stat_other', Filter::postBool('stat_other'));
            $this->setBlockSetting($block_id, 'stat_media', Filter::postBool('stat_media'));
            $this->setBlockSetting($block_id, 'stat_repo', Filter::postBool('stat_repo'));
            $this->setBlockSetting($block_id, 'stat_surname', Filter::postBool('stat_surname'));
            $this->setBlockSetting($block_id, 'stat_events', Filter::postBool('stat_events'));
            $this->setBlockSetting($block_id, 'stat_users', Filter::postBool('stat_users'));
            $this->setBlockSetting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth'));
            $this->setBlockSetting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth'));
            $this->setBlockSetting($block_id, 'stat_first_death', Filter::postBool('stat_first_death'));
            $this->setBlockSetting($block_id, 'stat_last_death', Filter::postBool('stat_last_death'));
            $this->setBlockSetting($block_id, 'stat_long_life', Filter::postBool('stat_long_life'));
            $this->setBlockSetting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life'));
            $this->setBlockSetting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil'));
            $this->setBlockSetting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil'));
        }
        $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
        $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
        $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1');
        $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1');
        $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1');
        $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1');
        $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1');
        $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1');
        $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1');
        $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1');
        $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
        $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
        $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1');
        $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1');
        $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1');
        $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
        $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
        $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
        ?>
		<tr>
			<td class="descriptionbox wrap width33">
				<?php 
        echo I18N::translate('Show date of last update?');
        ?>
			</td>
			<td class="optionbox">
				<?php 
        echo FunctionsEdit::editFieldYesNo('show_last_update', $show_last_update);
        ?>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33">
				<?php 
        echo I18N::translate('Show common surnames?');
        ?>
			</td>
			<td class="optionbox">
				<?php 
        echo FunctionsEdit::editFieldYesNo('show_common_surnames', $show_common_surnames);
        ?>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo I18N::translate('Select the stats to show in this block');
        ?>
</td>
			<td class="optionbox">
				<table>
					<tbody>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_indi" <?php 
        echo $stat_indi ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Individuals');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_first_birth" <?php 
        echo $stat_first_birth ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Earliest birth year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_surname" <?php 
        echo $stat_surname ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Total surnames');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_last_birth" <?php 
        echo $stat_last_birth ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Latest birth year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_fam" <?php 
        echo $stat_fam ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Families');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_first_death" <?php 
        echo $stat_first_death ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Earliest death year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_sour" <?php 
        echo $stat_sour ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Sources');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_last_death" <?php 
        echo $stat_last_death ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Latest death year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_media" <?php 
        echo $stat_media ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Media objects');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_long_life" <?php 
        echo $stat_long_life ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Individual who lived the longest');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_repo" <?php 
        echo $stat_repo ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Repositories');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_avg_life" <?php 
        echo $stat_avg_life ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Average age at death');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_events" <?php 
        echo $stat_events ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Total events');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_most_chil" <?php 
        echo $stat_most_chil ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Family with the most children');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_users" <?php 
        echo $stat_users ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Total users');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_avg_chil" <?php 
        echo $stat_avg_chil ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Average number of children per family');
        ?>
								</label>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
		<?php 
    }
    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        global $WT_TREE, $controller;
        $PEDIGREE_ROOT_ID = $WT_TREE->getPreference('PEDIGREE_ROOT_ID');
        $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid');
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'details', Filter::postBool('details'));
            $this->setBlockSetting($block_id, 'type', Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree'));
            $this->setBlockSetting($block_id, 'pid', Filter::post('pid', WT_REGEX_XREF));
        }
        $details = $this->getBlockSetting($block_id, 'details', '0');
        $type = $this->getBlockSetting($block_id, 'type', 'pedigree');
        $pid = $this->getBlockSetting($block_id, 'pid', Auth::check() ? $gedcomid ? $gedcomid : $PEDIGREE_ROOT_ID : $PEDIGREE_ROOT_ID);
        $controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
        ?>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo I18N::translate('Chart type');
        ?>
</td>
			<td class="optionbox">
				<?php 
        echo FunctionsEdit::selectEditControl('type', array('pedigree' => I18N::translate('Pedigree'), 'descendants' => I18N::translate('Descendants'), 'hourglass' => I18N::translate('Hourglass chart'), 'treenav' => I18N::translate('Interactive tree')), null, $type);
        ?>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo I18N::translate('Show details');
        ?>
</td>
		<td class="optionbox">
			<?php 
        echo FunctionsEdit::editFieldYesNo('details', $details);
        ?>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo I18N::translate('Individual');
        ?>
</td>
			<td class="optionbox">
				<input data-autocomplete-type="INDI" type="text" name="pid" id="pid" value="<?php 
        echo $pid;
        ?>
" size="5">
				<?php 
        echo FunctionsPrint::printFindIndividualLink('pid');
        $root = Individual::getInstance($pid, $WT_TREE);
        if ($root) {
            echo ' <span class="list_item">', $root->getFullName(), $root->formatFirstMajorFact(WT_EVENTS_BIRT, 1), '</span>';
        }
        ?>
			</td>
		</tr>
		<?php 
    }
Beispiel #27
0
 $user = User::find($user_id);
 $username = Filter::post('username');
 $real_name = Filter::post('real_name');
 $email = Filter::postEmail('email');
 $pass1 = Filter::post('pass1', WT_REGEX_PASSWORD);
 $pass2 = Filter::post('pass2', WT_REGEX_PASSWORD);
 $theme = Filter::post('theme', implode('|', array_keys(Theme::themeNames())), '');
 $language = Filter::post('language');
 $timezone = Filter::post('timezone');
 $contact_method = Filter::post('contact_method');
 $comment = Filter::post('comment');
 $auto_accept = Filter::postBool('auto_accept');
 $canadmin = Filter::postBool('canadmin');
 $visible_online = Filter::postBool('visible_online');
 $verified = Filter::postBool('verified');
 $approved = Filter::postBool('approved');
 if ($user_id === 0) {
     // Create a new user
     if (User::findByUserName($username)) {
         FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.'));
     } elseif (User::findByEmail($email)) {
         FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.'));
     } elseif ($pass1 !== $pass2) {
         FlashMessages::addMessage(I18N::translate('The passwords do not match.'));
     } else {
         $user = User::create($username, $real_name, $email, $pass1);
         $user->setPreference('reg_timestamp', date('U'))->setPreference('sessiontime', '0');
         Log::addAuthenticationLog('User ->' . $username . '<- created');
     }
 } else {
     $user = User::find($user_id);
Beispiel #28
0
    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all'));
            $this->setBlockSetting($block_id, 'controls', Filter::postBool('controls'));
            $this->setBlockSetting($block_id, 'start', Filter::postBool('start'));
            $this->setBlockSetting($block_id, 'filter_avi', Filter::postBool('filter_avi'));
            $this->setBlockSetting($block_id, 'filter_bmp', Filter::postBool('filter_bmp'));
            $this->setBlockSetting($block_id, 'filter_gif', Filter::postBool('filter_gif'));
            $this->setBlockSetting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg'));
            $this->setBlockSetting($block_id, 'filter_mp3', Filter::postBool('filter_mp3'));
            $this->setBlockSetting($block_id, 'filter_ole', Filter::postBool('filter_ole'));
            $this->setBlockSetting($block_id, 'filter_pcx', Filter::postBool('filter_pcx'));
            $this->setBlockSetting($block_id, 'filter_pdf', Filter::postBool('filter_pdf'));
            $this->setBlockSetting($block_id, 'filter_png', Filter::postBool('filter_png'));
            $this->setBlockSetting($block_id, 'filter_tiff', Filter::postBool('filter_tiff'));
            $this->setBlockSetting($block_id, 'filter_wav', Filter::postBool('filter_wav'));
            $this->setBlockSetting($block_id, 'filter_audio', Filter::postBool('filter_audio'));
            $this->setBlockSetting($block_id, 'filter_book', Filter::postBool('filter_book'));
            $this->setBlockSetting($block_id, 'filter_card', Filter::postBool('filter_card'));
            $this->setBlockSetting($block_id, 'filter_certificate', Filter::postBool('filter_certificate'));
            $this->setBlockSetting($block_id, 'filter_coat', Filter::postBool('filter_coat'));
            $this->setBlockSetting($block_id, 'filter_document', Filter::postBool('filter_document'));
            $this->setBlockSetting($block_id, 'filter_electronic', Filter::postBool('filter_electronic'));
            $this->setBlockSetting($block_id, 'filter_fiche', Filter::postBool('filter_fiche'));
            $this->setBlockSetting($block_id, 'filter_film', Filter::postBool('filter_film'));
            $this->setBlockSetting($block_id, 'filter_magazine', Filter::postBool('filter_magazine'));
            $this->setBlockSetting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript'));
            $this->setBlockSetting($block_id, 'filter_map', Filter::postBool('filter_map'));
            $this->setBlockSetting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper'));
            $this->setBlockSetting($block_id, 'filter_other', Filter::postBool('filter_other'));
            $this->setBlockSetting($block_id, 'filter_painting', Filter::postBool('filter_painting'));
            $this->setBlockSetting($block_id, 'filter_photo', Filter::postBool('filter_photo'));
            $this->setBlockSetting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone'));
            $this->setBlockSetting($block_id, 'filter_video', Filter::postBool('filter_video'));
        }
        $filter = $this->getBlockSetting($block_id, 'filter', 'all');
        $controls = $this->getBlockSetting($block_id, 'controls', '1');
        $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start');
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Show only individuals, events, or all');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::selectEditControl('filter', array('indi' => I18N::translate('Individuals'), 'event' => I18N::translate('Facts and events'), 'all' => I18N::translate('All')), null, $filter, '');
        echo '</td></tr>';
        $filters = array('avi' => $this->getBlockSetting($block_id, 'filter_avi', '0'), 'bmp' => $this->getBlockSetting($block_id, 'filter_bmp', '1'), 'gif' => $this->getBlockSetting($block_id, 'filter_gif', '1'), 'jpeg' => $this->getBlockSetting($block_id, 'filter_jpeg', '1'), 'mp3' => $this->getBlockSetting($block_id, 'filter_mp3', '0'), 'ole' => $this->getBlockSetting($block_id, 'filter_ole', '1'), 'pcx' => $this->getBlockSetting($block_id, 'filter_pcx', '1'), 'pdf' => $this->getBlockSetting($block_id, 'filter_pdf', '0'), 'png' => $this->getBlockSetting($block_id, 'filter_png', '1'), 'tiff' => $this->getBlockSetting($block_id, 'filter_tiff', '1'), 'wav' => $this->getBlockSetting($block_id, 'filter_wav', '0'), 'audio' => $this->getBlockSetting($block_id, 'filter_audio', '0'), 'book' => $this->getBlockSetting($block_id, 'filter_book', '1'), 'card' => $this->getBlockSetting($block_id, 'filter_card', '1'), 'certificate' => $this->getBlockSetting($block_id, 'filter_certificate', '1'), 'coat' => $this->getBlockSetting($block_id, 'filter_coat', '1'), 'document' => $this->getBlockSetting($block_id, 'filter_document', '1'), 'electronic' => $this->getBlockSetting($block_id, 'filter_electronic', '1'), 'fiche' => $this->getBlockSetting($block_id, 'filter_fiche', '1'), 'film' => $this->getBlockSetting($block_id, 'filter_film', '1'), 'magazine' => $this->getBlockSetting($block_id, 'filter_magazine', '1'), 'manuscript' => $this->getBlockSetting($block_id, 'filter_manuscript', '1'), 'map' => $this->getBlockSetting($block_id, 'filter_map', '1'), 'newspaper' => $this->getBlockSetting($block_id, 'filter_newspaper', '1'), 'other' => $this->getBlockSetting($block_id, 'filter_other', '1'), 'painting' => $this->getBlockSetting($block_id, 'filter_painting', '1'), 'photo' => $this->getBlockSetting($block_id, 'filter_photo', '1'), 'tombstone' => $this->getBlockSetting($block_id, 'filter_tombstone', '1'), 'video' => $this->getBlockSetting($block_id, 'filter_video', '0'));
        ?>
	<tr>
	<td class="descriptionbox wrap width33">
		<?php 
        echo I18N::translate('Filter');
        ?>
	</td>
	<td class="optionbox">
		<center><b><?php 
        echo GedcomTag::getLabel('FORM');
        ?>
</b></center>
		<table class="width100">
			<tr>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_avi" <?php 
        echo $filters['avi'] ? 'checked' : '';
        ?>
>
						avi
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_bmp" <?php 
        echo $filters['bmp'] ? 'checked' : '';
        ?>
>
						bmp
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_gif" <?php 
        echo $filters['gif'] ? 'checked' : '';
        ?>
>
						gif
					</label>
				</td>
			</tr>
			<tr>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_jpeg" <?php 
        echo $filters['jpeg'] ? 'checked' : '';
        ?>
>
						jpeg
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_mp3" <?php 
        echo $filters['mp3'] ? 'checked' : '';
        ?>
>
						mp3
					</label>
				</td>
					<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_ole" <?php 
        echo $filters['ole'] ? 'checked' : '';
        ?>
>
						ole
					</label>
				</td>
			</tr>
			<tr>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_pcx" <?php 
        echo $filters['pcx'] ? 'checked' : '';
        ?>
>
						pcx
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_pdf" <?php 
        echo $filters['pdf'] ? 'checked' : '';
        ?>
>
						pdf
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_png" <?php 
        echo $filters['png'] ? 'checked' : '';
        ?>
>
						png
					</label>
				</td>
			</tr>
			<tr>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_tiff" <?php 
        echo $filters['tiff'] ? 'checked' : '';
        ?>
>
						tiff
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_wav" <?php 
        echo $filters['wav'] ? 'checked' : '';
        ?>
>
						wav
					</label>
				</td>
				<td class="width33"></td>
				<td class="width33"></td>
			</tr>
		</table>
			<br>
			<center><b><?php 
        echo GedcomTag::getLabel('TYPE');
        ?>
</b></center>
				<table class="width100">
					<tr>
					<?php 
        //-- Build the list of checkboxes
        $i = 0;
        foreach (GedcomTag::getFileFormTypes() as $typeName => $typeValue) {
            $i++;
            if ($i > 3) {
                $i = 1;
                echo '</tr><tr>';
            }
            echo '<td class="width33"><label><input type="checkbox" value="yes" name="filter_' . $typeName . '" ';
            echo $filters[$typeName] ? 'checked' : '';
            echo '> ' . $typeValue . '</label></td>';
        }
        ?>
				</tr>
			</table>
		</td>
	</tr>

	<?php 
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Show slide show controls');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('controls', $controls);
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Start slide show on page load');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('start', $start);
        echo '</td></tr>';
    }
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $num = $this->getBlockSetting($block_id, 'num', '10');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $block = $this->getBlockSetting($block_id, 'block', '0');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of items to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="num" size="2" value="', $num, '">';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'show_last_update', Filter::postBool('show_last_update'));
            $this->setBlockSetting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames'));
            $this->setBlockSetting($block_id, 'number_of_surnames', Filter::postInteger('number_of_surnames'));
            $this->setBlockSetting($block_id, 'stat_indi', Filter::postBool('stat_indi'));
            $this->setBlockSetting($block_id, 'stat_fam', Filter::postBool('stat_fam'));
            $this->setBlockSetting($block_id, 'stat_sour', Filter::postBool('stat_sour'));
            $this->setBlockSetting($block_id, 'stat_other', Filter::postBool('stat_other'));
            $this->setBlockSetting($block_id, 'stat_media', Filter::postBool('stat_media'));
            $this->setBlockSetting($block_id, 'stat_repo', Filter::postBool('stat_repo'));
            $this->setBlockSetting($block_id, 'stat_surname', Filter::postBool('stat_surname'));
            $this->setBlockSetting($block_id, 'stat_events', Filter::postBool('stat_events'));
            $this->setBlockSetting($block_id, 'stat_users', Filter::postBool('stat_users'));
            $this->setBlockSetting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth'));
            $this->setBlockSetting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth'));
            $this->setBlockSetting($block_id, 'stat_first_death', Filter::postBool('stat_first_death'));
            $this->setBlockSetting($block_id, 'stat_last_death', Filter::postBool('stat_last_death'));
            $this->setBlockSetting($block_id, 'stat_long_life', Filter::postBool('stat_long_life'));
            $this->setBlockSetting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life'));
            $this->setBlockSetting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil'));
            $this->setBlockSetting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil'));
        }
        $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
        $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
        $number_of_surnames = $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES);
        $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1');
        $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1');
        $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1');
        $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1');
        $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1');
        $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1');
        $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1');
        $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1');
        $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
        $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
        $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1');
        $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1');
        $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1');
        $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
        $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
        $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
        ?>
		<tr>
			<td class="descriptionbox wrap width33">
				<label for="show-last-update">
					<?php 
        echo I18N::translate('Show date of last update');
        ?>
				</label>
			</td>
			<td class="optionbox">
				<input type="checkbox" value="yes" id="show-last-update" name="show_last_update" <?php 
        echo $show_last_update ? 'checked' : '';
        ?>
>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33">
				<?php 
        echo I18N::translate('Statistics');
        ?>
			</td>
			<td class="optionbox">
				<table>
					<tbody>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_indi" <?php 
        echo $stat_indi ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Individuals');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_first_birth" <?php 
        echo $stat_first_birth ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Earliest birth year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_surname" <?php 
        echo $stat_surname ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Total surnames');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_last_birth" <?php 
        echo $stat_last_birth ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Latest birth year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_fam" <?php 
        echo $stat_fam ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Families');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_first_death" <?php 
        echo $stat_first_death ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Earliest death year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_sour" <?php 
        echo $stat_sour ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Sources');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_last_death" <?php 
        echo $stat_last_death ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Latest death year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_media" <?php 
        echo $stat_media ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Media objects');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_long_life" <?php 
        echo $stat_long_life ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Individual who lived the longest');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_repo" <?php 
        echo $stat_repo ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Repositories');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_avg_life" <?php 
        echo $stat_avg_life ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Average age at death');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_events" <?php 
        echo $stat_events ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Total events');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_most_chil" <?php 
        echo $stat_most_chil ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Family with the most children');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_users" <?php 
        echo $stat_users ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Total users');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_avg_chil" <?php 
        echo $stat_avg_chil ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Average number of children per family');
        ?>
								</label>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33">
				<label for="show-common-surnames">
					<?php 
        echo I18N::translate('Most common surnames');
        ?>
				</label>
			</td>
			<td class="optionbox">
				<input type="checkbox" value="yes" id="show-common-surnames" name="show_common_surnames" <?php 
        echo $show_common_surnames ? 'checked' : '';
        ?>
>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33">
				<label for="number-of-surnames">
					<?php 
        echo I18N::translate('Number of surnames');
        ?>
				</label>
			</td>
			<td class="optionbox">
				<input
					id="number-of-surnames"
					maxlength="5"
					name="number_of_surnames"
					pattern="[1-9][0-9]*"
					required
					type="text"
					value="<?php 
        echo Filter::escapeHtml($number_of_surnames);
        ?>
"
				>
			</td>
		</tr>
		<?php 
    }