<commit_before><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * communityTopicComment actions.
 *
 * @package    OpenPNE
 * @subpackage communityTopicComment
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 */
class communityTopicCommentActions extends sfActions
{
  public function preExecute()
  {
    $object = $this->getRoute()->getObject();

    if ($object instanceof CommunityTopic)
    {
      $this->communityTopic = $object;
      $this->community = $this->communityTopic->getCommunity();
    }
    elseif ($object instanceof CommunityTopicComment)
    {
      $this->communityTopicComment = $object;
      $this->communityTopic = $this->communityTopicComment->getCommunityTopic();
      $this->community = $this->communityTopic->getCommunity();
    }
  }

  public function postExecute()
  {
    sfConfig::set('sf_nav_type', 'community');
    sfConfig::set('sf_nav_id', $this->community->getId());
  }

 /**
  * Executes create action
  *
  * @param sfRequest $request A request object
  */
  public function executeCreate(sfWebRequest $request)
  {
    $this->forward404Unless($this->communityTopic->isCreatableCommunityTopicComment($this->getUser()->getMemberId()));

    $this->form = new CommunityTopicCommentForm();
    $this->form->getObject()->setMemberId($this->getUser()->getMemberId());
    $this->form->getObject()->setCommunityTopic($this->communityTopic);
    $this->form->bind($request->getParameter($this->form->getName()));
    if ($this->form->isValid())
    {
      $this->form->save();
      $this->redirect('@communityTopic_show?id='.$this->communityTopic->getId());
    }

    $this->setTemplate('../../communityTopic/templates/show');
  }

  public function executeDeleteConfirm(sfWebRequest $request)
  {
    $this->forward404Unless($this->communityTopicComment->isDeletable($this->getUser()->getMemberId()));

    $this->form = new sfForm();
  }

  public function executeDelete(sfWebRequest $request)
  {
    $request->checkCSRFProtection();

    $this->forward404Unless($this->communityTopicComment->isDeletable($this->getUser()->getMemberId()));

    $this->communityTopicComment->delete();

    $this->getUser()->setFlash('notice', 'The comment was deleted successfully.');

    $this->redirect('communityTopic_show?id='.$this->communityTopic->getId());
  }
}<commit_msg>#3554:fixed missing '@' for a routing rule<commit_after><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * communityTopicComment actions.
 *
 * @package    OpenPNE
 * @subpackage communityTopicComment
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 */
class communityTopicCommentActions extends sfActions
{
  public function preExecute()
  {
    $object = $this->getRoute()->getObject();

    if ($object instanceof CommunityTopic)
    {
      $this->communityTopic = $object;
      $this->community = $this->communityTopic->getCommunity();
    }
    elseif ($object instanceof CommunityTopicComment)
    {
      $this->communityTopicComment = $object;
      $this->communityTopic = $this->communityTopicComment->getCommunityTopic();
      $this->community = $this->communityTopic->getCommunity();
    }
  }

  public function postExecute()
  {
    sfConfig::set('sf_nav_type', 'community');
    sfConfig::set('sf_nav_id', $this->community->getId());
  }

 /**
  * Executes create action
  *
  * @param sfRequest $request A request object
  */
  public function executeCreate(sfWebRequest $request)
  {
    $this->forward404Unless($this->communityTopic->isCreatableCommunityTopicComment($this->getUser()->getMemberId()));

    $this->form = new CommunityTopicCommentForm();
    $this->form->getObject()->setMemberId($this->getUser()->getMemberId());
    $this->form->getObject()->setCommunityTopic($this->communityTopic);
    $this->form->bind($request->getParameter($this->form->getName()));
    if ($this->form->isValid())
    {
      $this->form->save();
      $this->redirect('@communityTopic_show?id='.$this->communityTopic->getId());
    }

    $this->setTemplate('../../communityTopic/templates/show');
  }

  public function executeDeleteConfirm(sfWebRequest $request)
  {
    $this->forward404Unless($this->communityTopicComment->isDeletable($this->getUser()->getMemberId()));

    $this->form = new sfForm();
  }

  public function executeDelete(sfWebRequest $request)
  {
    $request->checkCSRFProtection();

    $this->forward404Unless($this->communityTopicComment->isDeletable($this->getUser()->getMemberId()));

    $this->communityTopicComment->delete();

    $this->getUser()->setFlash('notice', 'The comment was deleted successfully.');

    $this->redirect('@communityTopic_show?id='.$this->communityTopic->getId());
  }
}
{'fraction_non_alphanumeric': 0.16686205549042596, 'fraction_numerical': 0.0042985541227041815, 'mean_word_length': 4.29369183040331, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 139, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2016904', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1451, 'n_words': 263}