本文整理汇总了PHP中Fisharebest\Webtrees\Filter::checkCsrf方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::checkCsrf方法的具体用法?PHP Filter::checkCsrf怎么用?PHP Filter::checkCsrf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Filter
的用法示例。
在下文中一共展示了Filter::checkCsrf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* AdminConfig@index
*/
public function index()
{
global $WT_TREE;
$action = Filter::post('action');
if ($action == 'update' && Filter::checkCsrf()) {
$this->update();
}
Theme::theme(new AdministrationTheme())->init($WT_TREE);
$ctrl = new PageController();
$ctrl->restrictAccess(Auth::isAdmin())->setPageTitle($this->module->getTitle());
$view_bag = new ViewBag();
$view_bag->set('title', $ctrl->getPageTitle());
$view_bag->set('module', $this->module);
ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
}
示例2: update
/**
* Saves Sosa's user preferences (root individual for the user).
*
* @param BaseController $controller
* @return bool True is saving successfull
*/
protected function update(BaseController $controller)
{
global $WT_TREE;
if ($this->canUpdate() && Filter::checkCsrf()) {
$indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE);
$user = User::find(Filter::postInteger('userid', -1));
if ($user && $indi) {
$WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref());
$controller->addInlineJavascript('
$( document ).ready(function() {
majComputeSosa(' . $user->getUserId() . ');
});');
FlashMessages::addMessage(I18N::translate('The preferences have been updated.'));
return true;
}
}
FlashMessages::addMessage(I18N::translate('An error occurred while saving data...'), 'danger');
return false;
}
示例3: config
/**
* WelcomeBlock@config
*
* @param string $block_id
*/
public function config($block_id)
{
if (Filter::postBool('save') && Filter::checkCsrf()) {
$this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled'));
$this->module->setBlockSetting($block_id, 'piwik_url', trim(Filter::postUrl('piwik_url')));
$this->module->setBlockSetting($block_id, 'piwik_siteid', trim(Filter::post('piwik_siteid')));
$this->module->setBlockSetting($block_id, 'piwik_token', trim(Filter::post('piwik_token')));
Cache::delete('piwikCountYear', $this->module);
throw new MvcException(200);
// Use this instead of exit
}
$view_bag = new ViewBag();
// Is Piwik Statistic Enabled ?
$view_bag->set('piwik_enabled', $this->module->getBlockSetting($block_id, 'piwik_enabled', '0'));
//Piwik Root Url
$view_bag->set('piwik_url', $this->module->getBlockSetting($block_id, 'piwik_url', ''));
// Piwik token
$view_bag->set('piwik_token', $this->module->getBlockSetting($block_id, 'piwik_token', ''));
// Piwik side id
$view_bag->set('piwik_siteid', $this->module->getBlockSetting($block_id, 'piwik_siteid', ''));
ViewFactory::make('WelcomeBlockConfig', $this, new BaseController(), $view_bag)->renderPartial();
}
示例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: 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_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');
?>
//.........这里部分代码省略.........
示例6: PageController
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Fisharebest\Webtrees;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\Module\ModuleConfigInterface;
define('WT_SCRIPT_NAME', 'admin_module_sidebar.php');
require 'includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Sidebars'));
$action = Filter::post('action');
$modules = Module::getAllModulesByComponent('sidebar');
if ($action === 'update_mods' && Filter::checkCsrf()) {
foreach ($modules as $module) {
foreach (Tree::getAll() as $tree) {
$access_level = Filter::post('access-' . $module->getName() . '-' . $tree->getTreeId(), WT_REGEX_INTEGER, $module->defaultAccessLevel());
Database::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'sidebar', ?)")->execute(array($module->getName(), $tree->getTreeId(), $access_level));
}
$order = Filter::post('order-' . $module->getName());
Database::prepare("UPDATE `##module` SET sidebar_order = ? WHERE module_name = ?")->execute(array($order, $module->getName()));
}
header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
return;
}
$controller->addInlineJavascript('
jQuery("#module_table").sortable({
items: ".sortme",
forceHelperSize: true,
示例7: 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, '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>';
}
示例8: 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, '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>';
}
示例9: 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, '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>
//.........这里部分代码省略.........
示例10: list
if (preg_match('/^[0-9.]+\\|[0-9.]+\\|/', $latest_version_txt)) {
list($latest_version, $earliest_version, $download_url) = explode('|', $latest_version_txt);
} else {
// Cannot determine the latest version
list($latest_version, $earliest_version, $download_url) = explode('|', '||');
}
$latest_version_html = '<span dir="ltr">' . $latest_version . '</span>';
$download_url_html = '<b dir="auto"><a href="' . Filter::escapeHtml($download_url) . '">' . Filter::escapeHtml($download_url) . '</a></b>';
// Show a friendly message while the site is being upgraded
$lock_file = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'offline.txt';
$lock_file_text = I18N::translate('This website is being upgraded. Try again in a few minutes.') . PHP_EOL . FunctionsDate::formatTimestamp(WT_TIMESTAMP) . I18N::translate('UTC');
// Success/failure indicators
$icon_success = '<i class="icon-yes"></i>';
$icon_failure = '<i class="icon-failure"></i>';
// Need confirmation for various actions
$continue = Filter::post('continue', '1') && Filter::checkCsrf();
$modules_action = Filter::post('modules', 'ignore|disable');
$themes_action = Filter::post('themes', 'ignore|disable');
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Upgrade wizard'))->pageHeader();
echo '<h1>', $controller->getPageTitle(), '</h1>';
if ($latest_version == '') {
echo '<p>', I18N::translate('No upgrade information is available.'), '</p>';
return;
}
if (version_compare(WT_VERSION, $latest_version) >= 0) {
echo '<p>', I18N::translate('This is the latest version of webtrees. No upgrade is available.'), '</p>';
return;
}
echo '<form method="post" action="admin_site_upgrade.php">';
echo Filter::getCsrf();
示例11: 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>';
}
示例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, '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>';
}
示例13: 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>';
}
示例14: 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_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>
//.........这里部分代码省略.........
示例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('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)') . " <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>';
}