Removing leecruft. No, you sure as hell couldn't defer it.
[lhc/web/wiklou.git] / includes / SpecialBlockme.php
index 23ac2a5..b452b14 100644 (file)
@@ -1,9 +1,20 @@
 <?php
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
+
+/**
+ *
+ */
 function wfSpecialBlockme()
 {
-       global $wgIP, $wgBlockOpenProxies, $wgOut;
+       global $wgBlockOpenProxies, $wgOut, $wgProxyKey;
+
+       $ip = wfGetIP();
 
-       if ( !$wgBlockOpenProxies ) {
+       if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $ip . $wgProxyKey ) ) {
                $wgOut->addWikiText( wfMsg( "disabled" ) );
                return;
        }
@@ -12,7 +23,8 @@ function wfSpecialBlockme()
        $reason = wfMsg( "proxyblockreason" );
        $success = wfMsg( "proxyblocksuccess" );
 
-       $id = User::idForName( $blockerName );
+       $u = User::newFromName( $blockerName );
+       $id = $u->idForName();
        if ( !$id ) {
                $u = User::newFromName( $blockerName );
                $u->addToDatabase();
@@ -21,7 +33,7 @@ function wfSpecialBlockme()
                $id = $u->getID();
        }
 
-       $block = new Block( $wgIP, 0, $id, $reason, wfTimestampNow() );
+       $block = new Block( $ip, 0, $id, $reason, wfTimestampNow() );
        $block->insert();
 
        $wgOut->addWikiText( $success );