当前位置: 首页>>代码示例>>PHP>>正文


PHP WT_Filter::getCsrf方法代码示例

本文整理汇总了PHP中WT_Filter::getCsrf方法的典型用法代码示例。如果您正苦于以下问题:PHP WT_Filter::getCsrf方法的具体用法?PHP WT_Filter::getCsrf怎么用?PHP WT_Filter::getCsrf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WT_Filter的用法示例。


在下文中一共展示了WT_Filter::getCsrf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: uasort

        $module->order = $order;
        // Make the new order take effect immediately
    }
    uasort($modules, function ($x, $y) {
        return $x->order - $y->order;
    });
}
?>
<div id="sidebars" align="center">
	<form method="post" action="<?php 
echo WT_SCRIPT_NAME;
?>
">
		<input type="hidden" name="action" value="update_mods">
		<?php 
echo WT_Filter::getCsrf();
?>
		<table id="sidebars_table" class="modules_table">
			<thead>
				<tr>
					<th><?php 
echo WT_I18N::translate('Sidebar');
?>
</th>
					<th><?php 
echo WT_I18N::translate('Description');
?>
</th>
					<th><?php 
echo WT_I18N::translate('Order');
?>
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_module_sidebar.php

示例2: jQuery

			var fieldIDx = jQuery(this).attr("id");
			var idNum = fieldIDx.replace("RELATIONSHIP_PATH_LENGTH","");
			var newIDx = "gedcomid"+idNum;
			if (jQuery("#"+newIDx).val()=="") {
				alert("' . WT_I18N::translate('You must specify an individual record before you can restrict the user to their immediate family.') . '");
				jQuery(this).val("");
			}
		});

		function regex_quote(str) {
			return str.replace(/[\\\\.?+*()[\\](){}|]/g, "\\\\$&");
		}
	');
        echo '
	<form name="newform" method="post" action="admin_users.php?action=createuser" onsubmit="return checkform(this);" autocomplete="off">
		', WT_Filter::getCsrf(), '
		<table id="adduser">
			<tr>
				<td>', WT_I18N::translate('Real name'), help_link('real_name'), '</td>
				<td><input type="text" name="realname" style="width:95%;" required maxlength="64" value="', WT_Filter::escapeHtml($realname), '" autofocus></td>
				<td>', WT_I18N::translate('Administrator'), help_link('role'), '</td>
				<td><input type="checkbox" name="canadmin" value="1"></td>
			</tr>
			<tr>
				<td>', WT_I18N::translate('Username'), help_link('username'), '</td>
				<td><input type="text" name="username" style="width:95%;" required maxlength="32" value="', WT_Filter::escapeHtml($username), '"></td>
				<td>', WT_I18N::translate('Approved by administrator'), help_link('useradmin_verification'), '</td>
				<td><input type="checkbox" name="verified_by_admin" value="1" checked="checked"></td>
			</tr>
			<tr>
				<td>', WT_I18N::translate('Email address'), help_link('email'), '</td>
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_users.php

