Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -583,6 +583,7 @@ |
584 | 584 | 'SpecialActiveUsers' => 'includes/specials/SpecialActiveusers.php', |
585 | 585 | 'SpecialAllpages' => 'includes/specials/SpecialAllpages.php', |
586 | 586 | 'SpecialBlankpage' => 'includes/specials/SpecialBlankpage.php', |
| 587 | + 'SpecialBlockme' => 'includes/specials/SpecialBlockme.php', |
587 | 588 | 'SpecialBookSources' => 'includes/specials/SpecialBooksources.php', |
588 | 589 | 'SpecialComparePages' => 'includes/specials/SpecialComparePages.php', |
589 | 590 | 'SpecialExport' => 'includes/specials/SpecialExport.php', |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2753,6 +2753,7 @@ |
2754 | 2754 | 'Template namespace initialisation script', // Used in 1.2->1.3 upgrade |
2755 | 2755 | 'msg:double-redirect-fixer', // Automatic double redirect fix |
2756 | 2756 | 'msg:usermessage-editor', // Default user for leaving user messages |
| 2757 | + 'msg:proxyblocker', // For Special:Blockme |
2757 | 2758 | ); |
2758 | 2759 | |
2759 | 2760 | /** |
Index: trunk/phase3/includes/specials/SpecialBlockme.php |
— | — | @@ -18,35 +18,37 @@ |
19 | 19 | */ |
20 | 20 | |
21 | 21 | /** |
22 | | - * @file |
| 22 | + * Implements Special:Blockme |
23 | 23 | * @ingroup SpecialPage |
24 | 24 | */ |
| 25 | +class SpecialBlockme extends UnlistedSpecialPage { |
25 | 26 | |
26 | | -function wfSpecialBlockme() { |
27 | | - global $wgRequest, $wgBlockOpenProxies, $wgOut, $wgProxyKey; |
| 27 | + function __construct() { |
| 28 | + parent::__construct( 'Blockme' ); |
| 29 | + } |
28 | 30 | |
29 | | - $ip = wfGetIP(); |
| 31 | + function execute( $par ) { |
| 32 | + global $wgRequest, $wgOut, $wgBlockOpenProxies, $wgProxyKey; |
30 | 33 | |
31 | | - if( !$wgBlockOpenProxies || $wgRequest->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) { |
32 | | - $wgOut->addWikiMsg( 'proxyblocker-disabled' ); |
33 | | - return; |
34 | | - } |
| 34 | + $this->setHeaders(); |
| 35 | + $this->outputHeader(); |
35 | 36 | |
36 | | - $blockerName = wfMsg( "proxyblocker" ); |
37 | | - $reason = wfMsg( "proxyblockreason" ); |
| 37 | + $ip = wfGetIP(); |
| 38 | + if( !$wgBlockOpenProxies || $wgRequest->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) { |
| 39 | + $wgOut->addWikiMsg( 'proxyblocker-disabled' ); |
| 40 | + return; |
| 41 | + } |
38 | 42 | |
39 | | - $u = User::newFromName( $blockerName ); |
40 | | - $id = $u->idForName(); |
41 | | - if ( !$id ) { |
42 | | - $u = User::newFromName( $blockerName ); |
43 | | - $u->addToDatabase(); |
44 | | - $u->setPassword( bin2hex( mt_rand(0, 0x7fffffff ) ) ); |
45 | | - $u->saveSettings(); |
46 | | - $id = $u->getID(); |
47 | | - } |
| 43 | + $user = User::newFromName( wfMsgForContent( 'proxyblocker' ) ); |
| 44 | + if ( !$user->isLoggedIn() ) { |
| 45 | + $user->addToDatabase(); |
| 46 | + } |
| 47 | + $id = $user->getId(); |
| 48 | + $reason = wfMsg( 'proxyblockreason' ); |
48 | 49 | |
49 | | - $block = new Block( $ip, 0, $id, $reason, wfTimestampNow() ); |
50 | | - $block->insert(); |
| 50 | + $block = new Block( $ip, 0, $id, $reason, wfTimestampNow() ); |
| 51 | + $block->insert(); |
51 | 52 | |
52 | | - $wgOut->addWikiMsg( "proxyblocksuccess" ); |
| 53 | + $wgOut->addWikiMsg( 'proxyblocksuccess' ); |
| 54 | + } |
53 | 55 | } |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | |
183 | 183 | # Unlisted / redirects |
184 | 184 | 'Blankpage' => 'SpecialBlankpage', |
185 | | - 'Blockme' => array( 'UnlistedSpecialPage', 'Blockme' ), |
| 185 | + 'Blockme' => 'SpecialBlockme', |
186 | 186 | 'Emailuser' => 'SpecialEmailUser', |
187 | 187 | 'Listadmins' => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ), |
188 | 188 | 'Listbots' => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ), |