proxy check
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 10 Mar 2004 14:37:06 +0000 (14:37 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 10 Mar 2004 14:37:06 +0000 (14:37 +0000)
includes/SpecialBlockme.php [new file with mode: 0644]

diff --git a/includes/SpecialBlockme.php b/includes/SpecialBlockme.php
new file mode 100644 (file)
index 0000000..23ac2a5
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+function wfSpecialBlockme()
+{
+       global $wgIP, $wgBlockOpenProxies, $wgOut;
+
+       if ( !$wgBlockOpenProxies ) {
+               $wgOut->addWikiText( wfMsg( "disabled" ) );
+               return;
+       }
+
+       $blockerName = wfMsg( "proxyblocker" );
+       $reason = wfMsg( "proxyblockreason" );
+       $success = wfMsg( "proxyblocksuccess" );
+
+       $id = User::idForName( $blockerName );
+       if ( !$id ) {
+               $u = User::newFromName( $blockerName );
+               $u->addToDatabase();
+               $u->setPassword( bin2hex( mt_rand(0, 0x7fffffff ) ) );
+               $u->saveSettings();
+               $id = $u->getID();
+       }
+
+       $block = new Block( $wgIP, 0, $id, $reason, wfTimestampNow() );
+       $block->insert();
+
+       $wgOut->addWikiText( $success );
+}
+?>