Fix a wrong comparison: User::idFromName returns null (not 0) in case of non-existing...
authorRaimond Spekking <raymond@users.mediawiki.org>
Thu, 17 Dec 2009 12:53:09 +0000 (12:53 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Thu, 17 Dec 2009 12:53:09 +0000 (12:53 +0000)
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
includes/specials/SpecialDeletedContributions.php

index 00029ea..d5e600a 100644 (file)
@@ -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' )
index 5d1e43c..252d85a 100644 (file)
@@ -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' )