diff options
Diffstat (limited to 'includes/SpecialBlockme.php')
-rw-r--r-- | includes/SpecialBlockme.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/includes/SpecialBlockme.php b/includes/SpecialBlockme.php new file mode 100644 index 00000000..5bfce4ee --- /dev/null +++ b/includes/SpecialBlockme.php @@ -0,0 +1,40 @@ +<?php +/** + * + * @package MediaWiki + * @subpackage SpecialPage + */ + +/** + * + */ +function wfSpecialBlockme() { + global $wgRequest, $wgBlockOpenProxies, $wgOut, $wgProxyKey; + + $ip = wfGetIP(); + + if( !$wgBlockOpenProxies || $wgRequest->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) { + $wgOut->addWikiText( wfMsg( 'disabled' ) ); + return; + } + + $blockerName = wfMsg( "proxyblocker" ); + $reason = wfMsg( "proxyblockreason" ); + $success = wfMsg( "proxyblocksuccess" ); + + $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(); + } + + $block = new Block( $ip, 0, $id, $reason, wfTimestampNow() ); + $block->insert(); + + $wgOut->addWikiText( $success ); +} +?> |