setHeaders(); $this->outputHeader(); $ip = $this->getRequest()->getIP(); if( !$wgBlockOpenProxies || $this->getRequest()->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) { $this->getOutput()->addWikiMsg( 'proxyblocker-disabled' ); return; } $user = User::newFromName( $this->msg( 'proxyblocker' )->inContentLanguage()->text() ); # FIXME: newFromName could return false on a badly configured wiki. if ( !$user->isLoggedIn() ) { $user->addToDatabase(); } $block = new Block(); $block->setTarget( $ip ); $block->setBlocker( $user ); $block->mReason = $this->msg( 'proxyblockreason' )->inContentLanguage()->text(); $block->insert(); $this->getOutput()->addWikiMsg( 'proxyblocksuccess' ); } protected function getGroupName() { return 'other'; } }