Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -74,21 +74,19 @@ |
75 | 75 | $this->opts['target'] = $target; |
76 | 76 | $this->opts['topOnly'] = $request->getBool( 'topOnly' ); |
77 | 77 | |
78 | | - $nt = Title::makeTitleSafe( NS_USER, $target ); |
79 | | - if( !$nt ) { |
| 78 | + $userObj = User::newFromName( $target, false ); |
| 79 | + if( !$userObj ) { |
80 | 80 | $out->addHTML( $this->getForm() ); |
81 | 81 | return; |
82 | 82 | } |
83 | | - $id = User::idFromName( $nt->getText() ); |
| 83 | + $nt = $userObj->getUserPage(); |
| 84 | + $id = $userObj->getID(); |
84 | 85 | |
85 | 86 | if( $this->opts['contribs'] != 'newbie' ) { |
86 | 87 | $target = $nt->getText(); |
87 | | - $out->addSubtitle( $this->contributionsSub( $nt, $id ) ); |
| 88 | + $out->addSubtitle( $this->contributionsSub( $userObj ) ); |
88 | 89 | $out->setHTMLTitle( $this->msg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ), $target ) ) ); |
89 | | - $userObj = User::newFromName( $target, false ); |
90 | | - if ( is_object( $userObj ) ) { |
91 | | - $this->getSkin()->setRelevantUser( $userObj ); |
92 | | - } |
| 90 | + $this->getSkin()->setRelevantUser( $userObj ); |
93 | 91 | } else { |
94 | 92 | $out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub') ); |
95 | 93 | $out->setHTMLTitle( $this->msg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) ); |
— | — | @@ -193,8 +191,7 @@ |
194 | 192 | if ( IP::isIPAddress( $target ) ) { |
195 | 193 | $message = 'sp-contributions-footer-anon'; |
196 | 194 | } else { |
197 | | - $userObj = User::newFromName( $target ); |
198 | | - if ( !$userObj || $userObj->isAnon() ) { |
| 195 | + if ( $userObj->isAnon() ) { |
199 | 196 | // No message for non-existing users |
200 | 197 | return; |
201 | 198 | } |
— | — | @@ -211,19 +208,18 @@ |
212 | 209 | |
213 | 210 | /** |
214 | 211 | * Generates the subheading with links |
215 | | - * @param $nt Title object for the target |
216 | | - * @param $id Integer: User ID for the target |
| 212 | + * @param $userObj User object for the target |
217 | 213 | * @return String: appropriately-escaped HTML to be output literally |
218 | 214 | * @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined. |
219 | 215 | */ |
220 | | - protected function contributionsSub( $nt, $id ) { |
221 | | - if ( $id === null ) { |
222 | | - $user = htmlspecialchars( $nt->getText() ); |
| 216 | + protected function contributionsSub( $userObj ) { |
| 217 | + if ( $userObj->isAnon() ) { |
| 218 | + $user = htmlspecialchars( $userObj->getName() ); |
223 | 219 | } else { |
224 | | - $user = Linker::link( $nt, htmlspecialchars( $nt->getText() ) ); |
| 220 | + $user = Linker::link( $userObj->getUserPage(), htmlspecialchars( $userObj->getName() ) ); |
225 | 221 | } |
226 | | - $userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false ); |
227 | | - $talk = $nt->getTalkPage(); |
| 222 | + $nt = $userObj->getUserPage(); |
| 223 | + $talk = $userObj->getTalkPage(); |
228 | 224 | if( $talk ) { |
229 | 225 | $tools = self::getUserLinks( $nt, $talk, $userObj, $this->getUser() ); |
230 | 226 | $links = $this->getLang()->pipeList( $tools ); |
— | — | @@ -243,7 +239,7 @@ |
244 | 240 | $userObj->isAnon() ? |
245 | 241 | 'sp-contributions-blocked-notice-anon' : |
246 | 242 | 'sp-contributions-blocked-notice', |
247 | | - $nt->getText() # Support GENDER in 'sp-contributions-blocked-notice' |
| 243 | + $userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice' |
248 | 244 | ), |
249 | 245 | 'offset' => '' # don't use WebRequest parameter offset |
250 | 246 | ) |
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php |
— | — | @@ -287,15 +287,16 @@ |
288 | 288 | $options['limit'] = $request->getInt( 'limit', $wgQueryPageDefaultLimit ); |
289 | 289 | $options['target'] = $target; |
290 | 290 | |
291 | | - $nt = Title::makeTitleSafe( NS_USER, $target ); |
292 | | - if ( !$nt ) { |
| 291 | + $userObj = User::newFromName( $target ); |
| 292 | + if ( !$userObj ) { |
293 | 293 | $out->addHTML( $this->getForm( '' ) ); |
294 | 294 | return; |
295 | 295 | } |
296 | | - $id = User::idFromName( $nt->getText() ); |
| 296 | + $nt = $userObj->getUserPage(); |
| 297 | + $id = $userObj->getID(); |
297 | 298 | |
298 | | - $target = $nt->getText(); |
299 | | - $out->addSubtitle( $this->getSubTitle( $nt, $id ) ); |
| 299 | + $target = $userObj->getName(); |
| 300 | + $out->addSubtitle( $this->getSubTitle( $userObj ) ); |
300 | 301 | |
301 | 302 | if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) { |
302 | 303 | $options['namespace'] = intval( $ns ); |
— | — | @@ -336,18 +337,18 @@ |
337 | 338 | |
338 | 339 | /** |
339 | 340 | * Generates the subheading with links |
340 | | - * @param $nt Title object for the target |
341 | | - * @param $id Integer: User ID for the target |
| 341 | + * @param $userObj User object for the target |
342 | 342 | * @return String: appropriately-escaped HTML to be output literally |
343 | 343 | * @todo FIXME: Almost the same as contributionsSub in SpecialContributions.php. Could be combined. |
344 | 344 | */ |
345 | | - function getSubTitle( $nt, $id ) { |
346 | | - if ( $id === null ) { |
347 | | - $user = htmlspecialchars( $nt->getText() ); |
| 345 | + function getSubTitle( $userObj ) { |
| 346 | + if ( $userObj->isAnon() ) { |
| 347 | + $user = htmlspecialchars( $userObj->getName() ); |
348 | 348 | } else { |
349 | | - $user = Linker::link( $nt, htmlspecialchars( $nt->getText() ) ); |
| 349 | + $user = Linker::link( $userObj->getPage(), htmlspecialchars( $userObj->getText() ) ); |
350 | 350 | } |
351 | | - $userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false ); |
| 351 | + $nt = $userObj->getUserPage(); |
| 352 | + $id = $userObj->getID(); |
352 | 353 | $talk = $nt->getTalkPage(); |
353 | 354 | if( $talk ) { |
354 | 355 | # Talk page link |