https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106278
Revision: 106278
Author: catrope
Date: 2011-12-14 23:14:44 +0000 (Wed, 14 Dec 2011)
Log Message:
-----------
1.18wmf1: Update MoodBar to trunk state again to pick up r106277
Modified Paths:
--------------
branches/wmf/1.18wmf1/extensions/MoodBar/ApiMoodBarSetUserEmail.php
Modified: branches/wmf/1.18wmf1/extensions/MoodBar/ApiMoodBarSetUserEmail.php
===================================================================
--- branches/wmf/1.18wmf1/extensions/MoodBar/ApiMoodBarSetUserEmail.php
2011-12-14 23:09:21 UTC (rev 106277)
+++ branches/wmf/1.18wmf1/extensions/MoodBar/ApiMoodBarSetUserEmail.php
2011-12-14 23:14:44 UTC (rev 106278)
@@ -28,7 +28,7 @@
$error = wfMsgExt(
'invalidemailaddress', 'parseinline' ) ;
}
else {
- list( $status, $info )
= Preferences::trySetUserEmail( $wgUser, $params['email'] );
+ list( $status, $info )
= self::trySetUserEmail( $wgUser, $params['email'] );
// Status Object
if ( $status !== true )
{
@@ -68,6 +68,35 @@
$this->getResult()->addValue( null, $this->getModuleName(),
$result );
}
+ /**
+ * Tempoarary solution, will use Preference::trySetUserEmail in 1.19
+ */
+ private static function trySetUserEmail( User $user, $newaddr ) {
+ global $wgEnableEmail, $wgEmailAuthentication;
+ $info = ''; // none
+
+ if ( $wgEnableEmail ) {
+ $oldaddr = $user->getEmail();
+ if ( ( $newaddr != '' ) && ( $newaddr != $oldaddr ) ) {
+ $user->setEmail( $newaddr );
+ if ( $wgEmailAuthentication ) {
+ $type = $oldaddr != '' ? 'changed' :
'set';
+ $result = $user->sendConfirmationMail(
$type );
+ if ( !$result->isGood() ) {
+ return array( $result,
'mailerror' );
+ }
+ $info = 'eauth';
+ }
+ } elseif ( $newaddr != $oldaddr ) { // if the address
is the same, don't change it
+ $user->setEmail( $newaddr );
+ }
+ }
+
+ return array( true, $info );
+ }
+
+
+
public function needsToken() {
return true;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs