From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- includes/specials/SpecialBlockme.php | 66 ++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 22 deletions(-) (limited to 'includes/specials/SpecialBlockme.php') diff --git a/includes/specials/SpecialBlockme.php b/includes/specials/SpecialBlockme.php index f222e3c6..f5131f5f 100644 --- a/includes/specials/SpecialBlockme.php +++ b/includes/specials/SpecialBlockme.php @@ -1,37 +1,59 @@ getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) { - $wgOut->addWikiMsg( 'proxyblocker-disabled' ); - return; + function __construct() { + parent::__construct( 'Blockme' ); } - $blockerName = wfMsg( "proxyblocker" ); - $reason = wfMsg( "proxyblockreason" ); - - $u = User::newFromName( $blockerName ); - $id = $u->idForName(); - if ( !$id ) { - $u = User::newFromName( $blockerName ); - $u->addToDatabase(); - $u->setPassword( bin2hex( mt_rand(0, 0x7fffffff ) ) ); - $u->saveSettings(); - $id = $u->getID(); - } + function execute( $par ) { + global $wgRequest, $wgOut, $wgBlockOpenProxies, $wgProxyKey; + + $this->setHeaders(); + $this->outputHeader(); + + $ip = wfGetIP(); + if( !$wgBlockOpenProxies || $wgRequest->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) { + $wgOut->addWikiMsg( 'proxyblocker-disabled' ); + return; + } - $block = new Block( $ip, 0, $id, $reason, wfTimestampNow() ); - $block->insert(); + $user = User::newFromName( wfMsgForContent( 'proxyblocker' ) ); + if ( !$user->isLoggedIn() ) { + $user->addToDatabase(); + } + $id = $user->getId(); + $reason = wfMsg( 'proxyblockreason' ); - $wgOut->addWikiMsg( "proxyblocksuccess" ); + $block = new Block( $ip, 0, $id, $reason, wfTimestampNow() ); + $block->insert(); + + $wgOut->addWikiMsg( 'proxyblocksuccess' ); + } } -- cgit v1.2.3-54-g00ecf