original_string: public function Comment($Comment) {
        $Comment['InsertUserID'] = Gdn::Session()->UserID;
        $Comment['DateInserted'] = Gdn_Format::ToDateTime();
        $Comment['InsertIPAddress'] = Gdn::Request()->IpAddress();
        
        $this->Validation->ApplyRule('ActivityID', 'Required');
        $this->Validation->ApplyRule('Body', 'Required');
        $this->Validation->ApplyRule('DateInserted', 'Required');
        $this->Validation->ApplyRule('InsertUserID', 'Required');
        
        $this->EventArguments['Comment'] = $Comment;
        $this->FireEvent('BeforeSaveComment');
        
        if ($this->Validate($Comment)) {
           $Activity = $this->GetID($Comment['ActivityID'], DATASET_TYPE_ARRAY);
           Gdn::Controller()->Json('Activity', $CommentActivityID);
           
           $_ActivityID = $Comment['ActivityID'];
           // Check to see if this is a shared activity/notification.
           if ($CommentActivityID = GetValue('CommentActivityID', $Activity['Data'])) {
              Gdn::Controller()->Json('CommentActivityID', $CommentActivityID);
              $Comment['ActivityID'] = $CommentActivityID;
           }
           
           // Check for spam.
           $Spam = SpamModel::IsSpam('ActivityComment', $Comment);
           if ($Spam)
              return SPAM;
           
           // Check for approval
           $ApprovalRequired = CheckRestriction('Vanilla.Approval.Require');
           if ($ApprovalRequired && !GetValue('Verified', Gdn::Session()->User)) {
           	LogModel::Insert('Pending', 'ActivityComment', $Comment);
           	return UNAPPROVED;
           }
           
           $ID = $this->SQL->Insert('ActivityComment', $Comment);
           
           if ($ID) {
              // Check to see if this comment bumps the activity.
              if ($Activity && GetValue('Bump', $Activity['Data'])) {
                 $this->SQL->Put('Activity', array('DateUpdated' => $Comment['DateInserted']), array('ActivityID' => $Activity['ActivityID']));
                 if ($_ActivityID != $Comment['ActivityID']) {
                    $this->SQL->Put('Activity', array('DateUpdated' => $Comment['DateInserted']), array('ActivityID' => $_ActivityID));
                 }
              }
           }
           
           return $ID;
        }
        return FALSE;
     }
code: public function Comment($Comment) {
        $Comment['InsertUserID'] = Gdn::Session()->UserID;
        $Comment['DateInserted'] = Gdn_Format::ToDateTime();
        $Comment['InsertIPAddress'] = Gdn::Request()->IpAddress();
        
        $this->Validation->ApplyRule('ActivityID', 'Required');
        $this->Validation->ApplyRule('Body', 'Required');
        $this->Validation->ApplyRule('DateInserted', 'Required');
        $this->Validation->ApplyRule('InsertUserID', 'Required');
        
        $this->EventArguments['Comment'] = $Comment;
        $this->FireEvent('BeforeSaveComment');
        
        if ($this->Validate($Comment)) {
           $Activity = $this->GetID($Comment['ActivityID'], DATASET_TYPE_ARRAY);
           Gdn::Controller()->Json('Activity', $CommentActivityID);
           
           $_ActivityID = $Comment['ActivityID'];
           // Check to see if this is a shared activity/notification.
           if ($CommentActivityID = GetValue('CommentActivityID', $Activity['Data'])) {
              Gdn::Controller()->Json('CommentActivityID', $CommentActivityID);
              $Comment['ActivityID'] = $CommentActivityID;
           }
           
           // Check for spam.
           $Spam = SpamModel::IsSpam('ActivityComment', $Comment);
           if ($Spam)
              return SPAM;
           
           // Check for approval
           $ApprovalRequired = CheckRestriction('Vanilla.Approval.Require');
           if ($ApprovalRequired && !GetValue('Verified', Gdn::Session()->User)) {
           	LogModel::Insert('Pending', 'ActivityComment', $Comment);
           	return UNAPPROVED;
           }
           
           $ID = $this->SQL->Insert('ActivityComment', $Comment);
           
           if ($ID) {
              // Check to see if this comment bumps the activity.
              if ($Activity && GetValue('Bump', $Activity['Data'])) {
                 $this->SQL->Put('Activity', array('DateUpdated' => $Comment['DateInserted']), array('ActivityID' => $Activity['ActivityID']));
                 if ($_ActivityID != $Comment['ActivityID']) {
                    $this->SQL->Put('Activity', array('DateUpdated' => $Comment['DateInserted']), array('ActivityID' => $_ActivityID));
                 }
              }
           }
           
           return $ID;
        }
        return FALSE;
     }
