X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FLinker.php;h=fb446b494a4b031b333479c8b4d916b793f93456;hb=c3a1bff5a9324deb443b4acedd688c4b97f540aa;hp=3b0e72d96bd681cd738e318eaa2642face1be08f;hpb=0a2201e157b5b5da2a2ee73ea7a8d45f2b25b5d4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Linker.php b/includes/Linker.php index 3b0e72d96b..fb446b494a 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -894,24 +894,12 @@ class Linker { $classes = 'mw-userlink'; $page = null; if ( $userId == 0 ) { - $pos = strpos( $userName, '>' ); - if ( $pos !== false ) { - $iw = explode( ':', substr( $userName, 0, $pos ) ); - $firstIw = array_shift( $iw ); - $interwikiLookup = MediaWikiServices::getInstance()->getInterwikiLookup(); - if ( $interwikiLookup->isValidInterwiki( $firstIw ) ) { - $title = MWNamespace::getCanonicalName( NS_USER ) . ':' . substr( $userName, $pos + 1 ); - if ( $iw ) { - $title = join( ':', $iw ) . ':' . $title; - } - $page = Title::makeTitle( NS_MAIN, $title, '', $firstIw ); - } + $page = ExternalUserNames::getUserLinkTitle( $userName ); + + if ( ExternalUserNames::isExternal( $userName ) ) { $classes .= ' mw-extuserlink'; - } else { - $page = SpecialPage::getTitleFor( 'Contributions', $userName ); - if ( $altUserName === false ) { - $altUserName = IP::prettifyIP( $userName ); - } + } elseif ( $altUserName === false ) { + $altUserName = IP::prettifyIP( $userName ); } $classes .= ' mw-anonuserlink'; // Separate link class for anons (T45179) } else { @@ -948,7 +936,7 @@ class Linker { $blockable = !( $flags & self::TOOL_LINKS_NOBLOCK ); $addEmailLink = $flags & self::TOOL_LINKS_EMAIL && $userId; - if ( $userId == 0 && strpos( $userText, '>' ) !== false ) { + if ( $userId == 0 && ExternalUserNames::isExternal( $userText ) ) { // No tools for an external user return ''; } @@ -1023,7 +1011,7 @@ class Linker { /** * @since 1.16.3 - * @param int $userId Userid + * @param int $userId * @param string $userText User name in database. * @return string HTML fragment with block link */ @@ -1037,7 +1025,7 @@ class Linker { } /** - * @param int $userId Userid + * @param int $userId * @param string $userText User name in database. * @return string HTML fragment with e-mail user link */