From 6d6f53ad2afc26d73a81b237178f1b3583414c86 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Thu, 17 Dec 2009 12:53:09 +0000 Subject: [PATCH] Fix a wrong comparison: User::idFromName returns null (not 0) in case of non-existing user names. Therefore 0 !== $id results into addind a link to Special:UserRights in the tool links in case of requesting contribs for an IP address. --- includes/specials/SpecialContributions.php | 6 +++--- includes/specials/SpecialDeletedContributions.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 00029ea92a..d5e600ab3f 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -149,7 +149,7 @@ class SpecialContributions extends SpecialPage { $sk = $wgUser->getSkin(); - if ( 0 == $id ) { + if ( $id === null ) { $user = htmlspecialchars( $nt->getText() ); } else { $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) ); @@ -159,7 +159,7 @@ class SpecialContributions extends SpecialPage { if( $talk ) { # Talk page link $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) ); - if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && IP::isIPAddress( $nt->getText() ) ) ) { + if( ( $id !== null && $wgSysopUserBans ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) { if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links if ( $userObj->isBlocked() ) { $tools[] = $sk->linkKnown( # Change block link @@ -212,7 +212,7 @@ class SpecialContributions extends SpecialPage { # Add a link to change user rights for privileged users $userrightsPage = new UserrightsPage(); - if( 0 !== $id && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) { + if( $id !== null && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) { $tools[] = $sk->linkKnown( SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ), wfMsgHtml( 'sp-contributions-userrights' ) diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 5d1e43c6fa..252d85aaf8 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -338,7 +338,7 @@ class DeletedContributionsPage extends SpecialPage { $sk = $wgUser->getSkin(); - if ( 0 == $id ) { + if ( $id === null ) { $user = htmlspecialchars( $nt->getText() ); } else { $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) ); @@ -348,7 +348,7 @@ class DeletedContributionsPage extends SpecialPage { if( $talk ) { # Talk page link $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) ); - if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && IP::isIPAddress( $nt->getText() ) ) ) { + if( ( $id !== null && $wgSysopUserBans ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) { if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links if ( $userObj->isBlocked() ) { $tools[] = $sk->linkKnown( # Change block link @@ -398,7 +398,7 @@ class DeletedContributionsPage extends SpecialPage { # Add a link to change user rights for privileged users $userrightsPage = new UserrightsPage(); - if( 0 !== $id && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) { + if( $id !== null && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) { $tools[] = $sk->linkKnown( SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ), wfMsgHtml( 'sp-contributions-userrights' ) -- 2.20.1