r48005 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48004‎ | r48005 | r48006 >
Date:01:33, 4 March 2009
Author:werdna
Status:ok
Tags:
Comment:
GlobalBlocking overhaul:
-- Move GlobalBlocking class into its own file.
-- Abstract blocking logic to the GlobalBlocking class.
-- Introduce block "modification" as in core.
-- Cleanup log entries:
-- Weren't showing anon-only flag.
-- Use User:IP instead of Special:Contributions/IP
-- Code quality, removal of obsolete comments.
-- A few miscellaneous bugfixes.
Modified paths:
  • /trunk/extensions/GlobalBlocking/GlobalBlocking.i18n.php (modified) (history)
  • /trunk/extensions/GlobalBlocking/GlobalBlocking.php (modified) (history)
  • /trunk/extensions/GlobalBlocking/SpecialGlobalBlock.php (modified) (history)
  • /trunk/extensions/GlobalBlocking/SpecialGlobalBlockList.php (modified) (history)
  • /trunk/extensions/GlobalBlocking/SpecialGlobalBlockStatus.php (modified) (history)
  • /trunk/extensions/GlobalBlocking/SpecialRemoveGlobalBlock.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GlobalBlocking/GlobalBlocking.php
@@ -40,6 +40,8 @@
4141 $wgAutoloadClasses['ApiQueryGlobalBlocks'] = "$dir/ApiQueryGlobalBlocks.php";
4242 $wgAPIListModules['globalblocks'] = 'ApiQueryGlobalBlocks';
4343
 44+$wgAutoloadClasses['GlobalBlocking'] = "$dir/GlobalBlocking.class.php";
 45+
4446 $wgSpecialPageGroups['GlobalBlock'] = 'users';
4547 $wgSpecialPageGroups['GlobalBlockList'] = 'users';
4648 $wgSpecialPageGroups['GlobalBlockStatus'] = 'users';
@@ -50,9 +52,11 @@
5153 $wgLogNames['gblblock'] = 'globalblocking-logpage';
5254 $wgLogHeaders['gblblock'] = 'globalblocking-logpagetext';
5355 $wgLogActions['gblblock/gblock'] = 'globalblocking-block-logentry';
 56+$wgLogActions['gblblock/gblock2'] = 'globalblocking-block2-logentry';
5457 $wgLogActions['gblblock/gunblock'] = 'globalblocking-unblock-logentry';
5558 $wgLogActions['gblblock/whitelist'] = 'globalblocking-whitelist-logentry';
5659 $wgLogActions['gblblock/dwhitelist'] = 'globalblocking-dewhitelist-logentry'; // Stupid logging table doesn't like >16 chars
 60+$wgLogActions['gblblock/modify'] = 'globalblocking-modify-logentry';
