本文整理汇总了PHP中Fisharebest\Webtrees\Filter::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::post方法的具体用法?PHP Filter::post怎么用?PHP Filter::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Filter
的用法示例。
在下文中一共展示了Filter::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pageBody
public function pageBody()
{
$tmp_dir = WT_DATA_DIR . 'ftv_pdf_tmp/';
define('_JPGRAPH_PATH', $tmp_dir);
define('_MPDF_TEMP_PATH', $tmp_dir);
define('_MPDF_TTFONTDATAPATH', $tmp_dir);
require_once WT_MODULES_DIR . $this->getName() . '/mpdf/mpdf.php';
$stylesheet = file_get_contents($this->directory . '/css/style.css');
$stylesheet_rtl = file_get_contents($this->directory . '/css/style-rtl.css');
$html = Filter::post('pdfContent');
$header = '<header>=== ' . $this->tree()->getTitleHtml() . ' ===</header>';
$footer = '<footer>' . '<table><tr>' . '<td class="left">' . WT_BASE_URL . '</td>' . '<td class="center">{DATE d-m-Y}</td>' . '<td class="right">{PAGENO}</td>' . '</tr></table>' . '</footer>';
$mpdf = new mPDF();
$mpdf->simpleTables = true;
$mpdf->shrink_tables_to_fit = 1;
$mpdf->autoScriptToLang = true;
$mpdf->baseScript = 1;
$mpdf->autoVietnamese = true;
$mpdf->autoArabic = true;
$mpdf->autoLangToFont = true;
if (I18N::direction() === 'rtl') {
$mpdf->SetDirectionality('rtl');
$mpdf->WriteHTML($stylesheet_rtl, 1);
} else {
$mpdf->WriteHTML($stylesheet, 1);
}
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->autoMarginPadding = 5;
$admin = User::find($this->tree()->getPreference('WEBMASTER_USER_ID'))->getRealName();
$mpdf->setCreator($this->getTitle() . ' - a webtrees module by justcarmen.nl');
$mpdf->SetTitle(Filter::get('title'));
$mpdf->setAuthor($admin);
$mpdf->SetHTMLHeader($header);
$mpdf->setHTMLFooter($footer);
$html_chunks = explode("\n", $html);
$chunks = count($html_chunks);
$i = 1;
foreach ($html_chunks as $html_chunk) {
// write html body parts only (option 2);
if ($i === 1) {
// first chunk (initialize all buffers - init=true)
$mpdf->WriteHTML($html_chunk, 2, true, false);
} elseif ($i === $chunks) {
// last chunck (close all buffers - close=true)
$mpdf->WriteHTML($html_chunk, 2, false, true);
} else {
// all other parts (keep the buffer open)
$mpdf->WriteHTML($html_chunk, 2, false, false);
}
$i++;
}
$index = '
<pagebreak type="next-odd" />
<h2>' . I18N::translate('Index') . '</h2>
<columns column-count="2" column-gap="5" />
<indexinsert usedivletters="on" links="on" collation="' . WT_LOCALE . '.utf8" collationgroup="' . I18N::collation() . '" />';
$mpdf->writeHTML($index);
$mpdf->Output($tmp_dir . Filter::get('title') . '.pdf', 'F');
}
示例2: modAction
/**
* This is a general purpose hook, allowing modules to respond to routes
* of the form module.php?mod=FOO&mod_action=BAR
*
* @param string $mod_action
*/
public function modAction($mod_action)
{
switch ($mod_action) {
case 'delete':
$stmt = Database::prepare("DELETE FROM `##message` WHERE user_id = :user_id AND message_id = :message_id");
foreach (Filter::postArray('message_id') as $id) {
$stmt->execute(array('message_id' => $id, 'user_id' => Auth::id()));
}
}
$ged = Filter::post('ged');
$ctype = Filter::post('ctype', 'user|gedcom', 'user');
header('Location: ' . WT_BASE_URL . 'index.php?ged=' . Filter::escapeUrl($ged) . '&ctype=' . $ctype);
}
示例3: modAction
/**
* This is a general purpose hook, allowing modules to respond to routes
* of the form module.php?mod=FOO&mod_action=BAR
*
* @param string $mod_action
*/
public function modAction($mod_action)
{
global $WT_TREE;
switch ($mod_action) {
case 'menu-add-favorite':
// Process the "add to user favorites" menu item on indi/fam/etc. pages
$record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
if (Auth::check() && $record->canShowName()) {
self::addFavorite(array('user_id' => Auth::id(), 'gedcom_id' => $record->getTree()->getTreeId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null));
FlashMessages::addMessage(I18N::translate('“%s” has been added to your favorites.', $record->getFullName()));
}
break;
}
}
示例4: 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();
}
示例5: 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;
}
}
示例6: placesEdit
/**
* Edit places.
*/
private function placesEdit()
{
$GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM');
$action = Filter::post('action', null, Filter::get('action'));
$placeid = Filter::post('placeid', null, Filter::get('placeid'));
$place_name = Filter::post('place_name', null, Filter::get('place_name'));
$controller = new SimpleController();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Geographic data'))->addInlineJavascript('$("<link>", {rel: "stylesheet", type: "text/css", href: "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/css/wt_v3_googlemap.css"}).appendTo("head");')->pageHeader();
$where_am_i = $this->placeIdToHierarchy($placeid);
$level = count($where_am_i);
if ($action == 'addrecord' && Auth::isAdmin()) {
$statement = Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
if ($_POST['LONG_CONTROL'] == '' || $_POST['NEW_PLACE_LONG'] == '' || $_POST['NEW_PLACE_LATI'] == '') {
$statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
} else {
$statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
}
$controller->addInlineJavaScript('closePopupAndReloadParent();');
echo "<div class=\"center\"><button onclick=\"closePopupAndReloadParent();return false;\">", I18N::translate('close'), "</button></div>";
exit;
}
if ($action == 'updaterecord' && Auth::isAdmin()) {
$statement = Database::prepare("UPDATE `##placelocation` SET pl_place=?, pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?");
if ($_POST['LONG_CONTROL'] == '' || $_POST['NEW_PLACE_LONG'] == '' || $_POST['NEW_PLACE_LATI'] == '') {
$statement->execute(array($_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
} else {
$statement->execute(array($_POST['NEW_PLACE_NAME'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
}
$controller->addInlineJavaScript('closePopupAndReloadParent();');
echo "<div class=\"center\"><button onclick=\"closePopupAndReloadParent();return false;\">", I18N::translate('close'), "</button></div>";
exit;
}
// Update placelocation STREETVIEW fields
// TODO: This ought to be a POST request, rather than a GET request
if ($action == 'update_sv_params' && Auth::isAdmin()) {
Database::prepare("UPDATE `##placelocation` SET sv_lati=?, sv_long=?, sv_bearing=?, sv_elevation=?, sv_zoom=? WHERE pl_id=?")->execute(array(Filter::get('svlati'), Filter::get('svlong'), Filter::get('svbear'), Filter::get('svelev'), Filter::get('svzoom'), $placeid));
$controller->addInlineJavaScript('window.close();');
exit;
}
if ($action === 'update') {
// --- find the place in the file
$row = Database::prepare("SELECT pl_place, pl_lati, pl_long, pl_icon, pl_parent_id, pl_level, pl_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($placeid))->fetchOneRow();
$place_name = $row->pl_place;
$place_icon = $row->pl_icon;
$selected_country = explode("/", $place_icon);
if (isset($selected_country[1]) && $selected_country[1] != "flags") {
$selected_country = $selected_country[1];
} else {
$selected_country = "Countries";
}
$parent_id = $row->pl_parent_id;
$level = $row->pl_level;
$zoomfactor = $row->pl_zoom;
$parent_lati = 0.0;
$parent_long = 0.0;
if ($row->pl_lati !== null && $row->pl_long !== null) {
$place_lati = (double) str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
$place_long = (double) str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
} else {
$place_lati = 0.0;
$place_long = 0.0;
$zoomfactor = 1;
}
do {
$row = Database::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($parent_id))->fetchOneRow();
if (!$row) {
break;
}
if ($row->pl_lati !== null && $row->pl_long !== null) {
$parent_lati = (double) str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
$parent_long = (double) str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
if ($zoomfactor == 1) {
$zoomfactor = $row->pl_zoom;
}
}
$parent_id = $row->pl_parent_id;
} while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null);
echo '<b>', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
}
if ($action === 'add') {
// --- find the parent place in the file
if ($placeid != 0) {
$place_lati = 0.0;
$place_long = 0.0;
$zoomfactor = 1;
$parent_lati = 0.0;
$parent_long = 0.0;
$place_icon = '';
$parent_id = $placeid;
do {
$row = Database::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom, pl_level FROM `##placelocation` WHERE pl_id=?")->execute(array($parent_id))->fetchOneRow();
if ($row->pl_lati !== null && $row->pl_long !== null) {
$parent_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
$parent_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
$zoomfactor = $row->pl_zoom;
if ($zoomfactor > $GM_MAX_ZOOM) {
$zoomfactor = $GM_MAX_ZOOM;
//.........这里部分代码省略.........
示例7: header
Site::setPreference('WELCOME_TEXT_AUTH_MODE_' . WT_LOCALE, Filter::post('WELCOME_TEXT_AUTH_MODE_4'));
Site::setPreference('USE_REGISTRATION_MODULE', Filter::post('USE_REGISTRATION_MODULE'));
Site::setPreference('SHOW_REGISTER_CAUTION', Filter::post('SHOW_REGISTER_CAUTION'));
FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success');
}
header('Location: ' . WT_BASE_URL . 'admin.php');
return;
case 'tracking':
if (Filter::checkCsrf()) {
Site::setPreference('BING_WEBMASTER_ID', Filter::post('BING_WEBMASTER_ID'));
Site::setPreference('GOOGLE_WEBMASTER_ID', Filter::post('GOOGLE_WEBMASTER_ID'));
Site::setPreference('GOOGLE_ANALYTICS_ID', Filter::post('GOOGLE_ANALYTICS_ID'));
Site::setPreference('PIWIK_URL', Filter::post('PIWIK_URL'));
Site::setPreference('PIWIK_SITE_ID', Filter::post('PIWIK_SITE_ID'));
Site::setPreference('STATCOUNTER_PROJECT_ID', Filter::post('STATCOUNTER_PROJECT_ID'));
Site::setPreference('STATCOUNTER_SECURITY_ID', Filter::post('STATCOUNTER_SECURITY_ID'));
FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success');
}
header('Location: ' . WT_BASE_URL . 'admin.php');
return;
case 'languages':
if (Filter::checkCsrf()) {
Site::setPreference('LANGUAGES', implode(',', Filter::postArray('LANGUAGES')));
FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success');
}
header('Location: ' . WT_BASE_URL . 'admin.php');
return;
}
// Lists of options for <select> controls.
$SMTP_SSL_OPTIONS = array('none' => I18N::translate('none'), 'ssl' => I18N::translate('ssl'), 'tls' => I18N::translate('tls'));
$SMTP_ACTIVE_OPTIONS = array('internal' => I18N::translate('Use PHP mail to send messages'), 'external' => I18N::translate('Use SMTP to send messages'));
示例8: FROM
?>
</a></li>
<li class="active"><?php
echo $controller->getPageTitle();
?>
</li>
</ol>
<h1><?php
echo $controller->getPageTitle();
?>
</h1>
<?php
$tree1_id = Filter::post('tree1_id');
$tree2_id = Filter::post('tree2_id');
if ($tree1_id && $tree2_id != $tree1_id) {
// Every XREF used by both trees
$xrefs = Database::prepare("SELECT xref, type FROM (" . " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . " UNION " . " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . " UNION " . " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . " UNION " . " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . " UNION " . " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS this_tree JOIN (" . " SELECT xref FROM `##change` WHERE gedcom_id = ?" . " UNION " . " SELECT i_id AS xref FROM `##individuals` WHERE i_file = ?" . " UNION " . " SELECT f_id AS xref FROM `##families` WHERE f_file = ?" . " UNION " . " SELECT s_id AS xref FROM `##sources` WHERE s_file = ?" . " UNION " . " SELECT m_id AS xref FROM `##media` WHERE m_file = ?" . " UNION " . " SELECT o_id AS xref FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS other_trees USING (xref)")->execute(array($tree1_id, $tree1_id, $tree1_id, $tree1_id, $tree1_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id))->fetchAssoc();
if ($xrefs) {
$tree1 = Tree::findById($tree1_id);
$tree2 = Tree::findById($tree2_id);
echo '<p>', I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or “R14”.'), '</p>', '<p>', I18N::plural('The two family trees have %1$s record which uses the same “XREF”.', 'The two family trees have %1$s records which use the same “XREF”.', count($xrefs), count($xrefs)), '</p>', '<p>', I18N::translate('You must renumber the records in one of the trees before you can merge them.'), '</p>', '<p>', '<a class="current" href="admin_trees_renumber.php?ged=', $tree1->getNameUrl(), '">', I18N::translate('Renumber family tree'), ' — ', $tree1->getTitleHtml(), '</a>', '</p>', '<p>', '<a class="current" href="admin_trees_renumber.php?ged=', $tree2->getNameUrl(), '">', I18N::translate('Renumber family tree'), ' — ', $tree2->getTitleHtml(), '</a>', '</p>';
} else {
Database::beginTransaction();
Database::exec("LOCK TABLE" . " `##individuals` WRITE," . " `##individuals` AS individuals2 READ," . " `##families` WRITE," . " `##families` AS families2 READ," . " `##sources` WRITE," . " `##sources` AS sources2 READ," . " `##media` WRITE," . " `##media` AS media2 READ," . " `##other` WRITE," . " `##other` AS other2 READ," . " `##name` WRITE," . " `##name` AS name2 READ," . " `##placelinks` WRITE," . " `##placelinks` AS placelinks2 READ," . " `##change` WRITE," . " `##change` AS change2 READ," . " `##dates` WRITE," . " `##dates` AS dates2 READ," . " `##default_resn` WRITE," . " `##default_resn` AS default_resn2 READ," . " `##hit_counter` WRITE," . " `##hit_counter` AS hit_counter2 READ," . " `##link` WRITE," . " `##link` AS link2 READ");
Database::prepare("INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?")->execute(array($tree2_id, $tree1_id));
Database::prepare("INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?")->execute(array($tree2_id, $tree1_id));
Database::prepare("INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?")->execute(array($tree2_id, $tree1_id));
Database::prepare("INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom)" . " SELECT m_id, m_ext, m_type, m_titl, m_filename, ?, m_gedcom FROM `##media` AS media2 WHERE m_file = ?")->execute(array($tree2_id, $tree1_id));
Database::prepare("INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom)" . " SELECT o_id, ?, o_type, o_gedcom FROM `##other` AS other2 WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array($tree2_id, $tree1_id));
示例9:
}
}
}
}
} else {
http_response_code(406);
}
break;
case 'reject-changes':
// Reject all the pending changes for a record
$record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
if ($record && $record->canEdit() && Auth::isModerator($record->getTree())) {
FlashMessages::addMessage(I18N::translate('The changes to “%s” have been rejected.', $record->getFullName()));
FunctionsImport::rejectAllChanges($record);
} else {
http_response_code(406);
}
break;
case 'theme':
// Change the current theme
$theme = Filter::post('theme');
if (Site::getPreference('ALLOW_USER_THEMES') && array_key_exists($theme, Theme::themeNames())) {
Session::put('theme_id', $theme);
// Remember our selection
Auth::user()->setPreference('theme', $theme);
} else {
// Request for a non-existant theme.
http_response_code(406);
}
break;
}
示例10: foreach
}
foreach ($facts1 as $fact_id => $fact) {
if (in_array($fact_id, $keep1)) {
$gedcom .= "\n" . $fact->getGedcom();
}
}
foreach ($facts2 as $fact_id => $fact) {
if (in_array($fact_id, $keep2)) {
$gedcom .= "\n" . $fact->getGedcom();
}
}
$rec1->updateRecord($gedcom, true);
$rec2->deleteRecord();
FunctionsDb::updateFavorites($gid2, $gid1, $WT_TREE);
FlashMessages::addMessage(I18N::translate('The records “%1$s” and “%2$s” have been merged.', '<a class="alert-link" href="' . $rec1->getHtmlUrl() . '">' . $rec1->getFullName() . '</a>', $record2_name), 'success');
header('Location: ' . WT_BASE_URL . Filter::post('url', 'admin_trees_duplicates\\.php', WT_SCRIPT_NAME));
return;
}
$controller->pageHeader();
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_trees_manage.php"><?php
echo I18N::translate('Manage family trees');
?>
</a></li>
<li class="active"><?php
echo $controller->getPageTitle();
示例11: __construct
/**
* Startup activity
*/
public function __construct()
{
global $WT_TREE;
parent::__construct();
// $action comes from GET (search) or POST (replace)
if (Filter::post('action')) {
$this->action = Filter::post('action', 'replace', 'general');
$this->query = Filter::post('query');
$this->replace = Filter::post('replace');
$this->replaceNames = Filter::post('replaceNames', 'checked', '');
$this->replacePlaces = Filter::post('replacePlaces', 'checked', '');
$this->replacePlacesWord = Filter::post('replacePlacesWord', 'checked', '');
$this->replaceAll = Filter::post('replaceAll', 'checked', '');
} else {
$this->action = Filter::get('action', 'advanced|general|soundex|replace|header', 'general');
$this->query = Filter::get('query');
$this->replace = Filter::get('replace');
$this->replaceNames = Filter::get('replaceNames', 'checked', '');
$this->replacePlaces = Filter::get('replacePlaces', 'checked', '');
$this->replacePlacesWord = Filter::get('replacePlacesWord', 'checked', '');
$this->replaceAll = Filter::get('replaceAll', 'checked', '');
}
// Only editors can use search/replace
if ($this->action === 'replace' && !Auth::isEditor($WT_TREE)) {
$this->action = 'general';
}
$this->srindi = Filter::get('srindi', 'checked', '');
$this->srfams = Filter::get('srfams', 'checked', '');
$this->srsour = Filter::get('srsour', 'checked', '');
$this->srnote = Filter::get('srnote', 'checked', '');
$this->soundex = Filter::get('soundex', 'DaitchM|Russell', 'DaitchM');
$this->showasso = Filter::get('showasso');
$this->firstname = Filter::get('firstname');
$this->lastname = Filter::get('lastname');
$this->place = Filter::get('place');
$this->year = Filter::get('year');
// If no record types specified, search individuals
if (!$this->srfams && !$this->srsour && !$this->srnote) {
$this->srindi = 'checked';
}
// If no replace types specifiied, replace full records
if (!$this->replaceNames && !$this->replacePlaces && !$this->replacePlacesWord) {
$this->replaceAll = 'checked';
}
// Trees to search
if (Site::getPreference('ALLOW_CHANGE_GEDCOM')) {
foreach (Tree::getAll() as $search_tree) {
if (Filter::get('tree_' . $search_tree->getTreeId())) {
$this->search_trees[] = $search_tree;
}
}
if (!$this->search_trees) {
$this->search_trees[] = $WT_TREE;
}
} else {
$this->search_trees[] = $WT_TREE;
}
// If we want to show associated persons, build the list
switch ($this->action) {
case 'header':
// We can type in an XREF into the header search, and jump straight to it.
// Otherwise, the header search is the same as the general search
if (preg_match('/' . WT_REGEX_XREF . '/', $this->query)) {
$record = GedcomRecord::getInstance($this->query, $WT_TREE);
if ($record && $record->canShowName()) {
header('Location: ' . WT_BASE_URL . $record->getRawUrl());
exit;
}
}
$this->action = 'general';
$this->srindi = 'checked';
$this->srfams = 'checked';
$this->srsour = 'checked';
$this->srnote = 'checked';
$this->setPageTitle(I18N::translate('General search'));
$this->generalSearch();
break;
case 'general':
$this->setPageTitle(I18N::translate('General search'));
$this->generalSearch();
break;
case 'soundex':
// Create a dummy search query to use as a title to the results list
$this->query = trim($this->firstname . ' ' . $this->lastname . ' ' . $this->place);
$this->setPageTitle(I18N::translate('Phonetic search'));
$this->soundexSearch();
break;
case 'replace':
$this->setPageTitle(I18N::translate('Search and replace'));
$this->search_trees = array($WT_TREE);
$this->srindi = 'checked';
$this->srfams = 'checked';
$this->srsour = 'checked';
$this->srnote = 'checked';
if (Filter::post('query')) {
$this->searchAndReplace($WT_TREE);
header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=replace&query=' . Filter::escapeUrl($this->query) . '&replace=' . Filter::escapeUrl($this->replace) . '&replaceAll=' . $this->replaceAll . '&replaceNames=' . $this->replaceNames . '&replacePlaces=' . $this->replacePlaces . '&replacePlacesWord=' . $this->replacePlacesWord);
//.........这里部分代码省略.........
示例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, '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>
//.........这里部分代码省略.........
示例13: pageData
public function pageData()
{
$path = WT_DATA_DIR . '/ftv_cache/';
if (!file_exists($path)) {
File::mkdir($path);
}
$filename = $path . 'fancy-treeview-tmp.txt';
$content = Filter::post('pdfContent');
// make our datafile if it does not exist.
if (!file_exists($filename)) {
$handle = fopen($filename, 'w');
fclose($handle);
chmod($filename, 0644);
}
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
if (!($handle = @fopen($filename, 'w'))) {
exit;
}
// Write the pdfContent to our data.txt file.
if (fwrite($handle, $content) === FALSE) {
exit;
}
fclose($handle);
}
}
示例14: substr
// 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 {
FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
}
}
$gedcom = Filter::post('gedcom');
if ($gedcom && $gedcom !== $WT_TREE->getName()) {
try {
Database::prepare("UPDATE `##gedcom` SET gedcom_name = ? WHERE gedcom_id = ?")->execute(array($gedcom, $WT_TREE->getTreeId()));
Database::prepare("UPDATE `##site_setting` SET setting_value = ? WHERE setting_name='DEFAULT_GEDCOM' AND setting_value = ?")->execute(array($gedcom, $WT_TREE->getName()));
} catch (\Exception $ex) {
// Probably a duplicate name.
}
}
FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php');
return;
}
switch (Filter::get('action')) {
case 'privacy':
$controller->setPageTitle($WT_TREE->getTitleHtml() . ' — ' . I18N::translate('Privacy'))->addInlineJavascript('
示例15: 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>';
}