本文整理汇总了PHP中sfRequest::checkCSRFProtection方法的典型用法代码示例。如果您正苦于以下问题:PHP sfRequest::checkCSRFProtection方法的具体用法?PHP sfRequest::checkCSRFProtection怎么用?PHP sfRequest::checkCSRFProtection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfRequest
的用法示例。
在下文中一共展示了sfRequest::checkCSRFProtection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeDelete
/**
* Executes delete action
*
* @param sfRequest $request A redirect object
*/
public function executeDelete($request)
{
$request->checkCSRFProtection();
$this->forward404Unless($this->communityEventComment->isDeletable($this->getUser()->getMemberId()));
$this->communityEventComment->delete();
$this->getUser()->setFlash('notice', 'The comment was deleted successfully.');
$this->redirect('@communityEvent_show?id=' . $this->communityEvent->getId());
}
开发者ID:kiwpon,项目名称:opCommunityTopicPlugin,代码行数:13,代码来源:opCommunityTopicPluginEventCommentActions.class.php
示例2: executeDelete
/**
* Executes delete action
*
* @param sfRequest $request A request object
*/
public function executeDelete($request)
{
switch ($request->getParameter('target'))
{
case 'friend':
$fromId = $this->id;
$toId = $this->getUser()->getMemberId();
break;
case 'my':
default:
$fromId = $this->getUser()->getMemberId();
$toId = $this->id;
break;
}
$this->introFriend = Doctrine::getTable('IntroFriend')->getByFromAndTo($fromId, $toId);
$this->forward404Unless($this->introFriend);
// return uri
switch ($request->getParameter('from'))
{
case 'list':
$this->uri = $this->getController()->genUrl('@obj_introfriend?id='.$toId);
break;
case 'manage':
default:
$this->uri = $this->getController()->genUrl('@friend_manage');
}
// delete
if ($request->isMethod('post'))
{
$request->checkCSRFProtection();
$this->introFriend->delete();
$this->getUser()->setFlash('notice', 'The introductory essay was deleted.');
$this->redirect($this->uri);
}
}
开发者ID:nise-nabe,项目名称:opIntroFriendPlugin,代码行数:42,代码来源:opIntroFriendPluginIntroFriendActions.class.php
示例3: executeDelete
/**
* Executes delete action
*
* @param sfRequest $request A request object
*/
public function executeDelete($request)
{
$request->checkCSRFProtection();
$this->communityTopic->delete();
$this->getUser()->setFlash('notice', 'The %community% topic was deleted successfully.');
$this->redirect('community/home?id=' . $this->community->getId());
}
示例4: executeDropMember
/**
* Executes dropMember action
*
* @param sfRequest $request A request object
*/
public function executeDropMember($request)
{
$this->redirectUnless($this->isAdmin || $this->isSubAdmin, '@error');
$member = Doctrine::getTable('Member')->find($request->getParameter('member_id'));
$this->forward404Unless($member);
$isCommunityMember = Doctrine::getTable('CommunityMember')->isMember($member->getId(), $this->id);
$this->redirectUnless($isCommunityMember, '@error');
$isAdmin = Doctrine::getTable('CommunityMember')->isAdmin($member->getId(), $this->id);
$isSubAdmin = Doctrine::getTable('CommunityMember')->isSubAdmin($member->getId(), $this->id);
$this->redirectIf($isAdmin || $isSubAdmin, '@error');
if ($request->isMethod(sfWebRequest::POST)) {
$request->checkCSRFProtection();
Doctrine::getTable('CommunityMember')->quit($member->getId(), $this->id);
$this->redirect('@community_memberManage?id=' . $this->id);
}
$this->member = $member;
$this->community = Doctrine::getTable('Community')->find($this->id);
return sfView::INPUT;
}
示例5: executeSortProfileOption
/**
* Executes sortProfileOption action
*
* @param sfRequest $request A request object
*/
public function executeSortProfileOption($request)
{
if ($request->isXmlHttpRequest()) {
$request->checkCSRFProtection();
$parameters = $request->getParameterHolder();
$keys = $parameters->getNames();
foreach ($keys as $key) {
if (preg_match('/^profile_options_\\d+$/', $key, $match)) {
$order = $parameters->get($match[0]);
for ($i = 0; $i < count($order); $i++) {
$profileOption = Doctrine::getTable('ProfileOption')->find($order[$i]);
if ($profileOption) {
$profileOption->setSortOrder($i * 10);
$profileOption->save();
}
}
break;
}
}
}
return sfView::NONE;
}
示例6: executeUnlink
/**
* Executes unlink action
*
* @param sfRequest $request A request object
*/
public function executeUnlink($request)
{
$this->redirectToHomeIfIdIsNotValid();
if (!$this->relation->isFriend()) {
$this->getUser()->setFlash('error', 'This member is not your %friend%.');
$this->redirect('friend/manage');
}
if ($request->isMethod(sfWebRequest::POST)) {
$request->checkCSRFProtection();
$this->relation->removeFriend();
$this->redirect('friend/manage');
}
$this->member = Doctrine::getTable('Member')->find($this->id);
return sfView::INPUT;
}