示例3: edit

 private function edit()
 {
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     if (WT_USER_CAN_EDIT) {
         if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
             $block_id = WT_Filter::postInteger('block_id');
             if ($block_id) {
                 WT_DB::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $block_id));
             } else {
                 WT_DB::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0));
                 $block_id = WT_DB::getInstance()->lastInsertId();
             }
             set_block_setting($block_id, 'title', WT_Filter::post('title'));
             set_block_setting($block_id, 'story_body', WT_Filter::post('story_body'));
             $languages = array();
             foreach (WT_I18N::installed_languages() as $code => $name) {
                 if (WT_Filter::postBool('lang_' . $code)) {
                     $languages[] = $code;
                 }
             }
             set_block_setting($block_id, 'languages', implode(',', $languages));
             $this->config();
         } else {
             $block_id = WT_Filter::getInteger('block_id');
             $controller = new WT_Controller_Page();
             if ($block_id) {
                 $controller->setPageTitle(WT_I18N::translate('Edit story'));
                 $title = get_block_setting($block_id, 'title');
                 $story_body = get_block_setting($block_id, 'story_body');
                 $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
                 $xref = WT_DB::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
             } else {
                 $controller->setPageTitle(WT_I18N::translate('Add a story'));
                 $title = '';
                 $story_body = '';
                 $gedcom_id = WT_GED_ID;
                 $xref = WT_Filter::get('xref', WT_REGEX_XREF);
             }
             $controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
             if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
                 ckeditor_WT_Module::enableEditor($controller);
             }
             echo '<form name="story" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
             echo WT_Filter::getCsrf();
             echo '<input type="hidden" name="save" value="1">';
             echo '<input type="hidden" name="block_id" value="', $block_id, '">';
             echo '<input type="hidden" name="gedcom_id" value="', WT_GED_ID, '">';
             echo '<table id="story_module">';
             echo '<tr><th>';
             echo WT_I18N::translate('Story title');
             echo '</th></tr><tr><td><textarea name="title" rows="1" cols="90" tabindex="2">', WT_Filter::escapeHtml($title), '</textarea></td></tr>';
             echo '<tr><th>';
             echo WT_I18N::translate('Story');
             echo '</th></tr><tr><td>';
             echo '<textarea name="story_body" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($story_body), '</textarea>';
             echo '</td></tr>';
             echo '</table><table id="story_module2">';
             echo '<tr>';
             echo '<th>', WT_I18N::translate('Individual'), '</th>';
             echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
             echo '</tr>';
             echo '<tr>';
             echo '<td class="optionbox">';
             echo '<input data-autocomplete-type="INDI" type="text" name="xref" id="pid" size="4" value="' . $xref . '">';
             echo print_findindi_link('pid');
             if ($xref) {
                 $person = WT_Individual::getInstance($xref);
                 if ($person) {
                     echo ' ', $person->format_list('span');
                 }
             }
             echo '</td>';
             $languages = get_block_setting($block_id, 'languages');
             echo '<td class="optionbox">';
             echo edit_language_checkboxes('lang_', $languages);
             echo '</td></tr></table>';
             echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
             echo '</p>';
             echo '</form>';
             exit;
         }
     } else {
         header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
         exit;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:86,代码来源:module.php

示例4: modalDialog

            $in_progress = WT_DB::prepare("SELECT 1 FROM `##gedcom_chunk` WHERE gedcom_id=? AND imported=1 LIMIT 1")->execute(array($tree->tree_id))->fetchOne();
            if (!$in_progress) {
                echo '<div id="import', $tree->tree_id, '"><div id="progressbar', $tree->tree_id, '"><div style="position:absolute;">', WT_I18N::translate('Deleting old genealogy data…'), '</div></div></div>';
                $controller->addInlineJavascript('jQuery("#progressbar' . $tree->tree_id . '").progressbar({value: 0});');
            } else {
                echo '<div id="import', $tree->tree_id, '"></div>';
            }
            $controller->addInlineJavascript('jQuery("#import' . $tree->tree_id . '").load("import.php?gedcom_id=' . $tree->tree_id . '&keep_media' . $tree->tree_id . '=' . WT_Filter::get('keep_media' . $tree->tree_id) . '");');
            echo '<table border="0" width="100%" id="actions', $tree->tree_id, '" style="display:none">';
        } else {
            echo '<table border="0" width="100%" id="actions', $tree->tree_id, '">';
        }
        echo '<tr align="center">', '<td><a href="admin_trees_export.php?ged=', $tree->tree_name_url, '" onclick="return modalDialog(\'admin_trees_export.php?ged=', $tree->tree_name_url, '\', \'', WT_I18N::translate('Export'), '\');">', WT_I18N::translate('Export'), '</a>', help_link('export_gedcom'), '</td>', '<td><a href="', WT_SCRIPT_NAME, '?action=importform&amp;gedcom_id=', $tree->tree_id, '">', WT_I18N::translate('Import'), '</a>', help_link('import_gedcom'), '</td>', '<td><a href="admin_trees_download.php?ged=', $tree->tree_name_url, '">', WT_I18N::translate('Download'), '</a>', help_link('download_gedcom'), '</td>', '<td><a href="', WT_SCRIPT_NAME, '?action=uploadform&amp;gedcom_id=', $tree->tree_id, '">', WT_I18N::translate('Upload'), '</a>', help_link('upload_gedcom'), '</td>', '<td>', '<a href="#" onclick="if (confirm(\'' . WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', $tree->tree_name)), '\')) document.delete_form', $tree->tree_id, '.submit(); return false;">', WT_I18N::translate('Delete'), '</a>', '<form name="delete_form', $tree->tree_id, '" method="post" action="', WT_SCRIPT_NAME, '">', '<input type="hidden" name="action" value="delete">', '<input type="hidden" name="gedcom_id" value="', $tree->tree_id, '">', WT_Filter::getCsrf(), '</form>', '</td></tr></table></td></tr></table><br>';
    }
}
// Options for creating new gedcoms and setting defaults
if (Auth::isAdmin()) {
    echo '<table class="gedcom_table2"><tr>';
    if (count(WT_Tree::GetAll()) > 1) {
        echo '<th>', WT_I18N::translate('Default family tree'), help_link('default_gedcom'), '</th>';
    }
    echo '<th>', WT_I18N::translate('Create a new family tree'), help_link('add_new_gedcom'), '</th></tr><tr>';
    if (count(WT_Tree::GetAll()) > 1) {
        echo '<td><form name="defaultform" method="post" action="', WT_SCRIPT_NAME, '">', '<input type="hidden" name="action" value="setdefault">', WT_Filter::getCsrf(), select_edit_control('default_ged', WT_Tree::getNameList(), '', WT_Site::preference('DEFAULT_GEDCOM'), 'onchange="document.defaultform.submit();"'), '</form></td>';
    }
    echo '<td class="button">', '<form name="createform" method="post" action="', WT_SCRIPT_NAME, '">', WT_Filter::getCsrf(), '<input type="hidden" name="action" value="new_tree">', '<input name="ged_name">', ' <input type="submit" value="', WT_I18N::translate('save'), '">', '</form>', '</td>', '</tr></table><br>';
    // display link to PGV-WT transfer wizard on first visit to this page, before any GEDCOM is loaded
    if (count(WT_Tree::GetAll()) == 0 && count(User::all()) == 1) {
        echo '<div class="center">', '<a style="color:green; font-weight:bold;" href="admin_pgv_to_wt.php">', WT_I18N::translate('Click here for PhpGedView to <b>webtrees</b> transfer wizard'), '</a>', help_link('PGV_WIZARD'), '</div>';
    }
}
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_trees_manage.php

