Index: trunk/extensions/GlobalBlocking/GlobalBlocking.php |
— | — | @@ -40,6 +40,8 @@ |
41 | 41 | $wgAutoloadClasses['ApiQueryGlobalBlocks'] = "$dir/ApiQueryGlobalBlocks.php"; |
42 | 42 | $wgAPIListModules['globalblocks'] = 'ApiQueryGlobalBlocks'; |
43 | 43 | |
| 44 | +$wgAutoloadClasses['GlobalBlocking'] = "$dir/GlobalBlocking.class.php"; |
| 45 | + |
44 | 46 | $wgSpecialPageGroups['GlobalBlock'] = 'users'; |
45 | 47 | $wgSpecialPageGroups['GlobalBlockList'] = 'users'; |
46 | 48 | $wgSpecialPageGroups['GlobalBlockStatus'] = 'users'; |
— | — | @@ -50,9 +52,11 @@ |
51 | 53 | $wgLogNames['gblblock'] = 'globalblocking-logpage'; |
52 | 54 | $wgLogHeaders['gblblock'] = 'globalblocking-logpagetext'; |
53 | 55 | $wgLogActions['gblblock/gblock'] = 'globalblocking-block-logentry'; |
| 56 | +$wgLogActions['gblblock/gblock2'] = 'globalblocking-block2-logentry'; |
54 | 57 | $wgLogActions['gblblock/gunblock'] = 'globalblocking-unblock-logentry'; |
55 | 58 | $wgLogActions['gblblock/whitelist'] = 'globalblocking-whitelist-logentry'; |
56 | 59 | $wgLogActions['gblblock/dwhitelist'] = 'globalblocking-dewhitelist-logentry'; // Stupid logging table doesn't like >16 chars |
| 60 | +$wgLogActions['gblblock/modify'] = 'globalblocking-modify-logentry'; |
57 | 61 | |
58 | 62 | ## Permissions |
59 | 63 | $wgGroupPermissions['steward']['globalblock'] = true; |
— | — | @@ -79,161 +83,3 @@ |
80 | 84 | */ |
81 | 85 | $wgApplyGlobalBlocks = true; |
82 | 86 | |
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 @@ |
89 | 89 | $dbw->delete( 'globalblocks', array( 'gb_id' => $id ), __METHOD__ ); |
90 | 90 | |
91 | 91 | $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 ); |
93 | 93 | |
94 | 94 | $successmsg = wfMsgExt( 'globalblocking-unblock-unblocked', array( 'parse' ), $ip, $id ); |
95 | 95 | $wgOut->addHTML( $successmsg ); |
Index: trunk/extensions/GlobalBlocking/SpecialGlobalBlock.php |
— | — | @@ -21,7 +21,6 @@ |
22 | 22 | $wgOut->setArticleRelated( false ); |
23 | 23 | $wgOut->enableClientCache( false ); |
24 | 24 | |
25 | | - // We expect one error message, the "pages in the special namespace cannot be edited" one. |
26 | 25 | if (!$this->userCanExecute( $wgUser )) { |
27 | 26 | $this->displayRestrictionError(); |
28 | 27 | return; |
— | — | @@ -37,26 +36,58 @@ |
38 | 37 | return; |
39 | 38 | } |
40 | 39 | } |
| 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; |
41 | 57 | |
| 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 ) { |
42 | 66 | $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(); |
53 | 73 | } |
| 74 | + $errorstr .= Xml::tags( 'li', null, wfMsgExt( $msg, array( 'parseinline' ), $error ) ); |
54 | 75 | |
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 | + } |
58 | 80 | } |
59 | 81 | |
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; |
61 | 92 | } |
62 | 93 | |
63 | 94 | function loadParameters() { |
— | — | @@ -67,81 +98,42 @@ |
68 | 99 | if ($this->mExpiry == 'other') { |
69 | 100 | $this->mExpiry = $wgRequest->getText( 'wpExpiryOther' ); |
70 | 101 | } |
71 | | - $this->mAnonOnly = $wgRequest->getCheck( 'wpAnonOnly' ); |
| 102 | + $this->mAnonOnly = $wgRequest->getBool( 'wpAnonOnly' ); |
| 103 | + $this->mModify = $wgRequest->getBool( 'wpModify' ); |
| 104 | + $this->mModifyForm = $wgRequest->getCheck( 'modify' ); |
72 | 105 | } |
73 | 106 | |
74 | 107 | function trySubmit() { |
75 | | - global $wgUser,$wgDBname,$wgOut; |
76 | | - $errors = array(); |
| 108 | + global $wgOut, $wgUser; |
| 109 | + $options = array(); |
| 110 | + $skin = $wgUser->getSkin(); |
77 | 111 | |
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'; |
90 | 116 | |
91 | | - if ( false === $expiry ) { |
92 | | - $errors[] = array( 'globalblocking-block-expiryinvalid', $this->mExpiry ); |
93 | | - } |
| 117 | + $errors = GlobalBlocking::block( $this->mAddress, $this->mReason, $this->mExpiry, $options ); |
94 | 118 | |
95 | | - if (GlobalBlocking::getGlobalBlockId($ip)) { |
96 | | - $errors[] = array( 'globalblocking-block-alreadyblocked', $ip ); |
| 119 | + if ( count($errors) ) { |
| 120 | + return $errors; |
97 | 121 | } |
98 | | - |
99 | | - // Check for too-big ranges. |
100 | | - list( $range_start, $range_end ) = IP::parseRange( $ip ); |
101 | 122 | |
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'; |
105 | 129 | } |
106 | 130 | |
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 ) ); |
111 | 133 | |
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' ) ); |
144 | 136 | $wgOut->addHTML( $link ); |
145 | | - |
| 137 | + |
146 | 138 | return array(); |
147 | 139 | } |
148 | 140 | |
— | — | @@ -151,14 +143,17 @@ |
152 | 144 | $form = ''; |
153 | 145 | |
154 | 146 | // 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 | + } |
156 | 152 | |
157 | 153 | // Add errors |
158 | 154 | $wgOut->addHTML( $error ); |
159 | 155 | |
160 | 156 | $form .= Xml::openElement( 'fieldset' ) . |
161 | 157 | Xml::element( 'legend', null, wfMsg( 'globalblocking-block-legend' ) ); |
162 | | - |
163 | 158 | $form .= Xml::openElement( 'form', array( 'method' => 'post', 'action' => $wgScript, 'name' => 'uluser' ) ); |
164 | 159 | $form .= Xml::hidden( 'title', SpecialPage::getTitleFor('GlobalBlock')->getPrefixedText() ); |
165 | 160 | |
— | — | @@ -189,12 +184,15 @@ |
190 | 185 | $fields['globalblocking-block-options'] = Xml::checkLabel( wfMsg( 'ipbanononly' ), 'wpAnonOnly', 'wpAnonOnly', $this->mAnonOnly ); |
191 | 186 | |
192 | 187 | // 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 ); |
194 | 191 | |
195 | 192 | $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken() ); |
| 193 | + if ($this->mModifyForm) |
| 194 | + $form .= Xml::hidden( 'wpModify', 1 ); |
196 | 195 | |
197 | 196 | $form .= Xml::closeElement( 'form' ); |
198 | | - |
199 | 197 | $form .= Xml::closeElement( 'fieldset' ); |
200 | 198 | |
201 | 199 | $wgOut->addHTML( $form ); |
Index: trunk/extensions/GlobalBlocking/SpecialGlobalBlockStatus.php |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | $dbw->replace( 'global_block_whitelist', array( 'gbw_id' ), $row, __METHOD__ ); |
110 | 110 | |
111 | 111 | $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 ); |
113 | 113 | |
114 | 114 | $wgOut->addWikiMsg( 'globalblocking-whitelist-whitelisted', $ip, $id ); |
115 | 115 | } else { |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | $dbw->delete( 'global_block_whitelist', array( 'gbw_id' => $id ), __METHOD__ ); |
118 | 118 | |
119 | 119 | $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 ); |
121 | 121 | $wgOut->addWikiMsg( 'globalblocking-whitelist-dewhitelisted', $ip, $id ); |
122 | 122 | } |
123 | 123 | |
Index: trunk/extensions/GlobalBlocking/GlobalBlocking.i18n.php |
— | — | @@ -14,6 +14,7 @@ |
15 | 15 | 'globalblocking-desc' => '[[Special:GlobalBlock|Allows]] IP addresses to be [[Special:GlobalBlockList|blocked across multiple wikis]]', |
16 | 16 | 'globalblocking-block' => 'Globally block an IP address', |
17 | 17 | '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.', |
18 | 19 | 'globalblocking-block-intro' => 'You can use this page to block an IP address on all wikis.', |
19 | 20 | 'globalblocking-block-reason' => 'Reason for this block:', |
20 | 21 | 'globalblocking-block-expiry' => 'Block expiry:', |
— | — | @@ -26,10 +27,14 @@ |
27 | 28 | Please note that you cannot enter a user name!', |
28 | 29 | 'globalblocking-block-expiryinvalid' => 'The expiry you entered ($1) is invalid.', |
29 | 30 | 'globalblocking-block-submit' => 'Block this IP address globally', |
| 31 | + 'globalblocking-modify-submit' => 'Modify this global block', |
30 | 32 | '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', |
31 | 34 | 'globalblocking-block-successsub' => 'Global block successful', |
| 35 | + 'globalblocking-modify-successsub' => 'Global block modified successfully', |
32 | 36 | '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.', |
34 | 39 | 'globalblocking-block-bigrange' => 'The range you specified ($1) is too big to block. |
35 | 40 | You may block, at most, 65,536 addresses (/16 ranges)', |
36 | 41 | |
— | — | @@ -48,6 +53,7 @@ |
49 | 54 | 'globalblocking-list-unblock' => 'remove', |
50 | 55 | 'globalblocking-list-whitelisted' => 'locally disabled by $1: $2', |
51 | 56 | 'globalblocking-list-whitelist' => 'local status', |
| 57 | + 'globalblocking-list-modify' => 'modify', |
52 | 58 | 'globalblocking-goto-block' => 'Globally block an IP address', |
53 | 59 | 'globalblocking-goto-unblock' => 'Remove a global block', |
54 | 60 | 'globalblocking-goto-status' => 'Change local status for a global block', |
— | — | @@ -93,9 +99,13 @@ |
94 | 100 | It should be noted that global blocks can be made and removed on other wikis, and that these global blocks may affect this wiki. |
95 | 101 | To view all active global blocks, you may view the [[Special:GlobalBlockList|global block list]].', |
96 | 102 | 'globalblocking-block-logentry' => 'globally blocked [[$1]] with an expiry time of $2', |
| 103 | + 'globalblocking-block2-logentry' => 'globally blocked [[$1]] ($2)', |
97 | 104 | 'globalblocking-unblock-logentry' => 'removed global block on [[$1]]', |
98 | 105 | 'globalblocking-whitelist-logentry' => 'disabled the global block on [[$1]] locally', |
99 | 106 | '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', |
100 | 110 | |
101 | 111 | 'globalblocklist' => 'List of globally blocked IP addresses', |
102 | 112 | 'globalblock' => 'Globally block an IP address', |
Index: trunk/extensions/GlobalBlocking/SpecialGlobalBlockList.php |
— | — | @@ -1,6 +1,4 @@ |
2 | 2 | <?php |
3 | | -if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
5 | 3 | |
6 | 4 | class SpecialGlobalBlockList extends SpecialPage { |
7 | 5 | public $mSearchIP, $mSearch; |
— | — | @@ -157,25 +155,43 @@ |
158 | 156 | $options[] = wfMsg('globalblocking-list-anononly'); |
159 | 157 | |
160 | 158 | $titleObj = SpecialPage::getTitleFor( "GlobalBlockList" ); |
161 | | - $whitelistTitle = SpecialPage::getTitleFor( "GlobalBlockStatus" ); |
162 | | - $unblockTitle = SpecialPage::getTitleFor( "RemoveGlobalBlock" ); |
163 | 159 | |
164 | 160 | ## Do afterthoughts (comment, links for admins) |
165 | 161 | $info = array(); |
166 | 162 | $info[] = $sk->commentBlock($row->gb_reason); |
167 | 163 | |
168 | 164 | 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 | + ')'; |
172 | 172 | } |
173 | 173 | |
174 | 174 | 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 | + ')'; |
178 | 182 | } |
179 | 183 | |
| 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 | + |
180 | 196 | ## Userpage link / Info on originating wiki |
181 | 197 | $display_wiki = GlobalBlocking::getWikiName( $row->gb_by_wiki ); |
182 | 198 | $user_display = GlobalBlocking::maybeLinkUserpage( $row->gb_by_wiki, $row->gb_by ); |