Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

SpecialBlockme.php

Go to the documentation of this file.
00001 <?php 00002 function wfSpecialBlockme() 00003 { 00004 global $wgIP, $wgBlockOpenProxies, $wgOut, $wgProxyKey; 00005 00006 if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $wgIP . $wgProxyKey ) ) { 00007 $wgOut->addWikiText( wfMsg( "disabled" ) ); 00008 return; 00009 } 00010 00011 $blockerName = wfMsg( "proxyblocker" ); 00012 $reason = wfMsg( "proxyblockreason" ); 00013 $success = wfMsg( "proxyblocksuccess" ); 00014 00015 $u = User::newFromName( $blockerName ); 00016 $id = $u->idForName(); 00017 if ( !$id ) { 00018 $u = User::newFromName( $blockerName ); 00019 $u->addToDatabase(); 00020 $u->setPassword( bin2hex( mt_rand(0, 0x7fffffff ) ) ); 00021 $u->saveSettings(); 00022 $id = $u->getID(); 00023 } 00024 00025 $block = new Block( $wgIP, 0, $id, $reason, wfTimestampNow() ); 00026 $block->insert(); 00027 00028 $wgOut->addWikiText( $success ); 00029 } 00030 ?>

Generated on Tue Jun 29 23:40:07 2004 for Mediawiki by doxygen 1.3.7