X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FPreferences.php;h=c9caf4f779e3b6833a862d906ccbc78978d3344d;hb=147113bda515bbeaaa5c8c6f80eeb20bb2e4d87c;hp=2bb1e640bd34176db05fa563ee96467591af4451;hpb=3b92a39b1671b9b70c0cdd3f4b7aa491b50b6d2c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Preferences.php b/includes/Preferences.php index 2bb1e640bd..c9caf4f779 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -188,7 +188,8 @@ class Preferences { global $wgAuth, $wgContLang, $wgParser, $wgCookieExpiration, $wgLanguageCode, $wgDisableTitleConversion, $wgDisableLangConversion, $wgMaxSigChars, $wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication, - $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifRevealEditorAddress; + $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifRevealEditorAddress, + $wgSecureLogin; // retrieving user name for GENDER and misc. $userName = $user->getName(); @@ -280,18 +281,6 @@ class Preferences { 'help-message' => 'prefs-help-realname', ); - $defaultPreferences['gender'] = array( - 'type' => 'select', - 'section' => 'personal/info', - 'options' => array( - $context->msg( 'gender-male' )->text() => 'male', - $context->msg( 'gender-female' )->text() => 'female', - $context->msg( 'gender-unknown' )->text() => 'unknown', - ), - 'label-message' => 'yourgender', - 'help-message' => 'prefs-help-gender', - ); - if ( $canEditPrivateInfo && $wgAuth->allowPasswordChange() ) { $link = Linker::link( SpecialPage::getTitleFor( 'ChangePassword' ), $context->msg( 'prefs-resetpass' )->escaped(), array(), @@ -313,6 +302,15 @@ class Preferences { 'section' => 'personal/info', ); } + // Only show preferhttps if secure login is turned on + if ( $wgSecureLogin && wfCanIPUseHTTPS( $context->getRequest()->getIP() ) ) { + $defaultPreferences['prefershttps'] = array( + 'type' => 'toggle', + 'label-message' => 'tog-prefershttps', + 'help-message' => 'prefs-help-prefershttps', + 'section' => 'personal/info' + ); + } // Language $languages = Language::fetchLanguageNames( null, 'mw' ); @@ -333,6 +331,20 @@ class Preferences { 'label-message' => 'yourlanguage', ); + $defaultPreferences['gender'] = array( + 'type' => 'radio', + 'section' => 'personal/i18n', + 'options' => array( + $context->msg( 'parentheses', + $context->msg( 'gender-unknown' )->text() + )->text() => 'unknown', + $context->msg( 'gender-female' )->text() => 'female', + $context->msg( 'gender-male' )->text() => 'male', + ), + 'label-message' => 'yourgender', + 'help-message' => 'prefs-help-gender', + ); + // see if there are multiple language variants to choose from if ( !$wgDisableLangConversion ) { foreach ( LanguageConverter::$languagesWithVariants as $langCode ) { @@ -378,6 +390,18 @@ class Preferences { } } + // Stuff from Language::getExtraUserToggles() + // FIXME is this dead code? $extraUserToggles doesn't seem to be defined for any language + $toggles = $wgContLang->getExtraUserToggles(); + + foreach ( $toggles as $toggle ) { + $defaultPreferences[$toggle] = array( + 'type' => 'toggle', + 'section' => 'personal/i18n', + 'label-message' => "tog-$toggle", + ); + } + // show a preview of the old signature first $oldsigWikiText = $wgParser->preSaveTransform( "~~~", $context->getTitle(), $user, ParserOptions::newFromContext( $context ) ); $oldsigHTML = $context->getOutput()->parseInline( $oldsigWikiText, true, true ); @@ -684,6 +708,18 @@ class Preferences { * @param $defaultPreferences Array */ static function renderingPreferences( $user, IContextSource $context, &$defaultPreferences ) { + ## Diffs #################################### + $defaultPreferences['diffonly'] = array( + 'type' => 'toggle', + 'section' => 'rendering/diffs', + 'label-message' => 'tog-diffonly', + ); + $defaultPreferences['norollbackdiff'] = array( + 'type' => 'toggle', + 'section' => 'rendering/diffs', + 'label-message' => 'tog-norollbackdiff', + ); + ## Page Rendering ############################## global $wgAllowUserCssPrefs; if ( $wgAllowUserCssPrefs ) { @@ -978,7 +1014,7 @@ class Preferences { foreach ( $watchTypes as $action => $pref ) { if ( $user->isAllowed( $action ) ) { - // Give grep a chance to find the usages: + // Messages: // tog-watchdefault, tog-watchmoves, tog-watchdeletion, tog-watchcreations $defaultPreferences[$pref] = array( 'type' => 'toggle', @@ -1056,35 +1092,9 @@ class Preferences { } /** - * @param $user User - * @param $context IContextSource - * @param $defaultPreferences Array + * Dummy, kept for backwards-compatibility. */ static function miscPreferences( $user, IContextSource $context, &$defaultPreferences ) { - global $wgContLang; - - ## Misc ##################################### - $defaultPreferences['diffonly'] = array( - 'type' => 'toggle', - 'section' => 'misc/diffs', - 'label-message' => 'tog-diffonly', - ); - $defaultPreferences['norollbackdiff'] = array( - 'type' => 'toggle', - 'section' => 'misc/diffs', - 'label-message' => 'tog-norollbackdiff', - ); - - // Stuff from Language::getExtraUserToggles() - $toggles = $wgContLang->getExtraUserToggles(); - - foreach ( $toggles as $toggle ) { - $defaultPreferences[$toggle] = array( - 'type' => 'toggle', - 'section' => 'personal/i18n', - 'label-message' => "tog-$toggle", - ); - } } /**