Made email option actually work, fixed bug 18580 (new preferences page does not displ...
authorAndrew Garrett <werdna@users.mediawiki.org>
Mon, 27 Apr 2009 01:38:29 +0000 (01:38 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Mon, 27 Apr 2009 01:38:29 +0000 (01:38 +0000)
includes/DefaultSettings.php
includes/Preferences.php
languages/messages/MessagesEn.php

index 31b9d64..26b6684 100644 (file)
@@ -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. */
index 6dcbfab..73e982b 100644 (file)
@@ -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 ).'<br />';
+                                       $disableEmailPrefs = false;
+                               } else {
+                                       $disableEmailPrefs = true;
+                                       $skin = $wgUser->getSkin();
+                                       $emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
+                                               $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ),
+                                                       wfMsg( 'emailconfirmlink' ) ) . '<br />';
+                               }
+                       } 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,
index b9b88c5..843708b 100644 (file)
@@ -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',