11 require_once( 'WatchedItem.php' );
13 # Number of characters in user_token field
14 define( 'USER_TOKEN_LENGTH', 32 );
24 var $mId, $mName, $mPassword, $mEmail, $mNewtalk;
25 var $mRights, $mOptions;
26 var $mDataLoaded, $mNewpassword;
28 var $mBlockedby, $mBlockreason;
35 /** Construct using User:loadDefaults() */
37 $this->loadDefaults();
41 * Static factory method
43 * @param string $name Username, validated by Title:newFromText()
45 function newFromName( $name ) {
48 # Clean up name according to title rules
50 $t = Title
::newFromText( $name );
54 $u->setName( $t->getText() );
60 * Get username given an id.
61 * @param integer $id Database user id
62 * @return string Nickname of a user
65 function whoIs( $id ) {
66 $dbr =& wfGetDB( DB_SLAVE
);
67 return $dbr->selectField( 'user', 'user_name', array( 'user_id' => $id ) );
71 * Get real username given an id.
72 * @param integer $id Database user id
73 * @return string Realname of a user
76 function whoIsReal( $id ) {
77 $dbr =& wfGetDB( DB_SLAVE
);
78 return $dbr->selectField( 'user', 'user_real_name', array( 'user_id' => $id ) );
82 * Get database id given a user name
83 * @param string $name Nickname of a user
84 * @return integer|null Database user id (null: if non existent
87 function idFromName( $name ) {
88 $fname = "User::idFromName";
90 $nt = Title
::newFromText( $name );
91 if( is_null( $nt ) ) {
95 $dbr =& wfGetDB( DB_SLAVE
);
96 $s = $dbr->selectRow( 'user', array( 'user_id' ), array( 'user_name' => $nt->getText() ), $fname );
106 * does the string match an anonymous user IP address?
107 * @param string $name Nickname of a user
110 function isIP( $name ) {
111 return preg_match("/^\d{1,3}\.\d{1,3}.\d{1,3}\.\d{1,3}$/",$name);
115 * probably return a random password
116 * @return string probably a random password
118 * @todo Check what is doing really [AV]
120 function randomPassword() {
121 $pwchars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz';
122 $l = strlen( $pwchars ) - 1;
124 $np = $pwchars{mt_rand( 0, $l )} . $pwchars{mt_rand( 0, $l )} .
125 $pwchars{mt_rand( 0, $l )} . chr( mt_rand(48, 57) ) .
126 $pwchars{mt_rand( 0, $l )} . $pwchars{mt_rand( 0, $l )} .
127 $pwchars{mt_rand( 0, $l )};
132 * Set properties to default
133 * Used at construction. It will load per language default settings only
134 * if we have an available language object.
136 function loadDefaults() {
137 global $wgContLang, $wgIP;
138 global $wgNamespacesToBeSearchedDefault;
140 $this->mId
= $this->mNewtalk
= 0;
141 $this->mName
= $wgIP;
142 $this->mRealName
= $this->mEmail
= '';
143 $this->mPassword
= $this->mNewpassword
= '';
144 $this->mRights
= array();
145 // Getting user defaults only if we have an available language
146 if(isset($wgContLang)) { $this->loadDefaultFromLanguage(); }
148 foreach ($wgNamespacesToBeSearchedDefault as $nsnum => $val) {
149 $this->mOptions
['searchNs'.$nsnum] = $val;
151 unset( $this->mSkin
);
152 $this->mDataLoaded
= false;
153 $this->mBlockedby
= -1; # Unset
154 $this->mTouched
= '0'; # Allow any pages to be cached
155 $this->setToken(); # Random
156 $this->mHash
= false;
160 * Used to load user options from a language.
161 * This is not in loadDefault() cause we sometime create user before having
164 function loadDefaultFromLanguage(){
166 $defOpt = $wgContLang->getDefaultUserOptions() ;
167 foreach ( $defOpt as $oname => $val ) {
168 $this->mOptions
[$oname] = $val;
171 default language setting
173 $this->setOption('variant', $wgContLang->getPreferredVariant());
174 $this->setOption('language', $wgContLang->getPreferredVariant());
178 * Get blocking information
181 function getBlockedStatus() {
182 global $wgIP, $wgBlockCache, $wgProxyList;
184 if ( -1 != $this->mBlockedby
) { return; }
186 $this->mBlockedby
= 0;
190 $block = new Block();
191 if ( $block->load( $wgIP , $this->mId
) ) {
192 $this->mBlockedby
= $block->mBy
;
193 $this->mBlockreason
= $block->mReason
;
198 if ( !$this->mBlockedby
) {
199 $block = $wgBlockCache->get( $wgIP );
200 if ( $block !== false ) {
201 $this->mBlockedby
= $block->mBy
;
202 $this->mBlockreason
= $block->mReason
;
207 if ( !$this->mBlockedby
) {
208 if ( array_key_exists( $wgIP, $wgProxyList ) ) {
209 $this->mBlockreason
= wfMsg( 'proxyblockreason' );
210 $this->mBlockedby
= "Proxy blocker";
216 * Check if user is blocked
217 * @return bool True if blocked, false otherwise
219 function isBlocked() {
220 $this->getBlockedStatus();
221 if ( 0 === $this->mBlockedby
) { return false; }
226 * Get name of blocker
227 * @return string name of blocker
229 function blockedBy() {
230 $this->getBlockedStatus();
231 return $this->mBlockedby
;
235 * Get blocking reason
236 * @return string Blocking reason
238 function blockedFor() {
239 $this->getBlockedStatus();
240 return $this->mBlockreason
;
244 * Initialise php session
246 function SetupSession() {
247 global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain;
248 if( $wgSessionsInMemcached ) {
249 require_once( 'MemcachedSessions.php' );
250 } elseif( 'files' != ini_get( 'session.save_handler' ) ) {
251 # If it's left on 'user' or another setting from another
252 # application, it will end up failing. Try to recover.
253 ini_set ( 'session.save_handler', 'files' );
255 session_set_cookie_params( 0, $wgCookiePath, $wgCookieDomain );
256 session_cache_limiter( 'private, must-revalidate' );
261 * Read datas from session
264 function loadFromSession() {
265 global $wgMemc, $wgDBname;
267 if ( isset( $_SESSION['wsUserID'] ) ) {
268 if ( 0 != $_SESSION['wsUserID'] ) {
269 $sId = $_SESSION['wsUserID'];
273 } else if ( isset( $_COOKIE["{$wgDBname}UserID"] ) ) {
274 $sId = IntVal( $_COOKIE["{$wgDBname}UserID"] );
275 $_SESSION['wsUserID'] = $sId;
279 if ( isset( $_SESSION['wsUserName'] ) ) {
280 $sName = $_SESSION['wsUserName'];
281 } else if ( isset( $_COOKIE["{$wgDBname}UserName"] ) ) {
282 $sName = $_COOKIE["{$wgDBname}UserName"];
283 $_SESSION['wsUserName'] = $sName;
288 $passwordCorrect = FALSE;
289 $user = $wgMemc->get( $key = "$wgDBname:user:id:$sId" );
290 if($makenew = !$user) {
291 wfDebug( "User::loadFromSession() unable to load from memcached\n" );
294 $user->loadFromDatabase();
296 wfDebug( "User::loadFromSession() got from cache!\n" );
299 if ( isset( $_SESSION['wsToken'] ) ) {
300 $passwordCorrect = $_SESSION['wsToken'] == $user->mToken
;
301 } else if ( isset( $_COOKIE["{$wgDBname}Token"] ) ) {
302 $passwordCorrect = $user->mToken
== $_COOKIE["{$wgDBname}Token"];
304 return new User(); # Can't log in from session
307 if ( ( $sName == $user->mName
) && $passwordCorrect ) {
309 if($wgMemc->set( $key, $user ))
310 wfDebug( "User::loadFromSession() successfully saved user\n" );
312 wfDebug( "User::loadFromSession() unable to save to memcached\n" );
314 $user->spreadBlock();
317 return new User(); # Can't log in from session
321 * Load a user from the database
323 function loadFromDatabase() {
324 global $wgCommandLineMode;
325 $fname = "User::loadFromDatabase";
326 if ( $this->mDataLoaded ||
$wgCommandLineMode ) {
331 $this->mId
= IntVal( $this->mId
);
333 # check in separate table if there are changes to the talk page
334 $this->mNewtalk
=0; # reset talk page status
335 $dbr =& wfGetDB( DB_SLAVE
);
337 $res = $dbr->select( 'user_newtalk', 1, array( 'user_id' => $this->mId
), $fname );
339 if ( $dbr->numRows($res)>0 ) {
342 $dbr->freeResult( $res );
344 global $wgDBname, $wgMemc;
345 $key = "$wgDBname:newtalk:ip:{$this->mName}";
346 $newtalk = $wgMemc->get( $key );
347 if( ! is_integer( $newtalk ) ){
348 $res = $dbr->select( 'user_newtalk', 1, array( 'user_ip' => $this->mName
), $fname );
350 $this->mNewtalk
= $dbr->numRows( $res ) > 0 ?
1 : 0;
351 $dbr->freeResult( $res );
353 $wgMemc->set( $key, $this->mNewtalk
, time() ); // + 1800 );
355 $this->mNewtalk
= $newtalk ?
1 : 0;
359 $this->mDataLoaded
= true;
361 } # the following stuff is for non-anonymous users only
363 $s = $dbr->selectRow( 'user', array( 'user_name','user_password','user_newpassword','user_email',
364 'user_real_name','user_options','user_touched', 'user_token' ),
365 array( 'user_id' => $this->mId
), $fname );
367 if ( $s !== false ) {
368 $this->mName
= $s->user_name
;
369 $this->mEmail
= $s->user_email
;
370 $this->mRealName
= $s->user_real_name
;
371 $this->mPassword
= $s->user_password
;
372 $this->mNewpassword
= $s->user_newpassword
;
373 $this->decodeOptions( $s->user_options
);
374 $this->mTouched
= wfTimestamp(TS_MW
,$s->user_touched
);
375 $this->mRights
= explode( ",", strtolower(
376 $dbr->selectField( 'user_rights', 'user_rights', array( 'user_id' => $this->mId
) )
378 $this->mToken
= $s->user_token
;
381 $this->mDataLoaded
= true;
384 function getID() { return $this->mId
; }
385 function setID( $v ) {
387 $this->mDataLoaded
= false;
391 $this->loadFromDatabase();
395 function setName( $str ) {
396 $this->loadFromDatabase();
400 function getNewtalk() {
401 $this->loadFromDatabase();
402 return ( 0 != $this->mNewtalk
);
405 function setNewtalk( $val ) {
406 $this->loadFromDatabase();
407 $this->mNewtalk
= $val;
408 $this->invalidateCache();
411 function invalidateCache() {
412 $this->loadFromDatabase();
413 $this->mTouched
= wfTimestampNow();
414 # Don't forget to save the options after this or
415 # it won't take effect!
418 function validateCache( $timestamp ) {
419 $this->loadFromDatabase();
420 return ($timestamp >= $this->mTouched
);
425 * Will only be salted if $wgPasswordSalt is true
426 * @param string Password.
427 * @return string Salted password or clear password.
429 function addSalt( $p ) {
430 global $wgPasswordSalt;
432 return md5( "{$this->mId}-{$p}" );
438 * Encrypt a password.
439 * It can eventuall salt a password @see User::addSalt()
440 * @param string $p clear Password.
441 * @param string Encrypted password.
443 function encryptPassword( $p ) {
444 return $this->addSalt( md5( $p ) );
447 # Set the password and reset the random token
448 function setPassword( $str ) {
449 $this->loadFromDatabase();
451 $this->mPassword
= $this->encryptPassword( $str );
452 $this->mNewpassword
= '';
455 # Set the random token (used for persistent authentication)
456 function setToken( $token = false ) {
459 # Take random data from PRNG
460 # This is reasonably secure if the PRNG has been seeded correctly
461 for ($i = 0; $i<USER_TOKEN_LENGTH
/ 4; $i++
) {
462 $this->mToken
.= sprintf( "%04X", mt_rand( 0, 65535 ) );
465 $this->mToken
= $token;
470 function setCookiePassword( $str ) {
471 $this->loadFromDatabase();
472 $this->mCookiePassword
= md5( $str );
475 function setNewpassword( $str ) {
476 $this->loadFromDatabase();
477 $this->mNewpassword
= $this->encryptPassword( $str );
480 function getEmail() {
481 $this->loadFromDatabase();
482 return $this->mEmail
;
485 function setEmail( $str ) {
486 $this->loadFromDatabase();
487 $this->mEmail
= $str;
490 function getRealName() {
491 $this->loadFromDatabase();
492 return $this->mRealName
;
495 function setRealName( $str ) {
496 $this->loadFromDatabase();
497 $this->mRealName
= $str;
500 function getOption( $oname ) {
501 $this->loadFromDatabase();
502 if ( array_key_exists( $oname, $this->mOptions
) ) {
503 return $this->mOptions
[$oname];
509 function setOption( $oname, $val ) {
510 $this->loadFromDatabase();
511 if ( $oname == 'skin' ) {
512 # Clear cached skin, so the new one displays immediately in Special:Preferences
513 unset( $this->mSkin
);
515 $this->mOptions
[$oname] = $val;
516 $this->invalidateCache();
519 function getRights() {
520 $this->loadFromDatabase();
521 return $this->mRights
;
524 function addRight( $rname ) {
525 $this->loadFromDatabase();
526 array_push( $this->mRights
, $rname );
527 $this->invalidateCache();
531 $this->loadFromDatabase();
532 if ( 0 == $this->mId
) { return false; }
534 return in_array( 'sysop', $this->mRights
);
537 function isDeveloper() {
538 $this->loadFromDatabase();
539 if ( 0 == $this->mId
) { return false; }
541 return in_array( 'developer', $this->mRights
);
544 function isBureaucrat() {
545 $this->loadFromDatabase();
546 if ( 0 == $this->mId
) { return false; }
548 return in_array( 'bureaucrat', $this->mRights
);
552 * Whether the user is a bot
555 $this->loadFromDatabase();
557 # Why was this here? I need a UID=0 conversion script [TS]
558 # if ( 0 == $this->mId ) { return false; }
560 return in_array( 'bot', $this->mRights
);
564 * Load a skin if it doesn't exist or return it
565 * @todo FIXME : need to check the old failback system [AV]
567 function &getSkin() {
568 global $IP, $wgUsePHPTal;
569 if ( ! isset( $this->mSkin
) ) {
570 # get all skin names available
571 $skinNames = Skin
::getSkinNames();
573 $userSkin = $this->getOption( 'skin' );
574 if ( $userSkin == '' ) { $userSkin = 'standard'; }
576 if ( !isset( $skinNames[$userSkin] ) ) {
577 # in case the user skin could not be found find a replacement
582 # if phptal is enabled we should have monobook skin that
583 # superseed the good old SkinStandard.
584 if ( isset( $skinNames['monobook'] ) ) {
585 $fallback[0] = 'MonoBook';
588 if(is_numeric($userSkin) && isset( $fallback[$userSkin]) ){
589 $sn = $fallback[$userSkin];
594 # The user skin is available
595 $sn = $skinNames[$userSkin];
598 # Grab the skin class and initialise it. Each skin checks for PHPTal
599 # and will not load if it's not enabled.
600 require_once( $IP.'/skins/'.$sn.'.php' );
602 # Check if we got if not failback to default skin
603 $className = 'Skin'.$sn;
604 if( !class_exists( $className ) ) {
605 # DO NOT die if the class isn't found. This breaks maintenance
606 # scripts and can cause a user account to be unrecoverable
607 # except by SQL manipulation if a previously valid skin name
608 # is no longer valid.
609 $className = 'SkinStandard';
610 require_once( $IP.'/skins/Standard.php' );
612 $this->mSkin
= new $className;
618 * @param string $title Article title to look at
622 * Check watched status of an article
623 * @return bool True if article is watched
625 function isWatched( $title ) {
626 $wl = WatchedItem
::fromUserTitle( $this, $title );
627 return $wl->isWatched();
633 function addWatch( $title ) {
634 $wl = WatchedItem
::fromUserTitle( $this, $title );
636 $this->invalidateCache();
640 * Stop watching an article
642 function removeWatch( $title ) {
643 $wl = WatchedItem
::fromUserTitle( $this, $title );
645 $this->invalidateCache();
651 * @return string Encoding options
653 function encodeOptions() {
655 foreach ( $this->mOptions
as $oname => $oval ) {
656 array_push( $a, $oname.'='.$oval );
658 $s = implode( "\n", $a );
665 function decodeOptions( $str ) {
666 $a = explode( "\n", $str );
667 foreach ( $a as $s ) {
668 if ( preg_match( "/^(.[^=]*)=(.*)$/", $s, $m ) ) {
669 $this->mOptions
[$m[1]] = $m[2];
674 function setCookies() {
675 global $wgCookieExpiration, $wgCookiePath, $wgCookieDomain, $wgDBname;
676 if ( 0 == $this->mId
) return;
677 $this->loadFromDatabase();
678 $exp = time() +
$wgCookieExpiration;
680 $_SESSION['wsUserID'] = $this->mId
;
681 setcookie( $wgDBname.'UserID', $this->mId
, $exp, $wgCookiePath, $wgCookieDomain );
683 $_SESSION['wsUserName'] = $this->mName
;
684 setcookie( $wgDBname.'UserName', $this->mName
, $exp, $wgCookiePath, $wgCookieDomain );
686 $_SESSION['wsToken'] = $this->mToken
;
687 if ( 1 == $this->getOption( 'rememberpassword' ) ) {
688 setcookie( $wgDBname.'Token', $this->mToken
, $exp, $wgCookiePath, $wgCookieDomain );
690 setcookie( $wgDBname.'Token', '', time() - 3600 );
696 * It will clean the session cookie
699 global $wgCookiePath, $wgCookieDomain, $wgDBname, $wgIP;
700 $this->loadDefaults();
701 $this->setLoaded( true );
703 $_SESSION['wsUserID'] = 0;
705 setcookie( $wgDBname.'UserID', '', time() - 3600, $wgCookiePath, $wgCookieDomain );
706 setcookie( $wgDBname.'Token', '', time() - 3600, $wgCookiePath, $wgCookieDomain );
710 * Save object settings into database
712 function saveSettings() {
713 global $wgMemc, $wgDBname;
714 $fname = 'User::saveSettings';
716 $dbw =& wfGetDB( DB_MASTER
);
717 if ( ! $this->mNewtalk
) {
718 # Delete user_newtalk row
720 $dbw->delete( 'user_newtalk', array( 'user_id' => $this->mId
), $fname );
722 $dbw->delete( 'user_newtalk', array( 'user_ip' => $this->mName
), $fname );
723 $wgMemc->delete( "$wgDBname:newtalk:ip:{$this->mName}" );
726 if ( 0 == $this->mId
) { return; }
728 $dbw->update( 'user',
730 'user_name' => $this->mName
,
731 'user_password' => $this->mPassword
,
732 'user_newpassword' => $this->mNewpassword
,
733 'user_real_name' => $this->mRealName
,
734 'user_email' => $this->mEmail
,
735 'user_options' => $this->encodeOptions(),
736 'user_touched' => $dbw->timestamp($this->mTouched
),
737 'user_token' => $this->mToken
738 ), array( /* WHERE */
739 'user_id' => $this->mId
742 $dbw->set( 'user_rights', 'user_rights', implode( ",", $this->mRights
),
743 'user_id='. $this->mId
, $fname );
744 $wgMemc->delete( "$wgDBname:user:id:$this->mId" );
748 * Checks if a user with the given name exists, returns the ID
750 function idForName() {
751 $fname = 'User::idForName';
754 $s = trim( $this->mName
);
755 if ( 0 == strcmp( '', $s ) ) return 0;
757 $dbr =& wfGetDB( DB_SLAVE
);
758 $id = $dbr->selectField( 'user', 'user_id', array( 'user_name' => $s ), $fname );
759 if ( $id === false ) {
766 * Add user object to the database
768 function addToDatabase() {
769 $fname = 'User::addToDatabase';
770 $dbw =& wfGetDB( DB_MASTER
);
771 $seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' );
772 $dbw->insert( 'user',
774 'user_id' => $seqVal,
775 'user_name' => $this->mName
,
776 'user_password' => $this->mPassword
,
777 'user_newpassword' => $this->mNewpassword
,
778 'user_email' => $this->mEmail
,
779 'user_real_name' => $this->mRealName
,
780 'user_options' => $this->encodeOptions(),
781 'user_token' => $this->mToken
784 $this->mId
= $dbw->insertId();
785 $dbw->insert( 'user_rights',
787 'user_id' => $this->mId
,
788 'user_rights' => implode( ',', $this->mRights
)
794 function spreadBlock() {
796 # If the (non-anonymous) user is blocked, this function will block any IP address
797 # that they successfully log on from.
798 $fname = 'User::spreadBlock';
800 wfDebug( "User:spreadBlock()\n" );
801 if ( $this->mId
== 0 ) {
805 $userblock = Block
::newFromDB( '', $this->mId
);
806 if ( !$userblock->isValid() ) {
810 # Check if this IP address is already blocked
811 $ipblock = Block
::newFromDB( $wgIP );
812 if ( $ipblock->isValid() ) {
813 # Just update the timestamp
814 $ipblock->updateTimestamp();
818 # Make a new block object with the desired properties
819 wfDebug( "Autoblocking {$this->mName}@{$wgIP}\n" );
820 $ipblock->mAddress
= $wgIP;
822 $ipblock->mBy
= $userblock->mBy
;
823 $ipblock->mReason
= wfMsg( 'autoblocker', $this->getName(), $userblock->mReason
);
824 $ipblock->mTimestamp
= wfTimestampNow();
826 # If the user is already blocked with an expiry date, we don't
827 # want to pile on top of that!
828 if($userblock->mExpiry
) {
829 $ipblock->mExpiry
= min ( $userblock->mExpiry
, Block
::getAutoblockExpiry( $ipblock->mTimestamp
));
831 $ipblock->mExpiry
= Block
::getAutoblockExpiry( $ipblock->mTimestamp
);
839 function getPageRenderingHash() {
845 // stubthreshold is only included below for completeness,
846 // it will always be 0 when this function is called by parsercache.
848 $confstr = $this->getOption( 'math' );
849 $confstr .= '!' . $this->getOption( 'highlightbroken' );
850 $confstr .= '!' . $this->getOption( 'stubthreshold' );
851 $confstr .= '!' . $this->getOption( 'editsection' );
852 $confstr .= '!' . $this->getOption( 'editsectiononrightclick' );
853 $confstr .= '!' . $this->getOption( 'showtoc' );
854 $confstr .= '!' . $this->getOption( 'date' );
855 $confstr .= '!' . $this->getOption( 'numberheadings' );
857 // add in language variant option if there are multiple variants
858 // supported by the language object
859 if(sizeof($wgContLang->getVariants())>1) {
860 $confstr .= '!' . $this->getOption( 'variant' );
863 $this->mHash
= $confstr;
867 function isAllowedToCreateAccount() {
868 global $wgWhitelistAccount;
871 if (!$wgWhitelistAccount) { return 1; }; // default behaviour
872 foreach ($wgWhitelistAccount as $right => $ok) {
873 $userHasRight = (!strcmp($right, 'user') ||
in_array($right, $this->getRights()));
874 $allowed |
= ($ok && $userHasRight);
880 * Set mDataLoaded, return previous value
881 * Use this to prevent DB access in command-line scripts or similar situations
883 function setLoaded( $loaded ) {
884 return wfSetVar( $this->mDataLoaded
, $loaded );
887 function getUserPage() {
888 return Title
::makeTitle( NS_USER
, $this->mName
);
894 function getMaxID() {
895 $dbr =& wfGetDB( DB_SLAVE
);
896 return $dbr->selectField( 'user', 'max(user_id)', false );
900 * Determine whether the user is a newbie. Newbies are either
901 * anonymous IPs, or the 1% most recently created accounts.
902 * Bots and sysops are excluded.
903 * @return bool True if it is a newbie.
905 function isNewbie() {
906 return $this->mId
> User
::getMaxID() * 0.99 && !$this->isSysop() && !$this->isBot() ||
$this->getID() == 0;
910 * Check to see if the given clear-text password is one of the accepted passwords
911 * @param string $password User password.
912 * @return bool True if the given password is correct otherwise False.
914 function checkPassword( $password ) {
915 $this->loadFromDatabase();
916 $ep = $this->encryptPassword( $password );
917 if ( 0 == strcmp( $ep, $this->mPassword
) ) {
919 } elseif ( 0 == strcmp( $ep, $this->mNewpassword
) ) {
921 } elseif ( function_exists( 'iconv' ) ) {
922 # Some wikis were converted from ISO 8859-1 to UTF-8, the passwords can't be converted
923 # Check for this with iconv
924 /* $cp1252hash = $this->encryptPassword( iconv( 'UTF-8', 'WINDOWS-1252', $password ) );
925 if ( 0 == strcmp( $cp1252hash, $this->mPassword ) ) {