From: Andrew Garrett Date: Mon, 27 Apr 2009 01:38:29 +0000 (+0000) Subject: Made email option actually work, fixed bug 18580 (new preferences page does not displ... X-Git-Tag: 1.31.0-rc.0~41993 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=b87fd876259b8b82dcc8c94fab25f0187c7cecc5;p=lhc%2Fweb%2Fwiklou.git Made email option actually work, fixed bug 18580 (new preferences page does not display email confirmation data) --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 31b9d64bc7..26b6684eb5 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2499,6 +2499,7 @@ $wgDefaultUserOptions = array( 'noconvertlink' => 0, 'gender' => 'unknown', 'ccmeonemails' => 0, + 'disablemail' => 0, ); /** Whether or not to allow and use real name fields. Defaults to true. */ diff --git a/includes/Preferences.php b/includes/Preferences.php index 6dcbfab625..73e982bc14 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -220,11 +220,44 @@ class Preferences { ## Email ####################################### ## Email stuff - global $wgEnableEmail, $wgEnableUserEmail; - if ($wgEnableEmail) { + global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication; + + if ( $wgEmailAuthentication ) { + if ( $user->getEmail() ) { + if( $user->getEmailAuthenticationTimestamp() ) { + // date and time are separate parameters to facilitate localisation. + // $time is kept for backward compat reasons. + // 'emailauthenticated' is also used in SpecialConfirmemail.php + $time = $wgLang->timeAndDate( $user->getEmailAuthenticationTimestamp(), true ); + $d = $wgLang->date( $user->getEmailAuthenticationTimestamp(), true ); + $t = $wgLang->time( $user->getEmailAuthenticationTimestamp(), true ); + $emailauthenticated = wfMsg('emailauthenticated', $time, $d, $t ).'
'; + $disableEmailPrefs = false; + } else { + $disableEmailPrefs = true; + $skin = $wgUser->getSkin(); + $emailauthenticated = wfMsg('emailnotauthenticated').'
' . + $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ), + wfMsg( 'emailconfirmlink' ) ) . '
'; + } + } else { + $emailauthenticated = wfMsg( 'noemailprefs' ); + } + + $defaultPreferences['emailauthentication'] = + array( + 'type' => 'info', + 'raw' => true, + 'section' => 'email', + 'label-message' => 'prefs-emailconfirm-label', + 'default' => $emailauthenticated, + ); + + } + if ($wgEnableEmail) { if ($wgEnableUserEmail) { - $defaultPreferences['disableemail'] = + $defaultPreferences['disablemail'] = array( 'type' => 'toggle', 'invert' => true, diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index b9b88c57a6..843708b74d 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1611,6 +1611,7 @@ Note that their indexes of {{SITENAME}} content may be out of date.', 'prefs-custom-js' => 'Custom JS', 'prefs-reset-intro' => 'You can use this page to reset your preferences to the site defaults. This cannot be undone.', +'prefs-emailconfirm-label' => 'Email confirmation:', # User rights 'userrights' => 'User rights management',