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


PHP WT_Filter::getCsrfToken方法代码示例

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


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

示例1: pageHeader

    public function pageHeader()
    {
        // Import global variables into the local scope, for the theme’s header.php
        global $SEARCH_SPIDER, $TEXT_DIRECTION, $REQUIRE_AUTHENTICATION, $headerfile, $view;
        // The title often includes the names of records, which may have markup
        // that cannot be used in the page title.
        $title = html_entity_decode(strip_tags($this->page_title), ENT_QUOTES, 'UTF-8');
        // Initialise variables for the theme’s header.php
        $LINK_CANONICAL = $this->canonical_url;
        $META_ROBOTS = $this->meta_robots;
        $META_DESCRIPTION = WT_GED_ID ? get_gedcom_setting(WT_GED_ID, 'META_DESCRIPTION') : '';
        if (!$META_DESCRIPTION) {
            $META_DESCRIPTION = strip_tags(WT_TREE_TITLE);
        }
        $META_GENERATOR = WT_WEBTREES . ' ' . WT_VERSION . ' - ' . WT_WEBTREES_URL;
        $META_TITLE = WT_GED_ID ? get_gedcom_setting(WT_GED_ID, 'META_TITLE') : '';
        if ($META_TITLE) {
            $title .= ' - ' . $META_TITLE;
        }
        // This javascript needs to be loaded in the header, *before* the CSS.
        // All other javascript should be defered until the end of the page
        $javascript = '<script src="' . WT_MODERNIZR_URL . '"></script>';
        // Give Javascript access to some PHP constants
        $this->addInlineJavascript('
			var WT_STATIC_URL  = "' . WT_Filter::escapeJs(WT_STATIC_URL) . '";
			var WT_THEME_DIR   = "' . WT_Filter::escapeJs(WT_THEME_DIR) . '";
			var WT_MODULES_DIR = "' . WT_Filter::escapeJs(WT_MODULES_DIR) . '";
			var WT_GEDCOM      = "' . WT_Filter::escapeJs(WT_GEDCOM) . '";
			var WT_GED_ID      = "' . WT_Filter::escapeJs(WT_GED_ID) . '";
			var WT_USER_ID     = "' . WT_Filter::escapeJs(WT_USER_ID) . '";
			var textDirection  = "' . WT_Filter::escapeJs($TEXT_DIRECTION) . '";
			var WT_SCRIPT_NAME = "' . WT_Filter::escapeJs(WT_SCRIPT_NAME) . '";
			var WT_LOCALE      = "' . WT_Filter::escapeJs(WT_LOCALE) . '";
			var WT_CSRF_TOKEN  = "' . WT_Filter::escapeJs(WT_Filter::getCsrfToken()) . '";
		', self::JS_PRIORITY_HIGH);
        // Temporary fix for access to main menu hover elements on android/blackberry touch devices
        $this->addInlineJavascript('
			if(navigator.userAgent.match(/Android|PlayBook/i)) {
				jQuery("#main-menu > li > a").attr("href", "#");
				jQuery("a.icon_arrow").attr("href", "#");
			}
		');
        header('Content-Type: text/html; charset=UTF-8');
        require WT_ROOT . $headerfile;
        // Flush the output, so the browser can render the header and load javascript
        // while we are preparing data for the page
        if (ini_get('output_buffering')) {
            ob_flush();
        }
        flush();
        // Once we've displayed the header, we should no longer write session data.
        Zend_Session::writeClose();
        // We've displayed the header - display the footer automatically
        $this->page_header = true;
        return $this;
    }
开发者ID:brambravo,项目名称:webtrees,代码行数:56,代码来源:Page.php

示例2: checkCsrf

 public static function checkCsrf()
 {
     if (WT_Filter::post('csrf') !== WT_Filter::getCsrfToken()) {
         // Oops.  Something is not quite right
         Log::addAuthenticationLog('CSRF mismatch - session expired or malicious attack');
         WT_FlashMessages::addMessage(WT_I18N::translate('This form has expired.  Try again.'));
         return false;
     }
     return true;
 }
开发者ID:sadr110,项目名称:webtrees,代码行数:10,代码来源:Filter.php


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