Index: trunk/phase3/includes/specials/SpecialIpblocklist.php |
— | — | @@ -71,9 +71,13 @@ |
72 | 72 | var $ip, $reason, $id; |
73 | 73 | |
74 | 74 | function IPUnblockForm( $ip, $id, $reason ) { |
| 75 | + global $wgRequest; |
75 | 76 | $this->ip = strtr( $ip, '_', ' ' ); |
76 | 77 | $this->id = $id; |
77 | 78 | $this->reason = $reason; |
| 79 | + $this->hideuserblocks = $wgRequest->getBool( 'hideuserblocks' ); |
| 80 | + $this->hidetempblocks = $wgRequest->getBool( 'hidetempblocks' ); |
| 81 | + $this->hideaddressblocks = $wgRequest->getBool( 'hideaddressblocks' ); |
78 | 82 | } |
79 | 83 | |
80 | 84 | /** |
— | — | @@ -257,11 +261,22 @@ |
258 | 262 | $conds['ipb_auto'] = 0; |
259 | 263 | } |
260 | 264 | } |
| 265 | + // Apply filters |
| 266 | + if( $this->hideuserblocks ) { |
| 267 | + $conds['ipb_user'] = 0; |
| 268 | + } |
| 269 | + if( $this->hidetempblocks ) { |
| 270 | + $conds['ipb_expiry'] = 'infinity'; |
| 271 | + } |
| 272 | + if( $this->hideaddressblocks ) { |
| 273 | + $conds[] = "ipb_range_end > ipb_range_start"; |
| 274 | + } |
261 | 275 | |
262 | 276 | $pager = new IPBlocklistPager( $this, $conds ); |
263 | 277 | if ( $pager->getNumRows() ) { |
264 | 278 | $wgOut->addHTML( |
265 | 279 | $this->searchForm() . |
| 280 | + $this->showhideLinks() . |
266 | 281 | $pager->getNavigationBar() . |
267 | 282 | Xml::tags( 'ul', null, $pager->getBody() ) . |
268 | 283 | $pager->getNavigationBar() |
— | — | @@ -287,6 +302,49 @@ |
288 | 303 | Xml::closeElement( 'fieldset' ) |
289 | 304 | ); |
290 | 305 | } |
| 306 | + |
| 307 | + function showhideLinks() { |
| 308 | + $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) ); |
| 309 | + $nondefaults = array(); |
| 310 | + if( $this->hideuserblocks ) { |
| 311 | + $nondefaults['hideuserblocks'] = $this->hideuserblocks; |
| 312 | + } |
| 313 | + if( $this->hidetempblocks ) { |
| 314 | + $nondefaults['hidetempblocks'] = $this->hidetempblocks; |
| 315 | + } |
| 316 | + if( $this->hideaddressblocks ) { |
| 317 | + $nondefaults['hideaddressblocks'] = $this->hideaddressblocks; |
| 318 | + } |
| 319 | + $ubLink = $this->makeOptionsLink( $showhide[1-$this->hideuserblocks], |
| 320 | + array( 'hideuserblocks' => 1-$this->hideuserblocks ), $nondefaults); |
| 321 | + $tbLink = $this->makeOptionsLink( $showhide[1-$this->hidetempblocks], |
| 322 | + array( 'hidetempblocks' => 1-$this->hidetempblocks ), $nondefaults); |
| 323 | + $sipbLink = $this->makeOptionsLink( $showhide[1-$this->hideaddressblocks], |
| 324 | + array( 'hideaddressblocks' => 1-$this->hideaddressblocks ), $nondefaults); |
| 325 | + |
| 326 | + $links = array(); |
| 327 | + $links[] = wfMsgHtml( 'ipblocklist-sh-userblocks', $ubLink ); |
| 328 | + $links[] = wfMsgHtml( 'ipblocklist-sh-tempblocks', $tbLink ); |
| 329 | + $links[] = wfMsgHtml( 'ipblocklist-sh-addressblocks', $sipbLink ); |
| 330 | + |
| 331 | + $hl = '(' . implode( ' | ', $links ) . ')<hr/>'; |
| 332 | + return $hl; |
| 333 | + } |
| 334 | + |
| 335 | + /** |
| 336 | + * Makes change an option link which carries all the other options |
| 337 | + * @param $title see Title |
| 338 | + * @param $override |
| 339 | + * @param $options |
| 340 | + */ |
| 341 | + function makeOptionsLink( $title, $override, $options, $active = false ) { |
| 342 | + global $wgUser; |
| 343 | + $sk = $wgUser->getSkin(); |
| 344 | + $params = wfArrayMerge( $options, $override ); |
| 345 | + $ipblocklist = SpecialPage::getTitleFor( 'IPBlockList' ); |
| 346 | + return $sk->link( $ipblocklist, htmlspecialchars( $title ), |
| 347 | + ( $active ? array( 'style'=>'font-weight: bold;' ) : array() ), $params, array( 'known' ) ); |
| 348 | + } |
291 | 349 | |
292 | 350 | /** |
293 | 351 | * Callback function to output a block |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2562,6 +2562,9 @@ |
2563 | 2563 | 'ipblocklist' => 'Blocked IP addresses and usernames', |
2564 | 2564 | 'ipblocklist-legend' => 'Find a blocked user', |
2565 | 2565 | 'ipblocklist-username' => 'Username or IP address:', |
| 2566 | +'ipblocklist-sh-userblocks' => '$1 account blocks', |
| 2567 | +'ipblocklist-sh-tempblocks' => '$1 temporary blocks', |
| 2568 | +'ipblocklist-sh-addressblocks' => '$1 single IP blocks', |
2566 | 2569 | 'ipblocklist-summary' => '', # do not translate or duplicate this message to other languages |
2567 | 2570 | 'ipblocklist-submit' => 'Search', |
2568 | 2571 | 'blocklistline' => '$1, $2 blocked $3 ($4)', |