Code Duplication    Length = 22-22 lines in 2 locations

code/pagetypes/Forum.php 2 locations

@@ 613-634 (lines=22) @@
610
		return false;
611
	}
612
613
	public function ban(SS_HTTPRequest $r) {
614
		if(!$r->param('ID')) return $this->httpError(404);
615
		if(!$this->canModerate()) return $this->httpError(403);
616
617
		$member = Member::get()->byID($r->param('ID'));
618
		if (!$member || !$member->exists()) return $this->httpError(404);
619
620
		$member->ForumStatus = 'Banned';
621
		$member->write();
622
623
		// Log event
624
		$currentUser = Member::currentUser();
625
		SS_Log::log(sprintf(
626
			'Banned member %s (#%d), by moderator %s (#%d)',
627
			$member->Email,
628
			$member->ID,
629
			$currentUser->Email,
630
			$currentUser->ID
631
		), SS_Log::NOTICE);
632
633
		return ($r->isAjax()) ? true : $this->redirectBack();
634
	}
635
636
	public function ghost(SS_HTTPRequest $r) {
637
		if(!$r->param('ID')) return $this->httpError(400);
@@ 636-657 (lines=22) @@
633
		return ($r->isAjax()) ? true : $this->redirectBack();
634
	}
635
636
	public function ghost(SS_HTTPRequest $r) {
637
		if(!$r->param('ID')) return $this->httpError(400);
638
		if(!$this->canModerate()) return $this->httpError(403);
639
640
		$member = Member::get()->byID($r->param('ID'));
641
		if (!$member || !$member->exists()) return $this->httpError(404);
642
643
		$member->ForumStatus = 'Ghost';
644
		$member->write();
645
646
		// Log event
647
		$currentUser = Member::currentUser();
648
		SS_Log::log(sprintf(
649
			'Ghosted member %s (#%d), by moderator %s (#%d)',
650
			$member->Email,
651
			$member->ID,
652
			$currentUser->Email,
653
			$currentUser->ID
654
		), SS_Log::NOTICE);
655
656
		return ($r->isAjax()) ? true : $this->redirectBack();
657
	}
658
659
	/**
660
	 * Get posts to display. This method assumes an URL parameter "ID" which contains the thread ID.