Use OutputPage::wrapWikiTextAsInterface() to add safe <div> wrappers
[lhc/web/wiklou.git] / includes / specials / SpecialUserrights.php
index 22c6afe..f63c884 100644 (file)
@@ -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( '<div class="error">' . $status->getWikiText() . '</div>' );
+                                       $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
                                }
                        }
                }
@@ -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 {
@@ -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 )