當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sfRequest::checkCSRFProtection方法代碼示例

本文整理匯總了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());
 }
開發者ID:te-koyama,項目名稱:openpne,代碼行數:12,代碼來源:opCommunityTopicPluginTopicActions.class.php

示例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;
 }
開發者ID:nise-nabe,項目名稱:ppcon-sns,代碼行數:24,代碼來源:opCommunityAction.class.php

示例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;
 }
開發者ID:te-koyama,項目名稱:openpne,代碼行數:27,代碼來源:actions.class.php

示例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;
 }
開發者ID:TadahiroKudo,項目名稱:OpenPNE3,代碼行數:20,代碼來源:opFriendAction.class.php


注:本文中的sfRequest::checkCSRFProtection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。