X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSpecialPreferences.php;h=9faba35baf70f83bba6924253c0a837398d5ad56;hb=7a9219be74758313796d2c17684ae2c6e95cf728;hp=1bbd5017e70b7ab3c8a9e39f8399293b48fc5eef;hpb=11337038b38b7b2bc586444ce82215fbef74f787;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 1bbd5017e7..9faba35baf 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -27,7 +27,7 @@ class PreferencesForm { var $mUserLanguage, $mUserVariant; var $mSearch, $mRecent, $mHourDiff, $mSearchLines, $mSearchChars, $mAction; var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize; - var $mUnderline; + var $mUnderline, $mWatchlistEdits; /** * Constructor @@ -64,6 +64,8 @@ class PreferencesForm { $this->mReset = $request->getCheck( 'wpReset' ); $this->mPosted = $request->wasPosted(); $this->mSuccess = $request->getCheck( 'success' ); + $this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' ); + $this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' ); $this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) && $this->mPosted && @@ -102,7 +104,7 @@ class PreferencesForm { global $wgUser, $wgOut; if ( $wgUser->isAnon() ) { - $wgOut->errorpage( 'prefsnologin', 'prefsnologintext' ); + $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext' ); return; } if ( wfReadOnly() ) { @@ -129,6 +131,16 @@ class PreferencesForm { return $val; } + /** + * @access private + */ + function validateFloat( &$val, $min, $max=0x7fffffff ) { + $val = floatval( $val ); + $val = min( $val, $max ); + $val = max( $val, $min ); + return( $val ); + } + /** * @access private */ @@ -231,6 +243,9 @@ class PreferencesForm { } else { $this->mainPrefsForm( 'error', wfMsg( 'badsig' ) ); } + } else { + // When no fancy sig used, make sure ~{3,5} get removed. + $this->mNick = $wgParser->cleanSigInSig( $this->mNick ); } $wgUser->setOption( 'language', $this->mUserLanguage ); @@ -247,6 +262,7 @@ class PreferencesForm { $wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines ) ); $wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars ) ); $wgUser->setOption( 'rclimit', $this->validateIntOrNull( $this->mRecent ) ); + $wgUser->setOption( 'wllimit', $this->validateIntOrNull( $this->mWatchlistEdits, 0, 1000 ) ); $wgUser->setOption( 'rows', $this->validateInt( $this->mRows, 4, 1000 ) ); $wgUser->setOption( 'cols', $this->validateInt( $this->mCols, 4, 1000 ) ); $wgUser->setOption( 'stubthreshold', $this->validateIntOrNull( $this->mStubs ) ); @@ -254,6 +270,7 @@ class PreferencesForm { $wgUser->setOption( 'imagesize', $this->mImageSize ); $wgUser->setOption( 'thumbsize', $this->mThumbSize ); $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) ); + $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) ); # Set search namespace options foreach( $this->mSearchNs as $i => $value ) { @@ -350,7 +367,9 @@ class PreferencesForm { $this->mImageSize = $wgUser->getOption( 'imagesize' ); $this->mThumbSize = $wgUser->getOption( 'thumbsize' ); $this->mRecent = $wgUser->getOption( 'rclimit' ); + $this->mWatchlistEdits = $wgUser->getOption( 'wllimit' ); $this->mUnderline = $wgUser->getOption( 'underline' ); + $this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' ); $togs = $wgLang->getUserToggles(); foreach ( $togs as $tname ) { @@ -447,7 +466,7 @@ class PreferencesForm { } else if ( '' != $status ) { $wgOut->addWikitext( $message . "\n----" ); } - + $qbs = $wgLang->getQuickbarSettings(); $skinNames = $wgLang->getSkinNames(); $mathopts = $wgLang->getMathNames(); @@ -675,12 +694,14 @@ class PreferencesForm { } # - if ($wgAllowRealName || $wgEnableEmail) { - $wgOut->addHTML("
"); - $rn = $wgAllowRealName ? wfMsg('prefs-help-realname') : ''; - $em = $wgEnableEmail ? '
' . wfMsg('prefs-help-email') : ''; - $wgOut->addHTML( $rn . $em . '
'); - } + # Show little "help" tips for the real name and email address options + if( $wgAllowRealName || $wgEnableEmail ) { + if( $wgAllowRealName ) + $tips[] = wfMsg( 'prefs-help-realname' ); + if( $wgEnableEmail ) + $tips[] = wfMsg( 'prefs-help-email' ); + $wgOut->addHtml( '
' . implode( '
', $tips ) . '
' ); + } $wgOut->addHTML( '' ); @@ -697,7 +718,7 @@ class PreferencesForm { } 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( "" ); + $wgOut->addHtml( wfHidden( 'wpQuickbar', $this->mQuickbar ) ); } # Skin @@ -765,7 +786,7 @@ class PreferencesForm { if ($dateopts) { $wgOut->addHTML( "
\n" . wfMsg( 'dateformat' ) . "\n" ); $idCnt = 0; - $epoch = '20010115161234'; + $epoch = '20010408091234'; foreach($dateopts as $key => $option) { if( $key == MW_DATE_DEFAULT ) { $formatted = wfMsgHtml( 'datedefault' ); @@ -798,12 +819,13 @@ class PreferencesForm { # Editing # - global $wgLivePreview; + global $wgLivePreview, $wgUseRCPatrol; $wgOut->addHTML( '
' . wfMsg( 'textboxsize' ) . ' -
- mRows}\" size='3' /> - mCols}\" size='3' /> -
" . +
' . + wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) . + ' ' . + wfInputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols ) . + "
" . $this->getToggles( array( 'editsection', 'editsectiononrightclick', @@ -812,17 +834,21 @@ class PreferencesForm { 'showtoolbar', 'previewonfirst', 'previewontop', + 'watchcreations', 'watchdefault', 'minordefault', 'externaleditor', 'externaldiff', - $wgLivePreview ? 'uselivepreview' : false, ) - ) . '
' + $wgLivePreview ? 'uselivepreview' : false, + $wgUser->isAllowed( 'patrol' ) && $wgUseRCPatrol ? 'autopatrol' : false, + 'forceeditsummary', + ) ) . '
' ); + $this->mUsedToggles['autopatrol'] = true; # Don't show this up for users who can't; the handler below is dumb and doesn't know it $wgOut->addHTML( '
' . htmlspecialchars(wfMsg('prefs-rc')) . '' . - ' mRecent\" size='3' />" . + wfInputLabel( wfMsg( 'recentchangescount' ), + 'wpRecent', 'wpRecent', 3, $this->mRecent ) . $this->getToggles( array( 'hideminor', $wgRCShowWatchingUsers ? 'shownumberswatching' : false, @@ -830,28 +856,39 @@ class PreferencesForm { ) . '
' ); + # Watchlist + $wgOut->addHTML( '
' . wfMsgHtml( 'prefs-watchlist' ) . '' ); + + $wgOut->addHTML( wfInputLabel( wfMsg( 'prefs-watchlist-days' ), + 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays ) ); + $wgOut->addHTML( '

' ); # Spacing + $wgOut->addHTML( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'extendwatchlist' ) ) ); + $wgOut->addHTML( wfInputLabel( wfMsg( 'prefs-watchlist-edits' ), + 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) ); + + $wgOut->addHTML( '
' ); + + # Search $wgOut->addHTML( '
' . wfMsg( 'searchresultshead' ) . '' . $this->addRow( - '', - "mSearch\" size='4' />" + wfLabel( wfMsg( 'resultsperpage' ), 'wpSearch' ), + wfInput( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) ) ) . $this->addRow( - '', - "mSearchLines\" size='4' />" + wfLabel( wfMsg( 'contextlines' ), 'wpSearchLines' ), + wfInput( 'wpSearchLines', 4, $this->mSearchLines, array( 'id' => 'wpSearchLines' ) ) ) . $this->addRow( - '', - "mSearchChars\" size='4' />" + wfLabel( wfMsg( 'contextchars' ), 'wpSearchChars' ), + wfInput( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) ) ) . "
" . wfMsg( 'defaultns' ) . "$ps
" ); # Misc # $wgOut->addHTML('
' . wfMsg('prefs-misc') . ''); - $wgOut->addHTML( - '' . - " mStubs\" size='6' />" - ); + $wgOut->addHTML( wfInputLabel( wfMsg( 'stubthreshold' ), + 'wpStubs', 'wpStubs', 6, $this->mStubs ) ); $msgUnderline = htmlspecialchars( wfMsg ( 'tog-underline' ) ); $msgUnderlinenever = htmlspecialchars( wfMsg ( 'underline-never' ) ); $msgUnderlinealways = htmlspecialchars( wfMsg ( 'underline-always' ) ); @@ -891,7 +928,7 @@ class PreferencesForm { \n" ); $wgOut->addWikiText( '
' . wfMsg('clearyourcache') . '
' ); - + } } ?>