Index: trunk/extensions/TorBlock/TorBlock.i18n.php |
— | — | @@ -14,6 +14,7 @@ |
15 | 15 | 'torblock-desc' => 'Allows tor exit nodes to be blocked from editing a wiki', |
16 | 16 | 'torblock-blocked' => 'Your IP address, <tt>$1</tt>, has been automatically identified as a tor exit node. |
17 | 17 | Editing through tor is blocked to prevent abuse.', |
| 18 | + 'torblock-isexitnode' => 'The IP address $1 is blocked as a Tor exit node.', |
18 | 19 | 'right-torunblocked' => 'Bypass automatic blocks of tor exit nodes', |
19 | 20 | 'tag-tor-description' => 'If this tag is set, an edit was made from a Tor exit node.', |
20 | 21 | 'tag-tor' => 'Made through tor', |
Index: trunk/extensions/TorBlock/TorBlock.php |
— | — | @@ -37,6 +37,7 @@ |
38 | 38 | $wgHooks['AbuseFilter-filterAction'][] = 'TorBlock::onAbuseFilterFilterAction'; |
39 | 39 | $wgHooks['AbuseFilter-builder'][] = 'TorBlock::onAbuseFilterBuilder'; |
40 | 40 | $wgHooks['EmailUserPermissionsErrors'][] = 'TorBlock::onEmailUserPermissionsErrors'; |
| 41 | +$wgHooks['getOtherBlockLogLink'][] = 'TorBlock::getTorBlockStatus'; |
41 | 42 | |
42 | 43 | // Define new autopromote condition |
43 | 44 | define('APCOND_TOR', 'tor'); // Numbers won't work, we'll get collisions |
Index: trunk/extensions/TorBlock/TorBlock.class.php |
— | — | @@ -159,7 +159,6 @@ |
160 | 160 | } |
161 | 161 | |
162 | 162 | public static function isExitNode($ip = null) { |
163 | | - #return true; ## FOR DEBUGGING |
164 | 163 | if ($ip == null) { |
165 | 164 | $ip = wfGetIp(); |
166 | 165 | } |
— | — | @@ -233,4 +232,26 @@ |
234 | 233 | $emptyTags[] = 'tor'; |
235 | 234 | return true; |
236 | 235 | } |
| 236 | + |
| 237 | + /** |
| 238 | + * Creates a message with the status |
| 239 | + * @param array $msg Message with the status |
| 240 | + * @param string $ip The IP address to be checked |
| 241 | + * @return boolean true |
| 242 | + */ |
| 243 | + public static function getTorBlockStatus( &$msg, $ip ) { |
| 244 | + // IP addresses can be blocked only |
| 245 | + // Fast return if IP is not an exit node |
| 246 | + if ( !IP::isIPAddress( $ip ) || !self::isExitNode( $ip ) ) { |
| 247 | + return true; |
| 248 | + } |
| 249 | + |
| 250 | + wfLoadExtensionMessages( 'TorBlock' ); |
| 251 | + $msg[] = Html::rawElement( |
| 252 | + 'span', |
| 253 | + array( 'class' => 'mw-torblock-isexitnode' ), |
| 254 | + wfMsgExt( 'torblock-isexitnode', 'parseinline', $ip ) |
| 255 | + ); |
| 256 | + return true; |
| 257 | + } |
237 | 258 | } |