本文整理汇总了PHP中Fisharebest\Webtrees\Filter::postBool方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::postBool方法的具体用法?PHP Filter::postBool怎么用?PHP Filter::postBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Filter
的用法示例。
在下文中一共展示了Filter::postBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* 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);
}
}
}
}
}
}
}
示例2: modAction
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;
}
}
示例3: configureBlock
/**
* 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>';
}
示例4: edit
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>
//.........这里部分代码省略.........
示例5: header
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;
示例6: header
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
示例7: header
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'));
示例8: edit
/**
* 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();
?>
&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
//.........这里部分代码省略.........
示例9: configureBlock
/** {@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>';
}
示例10: edit
/**
* 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();
?>
&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">
//.........这里部分代码省略.........
示例11: admin
/**
* 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() . '&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() . '&mod_action=generate&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>';
}
}
示例12: configureBlock
/**
* 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>';
}
示例13: addNewFact
/**
* 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 '';
}
}
示例14: modAction
/** {@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);
//.........这里部分代码省略.........
示例15: configureBlock
/**
* 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>';
}