r60862 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60861‎ | r60862 | r60863 >
Date:15:23, 9 January 2010
Author:ialex
Status:ok
Tags:
Comment:
* (bug 9794) User rights log entries for foreign user now links to the foreign user's page if possible
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/includes/WikiMap.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WikiMap.php
@@ -33,18 +33,22 @@
3434 return $wiki_id;
3535 }
3636
37 - static function foreignUserLink( $wiki_id, $user ) {
38 - return self::makeForeignLink( $wiki_id, "User:$user" );
 37+ static function foreignUserLink( $wiki_id, $user, $text=null ) {
 38+ return self::makeForeignLink( $wiki_id, "User:$user", $text );
3939 }
4040
4141 static function makeForeignLink( $wiki_id, $page, $text=null ) {
4242 global $wgUser;
4343 $sk = $wgUser->getSkin();
44 -
45 - if (!$text)
 44+
 45+ if ( !$text )
4646 $text=$page;
47 -
48 - return $sk->makeExternalLink( self::getForeignURL( $wiki_id, $page ) , $text );
 47+
 48+ $url = self::getForeignURL( $wiki_id, $page );
 49+ if ( $url === false )
 50+ return false;
 51+
 52+ return $sk->makeExternalLink( $url, $text );
4953 }
5054
5155 static function getForeignURL( $wiki_id, $page ) {
Index: trunk/phase3/includes/LogPage.php
@@ -291,7 +291,7 @@
292292 }
293293
294294 protected static function getTitleLink( $type, $skin, $title, &$params ) {
295 - global $wgLang, $wgContLang;
 295+ global $wgLang, $wgContLang, $wgUserrightsInterwikiDelimiter;
296296 if( !$skin ) {
297297 return $title->getPrefixedText();
298298 }
@@ -327,6 +327,13 @@
328328 break;
329329 case 'rights':
330330 $text = $wgContLang->ucfirst( $title->getText() );
 331+ $parts = explode( $wgUserrightsInterwikiDelimiter, $text, 2 );
 332+ if ( count( $parts ) == 2 ) {
 333+ $titleLink = WikiMap::foreignUserLink( $parts[1], $parts[0],
 334+ htmlspecialchars( $title->getPrefixedText() ) );
 335+ if ( $titleLink !== false )
 336+ break;
 337+ }
331338 $titleLink = $skin->link( Title::makeTitle( NS_USER, $text ) );
332339 break;
333340 case 'merge':
Index: trunk/phase3/RELEASE-NOTES
@@ -691,6 +691,8 @@
692692 * (bug 20115) Special:Userlogin title says "Log in / create account" even if the
693693 user can't create an account
694694 * (bug 2658) Don't attempt to set the TZ environment variable.
 695+* (bug 9794) User rights log entries for foreign user now links to the foreign
 696+ user's page if possible
695697
696698 == API changes in 1.16 ==
697699

Status & tagging log