X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUserrights.php;h=22c6afeefd3b6e864ea4808cad08854332f331a4;hb=c6ad2554f40f8ebbe9e38ac64ea933076f348729;hp=a05452d0145e9a43543f55a0fb24c41ad6339957;hpb=037db443a5ea4b074feb3a40f453f19054c0dc79;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index a05452d014..4168d91854 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -87,11 +87,7 @@ class UserrightsPage extends SpecialPage { $out->addModules( [ 'mediawiki.special.userrights' ] ); - if ( $par !== null ) { - $this->mTarget = $par; - } else { - $this->mTarget = $request->getVal( 'user' ); - } + $this->mTarget = $par ?? $request->getVal( 'user' ); if ( is_string( $this->mTarget ) ) { $this->mTarget = trim( $this->mTarget ); @@ -164,7 +160,7 @@ class UserrightsPage extends SpecialPage { // save settings if ( !$fetchedStatus->isOK() ) { - $this->getOutput()->addWikiText( $fetchedStatus->getWikiText() ); + $this->getOutput()->addWikiTextAsInterface( $fetchedStatus->getWikiText() ); return; } @@ -193,7 +189,7 @@ class UserrightsPage extends SpecialPage { return; } else { // Print an error message and redisplay the form - $out->addWikiText( '
' . $status->getWikiText() . '
' ); + $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() ); } } } @@ -373,7 +369,7 @@ class UserrightsPage extends SpecialPage { } if ( $add ) { foreach ( $add as $index => $group ) { - $expiry = isset( $groupExpiries[$group] ) ? $groupExpiries[$group] : null; + $expiry = $groupExpiries[$group] ?? null; if ( !$user->addGroup( $group, $expiry ) ) { unset( $add[$index] ); } @@ -472,7 +468,7 @@ class UserrightsPage extends SpecialPage { function editUserGroupsForm( $username ) { $status = $this->fetchUser( $username, true ); if ( !$status->isOK() ) { - $this->getOutput()->addWikiText( $status->getWikiText() ); + $this->getOutput()->addWikiTextAsInterface( $status->getWikiText() ); return; } else { @@ -501,18 +497,18 @@ class UserrightsPage extends SpecialPage { $parts = explode( $this->getConfig()->get( 'UserrightsInterwikiDelimiter' ), $username ); if ( count( $parts ) < 2 ) { $name = trim( $username ); - $database = ''; + $wikiId = ''; } else { - list( $name, $database ) = array_map( 'trim', $parts ); + list( $name, $wikiId ) = array_map( 'trim', $parts ); - if ( $database == wfWikiID() ) { - $database = ''; + if ( WikiMap::isCurrentWikiId( $wikiId ) ) { + $wikiId = ''; } else { if ( $writing && !$this->getUser()->isAllowed( 'userrights-interwiki' ) ) { return Status::newFatal( 'userrights-no-interwiki' ); } - if ( !UserRightsProxy::validDatabase( $database ) ) { - return Status::newFatal( 'userrights-nodatabase', $database ); + if ( !UserRightsProxy::validDatabase( $wikiId ) ) { + return Status::newFatal( 'userrights-nodatabase', $wikiId ); } } } @@ -526,10 +522,10 @@ class UserrightsPage extends SpecialPage { // We'll do a lookup for the name internally. $id = intval( substr( $name, 1 ) ); - if ( $database == '' ) { + if ( $wikiId == '' ) { $name = User::whoIs( $id ); } else { - $name = UserRightsProxy::whoIs( $database, $id ); + $name = UserRightsProxy::whoIs( $wikiId, $id ); } if ( !$name ) { @@ -543,10 +539,10 @@ class UserrightsPage extends SpecialPage { } } - if ( $database == '' ) { + if ( $wikiId == '' ) { $user = User::newFromName( $name ); } else { - $user = UserRightsProxy::newFromName( $database, $name ); + $user = UserRightsProxy::newFromName( $wikiId, $name ); } if ( !$user || $user->isAnon() ) { @@ -658,7 +654,7 @@ class UserrightsPage extends SpecialPage { )->escaped(); $grouplist = ''; - $count = count( $list ); + $count = count( $list ) + count( $tempList ); if ( $count > 0 ) { $grouplist = $this->msg( 'userrights-groupsmember' ) ->numParams( $count ) @@ -771,7 +767,7 @@ class UserrightsPage extends SpecialPage { * @param UserGroupMembership[] $usergroups Associative array of (group name as string => * UserGroupMembership object) for groups the user belongs to * @param User $user - * @return Array with 2 elements: the XHTML table element with checkxboes, and + * @return array Array with 2 elements: the XHTML table element with checkxboes, and * whether any groups are changeable */ private function groupCheckboxes( $usergroups, $user ) {