Extension:RudeProxyBlock
|
RudeProxyBlock Release status: stable |
|
|---|---|
| Implementation | User rights |
| Description | This extension disallows all access made by an IP listed as an Open Proxy. |
| Author(s) | Daniel Friesen (DantmanTalk) |
| Last version | 0.1 |
| License | No license specified |
| Download | see below |
|
Check usage (experimental) |
|
Extension:RudeProxyBlock blocks all the open proxies that Wikipedia had blocked. The pages in the Wikipedia open proxies category have been turned into a list. This bot was created because the block function in Pywikipediabot userlib.py was always returning a BlockError, which disallows access to all users listed in MediaWiki:Openproxylist.
The extension was built this extension after Jack Phoenix requested it.
Contents |
[edit] Usage
To use the extension create a list of proxies at MediaWiki:Openproxylist on your wiki (One proxy per line, no extra text on those lines). Any IP listed there will not be allowed to edit or view pages and will be redirected to Special:RudeProxyBlock and will have a message displayed to them (When viewed from a normal IP the page is just a link back to the Main Page). You can customize the title using MediaWiki:Rudeproxyblock and the message using MediaWiki:Rudeproxyblockmsg.
[edit] Installation
Copy the code below into extensions/RudeProxyBlock.php and add the change to LocalSettings.php.
[edit] Changes to LocalSettings.php
require_once("$IP/extensions/RudeProxyBlock.php");
[edit] extensions/RudeProxyBlock.php
<?php /** * The RudeProxyBlock Extension's task's are: * - Auto Blocking and Restriction of users using an OpenProxy listed in MediaWiki:Openproxylist * * @file * @ingroup Extensions * @version 0.1 * @author Daniel Friesen (http://www.wikia.com/wiki/User:Dantman) (mediawiki@danielfriesen.name) * @license http://www.gnu.org/copyleft/gpl.html GNU General Public Licence 2.0 or later */ if( !defined( 'MEDIAWIKI' ) ) die( "This is an extension to the MediaWiki package and cannot be run standalone." ); $wgExtensionFunctions[] = 'efRudeProxyBlockSetup'; $wgExtensionCredits['other'][] = array( 'name' => 'RudeProxyBlock', 'version' => '0.1', 'author' => '[http://www.wikia.com/wiki/User:Dantman Daniel Friesen (aka: Dantman)]', 'url' => 'http://www.mediawiki.org/wiki/Extension:RudeProxyBlock', 'description' => 'An extension to block open proxies' ); $wgHooks['userCan'][] = 'efBlockOpenProxies'; function efRudeProxyBlockSetup() { global $egOpenProxies, $egIsOpenProxy, $wgMessageCache; $egOpenProxies = explode( "\n", wfMsg( 'openproxylist' ) ); $egIsOpenProxy = in_array( wfGetIP(), $egOpenProxies ); $wgMessageCache->addMessages( array( 'rudeproxyblock' => 'Rude Proxy Block', 'rudeproxyblockmsg' => "We're sorry, but you are using a IP address which is listed as an Open Proxy.\n\nThis site does not allow users to view or edit the site under an open proxy." ) ); SpecialPage::addPage( new SpecialRudeProxyBlock() ); } function efBlockOpenProxies( &$self, &$wgUser, $action, &$result ) { global $egIsOpenProxy, $wgOut; if( $egIsOpenProxy ) { $s = SpecialPage::getTitleFor( 'RudeProxyBlock' ); if( !$self->equals( $s ) ) { $result = false; $wgOut->redirect( $s->getFullURL() ); return false; } } return true; } class SpecialRudeProxyBlock extends SpecialPage { /** * Constructor */ public function SpecialRudeProxyBlock() { SpecialPage::SpecialPage( 'RudeProxyBlock', false, false, false, 'default', false ); } /** * Execute */ public function execute( $par ) { global $wgOut, $egIsOpenProxy; $this->setHeaders(); if( $egIsOpenProxy ) { $wgOut->addHTML( wfMsg( 'rudeproxyblockmsg' ) ); } else { $wgOut->returnToMain(); } } }
[edit] See also
- (Pywikipedia-l) How can we block IPs via PWB?, pywikipedia mailing list, (November 2011).
