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