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


PHP Csrf::check_code方法代码示例

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


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

示例1: postResolve

 /**
  * Do something after resolving is done
  *
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function postResolve(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $plainCmd, $cmd, $_CORELANG;
     // CSRF code needs to be even in the login form. otherwise, we
     // could not do a super-generic check later.. NOTE: do NOT move
     // this above the "new cmsSession" line!
     Csrf::add_code();
     // CSRF protection.
     // Note that we only do the check as long as there's no
     // cmd given; this is so we can reload the main screen if
     // the check has failed somehow.
     // fileBrowser is an exception, as it eats CSRF codes like
     // candy. We're doing \Cx\Core\Csrf\Controller\Csrf::check_code() in the relevant
     // parts in the module instead.
     // The CSRF code needn't to be checked in the login module
     // because the user isn't logged in at this point.
     // TODO: Why is upload excluded? The CSRF check doesn't take place in the upload module!
     if (!empty($plainCmd) && !empty($cmd) and !in_array($plainCmd, array('FileBrowser', 'Upload', 'Login', 'Home'))) {
         // Since language initialization in in the same hook as this
         // and we cannot define the order of module-processing,
         // we need to check if language is already initialized:
         if (!is_array($_CORELANG) || !count($_CORELANG)) {
             $objInit = \Env::get('init');
             $objInit->_initBackendLanguage();
             $_CORELANG = $objInit->loadLanguageData('core');
         }
         Csrf::check_code();
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:34,代码来源:ComponentController.class.php


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