Index: trunk/extensions/WikimediaIncubator/WikimediaIncubator.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | 'path' => __FILE__, |
15 | 15 | 'name' => 'Wikimedia Incubator', |
16 | 16 | 'author' => 'SPQRobin', |
17 | | - 'version' => '3.1.0', |
| 17 | + 'version' => '3.1.1', |
18 | 18 | 'url' => 'http://www.mediawiki.org/wiki/Extension:WikimediaIncubator', |
19 | 19 | 'descriptionmsg' => 'wminc-desc', |
20 | 20 | ); |
Index: trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php |
— | — | @@ -7,11 +7,15 @@ |
8 | 8 | class SpecialRandomByTest extends RandomPage |
9 | 9 | { |
10 | 10 | public function __construct() { |
11 | | - global $wgUser, $wmincPref, $wmincProjectSite; |
12 | | - if( IncubatorTest::isContentProject() ) { |
| 11 | + global $wgUser, $wgRequest, $wmincPref, $wmincProjectSite; |
| 12 | + $target = $wgRequest->getVal( 'testwiki' ); |
| 13 | + $target = IncubatorTest::analyzePrefix( $target ); |
| 14 | + $project = ( isset( $target['project'] ) ? $target['project'] : '' ); |
| 15 | + $lang = ( isset( $target['lang'] ) ? $target['lang'] : '' ); |
| 16 | + if( IncubatorTest::isContentProject() || ($project && $lang) ) { |
13 | 17 | $dbr = wfGetDB( DB_SLAVE ); |
14 | 18 | $this->extra[] = 'page_title' . |
15 | | - $dbr->buildLike( IncubatorTest::displayPrefix() . '/', $dbr->anyString() ); |
| 19 | + $dbr->buildLike( IncubatorTest::displayPrefix( $project, $lang ) . '/', $dbr->anyString() ); |
16 | 20 | } elseif($wgUser->getOption($wmincPref . '-project') == $wmincProjectSite['short'] ) { |
17 | 21 | global $wgVersion; |
18 | 22 | // only works above MW 1.17 |
Index: trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php |
— | — | @@ -70,12 +70,15 @@ |
71 | 71 | global $wgOut, $wmincPref, $wmincProjectSite, $wgUser; |
72 | 72 | $sk = $wgUser->getSkin(); |
73 | 73 | $user = User::newFromName( $target ); |
| 74 | + $name = $user->getName(); |
| 75 | + $id = $user->getId(); |
74 | 76 | $langNames = Language::getLanguageNames(); |
75 | | - if ( $user == null || $user->getId() == 0 ) { |
| 77 | + if ( $user == null || $id == 0 ) { |
76 | 78 | // show error if a user with that name does not exist |
77 | 79 | $wgOut->addHTML( Xml::span( wfMsg( 'wminc-userdoesnotexist', $target ), 'error' ) ); |
78 | 80 | } else { |
79 | 81 | $userproject = $user->getOption( $wmincPref . '-project' ); |
| 82 | + $userproject = ($userproject ? $userproject : 'none'); |
80 | 83 | $usercode = $user->getOption( $wmincPref . '-code' ); |
81 | 84 | $prefix = IncubatorTest::displayPrefix( $userproject, $usercode ); |
82 | 85 | if ( IncubatorTest::isContentProject( $userproject ) ) { |
— | — | @@ -85,11 +88,10 @@ |
86 | 89 | } else { |
87 | 90 | $testwiki = wfMsgHtml( 'wminc-testwiki-none' ); |
88 | 91 | } |
89 | | - $name = $user->getName(); |
90 | 92 | $wgOut->addHtml( |
91 | 93 | Xml::openElement( 'ul' ) . |
92 | 94 | '<li>' . wfMsgHtml( 'username' ) . ' ' . |
93 | | - $sk->userLink( $name, $name ) . $sk->userToolLinks( $name, $name ) . '</li>' . |
| 95 | + $sk->userLink( $id, $name ) . $sk->userToolLinks( $id, $name, true ) . '</li>' . |
94 | 96 | '<li>' . wfMsgHtml( 'loginlanguagelabel', $langNames[$user->getOption( 'language' )] . |
95 | 97 | ' (' . $user->getOption( 'language' ) . ')' ) . '</li>' . |
96 | 98 | '<li>' . wfMsgHtml( 'wminc-testwiki' ) . ' ' . $testwiki . '</li>' . |
Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | */ |
106 | 106 | static function validatePrefix( $title, $onlyprefix = false ) { |
107 | 107 | $data = self::analyzePrefix( $title, $onlyprefix ); |
108 | | - if( isset( $data['error'] ) ) { return true; } |
| 108 | + if( !isset( $data['error'] ) ) { return true; } |
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | static function efLoadViewUserLangLink( $id, $nt, &$links ) { |
254 | 254 | global $wgUser; |
255 | 255 | if ( $wgUser->isAllowed( 'viewuserlang' ) ) { |
256 | | - $user = wfUrlencode( $nt->getText() ); |
| 256 | + $user = $nt->getText(); |
257 | 257 | $links[] = $wgUser->getSkin()->link( |
258 | 258 | SpecialPage::getTitleFor( 'ViewUserLang', $user ), |
259 | 259 | wfMsgHtml( 'wminc-viewuserlang' ) |
Index: trunk/extensions/WikimediaIncubator/TestWikiRC.php |
— | — | @@ -20,12 +20,14 @@ |
21 | 21 | // If project site is selected, display all changes except test wiki changes |
22 | 22 | $dbr = wfGetDB( DB_SLAVE ); |
23 | 23 | $conds[] = 'rc_title NOT ' . $dbr->buildLike( 'W', $dbr->anyChar(), '/', $dbr->anyString() ); |
24 | | - } else { |
| 24 | + } elseif( IncubatorTest::validatePrefix( $prefix, true ) ) { |
25 | 25 | // Else, display changes to the selected test wiki in the appropriate namespaces |
26 | 26 | $dbr = wfGetDB( DB_SLAVE ); |
27 | 27 | $conds['rc_namespace'] = $wmincTestWikiNamespaces; |
28 | 28 | $conds[] = 'rc_title ' . $dbr->buildLike( $prefix . '/', $dbr->anyString() ) . |
29 | 29 | ' OR rc_title = ' . $dbr->addQuotes( $prefix ); |
| 30 | + } else { |
| 31 | + return true; |
30 | 32 | } |
31 | 33 | return true; |
32 | 34 | } |