5761
5862 ## Permissions
5963 $wgGroupPermissions['steward']['globalblock'] = true;
@@ -79,161 +83,3 @@
8084 */
8185 $wgApplyGlobalBlocks = true;
8286
83 -class GlobalBlocking {
84 - static function getUserPermissionsErrors( &$title, &$user, $action, &$result ) {
85 - global $wgApplyGlobalBlocks;
86 - if ($action == 'read' || !$wgApplyGlobalBlocks) {
87 - return true;
88 - }
89 - $ip = wfGetIp();
90 - $blockError = self::getUserBlockErrors( $user, $ip );
91 - if( !empty($blockError) ) {
92 - $result[] = $blockError;
93 - return false;
94 - }
95 - return true;
96 - }
97 -
98 - static function isBlockedGlobally( &$user, $ip, &$blocked ) {
99 - $blockError = self::getUserBlockErrors( $user, $ip );
100 - if( $blockError ) {
101 - $blocked = true;
102 - return false;
103 - }
104 - return true;
105 - }
106 -
107 - static function getUserBlockErrors( $user, $ip ) {
108 - $dbr = GlobalBlocking::getGlobalBlockingSlave();
109 -
110 - $hex_ip = IP::toHex( $ip );
111 - $ip_pattern = substr( $hex_ip, 0, 4 ) . '%'; // Don't bother checking blocks out of this /16.
112 -
113 - $conds = array(
114 - 'gb_range_end>='.$dbr->addQuotes($hex_ip), // This block in the given range.
115 - 'gb_range_start<='.$dbr->addQuotes($hex_ip),
116 - 'gb_range_start like ' . $dbr->addQuotes( $ip_pattern ),
117 - 'gb_expiry>'.$dbr->addQuotes($dbr->timestamp(wfTimestampNow()))
118 - );
119 -
120 - if ( !$user->isAnon() )
121 - $conds['gb_anon_only'] = 0;
122 -
123 - // Get the block
124 - if ($block = $dbr->selectRow( 'globalblocks', '*', $conds, __METHOD__ )) {
125 -
126 - // Check for local whitelisting
127 - if (GlobalBlocking::getWhitelistInfo( $block->gb_id ) ) {
128 - // Block has been whitelisted.
129 - return array();
130 - }
131 -
132 - if ( $user->isAllowed( 'ipblock-exempt' ) ) {
133 - // User is exempt from IP blocks.
134 - return array();
135 - }
136 -
137 - $expiry = Block::formatExpiry( $block->gb_expiry );
138 -
139 - wfLoadExtensionMessages( 'GlobalBlocking' );
140 -
141 - $display_wiki = self::getWikiName( $block->gb_by_wiki );
142 - $user_display = self::maybeLinkUserpage( $block->gb_by_wiki, $block->gb_by );
143 -
144 - return array('globalblocking-blocked', $user_display, $display_wiki, $block->gb_reason, $expiry);
145 - }
146 - return array();
147 - }
148 -
149 - static function getGlobalBlockingMaster() {
150 - global $wgGlobalBlockingDatabase;
151 - return wfGetDB( DB_MASTER, 'globalblocking', $wgGlobalBlockingDatabase );
152 - }
153 -
154 - static function getGlobalBlockingSlave() {
155 - global $wgGlobalBlockingDatabase;
156 - return wfGetDB( DB_SLAVE, 'globalblocking', $wgGlobalBlockingDatabase );
157 - }
158 -
159 - static function getGlobalBlockId( $ip ) {
160 - $dbr = GlobalBlocking::getGlobalBlockingSlave();
161 -
162 - if (!($row = $dbr->selectRow( 'globalblocks', 'gb_id', array( 'gb_address' => $ip ), __METHOD__ )))
163 - return 0;
164 -
165 - return $row->gb_id;
166 - }
167 -
168 - static function purgeExpired() {
169 - // This is expensive. It involves opening a connection to a new master,
170 - // and doing a write query. We should only do it when a connection to the master
171 - // is already open (currently, when a global block is made).
172 - $dbw = GlobalBlocking::getGlobalBlockingMaster();
173 -
174 - // Stand-alone transaction.
175 - $dbw->begin();
176 - $dbw->delete( 'globalblocks', array('gb_expiry<'.$dbw->addQuotes($dbw->timestamp())), __METHOD__ );
177 - $dbw->commit();
178 -
179 - // Purge the global_block_whitelist table.
180 - // We can't be perfect about this without an expensive check on the master
181 - // for every single global block. However, we can be clever about it and store
182 - // the expiry of global blocks in the global_block_whitelist table.
183 - // That way, most blocks will fall out of the table naturally when they expire.
184 - $dbw = wfGetDB( DB_MASTER );
185 - $dbw->begin();
186 - $dbw->delete( 'global_block_whitelist', array( 'gbw_expiry<'.$dbw->addQuotes($dbw->timestamp())), __METHOD__ );
187 - $dbw->commit();
188 - }
189 -
190 - static function getWhitelistInfo( $id = null, $address = null ) {
191 - $conds = array();
192 - if ($id != null) {
193 - $conds = array( 'gbw_id' => $id );
194 - } elseif ($address != null) {
195 - $conds = array( 'gbw_address' => $address );
196 - } else {
197 - //WTF?
198 - throw new MWException( "Neither Block IP nor Block ID given for retrieving whitelist status" );
199 - }
200 -
201 - $dbr = wfGetDB( DB_SLAVE );
202 - $row = $dbr->selectRow( 'global_block_whitelist', array( 'gbw_by', 'gbw_reason' ), $conds, __METHOD__ );
203 -
204 - if ($row == false) {
205 - // Not whitelisted.
206 - return false;
207 - } else {
208 - // Block has been whitelisted
209 - return array( 'user' => $row->gbw_by, 'reason' => $row->gbw_reason );
210 - }
211 - }
212 -
213 - static function getWhitelistInfoByIP( $block_ip ) {
214 - return self::getWhitelistInfo( null, $block_ip );
215 - }
216 -
217 - static function getWikiName( $wiki_id ) {
218 - if (class_exists('WikiMap')) {
219 - // We can give more info than just the wiki id!
220 - $wiki = WikiMap::getWiki( $wiki_id );
221 -
222 - if ($wiki) {
223 - return $wiki->getDisplayName();
224 - }
225 - }
226 -
227 - return $wiki_id;
228 - }
229 -
230 - static function maybeLinkUserpage( $wiki_id, $user ) {
231 - if (class_exists( 'WikiMap')) {
232 - $wiki = WikiMap::getWiki( $wiki_id );
233 -
234 - if ($wiki) {
235 - return "[".$wiki->getUrl( "User:$user" )." $user]";
236 - }
237 - }
238 - return $user;
239 - }
240 -}
Index: trunk/extensions/GlobalBlocking/SpecialRemoveGlobalBlock.php
@@ -88,7 +88,7 @@
8989 $dbw->delete( 'globalblocks', array( 'gb_id' => $id ), __METHOD__ );
9090
9191 $page = new LogPage( 'gblblock' );
92 - $page->addEntry( 'gunblock', SpecialPage::getTitleFor( 'Contributions', $ip ), $this->mReason );
 92+ $page->addEntry( 'gunblock', Title::makeTitleSafe( NS_USER, $ip ), $this->mReason );
