* Add option to include templates in Special:Export.
[lhc/web/wiklou.git] / includes / SpecialBlockme.php
index 23ac2a5..e68f942 100644 (file)
@@ -1,10 +1,19 @@
 <?php
-function wfSpecialBlockme()
-{
-       global $wgIP, $wgBlockOpenProxies, $wgOut;
+/**
+ *
+ * @addtogroup SpecialPage
+ */
 
-       if ( !$wgBlockOpenProxies ) {
-               $wgOut->addWikiText( wfMsg( "disabled" ) );
+/**
+ *
+ */
+function wfSpecialBlockme() {
+       global $wgRequest, $wgBlockOpenProxies, $wgOut, $wgProxyKey;
+
+       $ip = wfGetIP();
+       
+       if( !$wgBlockOpenProxies || $wgRequest->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) {
+               $wgOut->addWikiText( wfMsg( 'proxyblocker-disabled' ) );
                return;
        }
 
@@ -12,7 +21,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,9 +31,9 @@ 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 );
 }
-?>
+