Changing comments layout preparing for generated documentation with Phpdocumentor
[lhc/web/wiklou.git] / includes / SpecialBlockme.php
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 function wfSpecialBlockme()
10 {
11 global $wgIP, $wgBlockOpenProxies, $wgOut, $wgProxyKey;
12
13 if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $wgIP . $wgProxyKey ) ) {
14 $wgOut->addWikiText( wfMsg( "disabled" ) );
15 return;
16 }
17
18 $blockerName = wfMsg( "proxyblocker" );
19 $reason = wfMsg( "proxyblockreason" );
20 $success = wfMsg( "proxyblocksuccess" );
21
22 $u = User::newFromName( $blockerName );
23 $id = $u->idForName();
24 if ( !$id ) {
25 $u = User::newFromName( $blockerName );
26 $u->addToDatabase();
27 $u->setPassword( bin2hex( mt_rand(0, 0x7fffffff ) ) );
28 $u->saveSettings();
29 $id = $u->getID();
30 }
31
32 $block = new Block( $wgIP, 0, $id, $reason, wfTimestampNow() );
33 $block->insert();
34
35 $wgOut->addWikiText( $success );
36 }
37 ?>