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


PHP WT_Filter::checkCsrf方法代码示例

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


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

示例1: configureBlock

 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'days', WT_Filter::postInteger('num', 1, 180, 7));
         set_block_setting($block_id, 'sendmail', WT_Filter::postBool('sendmail'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $sendmail = get_block_setting($block_id, 'sendmail', true);
     $days = get_block_setting($block_id, 'days', 7);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Send out reminder emails?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('sendmail', $sendmail);
     echo '<br>';
     echo WT_I18N::translate('Reminder email frequency (days)') . "&nbsp;<input type='text' name='days' value='" . $days . "' size='2'>";
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:25,代码来源:module.php

示例2: configureBlock

 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7));
         set_block_setting($block_id, 'filter', WT_Filter::postBool('filter'));
         set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM'));
         set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
         set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $days = get_block_setting($block_id, 'days', 7);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>';
     echo '</td></tr>';
     $filter = get_block_setting($block_id, 'filter', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Show only events of living individuals?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('filter', $filter);
     echo '</td></tr>';
     $onlyBDM = get_block_setting($block_id, 'onlyBDM', false);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Show only births, deaths, and marriages?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('onlyBDM', $onlyBDM);
     echo '</td></tr>';
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo select_edit_control('sortStyle', array('alpha' => WT_I18N::translate('sort by name'), 'anniv' => WT_I18N::translate('sort by date')), null, $sortStyle, '');
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:50,代码来源:module.php

示例3: foreach

    case 'replace_upload':
        $gedcom_id = WT_Filter::postInteger('gedcom_id');
        // Make sure the gedcom still exists
        if (WT_Filter::checkCsrf() && get_gedcom_from_id($gedcom_id)) {
            foreach ($_FILES as $FILE) {
                if ($FILE['error'] == 0 && is_readable($FILE['tmp_name'])) {
                    import_gedcom_file($gedcom_id, $FILE['tmp_name'], $FILE['name']);
                }
            }
        }
        header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?keep_media' . $gedcom_id . '=' . WT_Filter::postBool('keep_media' . $gedcom_id));
        exit;
    case 'replace_import':
        $gedcom_id = WT_Filter::postInteger('gedcom_id');
        // Make sure the gedcom still exists
        if (WT_Filter::checkCsrf() && get_gedcom_from_id($gedcom_id)) {
            $ged_name = basename(WT_Filter::post('ged_name'));
            import_gedcom_file($gedcom_id, WT_DATA_DIR . $ged_name, $ged_name);
        }
        header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?keep_media' . $gedcom_id . '=' . WT_Filter::postBool('keep_media' . $gedcom_id));
        exit;
}
$controller->pageHeader();
// Process GET actions
switch (WT_Filter::get('action')) {
    case 'uploadform':
    case 'importform':
        $gedcom_id = WT_Filter::getInteger('gedcom_id');
        $gedcom_name = get_gedcom_from_id($gedcom_id);
        // Check it exists
        if (!$gedcom_name) {
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_trees_manage.php

示例4: implode

    $ALL_THEME_DIRS[] = $themedir;
}
// Extract form variables
$form_action = WT_Filter::post('form_action');
$form_username = WT_Filter::post('form_username');
$form_realname = WT_Filter::post('form_realname');
$form_pass1 = WT_Filter::post('form_pass1', WT_REGEX_PASSWORD);
$form_pass2 = WT_Filter::post('form_pass2', WT_REGEX_PASSWORD);
$form_email = WT_Filter::postEmail('form_email');
$form_rootid = WT_Filter::post('form_rootid', WT_REGEX_XREF);
$form_theme = WT_Filter::post('form_theme', implode('|', $ALL_THEME_DIRS));
$form_language = WT_Filter::post('form_language', implode('|', array_keys(WT_I18N::installed_languages())), WT_LOCALE);
$form_contact_method = WT_Filter::post('form_contact_method');
$form_visible_online = WT_Filter::postBool('form_visible_online');
// Respond to form action
if ($form_action == 'update' && WT_Filter::checkCsrf()) {
    if ($form_username != Auth::user()->getUserName() && User::findByIdentifier($form_username)) {
        WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name.  A user with that user name already exists.  Please choose another user name.'));
    } elseif ($form_email != Auth::user()->getEmail() && User::findByIdentifier($form_email)) {
        WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address.  A user with that email already exists.'));
    } else {
        // Change username
        if ($form_username != WT_USER_NAME) {
            Log::addAuthenticationLog('User ' . Auth::user()->getUserName() . ' renamed to ' . $form_username);
            Auth::user()->setUserName($form_username);
        }
        // Change password
        if ($form_pass1 && $form_pass1 == $form_pass2) {
            Auth::user()->setPassword($form_pass1);
        }
        // Change other settings
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:edituser.php

示例5: fetchFriendList

 private function fetchFriendList()
 {
     global $WT_SESSION, $controller;
     $controller = new WT_Controller_Page();
     $controller->addInlineJavaScript("\n            \$('head').append('<link rel=\"stylesheet\" href=\"" . WT_MODULES_DIR . $this->getName() . "/facebook.css?v=" . WT_FACEBOOK_VERSION . "\" />');", WT_Controller_Page::JS_PRIORITY_LOW);
     $preApproved = unserialize($this->getSetting('preapproved'));
     if (WT_Filter::postArray('preApproved') && WT_Filter::checkCsrf()) {
         $roleRows = WT_Filter::postArray('preApproved');
         $fbUsernames = WT_Filter::postArray('facebook_username', WT_REGEX_USERNAME);
         foreach ($fbUsernames as $facebook_username) {
             $facebook_username = $this->cleanseFacebookUsername($facebook_username);
             $this->appendPreapproved($preApproved, $facebook_username, $roleRows);
         }
         $this->setSetting('preapproved', serialize($preApproved));
         WT_FlashMessages::addMessage(WT_I18N::translate('Users successfully imported from Facebook'));
         header("Location: module.php?mod=" . $this->getName() . "&mod_action=admin");
         exit;
     }
     if (empty($WT_SESSION->facebook_access_token)) {
         $this->error_page(WT_I18N::translate("You must <a href='%s'>login to the site via Facebook</a> in order to import friends from Facebook", "index.php?logout=1"));
     }
     $graph_url = "https://graph.facebook.com/" . self::api_dir . "me/friends?fields=first_name,last_name,name,username&access_token=" . $WT_SESSION->facebook_access_token;
     $friendsResponse = $this->fetch_url($graph_url);
     if ($friendsResponse === FALSE) {
         $this->error_page(WT_I18N::translate("Could not fetch your friends from Facebook. Note that this feature won't work for Facebook Apps created after 2014-04-30 due to a Facebook policy change."));
     }
     $controller->restrictAccess(\WT\Auth::isAdmin())->setPageTitle($this->getTitle())->pageHeader();
     $friends = json_decode($friendsResponse);
     if (empty($friends->data)) {
         $this->error_page(WT_I18N::translate("No friend data"));
         return;
     }
     function nameSort($a, $b)
     {
         return strcmp($a->last_name . " " . $a->first_name, $b->last_name . " " . $b->first_name);
     }
     usort($friends->data, "nameSort");
     echo "<form id='facebook_friend_list' method='post' action=''>";
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     // for select_edit_control
     $index = 0;
     foreach (WT_Tree::getAll() as $tree) {
         $class = $index++ % 2 ? 'odd' : 'even';
         echo "<label>" . $tree->tree_name_html . " - " . WT_I18N::translate('Role') . help_link('role') . ": " . select_edit_control('preApproved[' . $tree->tree_id . '][canedit]', $this->get_edit_options(), NULL, NULL) . "</label>";
     }
     foreach ($friends->data as $friend) {
         $facebook_username = $this->cleanseFacebookUsername(isset($friend->username) ? $friend->username : $friend->id);
         // Exclude friends who are already pre-approved or are current users
         if (isset($preApproved[$facebook_username]) || $this->get_user_id_from_facebook_username($facebook_username)) {
             continue;
         }
         echo "<label><input name='facebook_username[]' type='checkbox' value='" . $facebook_username . "'/>" . $friend->name . "</label>";
     }
     echo WT_Filter::getCsrf();
     echo "<button>Select Friends</button></form>";
 }
开发者ID:elRadix,项目名称:webtrees-facebook,代码行数:56,代码来源:module.php

示例6: 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

示例7: list

    list($latest_version, $earliest_version, $download_url) = explode('|', $latest_version_txt);
} else {
    // Cannot determine the latest version
    list($latest_version, $earliest_version, $download_url) = explode('|', '||');
}
$latest_version_html = '<span dir="ltr">' . $latest_version . '</span>';
$download_url_html = '<b dir="auto"><a href="' . WT_Filter::escapeHtml($download_url) . '">' . WT_Filter::escapeHtml($download_url) . '</a></b>';
// Show a friendly message while the site is being upgraded
$lock_file = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'offline.txt';
$lock_file_html = '<span dir="ltr">' . WT_Filter::escapeHtml($lock_file) . '</span>';
$lock_file_text = WT_I18N::translate('This site is being upgraded.  Try again in a few minutes.') . PHP_EOL . format_timestamp(WT_TIMESTAMP) . WT_I18N::translate('UTC');
// Success/failure indicators
$icon_success = '<i class="icon-yes"></i>';
$icon_failure = '<i class="icon-failure"></i>';
// Need confirmation for various actions
$continue = WT_Filter::post('continue', '1') && WT_Filter::checkCsrf();
$modules_action = WT_Filter::post('modules', 'ignore|disable');
$themes_action = WT_Filter::post('themes', 'ignore|disable');
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Upgrade wizard'))->pageHeader();
// Flush output as it happens - only effective on some webserver configurations.
ob_implicit_flush(true);
if (ob_get_level()) {
    ob_end_flush();
}
echo '<h2>', $controller->getPageTitle(), '</h2>';
if ($latest_version == '') {
    echo '<p>', WT_I18N::translate('No upgrade information is available.'), '</p>';
    exit;
}
if (version_compare(WT_VERSION, $latest_version) >= 0) {
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_site_upgrade.php

示例8: WT_Controller_Page

$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader()->addInlineJavascript('
    jQuery("#sidebars_table").sortable({items: ".sortme", forceHelperSize: true, forcePlaceholderSize: true, opacity: 0.7, cursor: "move", axis: "y"});

    //-- update the order numbers after drag-n-drop sorting is complete
    jQuery("#sidebars_table").bind("sortupdate", function(event, ui) {
			jQuery("#"+jQuery(this).attr("id")+" input").each(
				function (index, value) {
					value.value = index+1;
				}
			);
		});
	');
$modules = WT_Module::getActiveSidebars(WT_GED_ID, WT_PRIV_HIDE);
$action = WT_Filter::post('action');
if ($action == 'update_mods' && WT_Filter::checkCsrf()) {
    foreach ($modules as $module_name => $module) {
        foreach (WT_Tree::getAll() as $tree) {
            $access_level = WT_Filter::post("sidebaraccess-{$module_name}-{$tree->tree_id}", WT_REGEX_INTEGER, $module->defaultAccessLevel());
            WT_DB::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'sidebar', ?)")->execute(array($module_name, $tree->tree_id, $access_level));
        }
        $order = WT_Filter::post('sidebarorder-' . $module_name);
        WT_DB::prepare("UPDATE `##module` SET sidebar_order=? WHERE module_name=?")->execute(array($order, $module_name));
        $module->order = $order;
        // Make the new order take effect immediately
    }
    uasort($modules, function ($x, $y) {
        return $x->order - $y->order;
    });
}
?>
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_module_sidebar.php

示例9: 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

示例10: masquerade

     echo '<dd><a href="#" onclick="modalDialog(\'index_edit.php?user_id=' . $user_id . '\', \'', WT_I18N::translate('Change the blocks on this page'), '\');">', WT_I18N::translate('Change the blocks on this page'), '</a></dd>';
     // Masquerade as others users - but not other administrators
     if (!Auth::isAdmin($user)) {
         echo '<dt>', WT_I18N::translate('Masquerade as this user'), '</dt>';
         echo '<dd><a href="#" onclick="return masquerade(', $user_id, ')">', WT_I18N::translate('masquerade'), '</a></dd>';
     }
     echo '</dl>';
     // Column One - details
     echo '<div id="access">', '<h2>', WT_I18N::translate('Family tree access and settings'), '</h2>', '<table><tr>', '<th>', WT_I18N::translate('Family tree'), '</th>', '<th>', WT_I18N::translate('Default individual'), help_link('default_individual'), '</th>', '<th>', WT_I18N::translate('Individual record'), help_link('useradmin_gedcomid'), '</th>', '<th>', WT_I18N::translate('Role'), help_link('role'), '</th>', '<th>', WT_I18N::translate('Restrict to immediate family'), help_link('RELATIONSHIP_PATH_LENGTH'), '</th>', '</tr>';
     foreach (WT_Tree::getAll() as $tree) {
         echo '<tr><td>', $tree->tree_title_html, '</td><td>', edit_field_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-rootid', $tree->userPreference($user_id, 'rootid')), '</td><td>', edit_field_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-gedcomid', $tree->userPreference($user_id, 'gedcomid')), '</td><td>', select_edit_control_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-canedit', $ALL_EDIT_OPTIONS, null, $tree->userPreference($user_id, 'canedit')), '</td><td>', select_edit_control_inline('user_gedcom_setting-' . $user_id . '-' . $tree->tree_id . '-RELATIONSHIP_PATH_LENGTH', array(0 => WT_I18N::translate('no'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10), null, $tree->userPreference($user_id, 'RELATIONSHIP_PATH_LENGTH')), '</td></tr>';
     }
     echo '</table>';
     exit;
 case 'createuser':
     if (!WT_Filter::checkCsrf()) {
         $action = 'createform';
     } elseif (User::findByIdentifier($username)) {
         WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name.  A user with that user name already exists.  Please choose another user name.'));
         $action = 'createform';
     } elseif (User::findByIdentifier($emailaddress)) {
         WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address.  A user with that email already exists.'));
         $action = 'createform';
     } elseif ($pass1 != $pass2) {
         WT_FlashMessages::addMessage(WT_I18N::translate('Passwords do not match.'));
         $action = 'createform';
     } else {
         $user = User::create($username, $realname, $emailaddress, $pass1);
         $user->setSetting('reg_timestamp', date('U'))->setSetting('sessiontime', '0')->setSetting('theme', $user_theme)->setSetting('language', $user_language)->setSetting('contactmethod', $new_contact_method)->setSetting('comment', $new_comment)->setSetting('auto_accept', $new_auto_accept)->setSetting('canadmin', $canadmin)->setSetting('visibleonline', $visibleonline)->setSetting('editaccount', $editaccount)->setSetting('verified', $verified)->setSetting('verified_by_admin', $verified_by_admin);
         foreach (WT_Tree::getAll() as $tree) {
             $tree->userPreference($user->getUserId(), 'gedcomid', WT_Filter::post('gedcomid' . $tree->tree_id, WT_REGEX_XREF));
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_users.php


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