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 ) {
if ( self::$defaultPreferences )
return self::$defaultPreferences;
- global $wgRCMaxAge;
-
$defaultPreferences = array();
self::profilePreferences( $user, $defaultPreferences );
}
## Prod in defaults from the user
- global $wgDefaultUserOptions;
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]
$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;
}
}
// Language
- global $wgContLanguageCode;
- $languages = array_reverse( Language::getLanguageNames( false ) );
- if ( !array_key_exists( $wgContLanguageCode, $languages ) ) {
- $languages[$wgContLanguageCode] = $wgContLanguageCode;
+ global $wgLanguageCode;
+ $languages = Language::getLanguageNames( false );
+ if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
+ $languages[$wgLanguageCode] = $wgLanguageCode;
}
ksort( $languages );
$selectedSkin = $user->getOption( 'skin' );
if ( in_array( $selectedSkin, array( 'cologneblue', 'standard' ) ) ) {
- global $wgLang;
-
$settings = array_flip( $wgLang->getQuickbarSettings() );
$defaultPreferences['quickbar'] = array(
$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',
);
}
- $stubThresholdValues = array( 0, 50, 100, 500, 1000, 2000, 5000, 10000 );
- $stubThresholdOptions = array();
+ $stubThresholdValues = array( 50, 100, 500, 1000, 2000, 5000, 10000 );
+ $stubThresholdOptions = array( wfMsg( 'stub-threshold-disabled' ) => 0 );
foreach ( $stubThresholdValues as $value ) {
$stubThresholdOptions[wfMsg( 'size-bytes', $value )] = $value;
}
'section' => 'editing/advancedediting',
'label-message' => 'tog-showtoolbar',
);
+ $defaultPreferences['minordefault'] = array(
+ 'type' => 'toggle',
+ 'section' => 'editing/advancedediting',
+ 'label-message' => 'tog-minordefault',
+ );
if ( $wgUseExternalEditor ) {
$defaultPreferences['externaleditor'] = array(
$wgDefaultUserOptions['date'] = 'default';
}
- $idCnt = 0;
$epoch = wfTimestampNow();
foreach ( $dateopts as $key ) {
if ( $key == 'default' ) {
$wgLang->formatNum( $wgMaxSigChars )
)
);
- } elseif ( !empty( $alldata['fancysig'] ) &&
+ } elseif ( isset( $alldata['fancysig'] ) &&
+ $alldata['fancysig'] &&
false === $wgParser->validateSig( $signature ) ) {
return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'badsig' ) );
} else {
static function cleanSignature( $signature, $alldata ) {
global $wgParser;
- if ( $alldata['fancysig'] ) {
+ if ( isset( $alldata['fancysig'] ) && $alldata['fancysig'] ) {
$signature = $wgParser->cleanSig( $signature );
} else {
// When no fancy sig used, make sure ~{3,5} get removed.
}
return $opt;
}
+
+ static function filterIntval( $value, $alldata ){
+ return intval( $value );
+ }
static function filterTimezoneInput( $tz, $alldata ) {
$data = explode( '|', $tz, 3 );
return $tz;
default:
$data = explode( ':', $tz, 2 );
- $minDiff = 0;
if ( count( $data ) == 2 ) {
$data[0] = intval( $data[0] );
$data[1] = intval( $data[1] );
# 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';
}
$wgOut->redirect( $url );
}
- return true;
+ return Status::newGood();
}
public static function loadOldSearchNs( $user ) {