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 ) {
## 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]
$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;
+ global $wgLanguageCode;
$languages = Language::getLanguageNames( false );
- if ( !array_key_exists( $wgContLanguageCode, $languages ) ) {
- $languages[$wgContLanguageCode] = $wgContLanguageCode;
+ if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
+ $languages[$wgLanguageCode] = $wgLanguageCode;
}
ksort( $languages );
$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',
'section' => 'editing/advancedediting',
'label-message' => 'tog-showtoolbar',
);
+ $defaultPreferences['minordefault'] = array(
+ 'type' => 'toggle',
+ 'section' => 'editing/advancedediting',
+ 'label-message' => 'tog-minordefault',
+ );
if ( $wgUseExternalEditor ) {
$defaultPreferences['externaleditor'] = array(
}
static function validateSignature( $signature, $alldata ) {
- global $wgMaxSigChars, $wgLang;
+ global $wgParser, $wgMaxSigChars, $wgLang;
if ( mb_strlen( $signature ) > $wgMaxSigChars ) {
return Xml::element( 'span', array( 'class' => 'error' ),
wfMsgExt( 'badsiglength', 'parsemag',
$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.
$formDescriptor = Preferences::getPreferences( $user );
$htmlForm = new $formClass( $formDescriptor, 'prefs' );
+ $htmlForm->setId( 'mw-prefs-form' );
$htmlForm->setSubmitText( wfMsg( 'saveprefs' ) );
# Used message keys: 'accesskey-preferences-save', 'tooltip-preferences-save'
$htmlForm->setSubmitTooltip( 'preferences-save' );
}
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 ) {