當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Filter::postArray方法代碼示例

本文整理匯總了PHP中Fisharebest\Webtrees\Filter::postArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Filter::postArray方法的具體用法?PHP Filter::postArray怎麽用?PHP Filter::postArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Fisharebest\Webtrees\Filter的用法示例。


在下文中一共展示了Filter::postArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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);
 }
開發者ID:tunandras,項目名稱:webtrees,代碼行數:19,代碼來源:UserMessagesModule.php

示例2: header

                        $tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', null);
                    }
                }
            }
        }
        header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
        return;
}
switch (Filter::get('action')) {
    case 'load_json':
        // Generate an AJAX/JSON response for datatables to load a block of rows
        $search = Filter::postArray('search');
        $search = $search['value'];
        $start = Filter::postInteger('start');
        $length = Filter::postInteger('length');
        $order = Filter::postArray('order');
        $sql_select = "SELECT SQL_CACHE SQL_CALC_FOUND_ROWS '', u.user_id, user_name, real_name, email, us1.setting_value, us2.setting_value, us2.setting_value, us3.setting_value, us3.setting_value, us4.setting_value, us5.setting_value" . " FROM `##user` u" . " LEFT JOIN `##user_setting` us1 ON (u.user_id=us1.user_id AND us1.setting_name='language')" . " LEFT JOIN `##user_setting` us2 ON (u.user_id=us2.user_id AND us2.setting_name='reg_timestamp')" . " LEFT JOIN `##user_setting` us3 ON (u.user_id=us3.user_id AND us3.setting_name='sessiontime')" . " LEFT JOIN `##user_setting` us4 ON (u.user_id=us4.user_id AND us4.setting_name='verified')" . " LEFT JOIN `##user_setting` us5 ON (u.user_id=us5.user_id AND us5.setting_name='verified_by_admin')" . " WHERE u.user_id > 0";
        $args = array();
        if ($search) {
            $sql_select .= " AND (user_name LIKE CONCAT('%', :search_1, '%') OR real_name LIKE CONCAT('%', :search_2, '%') OR email LIKE CONCAT('%', :search_3, '%'))";
            $args['search_1'] = $search;
            $args['search_2'] = $search;
            $args['search_3'] = $search;
        }
        if ($order) {
            $sql_select .= " ORDER BY ";
            foreach ($order as $key => $value) {
                if ($key > 0) {
                    $sql_select .= ',';
                }
                // Datatables numbers columns 0, 1, 2
開發者ID:tronsmit,項目名稱:webtrees,代碼行數:31,代碼來源:admin_users.php

示例3: implode

 if ($AUTH) {
     $newgedrec .= "\n1 AUTH " . $AUTH;
 }
 $PUBL = Filter::post('PUBL');
 if ($PUBL) {
     $newgedrec .= "\n1 PUBL " . preg_replace('/\\r?\\n/', "\n2 CONT ", $PUBL);
 }
 $REPO = Filter::post('REPO', WT_REGEX_XREF);
 if ($REPO) {
     $newgedrec .= "\n1 REPO @" . $REPO . '@';
     $CALN = Filter::post('CALN');
     if ($CALN) {
         $newgedrec .= "\n1 CALN " . $CALN;
     }
 }
 $EVEN = Filter::postArray('EVEN', WT_REGEX_TAG);
 if ($EVEN) {
     $newgedrec .= "\n1 DATA";
     $newgedrec .= "\n2 EVEN " . implode(',', $EVEN);
     $EVEN_DATE = Filter::post('EVEN_DATE');
     if ($EVEN_DATE) {
         $newgedrec .= "\n3 EVEN_DATE " . $EVEN_DATE;
     }
     $EVEN_PLAC = Filter::post('EVEN_PLAC');
     if ($EVEN_PLAC) {
         $newgedrec .= "\n3 EVEN_PLAC " . $EVEN_PLAC;
     }
     $AGNC = Filter::post('AGNC');
     if ($AGNC) {
         $newgedrec .= "\n2 AGNC " . $AGNC;
     }
開發者ID:jflash,項目名稱:webtrees,代碼行數:31,代碼來源:edit_interface.php

示例4: header

    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'));
$WELCOME_TEXT_AUTH_MODE_OPTIONS = array(0 => I18N::translate('No predefined text'), 1 => I18N::translate('Predefined text that states all users can request a user account'), 2 => I18N::translate('Predefined text that states admin will decide on each request for a user account'), 3 => I18N::translate('Predefined text that states only family members can request a user account'), 4 => I18N::translate('Choose user defined welcome text typed below'));
$language_tags = array();
foreach (I18N::activeLocales() as $active_locale) {
    $language_tags[] = $active_locale->languageTag();
}
switch (Filter::get('action')) {
    case 'site':
開發者ID:AlexSnet,項目名稱:webtrees,代碼行數:31,代碼來源:admin_site_config.php

示例5: SimpleController

use Fisharebest\Webtrees\Functions\FunctionsPrint;
use Fisharebest\Webtrees\Query\QueryMedia;
define('WT_SCRIPT_NAME', 'addmedia.php');
require './includes/session.php';
$NO_UPDATE_CHAN = $WT_TREE->getPreference('NO_UPDATE_CHAN');
$MEDIA_DIRECTORY = $WT_TREE->getPreference('MEDIA_DIRECTORY');
$pid = Filter::get('pid', WT_REGEX_XREF, Filter::post('pid', WT_REGEX_XREF));
// edit this media object
$linktoid = Filter::get('linktoid', WT_REGEX_XREF, Filter::post('linktoid', WT_REGEX_XREF));
// create a new media object, linked to this record
$action = Filter::get('action', null, Filter::post('action'));
$filename = Filter::get('filename', null, Filter::post('filename'));
$text = Filter::postArray('text');
$tag = Filter::postArray('tag', WT_REGEX_TAG);
$islink = Filter::postArray('islink');
$glevels = Filter::postArray('glevels', '[0-9]');
$folder = Filter::post('folder');
$update_CHAN = !Filter::postBool('preserve_last_changed');
$controller = new SimpleController();
$controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->restrictAccess(Auth::isMember($WT_TREE));
$disp = true;
$media = Media::getInstance($pid, $WT_TREE);
if ($media) {
    $disp = $media->canShow();
}
if ($action == 'update' || $action == 'create') {
    if ($linktoid) {
        $disp = GedcomRecord::getInstance($linktoid, $WT_TREE)->canShow();
    }
}
if (!Auth::isEditor($WT_TREE) || !$disp) {
開發者ID:pal-saugstad,項目名稱:webtrees,代碼行數:31,代碼來源:addmedia.php

示例6: 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();
            ?>
&amp;mod_action=admin_edit">
			<?php 
            echo Filter::getCsrf();
            ?>
			<input type="hidden" name="save" value="1">
			<input type="hidden" name="block_id" value="<?php 
            echo $block_id;
            ?>
">

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

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

			<div class="form-group">
				<label for="faqbody" class="col-sm-3 control-label">
					<?php 
//.........這裏部分代碼省略.........
開發者ID:tunandras,項目名稱:webtrees,代碼行數:101,代碼來源:FrequentlyAskedQuestionsModule.php

示例7: implode

 $WT_TREE->setPreference('REPO_ID_PREFIX', Filter::post('REPO_ID_PREFIX'));
 $WT_TREE->setPreference('SAVE_WATERMARK_IMAGE', Filter::postBool('SAVE_WATERMARK_IMAGE'));
 $WT_TREE->setPreference('SAVE_WATERMARK_THUMB', Filter::postBool('SAVE_WATERMARK_THUMB'));
 $WT_TREE->setPreference('SHOW_COUNTER', Filter::postBool('SHOW_COUNTER'));
 $WT_TREE->setPreference('SHOW_EST_LIST_DATES', Filter::postBool('SHOW_EST_LIST_DATES'));
 $WT_TREE->setPreference('SHOW_FACT_ICONS', Filter::postBool('SHOW_FACT_ICONS'));
 $WT_TREE->setPreference('SHOW_GEDCOM_RECORD', Filter::postBool('SHOW_GEDCOM_RECORD'));
 $WT_TREE->setPreference('SHOW_HIGHLIGHT_IMAGES', Filter::postBool('SHOW_HIGHLIGHT_IMAGES'));
 $WT_TREE->setPreference('SHOW_LAST_CHANGE', Filter::postBool('SHOW_LAST_CHANGE'));
 $WT_TREE->setPreference('SHOW_LDS_AT_GLANCE', Filter::postBool('SHOW_LDS_AT_GLANCE'));
 $WT_TREE->setPreference('SHOW_MEDIA_DOWNLOAD', Filter::post('SHOW_MEDIA_DOWNLOAD'));
 $WT_TREE->setPreference('SHOW_NO_WATERMARK', Filter::post('SHOW_NO_WATERMARK'));
 $WT_TREE->setPreference('SHOW_PARENTS_AGE', Filter::postBool('SHOW_PARENTS_AGE'));
 $WT_TREE->setPreference('SHOW_PEDIGREE_PLACES', Filter::post('SHOW_PEDIGREE_PLACES'));
 $WT_TREE->setPreference('SHOW_PEDIGREE_PLACES_SUFFIX', Filter::postBool('SHOW_PEDIGREE_PLACES_SUFFIX'));
 $WT_TREE->setPreference('SHOW_RELATIVES_EVENTS', implode(',', Filter::postArray('SHOW_RELATIVES_EVENTS')));
 $WT_TREE->setPreference('SOURCE_ID_PREFIX', Filter::post('SOURCE_ID_PREFIX'));
 $WT_TREE->setPreference('SOUR_FACTS_ADD', str_replace(' ', '', Filter::post('SOUR_FACTS_ADD')));
 $WT_TREE->setPreference('SOUR_FACTS_QUICK', str_replace(' ', '', Filter::post('SOUR_FACTS_QUICK')));
 $WT_TREE->setPreference('SOUR_FACTS_UNIQUE', str_replace(' ', '', Filter::post('SOUR_FACTS_UNIQUE')));
 $WT_TREE->setPreference('SUBLIST_TRIGGER_I', Filter::post('SUBLIST_TRIGGER_I', WT_REGEX_INTEGER, 200));
 $WT_TREE->setPreference('SURNAME_LIST_STYLE', Filter::post('SURNAME_LIST_STYLE'));
 $WT_TREE->setPreference('SURNAME_TRADITION', Filter::post('SURNAME_TRADITION'));
 $WT_TREE->setPreference('THEME_DIR', Filter::post('THEME_DIR'));
 $WT_TREE->setPreference('THUMBNAIL_WIDTH', Filter::post('THUMBNAIL_WIDTH'));
 $WT_TREE->setPreference('USE_SILHOUETTE', Filter::postBool('USE_SILHOUETTE'));
 $WT_TREE->setPreference('WATERMARK_THUMB', Filter::postBool('WATERMARK_THUMB'));
 $WT_TREE->setPreference('WEBMASTER_USER_ID', Filter::post('WEBMASTER_USER_ID'));
 $WT_TREE->setPreference('WEBTREES_EMAIL', Filter::post('WEBTREES_EMAIL'));
 $WT_TREE->setPreference('title', Filter::post('title'));
 // Only accept valid folders for MEDIA_DIRECTORY
開發者ID:tronsmit,項目名稱:webtrees,代碼行數:31,代碼來源:admin_trees_config.php

示例8: configureBlock

    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        global $WT_TREE;
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $languages = Filter::postArray('lang');
            $this->setBlockSetting($block_id, 'gedcom', Filter::post('gedcom'));
            $this->setBlockSetting($block_id, 'title', Filter::post('title'));
            $this->setBlockSetting($block_id, 'html', Filter::post('html'));
            $this->setBlockSetting($block_id, 'show_timestamp', Filter::postBool('show_timestamp'));
            $this->setBlockSetting($block_id, 'timestamp', Filter::post('timestamp'));
            $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
        }
        $templates = array(I18N::translate('Keyword examples') => '#getAllTagsTable#', I18N::translate('Narrative description') => I18N::translate('This family tree was last updated on #gedcomUpdated#. There are #totalSurnames# surnames in this family tree. The earliest recorded event is the #firstEventType# of #firstEventName# in #firstEventYear#. The most recent event is the #lastEventType# of #lastEventName# in #lastEventYear#.<br><br>If you have any comments or feedback please contact #contactWebmaster#.'), I18N::translate('Statistics') => '<div class="gedcom_stats">
				<span style="font-weight: bold;"><a href="index.php?command=gedcom">#gedcomTitle#</a></span><br>
				' . I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') . '
				<table id="keywords">
					<tr>
						<td valign="top" class="width20">
							<table cellspacing="1" cellpadding="0">
								<tr>
									<td class="facts_label">' . I18N::translate('Individuals') . '</td>
									<td class="facts_value" align="right"><a href="indilist.php?surname_sublist=no">#totalIndividuals#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Males') . '</td>
									<td class="facts_value" align="right">#totalSexMales#<br>#totalSexMalesPercentage#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Females') . '</td>
									<td class="facts_value" align="right">#totalSexFemales#<br>#totalSexFemalesPercentage#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Total surnames') . '</td>
									<td class="facts_value" align="right"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged=' . $WT_TREE->getNameUrl() . '">#totalSurnames#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Families') . '</td>
									<td class="facts_value" align="right"><a href="famlist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalFamilies#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Sources') . '</td>
									<td class="facts_value" align="right"><a href="sourcelist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalSources#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Media objects') . '</td>
									<td class="facts_value" align="right"><a href="medialist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalMedia#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Repositories') . '</td>
									<td class="facts_value" align="right"><a href="repolist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalRepositories#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Total events') . '</td>
									<td class="facts_value" align="right">#totalEvents#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Total users') . '</td>
									<td class="facts_value" align="right">#totalUsers#</td>
								</tr>
							</table>
						</td>
						<td><br></td>
						<td valign="top">
							<table cellspacing="1" cellpadding="0" border="0">
								<tr>
									<td class="facts_label">' . I18N::translate('Earliest birth year') . '</td>
									<td class="facts_value" align="right">#firstBirthYear#</td>
									<td class="facts_value">#firstBirth#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Latest birth year') . '</td>
									<td class="facts_value" align="right">#lastBirthYear#</td>
									<td class="facts_value">#lastBirth#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Earliest death year') . '</td>
									<td class="facts_value" align="right">#firstDeathYear#</td>
									<td class="facts_value">#firstDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Latest death year') . '</td>
									<td class="facts_value" align="right">#lastDeathYear#</td>
									<td class="facts_value">#lastDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Individual who lived the longest') . '</td>
									<td class="facts_value" align="right">#longestLifeAge#</td>
									<td class="facts_value">#longestLife#</td>
								</tr>
								<tr>
									<td class="facts_label">' . I18N::translate('Average age at death') . '</td>
									<td class="facts_value" align="right">#averageLifespan#</td>
									<td class="facts_value"></td>
								</tr>
								<tr>
//.........這裏部分代碼省略.........
開發者ID:pal-saugstad,項目名稱:webtrees,代碼行數:101,代碼來源:HtmlBlockModule.php

示例9: PageController

 * Defined in session.php
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsDb;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
define('WT_SCRIPT_NAME', 'admin_site_merge.php');
require './includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Merge records') . ' — ' . $WT_TREE->getTitleHtml())->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
$gid1 = Filter::post('gid1', WT_REGEX_XREF, Filter::get('gid1', WT_REGEX_XREF));
$gid2 = Filter::post('gid2', WT_REGEX_XREF, Filter::get('gid2', WT_REGEX_XREF));
$keep1 = Filter::postArray('keep1');
$keep2 = Filter::postArray('keep2');
$rec1 = GedcomRecord::getInstance($gid1, $WT_TREE);
$rec2 = GedcomRecord::getInstance($gid2, $WT_TREE);
if ($gid1 && !$rec1) {
    FlashMessages::addMessage(I18N::translate('%1$s does not exist.', $gid1), 'danger');
}
if ($gid2 && !$rec2) {
    FlashMessages::addMessage(I18N::translate('%1$s does not exist.', $gid2), 'danger');
}
if ($rec1 && $rec2 && $rec1->getXref() === $rec2->getXref()) {
    FlashMessages::addMessage(I18N::translate('You entered the same IDs. You cannot merge the same records.'), 'danger');
}
if ($rec1 && $rec2 && $rec1::RECORD_TYPE !== $rec2::RECORD_TYPE) {
    FlashMessages::addMessage(I18N::translate('Records are not the same type. Cannot merge records that are not the same type.'), 'danger');
}
// Facts found both records
開發者ID:tronsmit,項目名稱:webtrees,代碼行數:31,代碼來源:admin_site_merge.php

示例10: editSave

 /**
  * Action from the configuration page
  */
 private function editSave()
 {
     if (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));
     }
 }
開發者ID:tronsmit,項目名稱:webtrees,代碼行數:19,代碼來源:FrequentlyAskedQuestionsModule.php

示例11: 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();
                ?>
&amp;mod_action=admin_edit">
					<?php 
                echo Filter::getCsrf();
                ?>
					<input type="hidden" name="save" value="1">
					<input type="hidden" name="block_id" value="<?php 
                echo $block_id;
                ?>
">
					<input type="hidden" name="gedcom_id" value="<?php 
                echo $WT_TREE->getTreeId();
                ?>
">

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

					<div class="form-group">
						<label for="story_body" class="col-sm-3 control-label">
//.........這裏部分代碼省略.........
開發者ID:tunandras,項目名稱:webtrees,代碼行數:101,代碼來源:StoriesModule.php

示例12: 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);
//.........這裏部分代碼省略.........
開發者ID:bxbroze,項目名稱:webtrees,代碼行數:101,代碼來源:module.php

