| @@ 792-820 (lines=29) @@ | ||
| 789 | } |
|
| 790 | ||
| 791 | ||
| 792 | public function ban(HTTPRequest $r) |
|
| 793 | { |
|
| 794 | if (!$r->param('ID')) { |
|
| 795 | return $this->httpError(404); |
|
| 796 | } |
|
| 797 | if (!$this->canModerate()) { |
|
| 798 | return $this->httpError(403); |
|
| 799 | } |
|
| 800 | ||
| 801 | $member = Member::get()->byID($r->param('ID')); |
|
| 802 | if (!$member || !$member->exists()) { |
|
| 803 | return $this->httpError(404); |
|
| 804 | } |
|
| 805 | ||
| 806 | $member->ForumStatus = 'Banned'; |
|
| 807 | $member->write(); |
|
| 808 | ||
| 809 | // Log event |
|
| 810 | $currentUser = Member::currentUser(); |
|
| 811 | Log::log(sprintf( |
|
| 812 | 'Banned member %s (#%d), by moderator %s (#%d)', |
|
| 813 | $member->Email, |
|
| 814 | $member->ID, |
|
| 815 | $currentUser->Email, |
|
| 816 | $currentUser->ID |
|
| 817 | ), Log::NOTICE); |
|
| 818 | ||
| 819 | return ($r->isAjax()) ? true : $this->redirectBack(); |
|
| 820 | } |
|
| 821 | ||
| 822 | public function ghost(HTTPRequest $r) |
|
| 823 | { |
|
| @@ 822-850 (lines=29) @@ | ||
| 819 | return ($r->isAjax()) ? true : $this->redirectBack(); |
|
| 820 | } |
|
| 821 | ||
| 822 | public function ghost(HTTPRequest $r) |
|
| 823 | { |
|
| 824 | if (!$r->param('ID')) { |
|
| 825 | return $this->httpError(400); |
|
| 826 | } |
|
| 827 | if (!$this->canModerate()) { |
|
| 828 | return $this->httpError(403); |
|
| 829 | } |
|
| 830 | ||
| 831 | $member = Member::get()->byID($r->param('ID')); |
|
| 832 | if (!$member || !$member->exists()) { |
|
| 833 | return $this->httpError(404); |
|
| 834 | } |
|
| 835 | ||
| 836 | $member->ForumStatus = 'Ghost'; |
|
| 837 | $member->write(); |
|
| 838 | ||
| 839 | // Log event |
|
| 840 | $currentUser = Member::currentUser(); |
|
| 841 | Log::log(sprintf( |
|
| 842 | 'Ghosted member %s (#%d), by moderator %s (#%d)', |
|
| 843 | $member->Email, |
|
| 844 | $member->ID, |
|
| 845 | $currentUser->Email, |
|
| 846 | $currentUser->ID |
|
| 847 | ), Log::NOTICE); |
|
| 848 | ||
| 849 | return ($r->isAjax()) ? true : $this->redirectBack(); |
|
| 850 | } |
|
| 851 | ||
| 852 | /** |
|
| 853 | * Get posts to display. This method assumes an URL parameter "ID" which contains the thread ID. |
|