+ $name = $username;
+ $database = '';
+ } else {
+ list( $name, $database ) = $parts;
+ }
+
+ if( $database != '' && !in_array( $database, $wgLocalDatabases ) ) {
+ $wgOut->addWikiText( wfMsg( 'userrights-nodatabase', $database ) );
+ return;
+ }
+
+ if( $name == '' ) {
+ $wgOut->addWikiText( wfMsg( 'nouserspecified' ) );
+ return;
+ }
+
+ if( $name{0} != '#' ) {
+ # Avoid normalization when the input is a user ID
+ $name = User::getCanonicalName( $name );
+ if( !$name ) {
+ $wgOut->addWikiText( wfMsg( 'noname' ) );
+ return;
+ }
+ }
+ $this->db =& $this->getDB( $database );
+ $this->userid = $this->getUserId( $name );
+
+ if( $this->userid == 0 ) {
+ $wgOut->addWikiText( wfMsg( 'nosuchusershort', wfEscapeWikiText( $username ) ) );
+ return;
+ }
+
+ if( $database != '' && !$wgUser->isAllowed('userrights-interwiki') ) {
+ $wgOut->addWikiText( wfMsg( 'userrights-no-interwiki' ) );
+ return;