示例13: header

 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
namespace JustCarmen\WebtreesAddOns\JustLight;

use Fisharebest\Webtrees\Database;
use Fisharebest\Webtrees\Filter;
define('WT_SCRIPT_NAME', 'action.php');
chdir('../../../');
// change the directory to the root of webtrees to load the required files from session.php.
require './includes/session.php';
header('Content-type: text/html; charset=UTF-8');
if (!Filter::checkCsrf()) {
    header('HTTP/1.0 406 Not Acceptable');
    exit;
}
$action = Filter::get('action');
switch ($action) {
    case 'imagetype':
        $xrefs = Filter::postArray('xrefs');
        $data = array();
        foreach ($xrefs as $xref) {
            $row = Database::prepare("SELECT m_type as imagetype FROM `##media` WHERE m_id=?")->execute(array($xref))->fetchOneRow();
            $data[$xref] = $row->imagetype;
        }
        header("Content-Type: application/json; charset=UTF-8");
        echo json_encode((object) $data);
        break;
    default:
        header('HTTP/1.0 404 Not Found');
        break;
}
開發者ID:bxbroze,項目名稱:webtrees,代碼行數:31,代碼來源:action.php

示例14: foreach

 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * 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 Rhumsaa\Uuid\Uuid;
define('WT_SCRIPT_NAME', 'admin_site_clean.php');
require './includes/session.php';
$to_delete = Filter::postArray('to_delete');
if ($to_delete && Filter::checkCsrf()) {
    foreach ($to_delete as $path) {
        $is_dir = is_dir(WT_DATA_DIR . $path);
        if (File::delete(WT_DATA_DIR . $path)) {
            if ($is_dir) {
                FlashMessages::addMessage(I18N::translate('The folder %s has been deleted.', Filter::escapeHtml($path)), 'success');
            } else {
                FlashMessages::addMessage(I18N::translate('The file %s has been deleted.', Filter::escapeHtml($path)), 'success');
            }
        } else {
            if ($is_dir) {
                FlashMessages::addMessage(I18N::translate('The folder %s could not be deleted.', Filter::escapeHtml($path)), 'danger');
            } else {
                FlashMessages::addMessage(I18N::translate('The file %s could not be deleted.', Filter::escapeHtml($path)), 'danger');
            }
開發者ID:pal-saugstad,項目名稱:webtrees,代碼行數:31,代碼來源:admin_site_clean.php

示例15: jsonTasksList

 /**
  * AdminConfig@jsonTasksList
  */
 public function jsonTasksList()
 {
     global $WT_TREE;
     $controller = new JsonController();
     $controller->restrictAccess(Auth::isAdmin());
     // Generate an AJAX/JSON response for datatables to load a block of rows
     $search = Filter::postArray('search');
     if ($search) {
         $search = $search['value'];
     }
     $start = Filter::postInteger('start');
     $length = Filter::postInteger('length');
     $order = Filter::postArray('order');
     $order_by_name = false;
     foreach ($order as $key => &$value) {
         switch ($value['column']) {
             case 3:
                 $order_by_name = true;
                 unset($order[$key]);
                 break;
             case 4:
                 $value['column'] = 'majat_last_run';
                 break;
             case 4:
                 $value['column'] = 'majat_last_result';
                 break;
             default:
                 unset($order[$key]);
         }
     }
     $list = $this->provider->getFilteredTasksList($search, $order, $start, $length);
     if ($order_by_name) {
         usort($list, function (AbstractTask $a, AbstractTask $b) {
             return I18N::strcasecmp($a->getTitle(), $b->getTitle());
         });
     }
     $recordsFiltered = count($list);
     $recordsTotal = $this->provider->getTasksCount();
     $data = array();
     foreach ($list as $task) {
         $datum = array();
         $datum[0] = '
             <div class="btn-group">
                 <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                     <i class="fa fa-pencil"></i><span class="caret"></span>
                 </button>
                 <ul class="dropdown-menu" role="menu">
                    <li>
                         <a href="#" onclick="return set_admintask_status(\'' . $task->getName() . '\', ' . ($task->isEnabled() ? 'false' : 'true') . ');">
                             <i class="fa fa-fw ' . ($task->isEnabled() ? 'fa-times' : 'fa-check') . '"></i> ' . ($task->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . '
                         </a>
                    </li>
                     <li>
                         <a href="module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task=' . $task->getName() . '">
                             <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . '
                         </a>
                    </li>
                 </ul>
             </div>';
         $datum[1] = $task->getName();
         $datum[2] = $task->isEnabled() ? '<i class="fa fa-check"></i><span class="sr-only">' . I18N::translate('Enabled') . '</span>' : '<i class="fa fa-times"></i><span class="sr-only">' . I18N::translate('Disabled') . '</span>';
         $datum[3] = $task->getTitle();
         $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s';
         $datum[4] = $task->getLastUpdated()->format($date_format);
         $datum[5] = $task->isLastRunSuccess() ? '<i class="fa fa-check"></i><span class="sr-only">' . I18N::translate('Yes') . '</span>' : '<i class="fa fa-times"></i><span class="sr-only">' . I18N::translate('No') . '</span>';
         $dtF = new \DateTime('@0');
         $dtT = new \DateTime('@' . $task->getFrequency() * 60);
         $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m'));
         $datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited');
         $datum[8] = $task->isRunning() ? '<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">' . I18N::translate('Running') . '</span>' : '<i class="fa fa-times"></i><span class="sr-only">' . I18N::translate('Not running') . '</span>';
         if ($task->isEnabled() && !$task->isRunning()) {
             $datum[9] = '
 			    <button id="bt_runtask_' . $task->getName() . '" class="btn btn-primary" href="#" onclick="return run_admintask(\'' . $task->getName() . '\')">
 			         <div id="bt_runtasktext_' . $task->getName() . '"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div>
 			    </button>';
         } else {
             $datum[9] = '';
         }
         $data[] = $datum;
     }
     $controller->pageHeader();
     $controller->encode(array('draw' => Filter::getInteger('draw'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data));
 }
開發者ID:jon48,項目名稱:webtrees-lib,代碼行數:86,代碼來源:AdminConfigController.php


注:本文中的Fisharebest\Webtrees\Filter::postArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。