9393
9494 $successmsg = wfMsgExt( 'globalblocking-unblock-unblocked', array( 'parse' ), $ip, $id );
9595 $wgOut->addHTML( $successmsg );
Index: trunk/extensions/GlobalBlocking/SpecialGlobalBlock.php
@@ -21,7 +21,6 @@
2222 $wgOut->setArticleRelated( false );
2323 $wgOut->enableClientCache( false );
2424
25 - // We expect one error message, the "pages in the special namespace cannot be edited" one.
2625 if (!$this->userCanExecute( $wgUser )) {
2726 $this->displayRestrictionError();
2827 return;
@@ -37,26 +36,58 @@
3837 return;
3938 }
4039 }
 40+
 41+ if ($this->mModifyForm) {
 42+ $dbr = GlobalBlocking::getGlobalBlockingSlave();
 43+ $block = $dbr->selectRow( 'globalblocks',
 44+ '*',
 45+ array( 'gb_address' => $this->mAddress ),
 46+ __METHOD__ );
 47+ if ($block->gb_expiry == 'infinity') {
 48+ $this->mExpirySelection = 'indefinite';
 49+ } else {
 50+ $this->mExpiry = wfTimestamp( TS_ISO_8601, $block->gb_expiry );
 51+ }
 52+ $this->mAnonOnly = $block->gb_anon_only;
 53+ $this->mReason = $block->gb_reason;
 54+ }
 55+
 56+ $errorstr = null;
