Beispiel #1
0
 /**
  * Report a Spam Comment as valid comment (not spam)
  */
 function reportham()
 {
     $comment = DataObject::get_by_id("PageComment", $this->urlParams['ID']);
     if ($comment && $comment->canEdit()) {
         // if spam protection module exists
         if (class_exists('SpamProtectorManager')) {
             SpamProtectorManager::send_feedback($comment, 'ham');
         }
         if (SSAkismet::isEnabled()) {
             try {
                 $akismet = new SSAkismet();
                 $akismet->setCommentAuthor($comment->getField('Name'));
                 $akismet->setCommentContent($comment->getField('Comment'));
                 $akismet->submitHam();
             } catch (Exception $e) {
                 // Akismet didn't work, most likely the service is down.
             }
         }
         $comment->setField('IsSpam', false);
         $comment->write();
     }
     if (Director::is_ajax()) {
         echo $comment->renderWith('PageCommentInterface_singlecomment');
     } else {
         Director::redirectBack();
     }
 }
 /**
  * Report a Spam Comment as valid comment (not spam)
  */
 function reportham($request)
 {
     // Protect against CSRF on destructive action
     $token = SecurityToken::inst();
     if (!$token->checkRequest($request)) {
         return $this->httpError(400);
     }
     $comment = DataObject::get_by_id("PageComment", $request->param('ID'));
     if ($comment && $comment->canEdit()) {
         // if spam protection module exists
         if (class_exists('SpamProtectorManager')) {
             SpamProtectorManager::send_feedback($comment, 'ham');
         }
         if (SSAkismet::isEnabled()) {
             try {
                 $akismet = new SSAkismet();
                 $akismet->setCommentAuthor($comment->getField('Name'));
                 $akismet->setCommentContent($comment->getField('Comment'));
                 $akismet->submitHam();
             } catch (Exception $e) {
                 // Akismet didn't work, most likely the service is down.
             }
         }
         $comment->setField('IsSpam', false);
         $comment->write();
     }
     if (Director::is_ajax()) {
         echo $comment->renderWith('PageCommentInterface_singlecomment');
     } else {
         Director::redirectBack();
     }
 }
	function reportham() {
		if(SSAkismet::isEnabled()) {
			if(Permission::check('CMS_ACCESS_CMSMain')) {
				$comment = DataObject::get_by_id("PageComment", $this->urlParams['ID']);
				
				if($comment) {
					try {
						$akismet = new SSAkismet();
						$akismet->setCommentAuthor($comment->getField('Name'));
						$akismet->setCommentContent($comment->getField('Comment'));
						
						$akismet->submitHam();
					} catch (Exception $e) {
						// Akismet didn't work, most likely the service is down.
					}
					
					$comment->setField('IsSpam', false);
					$comment->write();
				}
			}
		
			if(Director::is_ajax()) {
				echo $comment->renderWith('PageCommentInterface_singlecomment');
			} else {		
				Director::redirectBack();
			}
		}
	}
	function ham() {
		if(!Permission::check('ADMIN')) {
			return false;
		}

		$this->methodName = "ham";
		
		$childId = Convert::raw2sql($_REQUEST['ctf']['childID']);

		if (is_numeric($childId)) {
			$comment = DataObject::get_by_id($this->sourceClass, $childId);
			if($comment) {
				$comment->IsSpam = false;
				$comment->NeedsModeration = false;
				$comment->write();
				
				if(SSAkismet::isEnabled()) {
					try {
						$akismet = new SSAkismet();
						$akismet->setCommentAuthor($comment->getField('Name'));
						$akismet->setCommentContent($comment->getField('Comment'));
						
						$akismet->submitHam();
					} catch (Exception $e) {
						// Akismet didn't work, most likely the service is down.
					}
				}
			}
		}
	}