Followup r78924: keep track of exception/warning comments separately, to prevent...
[lhc/web/wiklou.git] / includes / Preferences.php
index c330cdd..0916040 100644 (file)
@@ -29,6 +29,11 @@ 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' ),
+                       'searchlimit' => array( 'Preferences', 'filterIntval' ),
        );
 
        static function getPreferences( $user ) {
@@ -62,7 +67,7 @@ class Preferences {
                ## Prod in defaults from the user
                foreach ( $defaultPreferences as $name => &$info ) {
                        $prefFromUser = self::getOptionFromUser( $name, $info, $user );
-                       $field = HTMLForm::loadInputFromParameters( $info ); // For validation
+                       $field = HTMLForm::loadInputFromParameters( $name, $info ); // For validation
                        $defaultOptions = User::getDefaultOptions();
                        $globalDefault = isset( $defaultOptions[$name] )
                                ? $defaultOptions[$name]
@@ -98,7 +103,7 @@ class Preferences {
                        $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
                        $val = array();
 
-                       foreach ( $options as $label => $value ) {
+                       foreach ( $options as $value ) {
                                if ( $user->getOption( "$prefix$value" ) ) {
                                        $val[] = $value;
                                }
@@ -529,7 +534,7 @@ class Preferences {
                $nowlocal = Xml::element( 'span', array( 'id' => 'wpLocalTime' ),
                        $wgLang->time( $now = wfTimestampNow(), true ) );
                $nowserver = $wgLang->time( $now, false ) .
-                       Xml::hidden( 'wpServerTime', substr( $now, 8, 2 ) * 60 + substr( $now, 10, 2 ) );
+                       Html::hidden( 'wpServerTime', substr( $now, 8, 2 ) * 60 + substr( $now, 10, 2 ) );
 
                $defaultPreferences['nowserver'] = array(
                        'type' => 'info',
@@ -705,6 +710,11 @@ class Preferences {
                        'section' => 'editing/advancedediting',
                        'label-message' => 'tog-showtoolbar',
                );
+               $defaultPreferences['minordefault'] = array(
+                       'type' => 'toggle',
+                       'section' => 'editing/advancedediting',
+                       'label-message' => 'tog-minordefault',
+               );
 
                if ( $wgUseExternalEditor ) {
                        $defaultPreferences['externaleditor'] = array(
@@ -1209,6 +1219,10 @@ class Preferences {
                }
                return $opt;
        }
+       
+       static function filterIntval( $value, $alldata ){
+               return intval( $value );
+       }
 
        static function filterTimezoneInput( $tz, $alldata ) {
                $data = explode( '|', $tz, 3 );
@@ -1218,7 +1232,6 @@ class Preferences {
                                return $tz;
                        default:
                                $data = explode( ':', $tz, 2 );
-                               $minDiff = 0;
                                if ( count( $data ) == 2 ) {
                                        $data[0] = intval( $data[0] );
                                        $data[1] = intval( $data[1] );
@@ -1268,8 +1281,8 @@ class Preferences {
                                        # Mail a temporary password to the dirty address.
                                        # User can come back through the confirmation URL to re-enable email.
                                        $result = $wgUser->sendConfirmationMail( $oldaddr != '' );
-                                       if ( WikiError::isError( $result ) ) {
-                                               return wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
+                                       if ( !$result->isGood() ) {
+                                               return htmlspecialchars( $result->getWikiText( 'mailerror' ) );
                                        } elseif ( $entryPoint == 'ui' ) {
                                                $result = 'eauth';
                                        }
@@ -1324,7 +1337,7 @@ class Preferences {
                        $wgOut->redirect( $url );
                }
 
-               return true;
+               return Status::newGood();
        }
 
        public static function loadOldSearchNs( $user ) {