code_tokens: public function Comment ( $ Comment ) { $ Comment [ 'InsertUserID' ] = Gdn :: Session ( ) -> UserID ; $ Comment [ 'DateInserted' ] = Gdn_Format :: ToDateTime ( ) ; $ Comment [ 'InsertIPAddress' ] = Gdn :: Request ( ) -> IpAddress ( ) ; $ this -> Validation -> ApplyRule ( 'ActivityID' , 'Required' ) ; $ this -> Validation -> ApplyRule ( 'Body' , 'Required' ) ; $ this -> Validation -> ApplyRule ( 'DateInserted' , 'Required' ) ; $ this -> Validation -> ApplyRule ( 'InsertUserID' , 'Required' ) ; $ this -> EventArguments [ 'Comment' ] = $ Comment ; $ this -> FireEvent ( 'BeforeSaveComment' ) ; if ( $ this -> Validate ( $ Comment ) ) { $ Activity = $ this -> GetID ( $ Comment [ 'ActivityID' ] , DATASET_TYPE_ARRAY ) ; Gdn :: Controller ( ) -> Json ( 'Activity' , $ CommentActivityID ) ; $ _ActivityID = $ Comment [ 'ActivityID' ] ; // Check to see if this is a shared activity/notification. if ( $ CommentActivityID = GetValue ( 'CommentActivityID' , $ Activity [ 'Data' ] ) ) { Gdn :: Controller ( ) -> Json ( 'CommentActivityID' , $ CommentActivityID ) ; $ Comment [ 'ActivityID' ] = $ CommentActivityID ; } // Check for spam. $ Spam = SpamModel :: IsSpam ( 'ActivityComment' , $ Comment ) ; if ( $ Spam ) return SPAM ; // Check for approval $ ApprovalRequired = CheckRestriction ( 'Vanilla.Approval.Require' ) ; if ( $ ApprovalRequired && ! GetValue ( 'Verified' , Gdn :: Session ( ) -> User ) ) { LogModel :: Insert ( 'Pending' , 'ActivityComment' , $ Comment ) ; return UNAPPROVED ; } $ ID = $ this -> SQL -> Insert ( 'ActivityComment' , $ Comment ) ; if ( $ ID ) { // Check to see if this comment bumps the activity. if ( $ Activity && GetValue ( 'Bump' , $ Activity [ 'Data' ] ) ) { $ this -> SQL -> Put ( 'Activity' , array ( 'DateUpdated' => $ Comment [ 'DateInserted' ] ) , array ( 'ActivityID' => $ Activity [ 'ActivityID' ] ) ) ; if ( $ _ActivityID != $ Comment [ 'ActivityID' ] ) { $ this -> SQL -> Put ( 'Activity' , array ( 'DateUpdated' => $ Comment [ 'DateInserted' ] ) , array ( 'ActivityID' => $ _ActivityID ) ) ; } } } return $ ID ; } return FALSE ; }
docstring: Save a comment on an activity.
  @param array $Comment
  @return int|bool
  @since 2.1
docstring_tokens: Save a comment on an activity .