moved release notes for r113737 to 1.19 (a 1.19-regression fix)
[lhc/web/wiklou.git] / includes / Preferences.php
index 942b04f..a9f7456 100644 (file)
@@ -29,6 +29,7 @@ class Preferences {
        static $defaultPreferences = null;
        static $saveFilters = array(
                        'timecorrection' => array( 'Preferences', 'filterTimezoneInput' ),
+                       'cols' => array( 'Preferences', 'filterIntval' ),
                        'rows' => array( 'Preferences', 'filterIntval' ),
                        'rclimit' => array( 'Preferences', 'filterIntval' ),
                        'wllimit' => array( 'Preferences', 'filterIntval' ),
@@ -83,9 +84,9 @@ class Preferences {
                                // Already set, no problem
                                continue;
                        } elseif ( !is_null( $prefFromUser ) && // Make sure we're not just pulling nothing
-                                       $field->validate( $prefFromUser, $user->mOptions ) === true ) {
+                                       $field->validate( $prefFromUser, $user->getOptions() ) === true ) {
                                $info['default'] = $prefFromUser;
-                       } elseif ( $field->validate( $globalDefault, $user->mOptions ) === true ) {
+                       } elseif ( $field->validate( $globalDefault, $user->getOptions() ) === true ) {
                                $info['default'] = $globalDefault;
                        } else {
                                throw new MWException( "Global default '$globalDefault' is invalid for field $name" );
@@ -251,7 +252,7 @@ class Preferences {
                }
 
                // Language
-               $languages = Language::getLanguageNames( false );
+               $languages = Language::fetchLanguageNames( null, 'mw' );
                if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
                        $languages[$wgLanguageCode] = $wgLanguageCode;
                }
@@ -353,16 +354,20 @@ class Preferences {
                                $emailAddress .= $emailAddress == '' ? $link : " ($link)";
                        }
 
+
                        $defaultPreferences['emailaddress'] = array(
                                'type' => 'info',
                                'raw' => true,
                                'default' => $emailAddress,
                                'label-message' => 'youremail',
                                'section' => 'personal/email',
+                               'help-messages' => $helpMessages,
+                               # 'cssclass' chosen below
                        );
 
                        $disableEmailPrefs = false;
 
+                       $emailauthenticationclass = 'mw-email-not-authenticated';
                        if ( $wgEmailAuthentication ) {
                                if ( $user->getEmail() ) {
                                        if ( $user->getEmailAuthenticationTimestamp() ) {
@@ -377,6 +382,7 @@ class Preferences {
                                                $emailauthenticated = $context->msg( 'emailauthenticated',
                                                        $time, $d, $t )->parse() . '<br />';
                                                $disableEmailPrefs = false;
+                                               $emailauthenticationclass = 'mw-email-authenticated';
                                        } else {
                                                $disableEmailPrefs = true;
                                                $emailauthenticated = $context->msg( 'emailnotauthenticated' )->parse() . '<br />' .
@@ -384,10 +390,12 @@ class Preferences {
                                                                SpecialPage::getTitleFor( 'Confirmemail' ),
                                                                $context->msg( 'emailconfirmlink' )->escaped()
                                                        ) . '<br />';
+                                               $emailauthenticationclass="mw-email-not-authenticated";
                                        }
                                } else {
                                        $disableEmailPrefs = true;
                                        $emailauthenticated = $context->msg( 'noemailprefs' )->escaped();
+                                       $emailauthenticationclass = 'mw-email-none';
                                }
 
                                $defaultPreferences['emailauthentication'] = array(
@@ -396,9 +404,11 @@ class Preferences {
                                        'section' => 'personal/email',
                                        'label-message' => 'prefs-emailconfirm-label',
                                        'default' => $emailauthenticated,
+                                       # Apply the same CSS class used on the input to the message:
+                                       'cssclass' => $emailauthenticationclass,
                                );
-
                        }
+                       $defaultPreferences['emailaddress']['cssclass'] = $emailauthenticationclass;
 
                        if ( $wgEnableUserEmail && $user->isAllowed( 'sendemail' ) ) {
                                $defaultPreferences['disablemail'] = array(
@@ -637,11 +647,6 @@ class Preferences {
                );
 
                if ( $wgAllowUserCssPrefs ) {
-                       $defaultPreferences['highlightbroken'] = array(
-                               'type' => 'toggle',
-                               'section' => 'rendering/advancedrendering',
-                               'label' => $context->msg( 'tog-highlightbroken' )->text(), // Raw HTML
-                       );
                        $defaultPreferences['showtoc'] = array(
                                'type' => 'toggle',
                                'section' => 'rendering/advancedrendering',
@@ -688,7 +693,13 @@ class Preferences {
                global $wgUseExternalEditor, $wgAllowUserCssPrefs;
 
                ## Editing #####################################
-               
+               $defaultPreferences['cols'] = array(
+                       'type' => 'int',
+                       'label-message' => 'columns',
+                       'section' => 'editing/textboxsize',
+                       'min' => 4,
+                       'max' => 1000,
+               );
                $defaultPreferences['rows'] = array(
                        'type' => 'int',
                        'label-message' => 'rows',
@@ -1456,10 +1467,13 @@ class Preferences {
        }
 
        /**
+        * @deprecated in 1.19; will be removed in 1.20.
         * @param $user User
         * @return array
         */
        public static function loadOldSearchNs( $user ) {
+               wfDeprecated( __METHOD__, '1.19' );
+
                $searchableNamespaces = SearchEngine::searchableNamespaces();
                // Back compat with old format
                $arr = array();