示例5: login_or_register

    /**
     * If the Facebook username or email is associated with an account, login to it. Otherwise, register a new account.
     *
     * @param object $facebookUser Facebook user
     * @param string $url          (optional) URL to redirect to afterwards.
     */
    private function login_or_register(&$facebookUser, $url = '')
    {
        $REQUIRE_ADMIN_AUTH_REGISTRATION = WT_Site::getPreference('REQUIRE_ADMIN_AUTH_REGISTRATION');
        if ($this->getSetting('require_verified', 1) && empty($facebookUser->verified)) {
            $this->error_page(WT_I18N::translate('Only verified Facebook accounts are authorized. Please verify your account on Facebook and then try again'));
        }
        if (empty($facebookUser->username)) {
            $facebookUser->username = $facebookUser->id;
        }
        $user_id = $this->get_user_id_from_facebook_username($facebookUser->username);
        if (!$user_id) {
            if (!isset($facebookUser->email)) {
                $this->error_page(WT_I18N::translate('You must grant access to your email address via Facebook in order to use this website. Please uninstall the application on Facebook and try again.'));
            }
            $user = User::findByIdentifier($facebookUser->email);
            if ($user) {
                $user_id = $user->getUserId();
            }
        }
        if ($user_id) {
            // This is an existing user so log them in if they are approved
            $login_result = $this->login($user_id);
            $message = '';
            switch ($login_result) {
                case -1:
                    // not validated
                    $message = WT_I18N::translate('This account has not been verified.  Please check your email for a verification message.');
                    break;
                case -2:
                    // not approved
                    $message = WT_I18N::translate('This account has not been approved.  Please wait for an administrator to approve it.');
                    break;
                default:
                    $user = User::find($user_id);
                    $user->setPreference(self::user_setting_facebook_username, $this->cleanseFacebookUsername($facebookUser->username));
                    // redirect to the homepage/$url
                    header('Location: ' . WT_SCRIPT_PATH . $url);
                    return;
            }
            $this->error_page($message);
        } else {
            // This is a new Facebook user who may or may not already have a manual account
            if (!WT_Site::getPreference('USE_REGISTRATION_MODULE')) {
                $this->error_page('<p>' . WT_I18N::translate('The administrator has disabled registrations.') . '</p>');
            }
            // check if the username is already in use
            $username = $this->cleanseFacebookUsername($facebookUser->username);
            $wt_username = substr($username, 0, 32);
            // Truncate the username to 32 characters to match the DB.
            if (User::findByIdentifier($wt_username)) {
                // fallback to email as username since we checked above that a user with the email didn't exist.
                $wt_username = $facebookUser->email;
                $wt_username = substr($wt_username, 0, 32);
                // Truncate the username to 32 characters to match the DB.
            }
            // Generate a random password since the user shouldn't need it and can always reset it.
            $password = md5(uniqid(rand(), TRUE));
            $hashcode = md5(uniqid(rand(), true));
            $preApproved = unserialize($this->getSetting('preapproved'));
            // From login.php:
            Log::addAuthenticationLog('User registration requested for: ' . $wt_username);
            if ($user = User::create($wt_username, $facebookUser->name, $facebookUser->email, $password)) {
                $verifiedByAdmin = !$REQUIRE_ADMIN_AUTH_REGISTRATION || isset($preApproved[$username]);
                $user->setPreference(self::user_setting_facebook_username, $this->cleanseFacebookUsername($facebookUser->username))->setPreference('language', WT_LOCALE)->setPreference('verified', '1')->setPreference('verified_by_admin', $verifiedByAdmin ? '1' : '0')->setPreference('reg_timestamp', date('U'))->setPreference('reg_hashcode', $hashcode)->setPreference('contactmethod', 'messaging2')->setPreference('visibleonline', '1')->setPreference('editaccount', '1')->setPreference('auto_accept', '0')->setPreference('canadmin', '0')->setPreference('sessiontime', $verifiedByAdmin ? WT_TIMESTAMP : '0')->setPreference('comment', @$facebookUser->birthday . "\n " . "https://www.facebook.com/" . $this->cleanseFacebookUsername($facebookUser->username));
                // Apply pre-approval settings
                if (isset($preApproved[$username])) {
                    $userSettings = $preApproved[$username];
                    foreach ($userSettings as $gedcom => $userGedcomSettings) {
                        foreach (array('gedcomid', 'rootid', 'canedit') as $userPref) {
                            if (empty($userGedcomSettings[$userPref])) {
                                continue;
                            }
                            // Use a direct DB query instead of $tree->setUserPreference since we
                            // can't get a reference to the WT_Tree since it checks permissions but
                            // we are trying to give the permissions.
                            WT_DB::prepare("REPLACE INTO `##user_gedcom_setting` (user_id, gedcom_id, setting_name, setting_value) VALUES (?, ?, ?, LEFT(?, 255))")->execute(array($user->getUserId(), $gedcom, $userPref, $userGedcomSettings[$userPref]));
                        }
                    }
                    // Remove the pre-approval record
                    unset($preApproved[$username]);
                    $this->setSetting('preapproved', serialize($preApproved));
                }
                // We need jQuery below
                global $controller;
                $controller = new WT_Controller_Page();
                $controller->setPageTitle($this->getTitle())->pageHeader();
                echo '<form id="verify-form" name="verify-form" method="post" action="', WT_LOGIN_URL, '" class="ui-autocomplete-loading" style="width:16px;height:16px;padding:0">';
                echo $this->hidden_input("action", "verify_hash");
                echo $this->hidden_input("user_name", $wt_username);
                echo $this->hidden_input("user_password", $password);
                echo $this->hidden_input("user_hashcode", $hashcode);
                echo WT_Filter::getCsrf();
                echo '</form>';
                if ($verifiedByAdmin) {
//.........这里部分代码省略.........
开发者ID:elRadix,项目名称:webtrees-facebook,代码行数:101,代码来源:module.php

示例6: print_indi_form

function print_indi_form($nextaction, WT_Individual $person = null, WT_Family $family = null, WT_Fact $name_fact = null, $famtag = 'CHIL', $gender = 'U')
{
    global $WORD_WRAPPED_NOTES, $NPFX_accept, $SHOW_GEDCOM_RECORD, $bdm, $STANDARD_NAME_FACTS, $ADVANCED_NAME_FACTS;
    global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $controller;
    $SURNAME_TRADITION = get_gedcom_setting(WT_GED_ID, 'SURNAME_TRADITION');
    if ($person) {
        $xref = $person->getXref();
    } elseif ($family) {
        $xref = $family->getXref();
    } else {
        $xref = 'new';
    }
    $name_fields = array();
    if ($name_fact) {
        $name_fact_id = $name_fact->getFactId();
        $name_type = $name_fact->getAttribute('TYPE');
        $namerec = $name_fact->getGedcom();
        // Populate the standard NAME field and subfields
        foreach ($STANDARD_NAME_FACTS as $tag) {
            if ($tag == 'NAME') {
                $name_fields[$tag] = $name_fact->getValue();
            } else {
                $name_fields[$tag] = $name_fact->getAttribute($tag);
            }
        }
    } else {
        $name_fact_id = null;
        $name_type = null;
        $namerec = null;
        // Populate the standard NAME field and subfields
        foreach ($STANDARD_NAME_FACTS as $tag) {
            $name_fields[$tag] = '';
        }
    }
    $bdm = '';
    // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR
    echo '<div id="edit_interface-page">';
    echo '<h4>', $controller->getPageTitle(), '</h4>';
    init_calendar_popup();
    echo '<form method="post" name="addchildform" onsubmit="return checkform();">';
    echo '<input type="hidden" name="ged" value="', WT_Filter::escapeHtml(WT_GEDCOM), '">';
    echo '<input type="hidden" name="action" value="', $nextaction, '">';
    echo '<input type="hidden" name="fact_id" value="', $name_fact_id, '">';
    echo '<input type="hidden" name="xref" value="', $xref, '">';
    echo '<input type="hidden" name="famtag" value="', $famtag, '">';
    echo '<input type="hidden" name="gender" value="', $gender, '">';
    echo '<input type="hidden" name="goto" value="">';
    // set by javascript
    echo WT_Filter::getCsrf();
    echo '<table class="facts_table">';
    switch ($nextaction) {
        case 'add_child_to_family_action':
        case 'add_child_to_individual_action':
            // When adding a new child, specify the pedigree
            add_simple_tag('0 PEDI');
            break;
        case 'update':
            // When adding/editing a name, specify the type
            add_simple_tag('0 TYPE ' . $name_type, '', '', null, $person);
            break;
    }
    $new_marnm = '';
    // Inherit surname from parents, spouse or child
    if (!$namerec) {
        // We’ll need the parent’s name to set the child’s surname
        if ($family) {
            $father = $family->getHusband();
            if ($father && $father->getFirstFact('NAME')) {
                $father_name = $father->getFirstFact('NAME')->getValue();
            } else {
                $father_name = '';
            }
            $mother = $family->getWife();
            if ($mother && $mother->getFirstFact('NAME')) {
                $mother_name = $mother->getFirstFact('NAME')->getValue();
            } else {
                $mother_name = '';
            }
        } else {
            $father_name = '';
            $mother_name = '';
        }
        // We’ll need the spouse/child’s name to set the spouse/parent’s surname
        if ($person && $person->getFirstFact('NAME')) {
            $indi_name = $person->getFirstFact('NAME')->getValue();
        } else {
            $indi_name = '';
        }
        // Different cultures do surnames differently
        switch ($SURNAME_TRADITION) {
            case 'spanish':
                //Mother: Maria /AAAA BBBB/
                //Father: Jose  /CCCC DDDD/
                //Child:  Pablo /CCCC AAAA/
                switch ($nextaction) {
                    case 'add_child_to_family_action':
                        if (preg_match('/\\/(\\S+) \\S+\\//', $mother_name, $matchm) && preg_match('/\\/(\\S+) \\S+\\//', $father_name, $matchf)) {
                            $name_fields['SURN'] = $matchf[1] . ' ' . $matchm[1];
                            $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/';
                        }
//.........这里部分代码省略.........
开发者ID:brambravo,项目名称:webtrees,代码行数:101,代码来源:edit_interface.php

示例7: edit

 private function edit()
 {
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         $block_id = WT_Filter::postInteger('block_id');
         if ($block_id) {
             WT_DB::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, '0'), block_order=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::postInteger('block_order'), $block_id));
         } else {
             WT_DB::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, '0'), ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), $this->getName(), WT_Filter::postInteger('block_order')));
             $block_id = WT_DB::getInstance()->lastInsertId();
         }
         set_block_setting($block_id, 'header', WT_Filter::post('header'));
         set_block_setting($block_id, 'faqbody', WT_Filter::post('faqbody'));
         $languages = array();
         foreach (WT_I18N::installed_languages() as $code => $name) {
             if (WT_Filter::postBool('lang_' . $code)) {
                 $languages[] = $code;
             }
         }
         set_block_setting($block_id, 'languages', implode(',', $languages));
         $this->config();
     } else {
         $block_id = WT_Filter::getInteger('block_id');
         $controller = new WT_Controller_Page();
         if ($block_id) {
             $controller->setPageTitle(WT_I18N::translate('Edit FAQ item'));
             $header = get_block_setting($block_id, 'header');
             $faqbody = get_block_setting($block_id, 'faqbody');
             $block_order = WT_DB::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
             $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
         } else {
             $controller->setPageTitle(WT_I18N::translate('Add an FAQ item'));
             $header = '';
             $faqbody = '';
             $block_order = WT_DB::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
             $gedcom_id = WT_GED_ID;
         }
         $controller->pageHeader();
         if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
             ckeditor_WT_Module::enableEditor($controller);
         }
         // "Help for this page" link
         echo '<div id="page_help">', help_link('add_faq_item', $this->getName()), '</div>';
         echo '<form name="faq" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
         echo WT_Filter::getCsrf();
         echo '<input type="hidden" name="save" value="1">';
         echo '<input type="hidden" name="block_id" value="', $block_id, '">';
         echo '<table id="faq_module">';
         echo '<tr><th>';
         echo WT_I18N::translate('Question');
         echo '</th></tr><tr><td><input type="text" name="header" size="90" tabindex="1" value="' . WT_Filter::escapeHtml($header) . '"></td></tr>';
         echo '<tr><th>';
         echo WT_I18N::translate('Answer');
         echo '</th></tr><tr><td>';
         echo '<textarea name="faqbody" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($faqbody), '</textarea>';
         echo '</td></tr>';
         echo '</table><table id="faq_module2">';
         echo '<tr>';
         echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
         echo '<th>', WT_I18N::translate('FAQ position'), help_link('add_faq_order', $this->getName()), '</th>';
         echo '<th>', WT_I18N::translate('FAQ visibility'), help_link('add_faq_visibility', $this->getName()), '</th>';
         echo '</tr><tr>';
         echo '<td>';
         $languages = get_block_setting($block_id, 'languages');
         echo edit_language_checkboxes('lang_', $languages);
         echo '</td><td>';
         echo '<input type="text" name="block_order" size="3" tabindex="3" value="', $block_order, '"></td>';
         echo '</td><td>';
         echo select_edit_control('gedcom_id', WT_Tree::getIdList(), WT_I18N::translate('All'), $gedcom_id, 'tabindex="4"');
         echo '</td></tr>';
         echo '</table>';
         echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
         echo '</form>';
         exit;
     }
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:76,代码来源:module.php


注:本文中的WT_Filter::getCsrf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。