var $mUserLanguage, $mUserVariant;
var $mSearch, $mRecent, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
+ var $mUnderline;
/**
* Constructor
$this->mSearchChars = $request->getVal( 'wpSearchChars' );
$this->mImageSize = $request->getVal( 'wpImageSize' );
$this->mThumbSize = $request->getInt( 'wpThumbSize' );
+ $this->mUnderline = $request->getInt( 'wpOpunderline' );
$this->mAction = $request->getVal( 'action' );
$this->mReset = $request->getCheck( 'wpReset' );
$this->mPosted = $request->wasPosted();
+
$this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
$this->mPosted &&
$wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
global $wgUser, $wgLang, $wgOut;
global $wgEnableUserEmail, $wgEnableEmail;
global $wgEmailAuthentication, $wgMinimalPasswordLength;
+ global $wgAuth;
+
if ( '' != $this->mNewpass ) {
if ( $this->mNewpass != $this->mRetypePass ) {
$this->mainPrefsForm( wfMsg( 'wrongpassword' ) );
return;
}
+ if (!$wgAuth->setPassword( $wgUser, $this->mNewpass )) {
+ $this->mainPrefsForm( wfMsg( 'externaldberror' ) );
+ return;
+ }
$wgUser->setPassword( $this->mNewpass );
}
$wgUser->setRealName( $this->mRealName );
$wgUser->setOption( 'nickname', $this->mNick );
$wgUser->setOption( 'quickbar', $this->mQuickbar );
$wgUser->setOption( 'skin', $this->mSkin );
- $wgUser->setOption( 'math', $this->mMath );
- $wgUser->setOption( 'date', $this->mDate );
+ global $wgUseTeX;
+ if( $wgUseTeX ) {
+ $wgUser->setOption( 'math', $this->mMath );
+ }
+ $wgUser->setOption( 'date', $this->validateInt( $this->mDate, 0, 10 ) );
$wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch ) );
$wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines ) );
$wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars ) );
$wgUser->setOption( 'timecorrection', $this->validateTimeZone( $this->mHourDiff, -12, 14 ) );
$wgUser->setOption( 'imagesize', $this->mImageSize );
$wgUser->setOption( 'thumbsize', $this->mThumbSize );
+ $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
# Set search namespace options
foreach( $this->mSearchNs as $i => $value ) {
foreach ( $this->mToggles as $tname => $tvalue ) {
$wgUser->setOption( $tname, $tvalue );
}
+ if (!$wgAuth->updateExternalDB($wgUser)) {
+ $this->mainPrefsForm( wfMsg( 'externaldberror' ) );
+ return;
+ }
$wgUser->setCookies();
$wgUser->saveSettings();
# User can come back through the confirmation URL to re-enable email.
$result = $wgUser->sendConfirmationMail();
if( WikiError::isError( $result ) ) {
- $error = wfMsg( 'mailerror', $result->toString() );
+ $error = wfMsg( 'mailerror', $result->getMessage() );
} else {
$error = wfMsg( 'eauthentsent', $wgUser->getName() );
}
$this->mImageSize = $wgUser->getOption( 'imagesize' );
$this->mThumbSize = $wgUser->getOption( 'thumbsize' );
$this->mRecent = $wgUser->getOption( 'rclimit' );
+ $this->mUnderline = $wgUser->getOption( 'underline' );
$togs = $wgLang->getUserToggles();
foreach ( $togs as $tname ) {
global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
- global $wgContLanguageCode;
+ global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins;
$wgOut->setPageTitle( wfMsg( 'preferences' ) );
$wgOut->setArticleRelated( false );
$titleObj = Title::makeTitle( NS_SPECIAL, 'Preferences' );
$action = $titleObj->escapeLocalURL();
-
+
+ # Pre-expire some toggles so they won't show if disabled
+ $this->mUsedToggles[ 'shownumberswatching' ] = true;
+ $this->mUsedToggles[ 'showupdated' ] = true;
+ $this->mUsedToggles[ 'enotifwatchlistpages' ] = true;
+ $this->mUsedToggles[ 'enotifusertalkpages' ] = true;
+ $this->mUsedToggles[ 'enotifminoredits' ] = true;
+ $this->mUsedToggles[ 'enotifrevealaddr' ] = true;
# Enotif
# <FIXME>
$enotifwatchlistpages = ($wgEnotifWatchlist) ? $this->getToggle( 'enotifwatchlistpages' ) : '';
$enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages' ) : '';
- $enotifminoredits = ($wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits' ) : '';
- $enotifrevealaddr = ($wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr' ) : '';
+ $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits' ) : '';
+ $enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr' ) : '';
$prefs_help_email_enotif = ( $wgEnotifWatchlist || $wgEnotifUserTalk) ? ' ' . wfMsg('prefs-help-email-enotif') : '';
$prefs_help_realname = '';
$wgOut->addHTML( "<div><label><input type='radio' name='wpQuickbar' value=\"$i\"$checked />{$qbs[$i]}</label></div>\n" );
}
$wgOut->addHtml( "</fieldset>\n\n" );
+ } else {
+ # Need to output a hidden option even if the relevant skin is not in use,
+ # otherwise the preference will get reset to 0 on submit
+ $wgOut->addHTML( "<input type='hidden' name='wpQuickbar' value='{$this->mQuickbar}' />" );
}
# Skin
# Only show members of $wgValidSkinNames rather than
# $skinNames (skins is all skin names from Language.php)
foreach ($wgValidSkinNames as $skinkey => $skinname ) {
- global $wgDefaultSkin;
-
+ if ( in_array( $skinkey, $wgSkipSkins ) ) {
+ continue;
+ }
$checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
$sn = isset( $skinNames[$skinkey] ) ? $skinNames[$skinkey] : $skinname;
# Math
#
- $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
- foreach ( $mathopts as $k => $v ) {
- $checked = $k == $this->mMath ? ' checked="checked"' : '';
- $wgOut->addHTML( "<div><label><input type='radio' name='wpMath' value=\"$k\"$checked /> ".wfMsg($v)."</label></div>\n" );
+ global $wgUseTeX;
+ if( $wgUseTeX ) {
+ $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
+ foreach ( $mathopts as $k => $v ) {
+ $checked = $k == $this->mMath ? ' checked="checked"' : '';
+ $wgOut->addHTML( "<div><label><input type='radio' name='wpMath' value=\"$k\"$checked /> ".wfMsg($v)."</label></div>\n" );
+ }
+ $wgOut->addHTML( "</fieldset>\n\n" );
}
- $wgOut->addHTML( "</fieldset>\n\n" );
# Files
#
$this->getToggles( array(
'hideminor',
$wgRCShowWatchingUsers ? 'shownumberswatching' : false,
- 'usenewrc',
- 'rcusemodstyle',
- array(
- 'showupdated',
- wfMsg('updatedmarker')
- ) )
+ 'usenewrc' )
) . '</fieldset>'
);
#
$wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') . '</legend>');
+ $msgUnderline = htmlspecialchars(wfMsg("tog-underline"));
+ $msgUnderlinenever = htmlspecialchars(wfMsg("underline-never"));
+ $msgUnderlinealways = htmlspecialchars(wfMsg("underline-always"));
+ $msgUnderlinedefault = htmlspecialchars(wfMsg("underline-default"));
+ $uopt = $wgUser->getOption("underline");
+ $s0 = $uopt == 0 ? " selected=\"selected\"" : "";
+ $s1 = $uopt == 1 ? " selected=\"selected\"" : "";
+ $s2 = $uopt == 2 ? " selected=\"selected\"" : "";
+ $wgOut->addHTML("
+<div class='toggle'><label>$msgUnderline
+<select name=\"wpOpunderline\">
+<option value=\"0\"$s0>$msgUnderlinenever</option>
+<option value=\"1\"$s1>$msgUnderlinealways</option>
+<option value=\"2\"$s2>$msgUnderlinedefault</option>
+</select>
+</label></div>
+");
foreach ( $togs as $tname ) {
if( !array_key_exists( $tname, $this->mUsedToggles ) ) {
$wgOut->addHTML( $this->getToggle( $tname ) );