Fix documentation of wfDebugLog()
[lhc/web/wiklou.git] / includes / Preferences.php
index dbf4346..2d1529d 100644 (file)
@@ -62,6 +62,13 @@ class Preferences {
                'emailaddress',
        );
 
+       /**
+        * @return array
+        */
+       static function getSaveBlacklist() {
+               return self::$saveBlacklist;
+       }
+
        /**
         * @throws MWException
         * @param $user User
@@ -186,7 +193,7 @@ class Preferences {
         */
        static function profilePreferences( $user, IContextSource $context, &$defaultPreferences ) {
                global $wgAuth, $wgContLang, $wgParser, $wgCookieExpiration, $wgLanguageCode,
-                       $wgDisableTitleConversion, $wgDisableLangConversion, $wgMaxSigChars,
+                       $wgDisableLangConversion, $wgMaxSigChars,
                        $wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication,
                        $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifRevealEditorAddress,
                        $wgSecureLogin;
@@ -374,14 +381,6 @@ class Preferences {
                                                'section' => 'personal/i18n',
                                                'help-message' => 'prefs-help-variant',
                                        );
-
-                                       if ( !$wgDisableTitleConversion ) {
-                                               $defaultPreferences['noconvertlink'] = array(
-                                                       'type' => 'toggle',
-                                                       'section' => 'personal/i18n',
-                                                       'label-message' => 'tog-noconvertlink',
-                                               );
-                                       }
                                } else {
                                        $defaultPreferences["variant-$langCode"] = array(
                                                'type' => 'api',
@@ -1023,15 +1022,7 @@ class Preferences {
         * @param $defaultPreferences Array
         */
        static function searchPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               global $wgContLang, $wgVectorUseSimpleSearch;
-
-               if ( $wgVectorUseSimpleSearch ) {
-                       $defaultPreferences['vector-simplesearch'] = array(
-                               'type' => 'toggle',
-                               'label-message' => 'vector-simplesearch-preference',
-                               'section' => 'searchoptions/displaysearchoptions',
-                       );
-               }
+               global $wgContLang;
 
                $defaultPreferences['searcheverything'] = array(
                        'type' => 'toggle',
@@ -1397,10 +1388,9 @@ class Preferences {
         *
         * @param $formData
         * @param $form PreferencesForm
-        * @param $entryPoint string
         * @return bool|Status|string
         */
-       static function tryFormSubmit( $formData, $form, $entryPoint = 'internal' ) {
+       static function tryFormSubmit( $formData, $form ) {
                global $wgHiddenPrefs, $wgAuth;
 
                $user = $form->getModifiedUser();
@@ -1420,7 +1410,7 @@ class Preferences {
 
                // Fortunately, the realname field is MUCH simpler
                // (not really "private", but still shouldn't be edited without permission)
-               if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->isAllowed( 'editmyprivateinfo' ) ) {
+               if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->isAllowed( 'editmyprivateinfo' ) && array_key_exists( 'realname', $formData ) ) {
                        $realName = $formData['realname'];
                        $user->setRealName( $realName );
                }
@@ -1446,6 +1436,7 @@ class Preferences {
                                $user->setOption( $key, $value );
                        }
 
+                       wfRunHooks( 'PreferencesFormPreSave', array( $formData, $form, $user, &$result ) );
                        $user->saveSettings();
                }
 
@@ -1460,7 +1451,7 @@ class Preferences {
         * @return Status
         */
        public static function tryUISubmit( $formData, $form ) {
-               $res = self::tryFormSubmit( $formData, $form, 'ui' );
+               $res = self::tryFormSubmit( $formData, $form );
 
                if ( $res ) {
                        $urlOptions = array( 'success' => 1 );