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


PHP sfForm::disableCSRFProtection方法代码示例

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


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

示例1: setup

 public function setup()
 {
     $this->enablePlugins('sfDoctrinePlugin');
     $this->enablePlugins('sfDoctrineGuardPlugin');
     $this->enablePlugins('sfFormExtraPlugin');
     $this->enablePlugins('sfCASPlugin');
     $this->enablePlugins('sfUTCCASPlugin');
     $this->enablePlugins('sfImageTransformPlugin');
     $this->enablePlugins('sfXssSafePlugin');
     sfForm::disableCSRFProtection();
     require_once sfConfig::get('sf_lib_dir') . '/vendor/ginger-client/autoload.php';
     $this->enablePlugins('sfTCPDFPlugin');
 }
开发者ID:TheoJD,项目名称:portail,代码行数:13,代码来源:ProjectConfiguration.class.php

示例2: _initialize

 public function _initialize()
 {
     if (!file_exists($this->config['project_dir'] . '/config/ProjectConfiguration.class.php')) {
         throw new \Codeception\Exception\ModuleConfigException('Symfony1', 'config/ProjectConfiguration.class.php not found. This file is required for running symfony1');
     }
     require_once $this->config['project_dir'] . '/config/ProjectConfiguration.class.php';
     $conf = \ProjectConfiguration::getApplicationConfiguration($this->config['app'], 'test', true);
     \sfContext::createInstance($conf);
     // chdir(\sfConfig::get('sf_web_dir'));
     $this->browser = new \sfBrowser($this->config['url']);
     $this->browser->get($this->config['url']);
     \sfForm::disableCSRFProtection();
 }
开发者ID:juansrx,项目名称:symfony1module,代码行数:13,代码来源:Symfony1.php

示例3: FormTest

$f = new FormTest(array(), array(), false);
$t->ok(!$f->isCSRFProtected(), '->isCSRFProtected() returns true if the form is CSRF protected');
sfForm::enableCSRFProtection('mygreatsecret');
$f = new FormTest();
$v = $f->getValidatorSchema();
$t->is($v[sfForm::getCSRFFieldName()]->getOption('token'), '*mygreatsecret*', '::enableCSRFProtection() can take a secret argument');
// ->enableLocalCSRFProtection() ->disableLocalCSRFProtection()
$t->diag('->enableLocalCSRFProtection() ->disableLocalCSRFProtection()');
$f = new TestForm3();
sfForm::disableCSRFProtection();
$t->ok(!$f->isCSRFProtected(), '->disableLocalCSRFProtection() disabled CSRF protection for the current form');
sfForm::enableCSRFProtection();
$t->ok(!$f->isCSRFProtected(), '->disableLocalCSRFProtection() disabled CSRF protection for the current form, even if the global CSRF protection is enabled');
$f = new TestForm3(array(), array(), 'foo');
$t->ok(!$f->isCSRFProtected(), '->disableLocalCSRFProtection() disabled CSRF protection for the current form, even a CSRF secret is provided in the constructor');
sfForm::disableCSRFProtection();
$f = new TestForm4();
$t->ok($f->isCSRFProtected(), '->enableLocalCSRFProtection() enables CSRF protection when passed null and global CSRF is disabled');
$f = new TestForm4(array(), array('csrf_secret' => '**localsecret**'));
$t->ok($f->isCSRFProtected(), '->enableLocalCSRFProtection() enables CSRF protection when passed a string global CSRF is disabled');
// ::getCSRFFieldName() ::setCSRFFieldName()
$t->diag('::getCSRFFieldName() ::setCSRFFieldName()');
sfForm::enableCSRFProtection();
sfForm::setCSRFFieldName('_token_');
$f = new FormTest();
$v = $f->getValidatorSchema();
$t->ok(isset($v['_token_']), '::setCSRFFieldName() changes the CSRF token field name');
$t->is(sfForm::getCSRFFieldName(), '_token_', '::getCSRFFieldName() returns the CSRF token field name');
// ->isMultipart()
$t->diag('->isMultipart()');
$f = new FormTest();
开发者ID:Tony-M,项目名称:GrannySymfony,代码行数:31,代码来源:sfFormTest.php

示例4: executeRenameNode

 /**
  * @param sfWebRequest $request
  */
 public function executeRenameNode(sfWebRequest $request)
 {
     // Appel AJAX requis.
     $this->forward404Unless($request->isXmlHttpRequest());
     $this->setLayout(sfView::NONE);
     $this->getResponse()->setContentType('application/json');
     // Vérification des paramètres.
     $this->checkUpParameters($request);
     sfForm::disableCSRFProtection();
     $JSONResponse = array();
     $this->ei_node = Doctrine_Core::getTable("EiDataSetStructure")->find($request->getParameter("ei_node_id"));
     // On instancie le formulaire en fonction du type de noeud.
     if ($this->ei_node instanceof EiNodeDataSet) {
         $this->form = new EiNodeDataSetForm($this->ei_node);
         $JSONResponse = $this->processFormNode($request, $this->form);
         $type = 'Node';
     } elseif ($this->ei_node instanceof EiLeafDataSet) {
         $this->ei_leaf = $this->ei_node;
         $this->form = new EiLeafDataSetForm($this->ei_node);
         $JSONResponse = $this->processFormLeaf($request, $this->form);
         $type = 'Attribute';
     }
     if (!$JSONResponse) {
         $JSONResponse = $this->createJSONResponse('saved', 'ok', $type);
     }
     return $this->renderText(json_encode($JSONResponse));
 }
开发者ID:lendji4000,项目名称:compose,代码行数:30,代码来源:actions.class.php


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