From: Andrew Garrett Date: Fri, 3 Jul 2009 13:14:11 +0000 (+0000) Subject: (bug 18760) Do not show any email-related preferences if $wgEnableEmail is off. X-Git-Tag: 1.31.0-rc.0~41120 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=fd6dd8b4ed5f1a894cccd527061d881f75126988;p=lhc%2Fweb%2Fwiklou.git (bug 18760) Do not show any email-related preferences if $wgEnableEmail is off. --- diff --git a/includes/Preferences.php b/includes/Preferences.php index 9ffe9c7126..a7bd902585 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -276,65 +276,68 @@ class Preferences { ); ## Email stuff - global $wgEmailConfirmToEdit; - - $defaultPreferences['emailaddress'] = - array( - 'type' => $wgAuth->allowPropChange( 'emailaddress' ) ? 'text' : 'info', - 'default' => $user->getEmail(), - 'section' => 'personal/email', - 'label-message' => 'youremail', - 'help-message' => $wgEmailConfirmToEdit - ? 'prefs-help-email-required' - : 'prefs-help-email', - 'validation-callback' => array( 'Preferences', 'validateEmail' ), - ); - - global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication; - - $disableEmailPrefs = false; - - 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 = htmlspecialchars( wfMsg( 'emailauthenticated', $time, $d, $t ) ) . '
'; - $disableEmailPrefs = false; + + global $wgEnableEmail; + if ($wgEnableEmail) { + + global $wgEmailConfirmToEdit; + + $defaultPreferences['emailaddress'] = + array( + 'type' => $wgAuth->allowPropChange( 'emailaddress' ) ? 'text' : 'info', + 'default' => $user->getEmail(), + 'section' => 'personal/email', + 'label-message' => 'youremail', + 'help-message' => $wgEmailConfirmToEdit + ? 'prefs-help-email-required' + : 'prefs-help-email', + 'validation-callback' => array( 'Preferences', 'validateEmail' ), + ); + + global $wgEnableUserEmail, $wgEmailAuthentication; + + $disableEmailPrefs = false; + + 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 = htmlspecialchars( wfMsg( 'emailauthenticated', $time, $d, $t ) ) . '
'; + $disableEmailPrefs = false; + } else { + $disableEmailPrefs = true; + global $wgUser; // wgUser is okay here, it's for display + $skin = $wgUser->getSkin(); + $emailauthenticated = wfMsgHtml( 'emailnotauthenticated' ) . '
' . + $skin->link( + SpecialPage::getTitleFor( 'Confirmemail' ), + wfMsg( 'emailconfirmlink' ), + array(), + array(), + array( 'known', 'noclasses' ) + ) . '
'; + } } else { $disableEmailPrefs = true; - global $wgUser; // wgUser is okay here, it's for display - $skin = $wgUser->getSkin(); - $emailauthenticated = wfMsgHtml( 'emailnotauthenticated' ) . '
' . - $skin->link( - SpecialPage::getTitleFor( 'Confirmemail' ), - wfMsg( 'emailconfirmlink' ), - array(), - array(), - array( 'known', 'noclasses' ) - ) . '
'; + $emailauthenticated = wfMsgHtml( 'noemailprefs' ); } - } else { - $disableEmailPrefs = true; - $emailauthenticated = wfMsgHtml( 'noemailprefs' ); + + $defaultPreferences['emailauthentication'] = + array( + 'type' => 'info', + 'raw' => true, + 'section' => 'personal/email', + 'label-message' => 'prefs-emailconfirm-label', + 'default' => $emailauthenticated, + ); + } - - $defaultPreferences['emailauthentication'] = - array( - 'type' => 'info', - 'raw' => true, - 'section' => 'personal/email', - 'label-message' => 'prefs-emailconfirm-label', - 'default' => $emailauthenticated, - ); - - } - - if( $wgEnableEmail ) { + if( $wgEnableUserEmail ) { $defaultPreferences['disablemail'] = array(