4157
 58+ if (is_array($errors) && count($errors)>0) {
 59+ $errorstr = $this->formatErrors( $errors );
 60+ }
 61+
 62+ $this->form( $errorstr );
 63+ }
 64+
 65+ function formatErrors( $errors ) {
4266 $errorstr = '';
43 -
44 - if (is_array($errors) && count($errors)>0) {
45 - foreach ( $errors as $error ) {
46 - if (is_array($error)) {
47 - $msg = array_shift($error);
48 - } else {
49 - $msg = $error;
50 - $error = array();
51 - }
52 - $errorstr .= Xml::tags( 'li', null, wfMsgExt( $msg, array( 'parseinline' ), $error ) );
 67+ foreach ( $errors as $error ) {
 68+ if (is_array($error)) {
 69+ $msg = array_shift($error);
 70+ } else {
 71+ $msg = $error;
 72+ $error = array();
5373 }
 74+ $errorstr .= Xml::tags( 'li', null, wfMsgExt( $msg, array( 'parseinline' ), $error ) );
5475
55 - $errorstr = wfMsgExt( 'globalblocking-block-errors', array( 'parse' ), array( count( $errors ) ) ) . Xml::tags( 'ul', null, $errorstr );
56 -
57 - $errorstr = Xml::tags( 'div', array( 'class' => 'error' ), $errorstr );
 76+ // Special case
 77+ if ($msg == 'globalblocking-block-alreadyblocked') {
 78+ $this->mModifyForm = true;
 79+ }
5880 }
5981
60 - $this->form( $errorstr );
 82+ $errorstr = Xml::tags( 'ul', null, $errorstr );
 83+ $header = wfMsgExt( 'globalblocking-block-errors',
 84+ 'parse',
 85+ array(count( $errors ))
 86+ );
 87+ $errorstr = "$header\n$errorstr";
 88+
 89+ $errorstr = Xml::tags( 'div', array( 'class' => 'error' ), $errorstr );
 90+
 91+ return $errorstr;
6192 }
6293
6394 function loadParameters() {
@@ -67,81 +98,42 @@
6899 if ($this->mExpiry == 'other') {
69100 $this->mExpiry = $wgRequest->getText( 'wpExpiryOther' );
70101 }
71 - $this->mAnonOnly = $wgRequest->getCheck( 'wpAnonOnly' );
 102+ $this->mAnonOnly = $wgRequest->getBool( 'wpAnonOnly' );
 103+ $this->mModify = $wgRequest->getBool( 'wpModify' );
 104+ $this->mModifyForm = $wgRequest->getCheck( 'modify' );
72105 }
73106
74107 function trySubmit() {
75 - global $wgUser,$wgDBname,$wgOut;
76 - $errors = array();
 108+ global $wgOut, $wgUser;
 109+ $options = array();
 110+ $skin = $wgUser->getSkin();
77111
78 - ## Purge expired blocks.
79 - GlobalBlocking::purgeExpired();
80 -
81 - ## Validate input
82 - $ip = IP::sanitizeIP( $this->mAddress );
83 -
84 - if (!IP::isIPAddress($ip)) {
85 - // Invalid IP address.
86 - $errors[] = array( 'globalblocking-block-ipinvalid', $ip );
87 - }
88 -
89 - $expiry = Block::parseExpiryInput( $this->mExpiry );
 112+ if ($this->mAnonOnly)
 113+ $options[] = 'anon-only';
 114+ if ($this->mModify)
 115+ $options[] = 'modify';
90116
91 - if ( false === $expiry ) {
92 - $errors[] = array( 'globalblocking-block-expiryinvalid', $this->mExpiry );
93 - }
 117+ $errors = GlobalBlocking::block( $this->mAddress, $this->mReason, $this->mExpiry, $options );
94118
95 - if (GlobalBlocking::getGlobalBlockId($ip)) {
96 - $errors[] = array( 'globalblocking-block-alreadyblocked', $ip );
 119+ if ( count($errors) ) {
 120+ return $errors;
97121 }
98 -
99 - // Check for too-big ranges.
100 - list( $range_start, $range_end ) = IP::parseRange( $ip );
101122
102 - if (substr( $range_start, 0, 4 ) != substr( $range_end, 0, 4 )) {
103 - // Range crosses a /16 boundary.
104 - $errors[] = array( 'globalblocking-block-bigrange', $ip );
 123+ if ($this->mModify) {
 124+ $textMessage = 'globalblocking-modify-success';
 125+ $subMessage = 'globalblocking-modify-successsub';
 126+ } else {
 127+ $textMessage = 'globalblocking-block-success';
 128+ $subMessage = 'globalblocking-block-successsub';
105129 }
106130
107 - // Normalise the range
108 - if ($range_start != $range_end) {
109 - $ip = Block::normaliseRange( $ip );
110 - }
 131+ $wgOut->addWikitext( wfMsg($textMessage, $this->mAddress ) );
 132+ $wgOut->setSubtitle( wfMsg( $subMessage ) );
111133
112 - if (count($errors)>0)
113 - return $errors;
114 -
115 - // We're a-ok.
116 - $dbw = GlobalBlocking::getGlobalBlockingMaster();
117 -
118 - $row = array();
119 - $row['gb_address'] = $ip;
120 - $row['gb_by'] = $wgUser->getName();
121 - $row['gb_by_wiki'] = $wgDBname;
122 - $row['gb_reason'] = $this->mReason;
123 - $row['gb_timestamp'] = $dbw->timestamp(wfTimestampNow());
124 - $row['gb_anon_only'] = $this->mAnonOnly;
125 - $row['gb_expiry'] = Block::encodeExpiry($expiry, $dbw);
126 - list( $row['gb_range_start'], $row['gb_range_end'] ) = array( $range_start, $range_end );
127 -
128 - $dbw->insert( 'globalblocks', $row, __METHOD__ );
129 -
130 - // Log it.
131 - $logParams = array();
132 - $logParams[] = $this->mExpiry;
133 - if ($this->mAnonOnly)
134 - $logParams[] = wfMsgForContent( 'globalblocking-list-anononly' );
135 -
136 - $page = new LogPage( 'gblblock' );
137 -
138 - $page->addEntry( 'gblock', SpecialPage::getTitleFor( 'Contributions', $ip ), $this->mReason, $logParams );
139 -
140 - $wgOut->addWikitext( wfMsg('globalblocking-block-success', $ip ) );
141 - $wgOut->setSubtitle( wfMsg( 'globalblocking-block-successsub' ) );
142 -
143 - $link = $wgUser->getSkin()->makeKnownLinkObj( SpecialPage::getTitleFor( 'GlobalBlockList' ), wfMsg( 'globalblocking-return' ) );
 134+ $link = $skin->link( SpecialPage::getTitleFor( 'GlobalBlockList' ),
 135+ wfMsg( 'globalblocking-return' ) );
144136 $wgOut->addHTML( $link );
145 -
 137+
146138 return array();
147139 }
148140
@@ -151,14 +143,17 @@
152144 $form = '';
153145
154146 // Introduction
155 - $wgOut->addWikiMsg( 'globalblocking-block-intro' );
 147+ if ($this->mModifyForm) {
 148+ $wgOut->addWikiMsg( 'globalblocking-modify-intro' );
 149+ } else {
 150+ $wgOut->addWikiMsg( 'globalblocking-block-intro' );
 151+ }
156152
157153 // Add errors
158154 $wgOut->addHTML( $error );
159155
160156 $form .= Xml::openElement( 'fieldset' ) .
161157 Xml::element( 'legend', null, wfMsg( 'globalblocking-block-legend' ) );
162 -
163158 $form .= Xml::openElement( 'form', array( 'method' => 'post', 'action' => $wgScript, 'name' => 'uluser' ) );
164159 $form .= Xml::hidden( 'title', SpecialPage::getTitleFor('GlobalBlock')->getPrefixedText() );
165160
@@ -189,12 +184,15 @@
190185 $fields['globalblocking-block-options'] = Xml::checkLabel( wfMsg( 'ipbanononly' ), 'wpAnonOnly', 'wpAnonOnly', $this->mAnonOnly );
191186
192187 // Build a form.
193 - $form .= Xml::buildForm( $fields, 'globalblocking-block-submit' );
 188+ $submitMsg = $this->mModifyForm
 189+ ? 'globalblocking-modify-submit' : 'globalblocking-block-submit';
 190+ $form .= Xml::buildForm( $fields, $submitMsg );
194191
195192 $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken() );
 193+ if ($this->mModifyForm)
 194+ $form .= Xml::hidden( 'wpModify', 1 );
196195
197196 $form .= Xml::closeElement( 'form' );
198 -
199197 $form .= Xml::closeElement( 'fieldset' );
200198
201199 $wgOut->addHTML( $form );
Index: trunk/extensions/GlobalBlocking/SpecialGlobalBlockStatus.php
@@ -108,7 +108,7 @@
109109 $dbw->replace( 'global_block_whitelist', array( 'gbw_id' ), $row, __METHOD__ );
110110
111111 $page = new LogPage( 'gblblock' );
112 - $page->addEntry( 'whitelist', SpecialPage::getTitleFor( 'Contributions', $ip ), $this->mReason );
 112+ $page->addEntry( 'whitelist', Title::makeTitleSafe( NS_USER, $ip ), $this->mReason );
113113
114114 $wgOut->addWikiMsg( 'globalblocking-whitelist-whitelisted', $ip, $id );
115115 } else {
@@ -116,7 +116,7 @@
117117 $dbw->delete( 'global_block_whitelist', array( 'gbw_id' => $id ), __METHOD__ );
118118
119119 $page = new LogPage( 'gblblock' );
120 - $page->addEntry( 'dwhitelist', SpecialPage::getTitleFor( 'Contributions', $ip ), $this->mReason );
 120+ $page->addEntry( 'dwhitelist', Title::makeTitleSafe( NS_USER, $ip ), $this->mReason );
121121 $wgOut->addWikiMsg( 'globalblocking-whitelist-dewhitelisted', $ip, $id );
122122 }
123123
Index: trunk/extensions/GlobalBlocking/GlobalBlocking.i18n.php
@@ -14,6 +14,7 @@
1515 'globalblocking-desc' => '[[Special:GlobalBlock|Allows]] IP addresses to be [[Special:GlobalBlockList|blocked across multiple wikis]]',
1616 'globalblocking-block' => 'Globally block an IP address',
1717 'globalblocking-expiry-options' => '-', # do not translate or duplicate this message to other languages
 18+ 'globalblocking-modify-intro' => 'You can use this form to change the settings of a global block.',
1819 'globalblocking-block-intro' => 'You can use this page to block an IP address on all wikis.',
1920 'globalblocking-block-reason' => 'Reason for this block:',
2021 'globalblocking-block-expiry' => 'Block expiry:',
@@ -26,10 +27,14 @@
2728 Please note that you cannot enter a user name!',
2829 'globalblocking-block-expiryinvalid' => 'The expiry you entered ($1) is invalid.',
2930 'globalblocking-block-submit' => 'Block this IP address globally',
 31+ 'globalblocking-modify-submit' => 'Modify this global block',
3032 'globalblocking-block-success' => 'The IP address $1 has been successfully blocked on all projects.',
 33+ 'globalblocking-modify-success' => 'The global block on $1 has been successfully modified',
3134 'globalblocking-block-successsub' => 'Global block successful',
 35+ 'globalblocking-modify-successsub' => 'Global block modified successfully',
3236 'globalblocking-block-alreadyblocked' => 'The IP address $1 is already blocked globally.
33 -You can view the existing block on the [[Special:GlobalBlockList|list of global blocks]].',
 37+You can view the existing block on the [[Special:GlobalBlockList|list of global blocks]],
 38+or modify the settings of the existing block by re-submitting this form.',
3439 'globalblocking-block-bigrange' => 'The range you specified ($1) is too big to block.
3540 You may block, at most, 65,536 addresses (/16 ranges)',
3641
@@ -48,6 +53,7 @@
4954 'globalblocking-list-unblock' => 'remove',
5055 'globalblocking-list-whitelisted' => 'locally disabled by $1: $2',
5156 'globalblocking-list-whitelist' => 'local status',
 57+ 'globalblocking-list-modify' => 'modify',
5258 'globalblocking-goto-block' => 'Globally block an IP address',
5359 'globalblocking-goto-unblock' => 'Remove a global block',
5460 'globalblocking-goto-status' => 'Change local status for a global block',
@@ -93,9 +99,13 @@
94100 It should be noted that global blocks can be made and removed on other wikis, and that these global blocks may affect this wiki.
95101 To view all active global blocks, you may view the [[Special:GlobalBlockList|global block list]].',
96102 'globalblocking-block-logentry' => 'globally blocked [[$1]] with an expiry time of $2',
 103+ 'globalblocking-block2-logentry' => 'globally blocked [[$1]] ($2)',
97104 'globalblocking-unblock-logentry' => 'removed global block on [[$1]]',
98105 'globalblocking-whitelist-logentry' => 'disabled the global block on [[$1]] locally',
99106 'globalblocking-dewhitelist-logentry' => 're-enabled the global block on [[$1]] locally',
 107+ 'globalblocking-modify-logentry' => 'modified the global block on [[$1]] ($2)',
 108+ 'globalblocking-logentry-expiry' => 'expires $1',
 109+ 'globalblocking-logentry-noexpiry' => 'no expiry set',
100110
101111 'globalblocklist' => 'List of globally blocked IP addresses',
102112 'globalblock' => 'Globally block an IP address',
Index: trunk/extensions/GlobalBlocking/SpecialGlobalBlockList.php
@@ -1,6 +1,4 @@
22 <?php
3 -if ( ! defined( 'MEDIAWIKI' ) )
4 - die();
53
64 class SpecialGlobalBlockList extends SpecialPage {
75 public $mSearchIP, $mSearch;
@@ -157,25 +155,43 @@
158156 $options[] = wfMsg('globalblocking-list-anononly');
159157
160158 $titleObj = SpecialPage::getTitleFor( "GlobalBlockList" );
161 - $whitelistTitle = SpecialPage::getTitleFor( "GlobalBlockStatus" );
162 - $unblockTitle = SpecialPage::getTitleFor( "RemoveGlobalBlock" );
163159
164160 ## Do afterthoughts (comment, links for admins)
165161 $info = array();
166162 $info[] = $sk->commentBlock($row->gb_reason);
167163
168164 if( $wgUser->isAllowed( 'globalunblock' ) ) {
169 - $info[] = '(' . $sk->makeKnownLinkObj($unblockTitle,
170 - wfMsg( 'globalblocking-list-unblock' ),
171 - 'address=' . urlencode( $row->gb_address ) ) . ')';
 165+ $unblockTitle = SpecialPage::getTitleFor( "RemoveGlobalBlock" );
 166+ $info[] = '(' . $sk->link($unblockTitle,
 167+ wfMsgExt( 'globalblocking-list-unblock', 'parseinline' ),
 168+ array(),
 169+ array( 'address' => $row->gb_address )
 170+ ) .
 171+ ')';
172172 }
173173
174174 if( $wgUser->isAllowed( 'globalblock-whitelist' ) ) {
175 - $info[] = '(' . $sk->makeKnownLinkObj($whitelistTitle,
176 - wfMsg( 'globalblocking-list-whitelist' ),
177 - 'address=' . urlencode( $row->gb_address ) ) . ')';
 175+ $whitelistTitle = SpecialPage::getTitleFor( "GlobalBlockStatus" );
 176+ $info[] = '(' . $sk->link($whitelistTitle,
 177+ wfMsgExt( 'globalblocking-list-whitelist', 'parseinline' ),
 178+ array(),
 179+ array( 'address' => $row->gb_address )
 180+ ) .
 181+ ')';
178182 }
179183
 184+ if ( $wgUser->isAllowed( 'globalblock' ) ) {
 185+ $reblockTitle = SpecialPage::getTitleFor( 'GlobalBlock' );
 186+ $msg = wfMsgExt( 'globalblocking-list-modify', 'parseinline' );
 187+ $link = $sk->link(
 188+ $reblockTitle,
 189+ $msg,
 190+ array(),
 191+ array( 'wpAddress' => $row->gb_address, 'modify' => 1 )
 192+ );
 193+ $info[] = "($link)";
 194+ }
 195+
180196 ## Userpage link / Info on originating wiki
181197 $display_wiki = GlobalBlocking::getWikiName( $row->gb_by_wiki );
182198 $user_display = GlobalBlocking::maybeLinkUserpage( $row->gb_by_wiki, $row->gb_by );

Status & tagging log