new anti-bot code
[lhc/web/wiklou.git] / includes / User.php
1 <?php
2 # See user.doc
3
4 require_once( 'WatchedItem.php' );
5
6 class User {
7 /* private */ var $mId, $mName, $mPassword, $mEmail, $mNewtalk;
8 /* private */ var $mRights, $mOptions;
9 /* private */ var $mDataLoaded, $mNewpassword;
10 /* private */ var $mSkin;
11 /* private */ var $mBlockedby, $mBlockreason;
12 /* private */ var $mTouched;
13 /* private */ var $mCookiePassword;
14 /* private */ var $mRealName;
15
16 function User() {
17 $this->loadDefaults();
18 }
19
20 # Static factory method
21 #
22 function newFromName( $name ) {
23 $u = new User();
24
25 # Clean up name according to title rules
26
27 $t = Title::newFromText( $name );
28 $u->setName( $t->getText() );
29 return $u;
30 }
31
32 /* static */ function whoIs( $id ) {
33 return wfGetSQL( 'user', 'user_name', 'user_id='.$id );
34 }
35
36 /* static */ function whoIsReal( $id ) {
37 return wfGetSQL( 'user', 'user_real_name', 'user_id='.$id );
38 }
39
40 /* static */ function idFromName( $name ) {
41 $nt = Title::newFromText( $name );
42 if( is_null( $nt ) ) {
43 # Illegal name
44 return null;
45 }
46 $sql = "SELECT user_id FROM user WHERE user_name='" .
47 wfStrencode( $nt->getText() ) . "'";
48 $res = wfQuery( $sql, DB_READ, 'User::idFromName' );
49
50 if ( 0 == wfNumRows( $res ) ) {
51 return 0;
52 } else {
53 $s = wfFetchObject( $res );
54 wfFreeResult( $res );
55 return $s->user_id;
56 }
57 }
58
59 # does the string match an anonymous user IP address?
60 /* static */ function isIP( $name ) {
61 return preg_match("/^\d{1,3}\.\d{1,3}.\d{1,3}\.\d{1,3}$/",$name);
62
63 }
64
65 /* static */ function randomPassword() {
66 $pwchars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz';
67 $l = strlen( $pwchars ) - 1;
68
69 wfSeedRandom();
70 $np = $pwchars{mt_rand( 0, $l )} . $pwchars{mt_rand( 0, $l )} .
71 $pwchars{mt_rand( 0, $l )} . chr( mt_rand(48, 57) ) .
72 $pwchars{mt_rand( 0, $l )} . $pwchars{mt_rand( 0, $l )} .
73 $pwchars{mt_rand( 0, $l )};
74 return $np;
75 }
76
77 function loadDefaults() {
78 global $wgLang, $wgIP;
79 global $wgNamespacesToBeSearchedDefault;
80
81 $this->mId = $this->mNewtalk = 0;
82 $this->mName = $wgIP;
83 $this->mEmail = '';
84 $this->mPassword = $this->mNewpassword = '';
85 $this->mRights = array();
86 $defOpt = $wgLang->getDefaultUserOptions() ;
87 foreach ( $defOpt as $oname => $val ) {
88 $this->mOptions[$oname] = $val;
89 }
90 foreach ($wgNamespacesToBeSearchedDefault as $nsnum => $val) {
91 $this->mOptions['searchNs'.$nsnum] = $val;
92 }
93 unset( $this->mSkin );
94 $this->mDataLoaded = false;
95 $this->mBlockedby = -1; # Unset
96 $this->mTouched = '0'; # Allow any pages to be cached
97 $this->cookiePassword = '';
98 }
99
100 /* private */ function getBlockedStatus()
101 {
102 global $wgIP, $wgBlockCache, $wgProxyList;
103
104 if ( -1 != $this->mBlockedby ) { return; }
105
106 $this->mBlockedby = 0;
107
108 # User blocking
109 if ( $this->mId ) {
110 $block = new Block();
111 if ( $block->load( $wgIP , $this->mId ) ) {
112 $this->mBlockedby = $block->mBy;
113 $this->mBlockreason = $block->mReason;
114 }
115 }
116
117 # IP/range blocking
118 if ( !$this->mBlockedby ) {
119 $block = $wgBlockCache->get( $wgIP );
120 if ( $block !== false ) {
121 $this->mBlockedby = $block->mBy;
122 $this->mBlockreason = $block->mReason;
123 }
124 }
125
126 # Proxy blocking
127 if ( !$this->mBlockedby ) {
128 if ( array_key_exists( $wgIP, $wgProxyList ) ) {
129 $this->mBlockreason = wfMsg( 'proxyblockreason' );
130 $this->mBlockedby = "Proxy blocker";
131 }
132 }
133 }
134
135 function isBlocked()
136 {
137 $this->getBlockedStatus();
138 if ( 0 === $this->mBlockedby ) { return false; }
139 return true;
140 }
141
142 function blockedBy() {
143 $this->getBlockedStatus();
144 return $this->mBlockedby;
145 }
146
147 function blockedFor() {
148 $this->getBlockedStatus();
149 return $this->mBlockreason;
150 }
151
152 function SetupSession() {
153 global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain;
154 if( $wgSessionsInMemcached ) {
155 require_once( 'MemcachedSessions.php' );
156 }
157 session_set_cookie_params( 0, $wgCookiePath, $wgCookieDomain );
158 session_cache_limiter( 'private, must-revalidate' );
159 @session_start();
160 }
161
162 /* static */ function loadFromSession()
163 {
164 global $wgMemc, $wgDBname;
165
166 if ( isset( $_SESSION['wsUserID'] ) ) {
167 if ( 0 != $_SESSION['wsUserID'] ) {
168 $sId = $_SESSION['wsUserID'];
169 } else {
170 return new User();
171 }
172 } else if ( isset( $_COOKIE["{$wgDBname}UserID"] ) ) {
173 $sId = IntVal( $_COOKIE["{$wgDBname}UserID"] );
174 $_SESSION['wsUserID'] = $sId;
175 } else {
176 return new User();
177 }
178 if ( isset( $_SESSION['wsUserName'] ) ) {
179 $sName = $_SESSION['wsUserName'];
180 } else if ( isset( $_COOKIE["{$wgDBname}UserName"] ) ) {
181 $sName = $_COOKIE["{$wgDBname}UserName"];
182 $_SESSION['wsUserName'] = $sName;
183 } else {
184 return new User();
185 }
186
187 $passwordCorrect = FALSE;
188 $user = $wgMemc->get( $key = "$wgDBname:user:id:$sId" );
189 if($makenew = !$user) {
190 wfDebug( "User::loadFromSession() unable to load from memcached\n" );
191 $user = new User();
192 $user->mId = $sId;
193 $user->loadFromDatabase();
194 } else {
195 wfDebug( "User::loadFromSession() got from cache!\n" );
196 }
197
198 if ( isset( $_SESSION['wsUserPassword'] ) ) {
199 $passwordCorrect = $_SESSION['wsUserPassword'] == $user->mPassword;
200 } else if ( isset( $_COOKIE["{$wgDBname}Password"] ) ) {
201 $user->mCookiePassword = $_COOKIE["{$wgDBname}Password"];
202 $_SESSION['wsUserPassword'] = $user->addSalt( $user->mCookiePassword );
203 $passwordCorrect = $_SESSION['wsUserPassword'] == $user->mPassword;
204 } else {
205 return new User(); # Can't log in from session
206 }
207
208 if ( ( $sName == $user->mName ) && $passwordCorrect ) {
209 if($makenew) {
210 if($wgMemc->set( $key, $user ))
211 wfDebug( "User::loadFromSession() successfully saved user\n" );
212 else
213 wfDebug( "User::loadFromSession() unable to save to memcached\n" );
214 }
215 $user->spreadBlock();
216 return $user;
217 }
218 return new User(); # Can't log in from session
219 }
220
221 function loadFromDatabase()
222 {
223 global $wgCommandLineMode;
224 if ( $this->mDataLoaded || $wgCommandLineMode ) {
225 return;
226 }
227
228 # Paranoia
229 $this->mId = IntVal( $this->mId );
230
231 # check in separate table if there are changes to the talk page
232 $this->mNewtalk=0; # reset talk page status
233 if($this->mId) {
234 $sql = "SELECT 1 FROM user_newtalk WHERE user_id={$this->mId}";
235 $res = wfQuery ($sql, DB_READ, "User::loadFromDatabase" );
236
237 if (wfNumRows($res)>0) {
238 $this->mNewtalk= 1;
239 }
240 wfFreeResult( $res );
241 } else {
242 global $wgDBname, $wgMemc;
243 $key = "$wgDBname:newtalk:ip:{$this->mName}";
244 $newtalk = $wgMemc->get( $key );
245 if( ! is_integer( $newtalk ) ){
246 $sql = "SELECT 1 FROM user_newtalk WHERE user_ip='{$this->mName}'";
247 $res = wfQuery ($sql, DB_READ, "User::loadFromDatabase" );
248
249 $this->mNewtalk = (wfNumRows($res)>0) ? 1 : 0;
250 wfFreeResult( $res );
251
252 $wgMemc->set( $key, $this->mNewtalk, time() ); // + 1800 );
253 } else {
254 $this->mNewtalk = $newtalk ? 1 : 0;
255 }
256 }
257 if(!$this->mId) {
258 $this->mDataLoaded = true;
259 return;
260 } # the following stuff is for non-anonymous users only
261
262 $sql = "SELECT user_name,user_password,user_newpassword,user_email," .
263 "user_real_name,user_options,user_rights,user_touched " .
264 " FROM user WHERE user_id=" . $this->mId;
265 $res = wfQuery( $sql, DB_READ, "User::loadFromDatabase" );
266
267 if ( wfNumRows( $res ) > 0 ) {
268 $s = wfFetchObject( $res );
269 $this->mName = $s->user_name;
270 $this->mEmail = $s->user_email;
271 $this->mRealName = $s->user_real_name;
272 $this->mPassword = $s->user_password;
273 $this->mNewpassword = $s->user_newpassword;
274 $this->decodeOptions( $s->user_options );
275 $this->mRights = explode( ",", strtolower( $s->user_rights ) );
276 $this->mTouched = $s->user_touched;
277 }
278
279 wfFreeResult( $res );
280 $this->mDataLoaded = true;
281 }
282
283 function getID() { return $this->mId; }
284 function setID( $v ) {
285 $this->mId = $v;
286 $this->mDataLoaded = false;
287 }
288
289 function getName() {
290 $this->loadFromDatabase();
291 return $this->mName;
292 }
293
294 function setName( $str ) {
295 $this->loadFromDatabase();
296 $this->mName = $str;
297 }
298
299 function getNewtalk() {
300 $this->loadFromDatabase();
301 return ( 0 != $this->mNewtalk );
302 }
303
304 function setNewtalk( $val )
305 {
306 $this->loadFromDatabase();
307 $this->mNewtalk = $val;
308 $this->invalidateCache();
309 }
310
311 function invalidateCache() {
312 $this->loadFromDatabase();
313 $this->mTouched = wfTimestampNow();
314 # Don't forget to save the options after this or
315 # it won't take effect!
316 }
317
318 function validateCache( $timestamp ) {
319 $this->loadFromDatabase();
320 return ($timestamp >= $this->mTouched);
321 }
322
323 function getPassword() {
324 $this->loadFromDatabase();
325 return $this->mPassword;
326 }
327
328 function getNewpassword() {
329 $this->loadFromDatabase();
330 return $this->mNewpassword;
331 }
332
333 function addSalt( $p ) {
334 global $wgPasswordSalt;
335 if($wgPasswordSalt)
336 return md5( "{$this->mId}-{$p}" );
337 else
338 return $p;
339 }
340
341 function encryptPassword( $p ) {
342 return $this->addSalt( md5( $p ) );
343 }
344
345 function setPassword( $str ) {
346 $this->loadFromDatabase();
347 $this->setCookiePassword( $str );
348 $this->mPassword = $this->encryptPassword( $str );
349 $this->mNewpassword = '';
350 }
351
352 function setCookiePassword( $str ) {
353 $this->loadFromDatabase();
354 $this->mCookiePassword = md5( $str );
355 }
356
357 function setNewpassword( $str ) {
358 $this->loadFromDatabase();
359 $this->mNewpassword = $this->encryptPassword( $str );
360 }
361
362 function getEmail() {
363 $this->loadFromDatabase();
364 return $this->mEmail;
365 }
366
367 function setEmail( $str ) {
368 $this->loadFromDatabase();
369 $this->mEmail = $str;
370 }
371
372 function getRealName() {
373 $this->loadFromDatabase();
374 return $this->mRealName;
375 }
376
377 function setRealName( $str ) {
378 $this->loadFromDatabase();
379 $this->mRealName = $str;
380 }
381
382 function getOption( $oname ) {
383 $this->loadFromDatabase();
384 if ( array_key_exists( $oname, $this->mOptions ) ) {
385 return $this->mOptions[$oname];
386 } else {
387 return '';
388 }
389 }
390
391 function setOption( $oname, $val ) {
392 $this->loadFromDatabase();
393 if ( $oname == 'skin' ) {
394 # Clear cached skin, so the new one displays immediately in Special:Preferences
395 unset( $this->mSkin );
396 }
397 $this->mOptions[$oname] = $val;
398 $this->invalidateCache();
399 }
400
401 function getRights() {
402 $this->loadFromDatabase();
403 return $this->mRights;
404 }
405
406 function addRight( $rname ) {
407 $this->loadFromDatabase();
408 array_push( $this->mRights, $rname );
409 $this->invalidateCache();
410 }
411
412 function isSysop() {
413 $this->loadFromDatabase();
414 if ( 0 == $this->mId ) { return false; }
415
416 return in_array( 'sysop', $this->mRights );
417 }
418
419 function isDeveloper() {
420 $this->loadFromDatabase();
421 if ( 0 == $this->mId ) { return false; }
422
423 return in_array( 'developer', $this->mRights );
424 }
425
426 function isBureaucrat() {
427 $this->loadFromDatabase();
428 if ( 0 == $this->mId ) { return false; }
429
430 return in_array( 'bureaucrat', $this->mRights );
431 }
432
433 function isBot() {
434 $this->loadFromDatabase();
435
436 # Why was this here? I need a UID=0 conversion script [TS]
437 # if ( 0 == $this->mId ) { return false; }
438
439 return in_array( 'bot', $this->mRights );
440 }
441
442 function &getSkin() {
443 if ( ! isset( $this->mSkin ) ) {
444 # get all skin names available from SkinNames.php
445 $skinNames = Skin::getSkinNames();
446 # get the user skin
447 $userSkin = $this->getOption( 'skin' );
448 if ( $userSkin == '' ) { $userSkin = 'standard'; }
449
450 if ( !isset( $skinNames[$userSkin] ) ) {
451 # in case the user skin could not be found find a replacement
452 $fallback = array(
453 0 => 'SkinStandard',
454 1 => 'SkinNostalgia',
455 2 => 'SkinCologneBlue');
456 # if phptal is enabled we should have monobook skin that superseed
457 # the good old SkinStandard.
458 if ( isset( $skinNames['monobook'] ) ) {
459 $fallback[0] = 'SkinMonoBook';
460 }
461
462 if(is_numeric($userSkin) && isset( $fallback[$userSkin]) ){
463 $sn = $fallback[$userSkin];
464 } else {
465 $sn = 'SkinStandard';
466 }
467 } else {
468 # The user skin is available
469 $sn = 'Skin' . $skinNames[$userSkin];
470 }
471
472 # only require the needed stuff
473 switch($sn) {
474 case 'SkinMonoBook':
475 require_once( 'SkinPHPTal.php' );
476 break;
477 case 'SkinStandard':
478 require_once( 'SkinStandard.php' );
479 break;
480 case 'SkinNostalgia':
481 require_once( 'SkinNostalgia.php' );
482 break;
483 case 'SkinCologneBlue':
484 require_once( 'SkinCologneBlue.php' );
485 break;
486 }
487 # now we can create the skin object
488 $this->mSkin = new $sn;
489 }
490 return $this->mSkin;
491 }
492
493 function isWatched( $title ) {
494 $wl = WatchedItem::fromUserTitle( $this, $title );
495 return $wl->isWatched();
496 }
497
498 function addWatch( $title ) {
499 $wl = WatchedItem::fromUserTitle( $this, $title );
500 $wl->addWatch();
501 $this->invalidateCache();
502 }
503
504 function removeWatch( $title ) {
505 $wl = WatchedItem::fromUserTitle( $this, $title );
506 $wl->removeWatch();
507 $this->invalidateCache();
508 }
509
510
511 /* private */ function encodeOptions() {
512 $a = array();
513 foreach ( $this->mOptions as $oname => $oval ) {
514 array_push( $a, $oname.'='.$oval );
515 }
516 $s = implode( "\n", $a );
517 return wfStrencode( $s );
518 }
519
520 /* private */ function decodeOptions( $str ) {
521 $a = explode( "\n", $str );
522 foreach ( $a as $s ) {
523 if ( preg_match( "/^(.[^=]*)=(.*)$/", $s, $m ) ) {
524 $this->mOptions[$m[1]] = $m[2];
525 }
526 }
527 }
528
529 function setCookies() {
530 global $wgCookieExpiration, $wgCookiePath, $wgCookieDomain, $wgDBname;
531 if ( 0 == $this->mId ) return;
532 $this->loadFromDatabase();
533 $exp = time() + $wgCookieExpiration;
534
535 $_SESSION['wsUserID'] = $this->mId;
536 setcookie( $wgDBname.'UserID', $this->mId, $exp, $wgCookiePath, $wgCookieDomain );
537
538 $_SESSION['wsUserName'] = $this->mName;
539 setcookie( $wgDBname.'UserName', $this->mName, $exp, $wgCookiePath, $wgCookieDomain );
540
541 $_SESSION['wsUserPassword'] = $this->mPassword;
542 if ( 1 == $this->getOption( 'rememberpassword' ) ) {
543 setcookie( $wgDBname.'Password', $this->mCookiePassword, $exp, $wgCookiePath, $wgCookieDomain );
544 } else {
545 setcookie( $wgDBname.'Password', '', time() - 3600 );
546 }
547 }
548
549 function logout() {
550 global $wgCookiePath, $wgCookieDomain, $wgDBname;
551 $this->mId = 0;
552
553 $_SESSION['wsUserID'] = 0;
554
555 setcookie( $wgDBname.'UserID', '', time() - 3600, $wgCookiePath, $wgCookieDomain );
556 setcookie( $wgDBname.'Password', '', time() - 3600, $wgCookiePath, $wgCookieDomain );
557 }
558
559 function saveSettings() {
560 global $wgMemc, $wgDBname;
561
562 if ( ! $this->mNewtalk ) {
563 if( $this->mId ) {
564 $sql="DELETE FROM user_newtalk WHERE user_id={$this->mId}";
565 wfQuery ($sql, DB_WRITE, "User::saveSettings");
566 } else {
567 $sql="DELETE FROM user_newtalk WHERE user_ip='{$this->mName}'";
568 wfQuery ($sql, DB_WRITE, "User::saveSettings");
569 $wgMemc->delete( "$wgDBname:newtalk:ip:{$this->mName}" );
570 }
571 }
572 if ( 0 == $this->mId ) { return; }
573
574 $sql = "UPDATE user SET " .
575 "user_name= '" . wfStrencode( $this->mName ) . "', " .
576 "user_password= '" . wfStrencode( $this->mPassword ) . "', " .
577 "user_newpassword= '" . wfStrencode( $this->mNewpassword ) . "', " .
578 "user_real_name= '" . wfStrencode( $this->mRealName ) . "', " .
579 "user_email= '" . wfStrencode( $this->mEmail ) . "', " .
580 "user_options= '" . $this->encodeOptions() . "', " .
581 "user_rights= '" . wfStrencode( implode( ",", $this->mRights ) ) . "', " .
582 "user_touched= '" . wfStrencode( $this->mTouched ) .
583 "' WHERE user_id={$this->mId}";
584 wfQuery( $sql, DB_WRITE, "User::saveSettings" );
585 $wgMemc->delete( "$wgDBname:user:id:$this->mId" );
586 }
587
588 # Checks if a user with the given name exists
589 #
590 function idForName() {
591 $gotid = 0;
592 $s = trim( $this->mName );
593 if ( 0 == strcmp( '', $s ) ) return 0;
594
595 $sql = "SELECT user_id FROM user WHERE user_name='" .
596 wfStrencode( $s ) . "'";
597 $res = wfQuery( $sql, DB_READ, "User::idForName" );
598 if ( 0 == wfNumRows( $res ) ) { return 0; }
599
600 $s = wfFetchObject( $res );
601 if ( '' == $s ) return 0;
602
603 $gotid = $s->user_id;
604 wfFreeResult( $res );
605 return $gotid;
606 }
607
608 function addToDatabase() {
609 $sql = "INSERT INTO user (user_name,user_password,user_newpassword," .
610 "user_email, user_real_name, user_rights, user_options) " .
611 " VALUES ('" . wfStrencode( $this->mName ) . "', '" .
612 wfStrencode( $this->mPassword ) . "', '" .
613 wfStrencode( $this->mNewpassword ) . "', '" .
614 wfStrencode( $this->mEmail ) . "', '" .
615 wfStrencode( $this->mRealName ) . "', '" .
616 wfStrencode( implode( ',', $this->mRights ) ) . "', '" .
617 $this->encodeOptions() . "')";
618 wfQuery( $sql, DB_WRITE, "User::addToDatabase" );
619 $this->mId = $this->idForName();
620 }
621
622 function spreadBlock()
623 {
624 global $wgIP;
625 # If the (non-anonymous) user is blocked, this function will block any IP address
626 # that they successfully log on from.
627 $fname = 'User::spreadBlock';
628
629 wfDebug( "User:spreadBlock()\n" );
630 if ( $this->mId == 0 ) {
631 return;
632 }
633
634 $userblock = Block::newFromDB( '', $this->mId );
635 if ( !$userblock->isValid() ) {
636 return;
637 }
638
639 # Check if this IP address is already blocked
640 $ipblock = Block::newFromDB( $wgIP );
641 if ( $ipblock->isValid() ) {
642 # Just update the timestamp
643 $ipblock->updateTimestamp();
644 return;
645 }
646
647 # Make a new block object with the desired properties
648 wfDebug( "Autoblocking {$this->mName}@{$wgIP}\n" );
649 $ipblock->mAddress = $wgIP;
650 $ipblock->mUser = 0;
651 $ipblock->mBy = $userblock->mBy;
652 $ipblock->mReason = wfMsg( 'autoblocker', $this->getName(), $userblock->mReason );
653 $ipblock->mTimestamp = wfTimestampNow();
654 $ipblock->mAuto = 1;
655 # If the user is already blocked with an expiry date, we don't
656 # want to pile on top of that!
657 if($userblock->mExpiry) {
658 $ipblock->mExpiry = min ( $userblock->mExpiry, Block::getAutoblockExpiry( $ipblock->mTimestamp ));
659 } else {
660 $ipblock->mExpiry = Block::getAutoblockExpiry( $ipblock->mTimestamp );
661 }
662
663 # Insert it
664 $ipblock->insert();
665
666 }
667
668 function getPageRenderingHash(){
669 static $hash = false;
670 if( $hash ){
671 return $hash;
672 }
673
674 // stubthreshold is only included below for completeness,
675 // it will always be 0 when this function is called by parsercache.
676
677 $confstr = $this->getOption( 'quickbar' );
678 $confstr .= '!' . $this->getOption( 'underline' );
679 $confstr .= '!' . $this->getOption( 'hover' );
680 $confstr .= '!' . $this->getOption( 'skin' );
681 $confstr .= '!' . $this->getOption( 'math' );
682 $confstr .= '!' . $this->getOption( 'highlightbroken' );
683 $confstr .= '!' . $this->getOption( 'stubthreshold' );
684 $confstr .= '!' . $this->getOption( 'editsection' );
685 $confstr .= '!' . $this->getOption( 'editsectiononrightclick' );
686 $confstr .= '!' . $this->getOption( 'showtoc' );
687 $confstr .= '!' . $this->getOption( 'date' );
688
689 if(strlen($confstr) > 32)
690 $hash = md5($confstr);
691 else
692 $hash = $confstr;
693 return $hash;
694 }
695
696 function isAllowedToCreateAccount() {
697 global $wgWhitelistAccount;
698 $allowed = false;
699
700 if (!$wgWhitelistAccount) { return 1; }; // default behaviour
701 foreach ($wgWhitelistAccount as $right => $ok) {
702 $userHasRight = (!strcmp($right, 'user') || in_array($right, $this->getRights()));
703 $allowed |= ($ok && $userHasRight);
704 }
705 return $allowed;
706 }
707
708 # Set mDataLoaded, return previous value
709 # Use this to prevent DB access in command-line scripts or similar situations
710 function setLoaded( $loaded )
711 {
712 wfSetVar( $this->mDataLoaded, $loaded );
713 }
714
715 function getUserPage() {
716 return Title::makeTitle( NS_USER, $this->mName );
717 }
718 }
719
720 ?>