* Fix regression in authentication hook auto-creation on login
[mediawiki.git] / includes / SpecialUserlogin.php
blobd43d249c253f7c02792441a0b4b1c8e76e22538e
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /**
9 * constructor
11 function wfSpecialUserlogin() {
12 global $wgCommandLineMode;
13 global $wgRequest;
14 if( !$wgCommandLineMode && !isset( $_COOKIE[session_name()] ) ) {
15 wfSetupSession();
18 $form = new LoginForm( $wgRequest );
19 $form->execute();
22 /**
24 * @package MediaWiki
25 * @subpackage SpecialPage
28 class LoginForm {
30 const SUCCESS = 0;
31 const NO_NAME = 1;
32 const ILLEGAL = 2;
33 const WRONG_PLUGIN_PASS = 3;
34 const NOT_EXISTS = 4;
35 const WRONG_PASS = 5;
36 const EMPTY_PASS = 6;
38 var $mName, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted;
39 var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword;
40 var $mLoginattempt, $mRemember, $mEmail, $mDomain, $mLanguage;
42 /**
43 * Constructor
44 * @param webrequest $request A webrequest object passed by reference
46 function LoginForm( &$request ) {
47 global $wgLang, $wgAllowRealName, $wgEnableEmail;
48 global $wgAuth;
50 $this->mType = $request->getText( 'type' );
51 $this->mName = $request->getText( 'wpName' );
52 $this->mPassword = $request->getText( 'wpPassword' );
53 $this->mRetype = $request->getText( 'wpRetype' );
54 $this->mDomain = $request->getText( 'wpDomain' );
55 $this->mReturnTo = $request->getVal( 'returnto' );
56 $this->mCookieCheck = $request->getVal( 'wpCookieCheck' );
57 $this->mPosted = $request->wasPosted();
58 $this->mCreateaccount = $request->getCheck( 'wpCreateaccount' );
59 $this->mCreateaccountMail = $request->getCheck( 'wpCreateaccountMail' )
60 && $wgEnableEmail;
61 $this->mMailmypassword = $request->getCheck( 'wpMailmypassword' )
62 && $wgEnableEmail;
63 $this->mLoginattempt = $request->getCheck( 'wpLoginattempt' );
64 $this->mAction = $request->getVal( 'action' );
65 $this->mRemember = $request->getCheck( 'wpRemember' );
66 $this->mLanguage = $request->getText( 'uselang' );
68 if( $wgEnableEmail ) {
69 $this->mEmail = $request->getText( 'wpEmail' );
70 } else {
71 $this->mEmail = '';
73 if( $wgAllowRealName ) {
74 $this->mRealName = $request->getText( 'wpRealName' );
75 } else {
76 $this->mRealName = '';
79 if( !$wgAuth->validDomain( $this->mDomain ) ) {
80 $this->mDomain = 'invaliddomain';
82 $wgAuth->setDomain( $this->mDomain );
84 # When switching accounts, it sucks to get automatically logged out
85 if( $this->mReturnTo == $wgLang->specialPage( 'Userlogout' ) ) {
86 $this->mReturnTo = '';
90 function execute() {
91 if ( !is_null( $this->mCookieCheck ) ) {
92 $this->onCookieRedirectCheck( $this->mCookieCheck );
93 return;
94 } else if( $this->mPosted ) {
95 if( $this->mCreateaccount ) {
96 return $this->addNewAccount();
97 } else if ( $this->mCreateaccountMail ) {
98 return $this->addNewAccountMailPassword();
99 } else if ( $this->mMailmypassword ) {
100 return $this->mailPassword();
101 } else if ( ( 'submitlogin' == $this->mAction ) || $this->mLoginattempt ) {
102 return $this->processLogin();
105 $this->mainLoginForm( '' );
109 * @private
111 function addNewAccountMailPassword() {
112 global $wgOut;
114 if ('' == $this->mEmail) {
115 $this->mainLoginForm( wfMsg( 'noemail', htmlspecialchars( $this->mName ) ) );
116 return;
119 $u = $this->addNewaccountInternal();
121 if ($u == NULL) {
122 return;
125 $u->saveSettings();
126 $result = $this->mailPasswordInternal( $u, false );
128 wfRunHooks( 'AddNewAccount', array( $u ) );
130 $wgOut->setPageTitle( wfMsg( 'accmailtitle' ) );
131 $wgOut->setRobotpolicy( 'noindex,nofollow' );
132 $wgOut->setArticleRelated( false );
134 if( WikiError::isError( $result ) ) {
135 $this->mainLoginForm( wfMsg( 'mailerror', $result->getMessage() ) );
136 } else {
137 $wgOut->addWikiText( wfMsg( 'accmailtext', $u->getName(), $u->getEmail() ) );
138 $wgOut->returnToMain( false );
140 $u = 0;
145 * @private
147 function addNewAccount() {
148 global $wgUser, $wgEmailAuthentication;
150 # Create the account and abort if there's a problem doing so
151 $u = $this->addNewAccountInternal();
152 if( $u == NULL )
153 return;
155 # If we showed up language selection links, and one was in use, be
156 # smart (and sensible) and save that language as the user's preference
157 global $wgLoginLanguageSelector;
158 if( $wgLoginLanguageSelector && $this->mLanguage )
159 $u->setOption( 'language', $this->mLanguage );
161 # Save user settings and send out an email authentication message if needed
162 $u->saveSettings();
163 if( $wgEmailAuthentication && User::isValidEmailAddr( $u->getEmail() ) )
164 $u->sendConfirmationMail();
166 # If not logged in, assume the new account as the current one and set session cookies
167 # then show a "welcome" message or a "need cookies" message as needed
168 if( $wgUser->isAnon() ) {
169 $wgUser = $u;
170 $wgUser->setCookies();
171 wfRunHooks( 'AddNewAccount', array( $wgUser ) );
172 if( $this->hasSessionCookie() ) {
173 return $this->successfulLogin( wfMsg( 'welcomecreation', $wgUser->getName() ), false );
174 } else {
175 return $this->cookieRedirectCheck( 'new' );
177 } else {
178 # Confirm that the account was created
179 global $wgOut;
180 $self = SpecialPage::getTitleFor( 'Userlogin' );
181 $wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) );
182 $wgOut->setArticleRelated( false );
183 $wgOut->setRobotPolicy( 'noindex,nofollow' );
184 $wgOut->addHtml( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) );
185 $wgOut->returnToMain( $self->getPrefixedText() );
186 wfRunHooks( 'AddNewAccount', array( $u ) );
187 return true;
192 * @private
194 function addNewAccountInternal() {
195 global $wgUser, $wgOut;
196 global $wgEnableSorbs, $wgProxyWhitelist;
197 global $wgMemc, $wgAccountCreationThrottle;
198 global $wgAuth, $wgMinimalPasswordLength;
200 // If the user passes an invalid domain, something is fishy
201 if( !$wgAuth->validDomain( $this->mDomain ) ) {
202 $this->mainLoginForm( wfMsg( 'wrongpassword' ) );
203 return false;
206 // If we are not allowing users to login locally, we should
207 // be checking to see if the user is actually able to
208 // authenticate to the authentication server before they
209 // create an account (otherwise, they can create a local account
210 // and login as any domain user). We only need to check this for
211 // domains that aren't local.
212 if( 'local' != $this->mDomain && '' != $this->mDomain ) {
213 if( !$wgAuth->canCreateAccounts() && ( !$wgAuth->userExists( $this->mName ) || !$wgAuth->authenticate( $this->mName, $this->mPassword ) ) ) {
214 $this->mainLoginForm( wfMsg( 'wrongpassword' ) );
215 return false;
219 if ( wfReadOnly() ) {
220 $wgOut->readOnlyPage();
221 return false;
224 if (!$wgUser->isAllowedToCreateAccount()) {
225 $this->userNotPrivilegedMessage();
226 return false;
229 $ip = wfGetIP();
230 if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) &&
231 $wgUser->inSorbsBlacklist( $ip ) )
233 $this->mainLoginForm( wfMsg( 'sorbs_create_account_reason' ) . ' (' . htmlspecialchars( $ip ) . ')' );
234 return;
237 $name = trim( $this->mName );
238 $u = User::newFromName( $name, 'creatable' );
239 if ( is_null( $u ) ) {
240 $this->mainLoginForm( wfMsg( 'noname' ) );
241 return false;
244 if ( 0 != $u->idForName() ) {
245 $this->mainLoginForm( wfMsg( 'userexists' ) );
246 return false;
249 if ( 0 != strcmp( $this->mPassword, $this->mRetype ) ) {
250 $this->mainLoginForm( wfMsg( 'badretype' ) );
251 return false;
254 if ( !$wgUser->isValidPassword( $this->mPassword ) ) {
255 $this->mainLoginForm( wfMsg( 'passwordtooshort', $wgMinimalPasswordLength ) );
256 return false;
259 $abortError = '';
260 if( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError ) ) ) {
261 // Hook point to add extra creation throttles and blocks
262 wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" );
263 $this->mainLoginForm( $abortError );
264 return false;
267 if ( $wgAccountCreationThrottle ) {
268 $key = wfMemcKey( 'acctcreate', 'ip', $ip );
269 $value = $wgMemc->incr( $key );
270 if ( !$value ) {
271 $wgMemc->set( $key, 1, 86400 );
273 if ( $value > $wgAccountCreationThrottle ) {
274 $this->throttleHit( $wgAccountCreationThrottle );
275 return false;
279 if( !$wgAuth->addUser( $u, $this->mPassword ) ) {
280 $this->mainLoginForm( wfMsg( 'externaldberror' ) );
281 return false;
284 # Update user count
285 $ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
286 $ssUpdate->doUpdate();
288 return $this->initUser( $u );
292 * Actually add a user to the database.
293 * Give it a User object that has been initialised with a name.
295 * @param $u User object.
296 * @return User object.
297 * @private
299 function initUser( $u ) {
300 $u->addToDatabase();
301 $u->setPassword( $this->mPassword );
302 $u->setEmail( $this->mEmail );
303 $u->setRealName( $this->mRealName );
304 $u->setToken();
306 global $wgAuth;
307 $wgAuth->initUser( $u );
309 $u->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 );
310 $u->saveSettings();
312 return $u;
316 * Internally authenticate the login request.
318 * This may create a local account as a side effect if the
319 * authentication plugin allows transparent local account
320 * creation.
322 * @public
324 function authenticateUserData() {
325 global $wgUser, $wgAuth;
326 if ( '' == $this->mName ) {
327 return self::NO_NAME;
329 $u = User::newFromName( $this->mName );
330 if( is_null( $u ) || !User::isUsableName( $u->getName() ) ) {
331 return self::ILLEGAL;
333 if ( 0 == $u->getID() ) {
334 global $wgAuth;
336 * If the external authentication plugin allows it,
337 * automatically create a new account for users that
338 * are externally defined but have not yet logged in.
340 if ( $wgAuth->autoCreate() && $wgAuth->userExists( $u->getName() ) ) {
341 if ( $wgAuth->authenticate( $u->getName(), $this->mPassword ) ) {
342 $u = $this->initUser( $u );
343 } else {
344 return self::WRONG_PLUGIN_PASS;
346 } else {
347 return self::NOT_EXISTS;
349 } else {
350 $u->load();
353 if (!$u->checkPassword( $this->mPassword )) {
354 return '' == $this->mPassword ? self::EMPTY_PASS : self::WRONG_PASS;
355 } else {
356 $wgAuth->updateUser( $u );
357 $wgUser = $u;
359 return self::SUCCESS;
363 function processLogin() {
364 global $wgUser, $wgAuth;
366 switch ($this->authenticateUserData())
368 case self::SUCCESS:
369 # We've verified now, update the real record
370 if( (bool)$this->mRemember != (bool)$wgUser->getOption( 'rememberpassword' ) ) {
371 $wgUser->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 );
372 $wgUser->saveSettings();
373 } else {
374 $wgUser->invalidateCache();
376 $wgUser->setCookies();
378 if( $this->hasSessionCookie() ) {
379 return $this->successfulLogin( wfMsg( 'loginsuccess', $wgUser->getName() ) );
380 } else {
381 return $this->cookieRedirectCheck( 'login' );
383 break;
385 case self::NO_NAME:
386 case self::ILLEGAL:
387 $this->mainLoginForm( wfMsg( 'noname' ) );
388 break;
389 case self::WRONG_PLUGIN_PASS:
390 $this->mainLoginForm( wfMsg( 'wrongpassword' ) );
391 break;
392 case self::NOT_EXISTS:
393 $this->mainLoginForm( wfMsg( 'nosuchuser', htmlspecialchars( $this->mName ) ) );
394 break;
395 case self::WRONG_PASS:
396 $this->mainLoginForm( wfMsg( 'wrongpassword' ) );
397 break;
398 case self::EMPTY_PASS:
399 $this->mainLoginForm( wfMsg( 'wrongpasswordempty' ) );
400 break;
401 default:
402 wfDebugDieBacktrace( "Unhandled case value" );
407 * @private
409 function mailPassword() {
410 global $wgUser, $wgOut;
412 # Check against blocked IPs
413 # fixme -- should we not?
414 if( $wgUser->isBlocked() ) {
415 $this->mainLoginForm( wfMsg( 'blocked-mailpassword' ) );
416 return;
419 # Check against the rate limiter
420 if( $wgUser->pingLimiter( 'mailpassword' ) ) {
421 $wgOut->rateLimited();
422 return;
425 if ( '' == $this->mName ) {
426 $this->mainLoginForm( wfMsg( 'noname' ) );
427 return;
429 $u = User::newFromName( $this->mName );
430 if( is_null( $u ) ) {
431 $this->mainLoginForm( wfMsg( 'noname' ) );
432 return;
434 if ( 0 == $u->getID() ) {
435 $this->mainLoginForm( wfMsg( 'nosuchuser', $u->getName() ) );
436 return;
439 # Check against password throttle
440 if ( $u->isPasswordReminderThrottled() ) {
441 global $wgPasswordReminderResendTime;
442 # Round the time in hours to 3 d.p., in case someone is specifying minutes or seconds.
443 $this->mainLoginForm( wfMsg( 'throttled-mailpassword',
444 round( $wgPasswordReminderResendTime, 3 ) ) );
445 return;
448 $result = $this->mailPasswordInternal( $u, true );
449 if( WikiError::isError( $result ) ) {
450 $this->mainLoginForm( wfMsg( 'mailerror', $result->getMessage() ) );
451 } else {
452 $this->mainLoginForm( wfMsg( 'passwordsent', $u->getName() ), 'success' );
458 * @return mixed true on success, WikiError on failure
459 * @private
461 function mailPasswordInternal( $u, $throttle = true ) {
462 global $wgCookiePath, $wgCookieDomain, $wgCookiePrefix, $wgCookieSecure;
463 global $wgServer, $wgScript;
465 if ( '' == $u->getEmail() ) {
466 return new WikiError( wfMsg( 'noemail', $u->getName() ) );
469 $np = $u->randomPassword();
470 $u->setNewpassword( $np, $throttle );
472 setcookie( "{$wgCookiePrefix}Token", '', time() - 3600, $wgCookiePath, $wgCookieDomain, $wgCookieSecure );
474 $u->saveSettings();
476 $ip = wfGetIP();
477 if ( '' == $ip ) { $ip = '(Unknown)'; }
479 $m = wfMsg( 'passwordremindertext', $ip, $u->getName(), $np, $wgServer . $wgScript );
481 $result = $u->sendMail( wfMsg( 'passwordremindertitle' ), $m );
482 return $result;
487 * @param string $msg Message that will be shown on success
488 * @param bool $auto Toggle auto-redirect to main page; default true
489 * @private
491 function successfulLogin( $msg, $auto = true ) {
492 global $wgUser;
493 global $wgOut;
495 # Run any hooks; ignore results
497 wfRunHooks('UserLoginComplete', array(&$wgUser));
499 $wgOut->setPageTitle( wfMsg( 'loginsuccesstitle' ) );
500 $wgOut->setRobotpolicy( 'noindex,nofollow' );
501 $wgOut->setArticleRelated( false );
502 $wgOut->addWikiText( $msg );
503 if ( !empty( $this->mReturnTo ) ) {
504 $wgOut->returnToMain( $auto, $this->mReturnTo );
505 } else {
506 $wgOut->returnToMain( $auto );
510 /** */
511 function userNotPrivilegedMessage() {
512 global $wgOut;
514 $wgOut->setPageTitle( wfMsg( 'whitelistacctitle' ) );
515 $wgOut->setRobotpolicy( 'noindex,nofollow' );
516 $wgOut->setArticleRelated( false );
518 $wgOut->addWikiText( wfMsg( 'whitelistacctext' ) );
520 $wgOut->returnToMain( false );
523 /** */
524 function userBlockedMessage() {
525 global $wgOut;
527 # Let's be nice about this, it's likely that this feature will be used
528 # for blocking large numbers of innocent people, e.g. range blocks on
529 # schools. Don't blame it on the user. There's a small chance that it
530 # really is the user's fault, i.e. the username is blocked and they
531 # haven't bothered to log out before trying to create an account to
532 # evade it, but we'll leave that to their guilty conscience to figure
533 # out.
535 $wgOut->setPageTitle( wfMsg( 'cantcreateaccounttitle' ) );
536 $wgOut->setRobotpolicy( 'noindex,nofollow' );
537 $wgOut->setArticleRelated( false );
539 $ip = wfGetIP();
540 $wgOut->addWikiText( wfMsg( 'cantcreateaccounttext', $ip ) );
541 $wgOut->returnToMain( false );
545 * @private
547 function mainLoginForm( $msg, $msgtype = 'error' ) {
548 global $wgUser, $wgOut, $wgAllowRealName, $wgEnableEmail;
549 global $wgCookiePrefix, $wgAuth, $wgLoginLanguageSelector;
551 if ( $this->mType == 'signup' ) {
552 if ( !$wgUser->isAllowed( 'createaccount' ) ) {
553 $this->userNotPrivilegedMessage();
554 return;
555 } elseif ( $wgUser->isBlockedFromCreateAccount() ) {
556 $this->userBlockedMessage();
557 return;
561 if ( '' == $this->mName ) {
562 if ( $wgUser->isLoggedIn() ) {
563 $this->mName = $wgUser->getName();
564 } else {
565 $this->mName = isset( $_COOKIE[$wgCookiePrefix.'UserName'] ) ? $_COOKIE[$wgCookiePrefix.'UserName'] : null;
569 $titleObj = SpecialPage::getTitleFor( 'Userlogin' );
571 if ( $this->mType == 'signup' ) {
572 $template = new UsercreateTemplate();
573 $q = 'action=submitlogin&type=signup';
574 $linkq = 'type=login';
575 $linkmsg = 'gotaccount';
576 } else {
577 $template = new UserloginTemplate();
578 $q = 'action=submitlogin&type=login';
579 $linkq = 'type=signup';
580 $linkmsg = 'nologin';
583 if ( !empty( $this->mReturnTo ) ) {
584 $returnto = '&returnto=' . wfUrlencode( $this->mReturnTo );
585 $q .= $returnto;
586 $linkq .= $returnto;
589 # Pass any language selection on to the mode switch link
590 if( $wgLoginLanguageSelector && $this->mLanguage )
591 $linkq .= '&uselang=' . $this->mLanguage;
593 $link = '<a href="' . htmlspecialchars ( $titleObj->getLocalUrl( $linkq ) ) . '">';
594 $link .= wfMsgHtml( $linkmsg . 'link' );
595 $link .= '</a>';
597 # Don't show a "create account" link if the user can't
598 if( $this->showCreateOrLoginLink( $wgUser ) )
599 $template->set( 'link', wfMsgHtml( $linkmsg, $link ) );
600 else
601 $template->set( 'link', '' );
603 $template->set( 'header', '' );
604 $template->set( 'name', $this->mName );
605 $template->set( 'password', $this->mPassword );
606 $template->set( 'retype', $this->mRetype );
607 $template->set( 'email', $this->mEmail );
608 $template->set( 'realname', $this->mRealName );
609 $template->set( 'domain', $this->mDomain );
611 $template->set( 'action', $titleObj->getLocalUrl( $q ) );
612 $template->set( 'message', $msg );
613 $template->set( 'messagetype', $msgtype );
614 $template->set( 'createemail', $wgEnableEmail && $wgUser->isLoggedIn() );
615 $template->set( 'userealname', $wgAllowRealName );
616 $template->set( 'useemail', $wgEnableEmail );
617 $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) or $this->mRemember );
619 # Prepare language selection links as needed
620 if( $wgLoginLanguageSelector ) {
621 $template->set( 'languages', $this->makeLanguageSelector() );
622 if( $this->mLanguage )
623 $template->set( 'uselang', $this->mLanguage );
626 // Give authentication and captcha plugins a chance to modify the form
627 $wgAuth->modifyUITemplate( $template );
628 if ( $this->mType == 'signup' ) {
629 wfRunHooks( 'UserCreateForm', array( &$template ) );
630 } else {
631 wfRunHooks( 'UserLoginForm', array( &$template ) );
634 $wgOut->setPageTitle( wfMsg( 'userlogin' ) );
635 $wgOut->setRobotpolicy( 'noindex,nofollow' );
636 $wgOut->setArticleRelated( false );
637 $wgOut->addTemplate( $template );
641 * @private
643 function showCreateOrLoginLink( &$user ) {
644 if( $this->mType == 'signup' ) {
645 return( true );
646 } elseif( $user->isAllowed( 'createaccount' ) ) {
647 return( true );
648 } else {
649 return( false );
654 * @private
656 function hasSessionCookie() {
657 global $wgDisableCookieCheck;
658 return ( $wgDisableCookieCheck ) ? true : ( isset( $_COOKIE[session_name()] ) );
662 * @private
664 function cookieRedirectCheck( $type ) {
665 global $wgOut;
667 $titleObj = SpecialPage::getTitleFor( 'Userlogin' );
668 $check = $titleObj->getFullURL( 'wpCookieCheck='.$type );
670 return $wgOut->redirect( $check );
674 * @private
676 function onCookieRedirectCheck( $type ) {
677 global $wgUser;
679 if ( !$this->hasSessionCookie() ) {
680 if ( $type == 'new' ) {
681 return $this->mainLoginForm( wfMsg( 'nocookiesnew' ) );
682 } else if ( $type == 'login' ) {
683 return $this->mainLoginForm( wfMsg( 'nocookieslogin' ) );
684 } else {
685 # shouldn't happen
686 return $this->mainLoginForm( wfMsg( 'error' ) );
688 } else {
689 return $this->successfulLogin( wfMsg( 'loginsuccess', $wgUser->getName() ) );
694 * @private
696 function throttleHit( $limit ) {
697 global $wgOut;
699 $wgOut->addWikiText( wfMsg( 'acct_creation_throttle_hit', $limit ) );
703 * Produce a bar of links which allow the user to select another language
704 * during login/registration but retain "returnto"
706 * @return string
708 function makeLanguageSelector() {
709 $msg = wfMsgForContent( 'loginlanguagelinks' );
710 if( $msg != '' && !wfEmptyMsg( 'loginlanguagelinks', $msg ) ) {
711 $langs = explode( "\n", $msg );
712 $links = array();
713 foreach( $langs as $lang ) {
714 $lang = trim( $lang, '* ' );
715 $parts = explode( '|', $lang );
716 $links[] = $this->makeLanguageSelectorLink( $parts[0], $parts[1] );
718 return count( $links ) > 0 ? wfMsgHtml( 'loginlanguagelabel', implode( ' | ', $links ) ) : '';
719 } else {
720 return '';
725 * Create a language selector link for a particular language
726 * Links back to this page preserving type and returnto
728 * @param $text Link text
729 * @param $lang Language code
731 function makeLanguageSelectorLink( $text, $lang ) {
732 global $wgUser;
733 $self = SpecialPage::getTitleFor( 'Userlogin' );
734 $attr[] = 'uselang=' . $lang;
735 if( $this->mType == 'signup' )
736 $attr[] = 'type=signup';
737 if( $this->mReturnTo )
738 $attr[] = 'returnto=' . $this->mReturnTo;
739 $skin =& $wgUser->getSkin();
740 return $skin->makeKnownLinkObj( $self, htmlspecialchars( $text ), implode( '&', $attr ) );