r64274 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64273‎ | r64274 | r64275 >
Date:21:31, 27 March 2010
Author:catrope
Status:ok
Tags:
Comment:
Fix coding style in r64230, r64256
Modified paths:
  • /trunk/phase3/includes/api/ApiBlock.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUnblock.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialIpblocklist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiUnblock.php
@@ -63,11 +63,11 @@
6464 $this->dieUsageMsg( array( 'cantunblock' ) );
6565 }
6666 # bug 15810: blocked admins should have limited access here
67 - if( $wgUser->isBlocked() ){
 67+ if ( $wgUser->isBlocked() ) {
6868 $status = IPBlockForm::checkUnblockSelf( $params['user'] );
69 - if( $status !== true ){
 69+ if ( $status !== true ) {
7070 $this->dieUsageMsg( array( $status ) );
71 - }
 71+ }
7272 }
7373
7474 $id = $params['id'];
Index: trunk/phase3/includes/api/ApiBlock.php
@@ -65,11 +65,11 @@
6666 $this->dieUsageMsg( array( 'cantblock' ) );
6767 }
6868 # bug 15810: blocked admins should have limited access here
69 - if( $wgUser->isBlocked() ){
 69+ if ( $wgUser->isBlocked() ) {
7070 $status = IPBlockForm::checkUnblockSelf( $params['user'] );
71 - if( $status !== true ){
 71+ if ( $status !== true ) {
7272 $this->dieUsageMsg( array( $status ) );
73 - }
 73+ }
7474 }
7575 if ( $params['hidename'] && !$wgUser->isAllowed( 'hideuser' ) ) {
7676 $this->dieUsageMsg( array( 'canthide' ) );
Index: trunk/phase3/includes/specials/SpecialIpblocklist.php
@@ -32,8 +32,8 @@
3333 }
3434
3535 # bug 15810: blocked admins should have limited access here
36 - if( $wgUser->isBlocked() ){
37 - if( $id ){
 36+ if ( $wgUser->isBlocked() ) {
 37+ if ( $id ) {
3838 # This doesn't pick up on autoblocks, but admins
3939 # should have the ipblock-exempt permission anyway
4040 $block = Block::newFromID( $id );
@@ -42,9 +42,9 @@
4343 $user = User::newFromName( $ip );
4444 }
4545 $status = IPBlockForm::checkUnblockSelf( $user );
46 - if( $status !== true ){
 46+ if ( $status !== true ) {
4747 throw new ErrorPageError( 'badaccess', $status );
48 - }
 48+ }
4949 }
5050
5151 if( $action == 'unblock' ){
Index: trunk/phase3/includes/specials/SpecialBlockip.php
@@ -26,11 +26,11 @@
2727 $ipb = new IPBlockForm( $par );
2828
2929 # bug 15810: blocked admins should have limited access here
30 - if( $wgUser->isBlocked() ){
 30+ if ( $wgUser->isBlocked() ) {
3131 $status = IPBlockForm::checkUnblockSelf( $ipb->BlockAddress );
32 - if( $status !== true ){
 32+ if ( $status !== true ) {
3333 throw new ErrorPageError( 'badaccess', $status );
34 - }
 34+ }
3535 }
3636
3737 $action = $wgRequest->getVal( 'action' );
@@ -375,18 +375,16 @@
376376 * either.
377377 * @param $user User, Int or String
378378 */
379 - public static function checkUnblockSelf( $user ){
 379+ public static function checkUnblockSelf( $user ) {
380380 global $wgUser;
381 - if( is_int( $user ) ){
 381+ if ( is_int( $user ) ) {
382382 $user = User::newFromId( $user );
383 - } elseif ( is_string( $user ) ){
 383+ } elseif ( is_string( $user ) ) {
384384 $user = User::newFromName( $user );
385385 }
386 - if( $user instanceof User
387 - && $user->getId() == $wgUser->getId() )
388 - {
 386+ if( $user instanceof User && $user->getId() == $wgUser->getId() ) {
389387 # User is trying to unblock themselves
390 - if( $wgUser->isAllowed( 'unblockself' ) ){
 388+ if ( $wgUser->isAllowed( 'unblockself' ) ) {
391389 return true;
392390 } else {
393391 return 'ipbnounblockself';

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64230Followup to r64228 - apply restrictions in API.happy-melon23:02, 26 March 2010
r64256Per r64228 CR: make the check a static method in IPBlockForm to reduce duplic...happy-melon15:05, 27 March 2010

Status & tagging log