Anonymouse Patch to Integrate with 2.0.18b2 IP Bans

edited July 2011 in Vanilla 2.0 - 2.8
Here are some patches to integrate anonymouse with 2.0.18b2 IP bans.

Insert this in the function DiscussionController_Render_Before right before
"if (!$Session->IsValid() && $AddCommentsPermission) {"
$BannedUser = Gdn::SQL()->Select('BanID') ->From('Ban') ->Where('BanType', 'IPAddress') ->Where('BanValue', RemoteIP()) ->Get() ->FirstRow(); if($BannedUser !== FALSE) { $Sender->AddAsset('Content', '<h3>You are banned</h3>'); return; }

Insert this in the function PostController_All_Handler right before " $Permission = C('Plugins.Anonymouse.Category', ArrayValue('Vanilla.Discussions.View', $Session->GetPermissions()));"

$BannedUser = Gdn::SQL()->Select('BanID') ->From('Ban') ->Where('BanType', 'IPAddress') ->Where('BanValue', RemoteIP()) ->Get() ->FirstRow(); if($BannedUser !== FALSE){ Gdn::SQL()->Update('Ban') ->Set('CountBlockedRegistrations', 'CountBlockedRegistrations+1', FALSE) ->Where('BanID', $BannedUser->BanID) ->Put(); return; }
Tagged:

Best Answer

  • SS ✭✭
    Answer ✓
    Thanks. I will implement this in future release.

Answers

  • SS ✭✭
    Answer ✓
    Thanks. I will implement this in future release.
Sign In or Register to comment.