3 * Hold things related to displaying and saving user preferences.
9 * Entry point that create the "Preferences" object
11 function wfSpecialPreferences() {
14 $form = new PreferencesForm( $wgRequest );
19 * Preferences form handling
20 * This object will show the preferences form and can save it as well.
21 * @ingroup SpecialPage
23 class PreferencesForm
{
24 var $mQuickbar, $mStubs;
25 var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick;
26 var $mUserLanguage, $mUserVariant;
27 var $mSearch, $mRecent, $mRecentDays, $mTimeZone, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
28 var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
29 var $mUnderline, $mWatchlistEdits, $mGender;
35 function __construct( &$request ) {
36 global $wgContLang, $wgUser, $wgAllowRealName;
38 $this->mQuickbar
= $request->getVal( 'wpQuickbar' );
39 $this->mStubs
= $request->getVal( 'wpStubs' );
40 $this->mRows
= $request->getVal( 'wpRows' );
41 $this->mCols
= $request->getVal( 'wpCols' );
42 $this->mSkin
= Skin
::normalizeKey( $request->getVal( 'wpSkin' ) );
43 $this->mMath
= $request->getVal( 'wpMath' );
44 $this->mDate
= $request->getVal( 'wpDate' );
45 $this->mUserEmail
= $request->getVal( 'wpUserEmail' );
46 $this->mRealName
= $wgAllowRealName ?
$request->getVal( 'wpRealName' ) : '';
47 $this->mEmailFlag
= $request->getCheck( 'wpEmailFlag' ) ?
0 : 1;
48 $this->mNick
= $request->getVal( 'wpNick' );
49 $this->mUserLanguage
= $request->getVal( 'wpUserLanguage' );
50 $this->mUserVariant
= $request->getVal( 'wpUserVariant' );
51 $this->mSearch
= $request->getVal( 'wpSearch' );
52 $this->mRecent
= $request->getVal( 'wpRecent' );
53 $this->mRecentDays
= $request->getVal( 'wpRecentDays' );
54 $this->mTimeZone
= $request->getVal( 'wpTimeZone' );
55 $this->mHourDiff
= $request->getVal( 'wpHourDiff' );
56 $this->mSearchLines
= $request->getVal( 'wpSearchLines' );
57 $this->mSearchChars
= $request->getVal( 'wpSearchChars' );
58 $this->mImageSize
= $request->getVal( 'wpImageSize' );
59 $this->mThumbSize
= $request->getInt( 'wpThumbSize' );
60 $this->mUnderline
= $request->getInt( 'wpOpunderline' );
61 $this->mAction
= $request->getVal( 'action' );
62 $this->mReset
= $request->getCheck( 'wpReset' );
63 $this->mRestoreprefs
= $request->getCheck( 'wpRestore' );
64 $this->mPosted
= $request->wasPosted();
65 $this->mSuccess
= $request->getCheck( 'success' );
66 $this->mWatchlistDays
= $request->getVal( 'wpWatchlistDays' );
67 $this->mWatchlistEdits
= $request->getVal( 'wpWatchlistEdits' );
68 $this->mDisableMWSuggest
= $request->getCheck( 'wpDisableMWSuggest' );
69 $this->mGender
= $request->getVal( 'wpGender' );
71 $this->mSaveprefs
= $request->getCheck( 'wpSaveprefs' ) &&
73 $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
75 # User toggles (the big ugly unsorted list of checkboxes)
76 $this->mToggles
= array();
77 if ( $this->mPosted
) {
78 $togs = User
::getToggles();
79 foreach ( $togs as $tname ) {
80 $this->mToggles
[$tname] = $request->getCheck( "wpOp$tname" ) ?
1 : 0;
84 $this->mUsedToggles
= array();
86 # Search namespace options
87 # Note: namespaces don't necessarily have consecutive keys
88 $this->mSearchNs
= array();
89 if ( $this->mPosted
) {
90 $namespaces = $wgContLang->getNamespaces();
91 foreach ( $namespaces as $i => $namespace ) {
93 $this->mSearchNs
[$i] = $request->getCheck( "wpNs$i" ) ?
1 : 0;
99 if ( !preg_match( '/^[a-z\-]*$/', $this->mUserLanguage
) ) {
100 $this->mUserLanguage
= 'nolanguage';
103 wfRunHooks( 'InitPreferencesForm', array( $this, $request ) );
107 global $wgUser, $wgOut, $wgTitle;
109 if ( $wgUser->isAnon() ) {
110 $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext', array($wgTitle->getPrefixedDBkey()) );
113 if ( wfReadOnly() ) {
114 $wgOut->readOnlyPage();
117 if ( $this->mReset
) {
119 $this->mainPrefsForm( 'reset', wfMsg( 'prefsreset' ) );
120 } else if ( $this->mSaveprefs
) {
121 $this->savePreferences();
122 } else if ( $this->mRestoreprefs
) {
123 $this->restorePreferences();
126 $this->mainPrefsForm( '' );
132 function validateInt( &$val, $min=0, $max=0x7fffffff ) {
134 $val = min($val, $max);
135 $val = max($val, $min);
142 function validateFloat( &$val, $min, $max=0x7fffffff ) {
143 $val = floatval( $val );
144 $val = min( $val, $max );
145 $val = max( $val, $min );
152 function validateIntOrNull( &$val, $min=0, $max=0x7fffffff ) {
157 return $this->validateInt( $val, $min, $max );
164 function validateDate( $val ) {
165 global $wgLang, $wgContLang;
166 if ( $val !== false && (
167 in_array( $val, (array)$wgLang->getDatePreferences() ) ||
168 in_array( $val, (array)$wgContLang->getDatePreferences() ) ) )
172 return $wgLang->getDefaultDateFormat();
177 * Used to validate the user inputed timezone before saving it as
178 * 'timecorrection', will return 'System' if fed bogus data.
180 * @param string $tz the user input Zoneinfo timezone
181 * @param string $s the user input offset string
184 function validateTimeZone( $tz, $s ) {
185 $data = explode( '|', $tz, 3 );
186 switch ( $data[0] ) {
192 $data = explode( ':', $s, 2 );
194 if( count( $data ) == 2 ) {
195 $data[0] = intval( $data[0] );
196 $data[1] = intval( $data[1] );
197 $minDiff = abs( $data[0] ) * 60 +
$data[1];
198 if ( $data[0] < 0 ) $minDiff = -$minDiff;
200 $minDiff = intval( $data[0] ) * 60;
203 # Max is +14:00 and min is -12:00, see:
204 # http://en.wikipedia.org/wiki/Timezone
205 $minDiff = min( $minDiff, 840 ); # 14:00
206 $minDiff = max( $minDiff, -720 ); # -12:00
207 return 'Offset|'.$minDiff;
211 function validateGender( $val ) {
212 $valid = array( 'male', 'female', 'unknown' );
213 if ( in_array($val, $valid) ) {
216 return User
::getDefaultOption( 'gender' );
223 function savePreferences() {
224 global $wgUser, $wgOut, $wgParser;
225 global $wgEnableUserEmail, $wgEnableEmail;
226 global $wgEmailAuthentication, $wgRCMaxAge;
227 global $wgAuth, $wgEmailConfirmToEdit;
229 $wgUser->setRealName( $this->mRealName
);
230 $oldOptions = $wgUser->mOptions
;
232 if( $wgUser->getOption( 'language' ) !== $this->mUserLanguage
) {
233 $needRedirect = true;
235 $needRedirect = false;
238 # Validate the signature and clean it up as needed
239 global $wgMaxSigChars;
240 if( mb_strlen( $this->mNick
) > $wgMaxSigChars ) {
242 $this->mainPrefsForm( 'error',
243 wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) );
245 } elseif( $this->mToggles
['fancysig'] ) {
246 if( $wgParser->validateSig( $this->mNick
) !== false ) {
247 $this->mNick
= $wgParser->cleanSig( $this->mNick
);
249 $this->mainPrefsForm( 'error', wfMsg( 'badsig' ) );
253 // When no fancy sig used, make sure ~{3,5} get removed.
254 $this->mNick
= $wgParser->cleanSigInSig( $this->mNick
);
257 $wgUser->setOption( 'language', $this->mUserLanguage
);
258 $wgUser->setOption( 'variant', $this->mUserVariant
);
259 $wgUser->setOption( 'nickname', $this->mNick
);
260 $wgUser->setOption( 'quickbar', $this->mQuickbar
);
261 global $wgAllowUserSkin;
262 if( $wgAllowUserSkin ) {
263 $wgUser->setOption( 'skin', $this->mSkin
);
267 $wgUser->setOption( 'math', $this->mMath
);
269 $wgUser->setOption( 'date', $this->validateDate( $this->mDate
) );
270 $wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch
) );
271 $wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines
) );
272 $wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars
) );
273 $wgUser->setOption( 'rclimit', $this->validateIntOrNull( $this->mRecent
) );
274 $wgUser->setOption( 'rcdays', $this->validateInt($this->mRecentDays
, 1, ceil($wgRCMaxAge / (3600*24))));
275 $wgUser->setOption( 'wllimit', $this->validateIntOrNull( $this->mWatchlistEdits
, 0, 1000 ) );
276 $wgUser->setOption( 'rows', $this->validateInt( $this->mRows
, 4, 1000 ) );
277 $wgUser->setOption( 'cols', $this->validateInt( $this->mCols
, 4, 1000 ) );
278 $wgUser->setOption( 'stubthreshold', $this->validateIntOrNull( $this->mStubs
) );
279 $wgUser->setOption( 'timecorrection', $this->validateTimeZone( $this->mTimeZone
, $this->mHourDiff
) );
280 $wgUser->setOption( 'imagesize', $this->mImageSize
);
281 $wgUser->setOption( 'thumbsize', $this->mThumbSize
);
282 $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline
, 0, 2) );
283 $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays
, 0, 7 ) );
284 $wgUser->setOption( 'disablesuggest', $this->mDisableMWSuggest
);
285 $wgUser->setOption( 'gender', $this->validateGender( $this->mGender
) );
287 # Set search namespace options
288 foreach( $this->mSearchNs
as $i => $value ) {
289 $wgUser->setOption( "searchNs{$i}", $value );
292 if( $wgEnableEmail && $wgEnableUserEmail ) {
293 $wgUser->setOption( 'disablemail', $this->mEmailFlag
);
297 foreach ( $this->mToggles
as $tname => $tvalue ) {
298 $wgUser->setOption( $tname, $tvalue );
302 if( $wgEnableEmail ) {
303 $newadr = $this->mUserEmail
;
304 $oldadr = $wgUser->getEmail();
305 if( ($newadr != '') && ($newadr != $oldadr) ) {
306 # the user has supplied a new email address on the login page
307 if( $wgUser->isValidEmailAddr( $newadr ) ) {
308 # new behaviour: set this new emailaddr from login-page into user database record
309 $wgUser->setEmail( $newadr );
310 # but flag as "dirty" = unauthenticated
311 $wgUser->invalidateEmail();
312 if ($wgEmailAuthentication) {
313 # Mail a temporary password to the dirty address.
314 # User can come back through the confirmation URL to re-enable email.
315 $result = $wgUser->sendConfirmationMail();
316 if( WikiError
::isError( $result ) ) {
317 $error = wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
319 $error = wfMsg( 'eauthentsent', $wgUser->getName() );
323 $error = wfMsg( 'invalidemailaddress' );
326 if( $wgEmailConfirmToEdit && empty( $newadr ) ) {
327 $this->mainPrefsForm( 'error', wfMsg( 'noemailtitle' ) );
330 $wgUser->setEmail( $this->mUserEmail
);
332 if( $oldadr != $newadr ) {
333 wfRunHooks( 'PrefsEmailAudit', array( $wgUser, $oldadr, $newadr ) );
337 if( !$wgAuth->updateExternalDB( $wgUser ) ){
338 $this->mainPrefsForm( 'error', wfMsg( 'externaldberror' ) );
343 if ( !wfRunHooks( 'SavePreferences', array( $this, $wgUser, &$msg, $oldOptions ) ) ) {
344 $this->mainPrefsForm( 'error', $msg );
348 $wgUser->setCookies();
349 $wgUser->saveSettings();
351 if( $needRedirect && $error === false ) {
352 $title = SpecialPage
::getTitleFor( 'Preferences' );
353 $wgOut->redirect( $title->getFullURL( 'success' ) );
357 $wgOut->parserOptions( ParserOptions
::newFromUser( $wgUser ) );
358 $this->mainPrefsForm( $error === false ?
'success' : 'error', $error);
364 function resetPrefs() {
365 global $wgUser, $wgLang, $wgContLang, $wgContLanguageCode, $wgAllowRealName, $wgLocalTZoffset;
367 $this->mUserEmail
= $wgUser->getEmail();
368 $this->mUserEmailAuthenticationtimestamp
= $wgUser->getEmailAuthenticationtimestamp();
369 $this->mRealName
= ($wgAllowRealName) ?
$wgUser->getRealName() : '';
371 # language value might be blank, default to content language
372 $this->mUserLanguage
= $wgUser->getOption( 'language', $wgContLanguageCode );
374 $this->mUserVariant
= $wgUser->getOption( 'variant');
375 $this->mEmailFlag
= $wgUser->getOption( 'disablemail' ) == 1 ?
1 : 0;
376 $this->mNick
= $wgUser->getOption( 'nickname' );
378 $this->mQuickbar
= $wgUser->getOption( 'quickbar' );
379 $this->mSkin
= Skin
::normalizeKey( $wgUser->getOption( 'skin' ) );
380 $this->mMath
= $wgUser->getOption( 'math' );
381 $this->mDate
= $wgUser->getDatePreference();
382 $this->mRows
= $wgUser->getOption( 'rows' );
383 $this->mCols
= $wgUser->getOption( 'cols' );
384 $this->mStubs
= $wgUser->getOption( 'stubthreshold' );
386 $tz = $wgUser->getOption( 'timecorrection' );
387 $data = explode( '|', $tz, 3 );
389 switch ( $data[0] ) {
391 $this->mTimeZone
= $tz;
392 # Check if the specified TZ exists, and change to 'Offset' if
394 if ( !function_exists('timezone_open') || @timezone_open
( $data[2] ) === false ) {
395 $this->mTimeZone
= 'Offset';
396 $minDiff = intval( $data[1] );
401 $this->mTimeZone
= 'System|'.$wgLocalTZoffset;
404 $this->mTimeZone
= 'Offset';
405 $minDiff = intval( $data[1] );
408 $this->mTimeZone
= 'Offset';
409 $data = explode( ':', $tz, 2 );
410 if( count( $data ) == 2 ) {
411 $data[0] = intval( $data[0] );
412 $data[1] = intval( $data[1] );
413 $minDiff = abs( $data[0] ) * 60 +
$data[1];
414 if ( $data[0] < 0 ) $minDiff = -$minDiff;
416 $minDiff = intval( $data[0] ) * 60;
420 if ( is_null( $minDiff ) ) {
421 $this->mHourDiff
= '';
423 $this->mHourDiff
= sprintf( '%+03d:%02d', floor($minDiff/60), abs($minDiff)%60
);
426 $this->mSearch
= $wgUser->getOption( 'searchlimit' );
427 $this->mSearchLines
= $wgUser->getOption( 'contextlines' );
428 $this->mSearchChars
= $wgUser->getOption( 'contextchars' );
429 $this->mImageSize
= $wgUser->getOption( 'imagesize' );
430 $this->mThumbSize
= $wgUser->getOption( 'thumbsize' );
431 $this->mRecent
= $wgUser->getOption( 'rclimit' );
432 $this->mRecentDays
= $wgUser->getOption( 'rcdays' );
433 $this->mWatchlistEdits
= $wgUser->getOption( 'wllimit' );
434 $this->mUnderline
= $wgUser->getOption( 'underline' );
435 $this->mWatchlistDays
= $wgUser->getOption( 'watchlistdays' );
436 $this->mDisableMWSuggest
= $wgUser->getBoolOption( 'disablesuggest' );
437 $this->mGender
= $wgUser->getOption( 'gender' );
439 $togs = User
::getToggles();
440 foreach ( $togs as $tname ) {
441 $this->mToggles
[$tname] = $wgUser->getOption( $tname );
444 $namespaces = $wgContLang->getNamespaces();
445 foreach ( $namespaces as $i => $namespace ) {
446 if ( $i >= NS_MAIN
) {
447 $this->mSearchNs
[$i] = $wgUser->getOption( 'searchNs'.$i );
451 wfRunHooks( 'ResetPreferences', array( $this, $wgUser ) );
457 function restorePreferences() {
458 global $wgUser, $wgOut;
459 $wgUser->restoreOptions();
460 $wgUser->setCookies();
461 $wgUser->saveSettings();
462 $title = SpecialPage
::getTitleFor( 'Preferences' );
463 $wgOut->redirect( $title->getFullURL( 'success' ) );
469 function namespacesCheckboxes() {
472 # Determine namespace checkboxes
473 $namespaces = $wgContLang->getNamespaces();
476 foreach ( $namespaces as $i => $name ) {
479 $checked = $this->mSearchNs
[$i] ?
"checked='checked'" : '';
480 $name = str_replace( '_', ' ', $namespaces[$i] );
483 $name = wfMsg( 'blanknamespace' );
485 $r1 .= "<input type='checkbox' value='1' name='wpNs$i' id='wpNs$i' {$checked}/> <label for='wpNs$i'>{$name}</label><br />\n";
491 function getToggle( $tname, $trailer = false, $disabled = false ) {
492 global $wgUser, $wgLang;
494 $this->mUsedToggles
[$tname] = true;
495 $ttext = $wgLang->getUserToggle( $tname );
497 $checked = $wgUser->getOption( $tname ) == 1 ?
' checked="checked"' : '';
498 $disabled = $disabled ?
' disabled="disabled"' : '';
499 $trailer = $trailer ?
$trailer : '';
500 return "<div class='toggle'><input type='checkbox' value='1' id=\"$tname\" name=\"wpOp$tname\"$checked$disabled />" .
501 " <span class='toggletext'><label for=\"$tname\">$ttext</label>$trailer</span></div>\n";
504 function getToggles( $items ) {
506 foreach( $items as $item ) {
507 if( $item === false )
509 if( is_array( $item ) ) {
510 list( $key, $trailer ) = $item;
515 $out .= $this->getToggle( $key, $trailer );
520 function addRow($td1, $td2) {
521 return "<tr><td class='mw-label'>$td1</td><td class='mw-input'>$td2</td></tr>";
525 * Helper function for user information panel
526 * @param $td1 label for an item
527 * @param $td2 item or null
528 * @param $td3 optional help or null
529 * @return xhtml block
531 function tableRow( $td1, $td2 = null, $td3 = null ) {
533 if ( is_null( $td3 ) ) {
536 $td3 = Xml
::tags( 'tr', null,
537 Xml
::tags( 'td', array( 'class' => 'pref-label', 'colspan' => '2' ), $td3 )
541 if ( is_null( $td2 ) ) {
542 $td1 = Xml
::tags( 'td', array( 'class' => 'pref-label', 'colspan' => '2' ), $td1 );
545 $td1 = Xml
::tags( 'td', array( 'class' => 'pref-label' ), $td1 );
546 $td2 = Xml
::tags( 'td', array( 'class' => 'pref-input' ), $td2 );
549 return Xml
::tags( 'tr', null, $td1 . $td2 ). $td3 . "\n";
556 function mainPrefsForm( $status , $message = '' ) {
557 global $wgUser, $wgOut, $wgLang, $wgContLang, $wgAuth;
558 global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
559 global $wgDisableLangConversion, $wgDisableTitleConversion;
560 global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
561 global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
562 global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
563 global $wgContLanguageCode, $wgDefaultSkin, $wgCookieExpiration;
564 global $wgEmailConfirmToEdit, $wgEnableMWSuggest, $wgLocalTZoffset;
566 $wgOut->setPageTitle( wfMsg( 'preferences' ) );
567 $wgOut->setArticleRelated( false );
568 $wgOut->setRobotPolicy( 'noindex,nofollow' );
569 $wgOut->addScriptFile( 'prefs.js' );
571 $wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc.
573 if ( $this->mSuccess ||
'success' == $status ) {
574 $wgOut->wrapWikiMsg( '<div class="successbox"><strong>$1</strong></div>', 'savedprefs' );
575 } else if ( 'error' == $status ) {
576 $wgOut->addWikiText( '<div class="errorbox"><strong>' . $message . '</strong></div>' );
577 } else if ( '' != $status ) {
578 $wgOut->addWikiText( $message . "\n----" );
581 $qbs = $wgLang->getQuickbarSettings();
582 $mathopts = $wgLang->getMathNames();
583 $dateopts = $wgLang->getDatePreferences();
584 $togs = User
::getToggles();
586 $titleObj = SpecialPage
::getTitleFor( 'Preferences' );
588 # Pre-expire some toggles so they won't show if disabled
589 $this->mUsedToggles
[ 'shownumberswatching' ] = true;
590 $this->mUsedToggles
[ 'showupdated' ] = true;
591 $this->mUsedToggles
[ 'enotifwatchlistpages' ] = true;
592 $this->mUsedToggles
[ 'enotifusertalkpages' ] = true;
593 $this->mUsedToggles
[ 'enotifminoredits' ] = true;
594 $this->mUsedToggles
[ 'enotifrevealaddr' ] = true;
595 $this->mUsedToggles
[ 'ccmeonemails' ] = true;
596 $this->mUsedToggles
[ 'uselivepreview' ] = true;
597 $this->mUsedToggles
[ 'noconvertlink' ] = true;
600 if ( !$this->mEmailFlag
) { $emfc = 'checked="checked"'; }
604 if ($wgEmailAuthentication && ($this->mUserEmail
!= '') ) {
605 if( $wgUser->getEmailAuthenticationTimestamp() ) {
606 // date and time are separate parameters to facilitate localisation.
607 // $time is kept for backward compat reasons.
608 // 'emailauthenticated' is also used in SpecialConfirmemail.php
609 $time = $wgLang->timeAndDate( $wgUser->getEmailAuthenticationTimestamp(), true );
610 $d = $wgLang->date( $wgUser->getEmailAuthenticationTimestamp(), true );
611 $t = $wgLang->time( $wgUser->getEmailAuthenticationTimestamp(), true );
612 $emailauthenticated = wfMsg('emailauthenticated', $time, $d, $t ).'<br />';
613 $disableEmailPrefs = false;
615 $disableEmailPrefs = true;
616 $skin = $wgUser->getSkin();
617 $emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
618 $skin->makeKnownLinkObj( SpecialPage
::getTitleFor( 'Confirmemail' ),
619 wfMsg( 'emailconfirmlink' ) ) . '<br />';
622 $emailauthenticated = '';
623 $disableEmailPrefs = false;
626 if ($this->mUserEmail
== '') {
627 $emailauthenticated = wfMsg( 'noemailprefs' ) . '<br />';
630 $ps = $this->namespacesCheckboxes();
632 $enotifwatchlistpages = ($wgEnotifWatchlist) ?
$this->getToggle( 'enotifwatchlistpages', false, $disableEmailPrefs ) : '';
633 $enotifusertalkpages = ($wgEnotifUserTalk) ?
$this->getToggle( 'enotifusertalkpages', false, $disableEmailPrefs ) : '';
634 $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ?
$this->getToggle( 'enotifminoredits', false, $disableEmailPrefs ) : '';
635 $enotifrevealaddr = (($wgEnotifWatchlist ||
$wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ?
$this->getToggle( 'enotifrevealaddr', false, $disableEmailPrefs ) : '';
640 Xml
::openElement( 'form', array(
641 'action' => $titleObj->getLocalUrl(),
643 'id' => 'mw-preferences-form',
645 Xml
::openElement( 'div', array( 'id' => 'preferences' ) )
651 Xml
::fieldset( wfMsg('prefs-personal') ) .
652 Xml
::openElement( 'table' ) .
653 $this->tableRow( Xml
::element( 'h2', null, wfMsg( 'prefs-personal' ) ) )
656 # Get groups to which the user belongs
657 $userEffectiveGroups = $wgUser->getEffectiveGroups();
658 $userEffectiveGroupsArray = array();
659 foreach( $userEffectiveGroups as $ueg ) {
661 // Skip the default * group, seems useless here
664 $userEffectiveGroupsArray[] = User
::makeGroupLinkHTML( $ueg );
666 asort( $userEffectiveGroupsArray );
668 $sk = $wgUser->getSkin();
669 $toolLinks = array();
670 $toolLinks[] = $sk->makeKnownLinkObj( SpecialPage
::getTitleFor( 'ListGroupRights' ), wfMsg( 'listgrouprights' ) );
671 # At the moment one tool link only but be prepared for the future...
672 # FIXME: Add a link to Special:Userrights for users who are allowed to use it.
673 # $wgUser->isAllowed( 'userrights' ) seems to strict in some cases
675 $userInformationHtml =
676 $this->tableRow( wfMsgHtml( 'username' ), htmlspecialchars( $wgUser->getName() ) ) .
677 $this->tableRow( wfMsgHtml( 'uid' ), htmlspecialchars( $wgUser->getId() ) ) .
680 wfMsgExt( 'prefs-memberingroups', array( 'parseinline' ), count( $userEffectiveGroupsArray ) ),
681 $wgLang->commaList( $userEffectiveGroupsArray ) .
682 '<br />(' . $wgLang->pipeList( $toolLinks ) . ')'
686 wfMsgHtml( 'prefs-edits' ),
687 $wgLang->formatNum( $wgUser->getEditCount() )
690 if( wfRunHooks( 'PreferencesUserInformationPanel', array( $this, &$userInformationHtml ) ) ) {
691 $wgOut->addHTML( $userInformationHtml );
694 if ( $wgAllowRealName ) {
697 Xml
::label( wfMsg('yourrealname'), 'wpRealName' ),
698 Xml
::input( 'wpRealName', 25, $this->mRealName
, array( 'id' => 'wpRealName' ) ),
699 Xml
::tags('div', array( 'class' => 'prefsectiontip' ),
700 wfMsgExt( 'prefs-help-realname', 'parseinline' )
705 if ( $wgEnableEmail ) {
708 Xml
::label( wfMsg('youremail'), 'wpUserEmail' ),
709 Xml
::input( 'wpUserEmail', 25, $this->mUserEmail
, array( 'id' => 'wpUserEmail' ) ),
710 Xml
::tags('div', array( 'class' => 'prefsectiontip' ),
711 wfMsgExt( $wgEmailConfirmToEdit ?
'prefs-help-email-required' : 'prefs-help-email', 'parseinline' )
717 global $wgParser, $wgMaxSigChars;
718 if( mb_strlen( $this->mNick
) > $wgMaxSigChars ) {
719 $invalidSig = $this->tableRow(
721 Xml
::element( 'span', array( 'class' => 'error' ),
722 wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) )
724 } elseif( !empty( $this->mToggles
['fancysig'] ) &&
725 false === $wgParser->validateSig( $this->mNick
) ) {
726 $invalidSig = $this->tableRow(
728 Xml
::element( 'span', array( 'class' => 'error' ), wfMsg( 'badsig' ) )
736 Xml
::label( wfMsg( 'yournick' ), 'wpNick' ),
737 Xml
::input( 'wpNick', 25, $this->mNick
,
740 // Note: $wgMaxSigChars is enforced in Unicode characters,
741 // both on the backend and now in the browser.
742 // Badly-behaved requests may still try to submit
743 // an overlong string, however.
744 'maxlength' => $wgMaxSigChars ) )
747 $this->tableRow( ' ', $this->getToggle( 'fancysig' ) )
750 $gender = new XMLSelect( 'wpGender', 'wpGender', $this->mGender
);
751 $gender->addOption( wfMsg( 'gender-unknown' ), 'unknown' );
752 $gender->addOption( wfMsg( 'gender-male' ), 'male' );
753 $gender->addOption( wfMsg( 'gender-female' ), 'female' );
757 Xml
::label( wfMsg( 'yourgender' ), 'wpGender' ),
759 Xml
::tags( 'div', array( 'class' => 'prefsectiontip' ),
760 wfMsgExt( 'prefs-help-gender', 'parseinline' )
765 list( $lsLabel, $lsSelect) = Xml
::languageSelector( $this->mUserLanguage
, false );
767 $this->tableRow( $lsLabel, $lsSelect )
770 /* see if there are multiple language variants to choose from*/
771 if(!$wgDisableLangConversion) {
772 $variants = $wgContLang->getVariants();
773 $variantArray = array();
775 $languages = Language
::getLanguageNames( true );
776 foreach($variants as $v) {
777 $v = str_replace( '_', '-', strtolower($v));
778 if( array_key_exists( $v, $languages ) ) {
779 // If it doesn't have a name, we'll pretend it doesn't exist
780 $variantArray[$v] = $languages[$v];
785 foreach( $variantArray as $code => $name ) {
786 $selected = ($code == $this->mUserVariant
);
787 $options .= Xml
::option( "$code - $name", $code, $selected ) . "\n";
790 if(count($variantArray) > 1) {
793 Xml
::label( wfMsg( 'yourvariant' ), 'wpUserVariant' ),
795 array( 'name' => 'wpUserVariant', 'id' => 'wpUserVariant' ),
802 if(count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) {
804 Xml
::tags( 'tr', null,
805 Xml
::tags( 'td', array( 'colspan' => '2' ),
806 $this->getToggle( "noconvertlink" )
814 if( $wgAuth->allowPasswordChange() ) {
815 $link = $wgUser->getSkin()->link( SpecialPage
::getTitleFor( 'ResetPass' ), wfMsgHtml( 'prefs-resetpass' ),
816 array() , array('returnto' => SpecialPage
::getTitleFor( 'Preferences') ) );
818 $this->tableRow( Xml
::element( 'h2', null, wfMsg( 'changepassword' ) ) ) .
819 $this->tableRow( '<ul><li>' . $link . '</li></ul>' ) );
824 if ( $wgEnableEmail ) {
827 if ($wgEnableUserEmail) {
828 // fixme -- the "allowemail" pseudotoggle is a hacked-together
829 // inversion for the "disableemail" preference.
830 $emf = wfMsg( 'allowemail' );
831 $disabled = $disableEmailPrefs ?
' disabled="disabled"' : '';
833 "<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>" .
834 $this->getToggle( 'ccmeonemails', '', $disableEmailPrefs );
839 $this->tableRow( Xml
::element( 'h2', null, wfMsg( 'email' ) ) ) .
843 $enotifwatchlistpages.
844 $enotifusertalkpages.
853 Xml
::closeElement( 'table' ) .
854 Xml
::closeElement( 'fieldset' )
860 if ($this->mSkin
== 'cologneblue' ||
$this->mSkin
== 'standard') {
861 $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'qbsettings' ) . "</legend>\n" );
862 for ( $i = 0; $i < count( $qbs ); ++
$i ) {
863 if ( $i == $this->mQuickbar
) { $checked = ' checked="checked"'; }
864 else { $checked = ""; }
865 $wgOut->addHTML( "<div><label><input type='radio' name='wpQuickbar' value=\"$i\"$checked />{$qbs[$i]}</label></div>\n" );
867 $wgOut->addHTML( "</fieldset>\n\n" );
869 # Need to output a hidden option even if the relevant skin is not in use,
870 # otherwise the preference will get reset to 0 on submit
871 $wgOut->addHTML( Xml
::hidden( 'wpQuickbar', $this->mQuickbar
) );
876 global $wgAllowUserSkin;
877 if( $wgAllowUserSkin ) {
878 $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg( 'skin' ) . "</legend>\n" );
879 $mptitle = Title
::newMainPage();
880 $previewtext = wfMsg( 'skin-preview' );
881 # Only show members of Skin::getSkinNames() rather than
882 # $skinNames (skins is all skin names from Language.php)
883 $validSkinNames = Skin
::getUsableSkins();
884 # Sort by UI skin name. First though need to update validSkinNames as sometimes
885 # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
886 foreach ( $validSkinNames as $skinkey => &$skinname ) {
887 $msgName = "skinname-{$skinkey}";
888 $localisedSkinName = wfMsg( $msgName );
889 if ( !wfEmptyMsg( $msgName, $localisedSkinName ) ) {
890 $skinname = $localisedSkinName;
893 asort($validSkinNames);
894 foreach( $validSkinNames as $skinkey => $sn ) {
895 $checked = $skinkey == $this->mSkin ?
' checked="checked"' : '';
896 $mplink = htmlspecialchars( $mptitle->getLocalURL( "useskin=$skinkey" ) );
897 $previewlink = "(<a target='_blank' href=\"$mplink\">$previewtext</a>)";
899 global $wgAllowUserCss, $wgAllowUserJs;
900 if( $wgAllowUserCss ) {
901 $cssPage = Title
::makeTitleSafe( NS_USER
, $wgUser->getName().'/'.$skinkey.'.css' );
902 $customCSS = $sk->makeLinkObj( $cssPage, wfMsgExt('prefs-custom-css', array() ) );
903 $extraLinks .= " ($customCSS)";
905 if( $wgAllowUserJs ) {
906 $jsPage = Title
::makeTitleSafe( NS_USER
, $wgUser->getName().'/'.$skinkey.'.js' );
907 $customJS = $sk->makeLinkObj( $jsPage, wfMsgHtml('prefs-custom-js') );
908 $extraLinks .= " ($customJS)";
910 if( $skinkey == $wgDefaultSkin )
911 $sn .= ' (' . wfMsg( 'default' ) . ')';
912 $wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked />
913 <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink{$extraLinks}<br />\n" );
915 $wgOut->addHTML( "</fieldset>\n\n" );
922 $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
923 foreach ( $mathopts as $k => $v ) {
924 $checked = ($k == $this->mMath
);
926 Xml
::openElement( 'div' ) .
927 Xml
::radioLabel( wfMsg( $v ), 'wpMath', $k, "mw-sp-math-$k", $checked ) .
928 Xml
::closeElement( 'div' ) . "\n"
931 $wgOut->addHTML( "</fieldset>\n\n" );
936 $imageLimitOptions = null;
937 foreach ( $wgImageLimits as $index => $limits ) {
938 $selected = ($index == $this->mImageSize
);
939 $imageLimitOptions .= Xml
::option( "{$limits[0]}×{$limits[1]}" .
940 wfMsg('unit-pixel'), $index, $selected );
943 $imageThumbOptions = null;
944 foreach ( $wgThumbLimits as $index => $size ) {
945 $selected = ($index == $this->mThumbSize
);
946 $imageThumbOptions .= Xml
::option($size . wfMsg('unit-pixel'), $index,
950 $imageSizeId = 'wpImageSize';
951 $thumbSizeId = 'wpThumbSize';
953 Xml
::fieldset( wfMsg( 'files' ) ) . "\n" .
954 Xml
::openElement( 'table' ) .
956 <td class="mw-label">' .
957 Xml
::label( wfMsg( 'imagemaxsize' ), $imageSizeId ) .
959 <td class="mw-input">' .
960 Xml
::openElement( 'select', array( 'name' => $imageSizeId, 'id' => $imageSizeId ) ) .
962 Xml
::closeElement( 'select' ) .
965 <td class="mw-label">' .
966 Xml
::label( wfMsg( 'thumbsize' ), $thumbSizeId ) .
968 <td class="mw-input">' .
969 Xml
::openElement( 'select', array( 'name' => $thumbSizeId, 'id' => $thumbSizeId ) ) .
971 Xml
::closeElement( 'select' ) .
974 Xml
::closeElement( 'table' ) .
975 Xml
::closeElement( 'fieldset' )
984 Xml
::openElement( 'fieldset' ) .
985 Xml
::element( 'legend', null, wfMsg( 'datetime' ) ) . "\n"
990 Xml
::openElement( 'fieldset' ) .
991 Xml
::element( 'legend', null, wfMsg( 'dateformat' ) ) . "\n"
994 $epoch = '20010115161234'; # Wikipedia day
995 foreach( $dateopts as $key ) {
996 if( $key == 'default' ) {
997 $formatted = wfMsg( 'datedefault' );
999 $formatted = $wgLang->timeanddate( $epoch, false, $key );
1002 Xml
::tags( 'div', null,
1003 Xml
::radioLabel( $formatted, 'wpDate', $key, "wpDate$idCnt", $key == $this->mDate
)
1008 $wgOut->addHTML( Xml
::closeElement( 'fieldset' ) . "\n" );
1011 $nowlocal = Xml
::openElement( 'span', array( 'id' => 'wpLocalTime' ) ) .
1012 $wgLang->time( $now = wfTimestampNow(), true ) .
1013 Xml
::closeElement( 'span' );
1014 $nowserver = $wgLang->time( $now, false ) .
1015 Xml
::hidden( 'wpServerTime', substr( $now, 8, 2 ) * 60 +
substr( $now, 10, 2 ) );
1018 Xml
::openElement( 'fieldset' ) .
1019 Xml
::element( 'legend', null, wfMsg( 'timezonelegend' ) ) .
1020 Xml
::openElement( 'table' ) .
1021 $this->addRow( wfMsg( 'servertime' ), $nowserver ) .
1022 $this->addRow( wfMsg( 'localtime' ), $nowlocal )
1024 $opt = Xml
::openElement( 'select', array(
1025 'name' => 'wpTimeZone',
1026 'id' => 'wpTimeZone',
1027 'onchange' => 'javascript:updateTimezoneSelection(false)' ) );
1028 $opt .= Xml
::option( wfMsg( 'timezoneuseserverdefault' ), "System|$wgLocalTZoffset", $this->mTimeZone
=== "System|$wgLocalTZoffset" );
1029 $opt .= Xml
::option( wfMsg( 'timezoneuseoffset' ), 'Offset', $this->mTimeZone
=== 'Offset' );
1031 if ( function_exists( 'timezone_identifiers_list' ) ) {
1032 # Read timezone list
1033 $tzs = timezone_identifiers_list();
1036 # Precache localized region names
1037 $tzRegions = array();
1038 $tzRegions['Africa'] = wfMsg( 'timezoneregion-africa' );
1039 $tzRegions['America'] = wfMsg( 'timezoneregion-america' );
1040 $tzRegions['Antarctica'] = wfMsg( 'timezoneregion-antarctica' );
1041 $tzRegions['Arctic'] = wfMsg( 'timezoneregion-arctic' );
1042 $tzRegions['Asia'] = wfMsg( 'timezoneregion-asia' );
1043 $tzRegions['Atlantic'] = wfMsg( 'timezoneregion-atlantic' );
1044 $tzRegions['Australia'] = wfMsg( 'timezoneregion-australia' );
1045 $tzRegions['Europe'] = wfMsg( 'timezoneregion-europe' );
1046 $tzRegions['Indian'] = wfMsg( 'timezoneregion-indian' );
1047 $tzRegions['Pacific'] = wfMsg( 'timezoneregion-pacific' );
1048 asort( $tzRegions );
1050 $selZone = explode( '|', $this->mTimeZone
, 3 );
1051 $selZone = ( $selZone[0] == 'ZoneInfo' ) ?
$selZone[2] : null;
1052 $now = date_create( 'now' );
1055 foreach ( $tzs as $tz ) {
1056 $z = explode( '/', $tz, 2 );
1058 # timezone_identifiers_list() returns a number of
1059 # backwards-compatibility entries. This filters them out of the
1060 # list presented to the user.
1061 if ( count( $z ) != 2 ||
!array_key_exists( $z[0], $tzRegions ) )
1065 $z[0] = $tzRegions[$z[0]];
1067 # Create region groups
1068 if ( $optgroup != $z[0] ) {
1069 if ( $optgroup !== '' ) {
1070 $opt .= Xml
::closeElement( 'optgroup' );
1073 $opt .= Xml
::openElement( 'optgroup', array( 'label' => $z[0] ) ) . "\n";
1076 $minDiff = floor( timezone_offset_get( timezone_open( $tz ), $now ) / 60 );
1077 $opt .= Xml
::option( str_replace( '_', ' ', $z[0] . '/' . $z[1] ), "ZoneInfo|$minDiff|$tz", $selZone === $tz, array( 'label' => $z[1] ) ) . "\n";
1079 if ( $optgroup !== '' ) $opt .= Xml
::closeElement( 'optgroup' );
1081 $opt .= Xml
::closeElement( 'select' );
1084 Xml
::label( wfMsg( 'timezoneselect' ), 'wpTimeZone' ),
1089 Xml
::label( wfMsg( 'timezoneoffset' ), 'wpHourDiff' ),
1090 Xml
::input( 'wpHourDiff', 6, $this->mHourDiff
, array(
1091 'id' => 'wpHourDiff',
1092 'onfocus' => 'javascript:updateTimezoneSelection(true)',
1093 'onblur' => 'javascript:updateTimezoneSelection(false)' ) ) ) .
1096 <td class='mw-submit'>" .
1097 Xml
::element( 'input',
1098 array( 'type' => 'button',
1099 'value' => wfMsg( 'guesstimezone' ),
1100 'onclick' => 'javascript:guessTimezone()',
1101 'id' => 'guesstimezonebutton',
1102 'style' => 'display:none;' ) ) .
1105 Xml
::closeElement( 'table' ) .
1106 Xml
::tags( 'div', array( 'class' => 'prefsectiontip' ), wfMsgExt( 'timezonetext', 'parseinline' ) ).
1107 Xml
::closeElement( 'fieldset' ) .
1108 Xml
::closeElement( 'fieldset' ) . "\n\n"
1113 global $wgLivePreview;
1115 Xml
::fieldset( wfMsg( 'textboxsize' ) ) .
1116 wfMsgHTML( 'prefs-edit-boxsize' ) . ' ' .
1117 Xml
::inputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows
) . ' ' .
1118 Xml
::inputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols
) .
1119 $this->getToggles( array(
1121 'editsectiononrightclick',
1130 $wgLivePreview ?
'uselivepreview' : false,
1135 $wgOut->addHTML( Xml
::closeElement( 'fieldset' ) );
1138 global $wgRCMaxAge, $wgUseRCPatrol;
1140 Xml
::fieldset( wfMsg( 'prefs-rc' ) ) .
1141 Xml
::openElement( 'table' ) .
1143 <td class="mw-label">' .
1144 Xml
::label( wfMsg( 'recentchangesdays' ), 'wpRecentDays' ) .
1146 <td class="mw-input">' .
1147 Xml
::input( 'wpRecentDays', 3, $this->mRecentDays
, array( 'id' => 'wpRecentDays' ) ) . ' ' .
1148 wfMsgExt( 'recentchangesdays-max', 'parsemag',
1149 $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) ) ) .
1152 <td class="mw-label">' .
1153 Xml
::label( wfMsg( 'recentchangescount' ), 'wpRecent' ) .
1155 <td class="mw-input">' .
1156 Xml
::input( 'wpRecent', 3, $this->mRecent
, array( 'id' => 'wpRecent' ) ) .
1159 Xml
::closeElement( 'table' ) .
1163 $toggles[] = 'hideminor';
1164 if( $wgUseRCPatrol ) {
1165 $toggles[] = 'hidepatrolled';
1166 $toggles[] = 'newpageshidepatrolled';
1168 if( $wgRCShowWatchingUsers ) $toggles[] = 'shownumberswatching';
1169 $toggles[] = 'usenewrc';
1172 $this->getToggles( $toggles ) .
1173 Xml
::closeElement( 'fieldset' )
1177 $watchlistToggles = array( 'watchlisthideminor', 'watchlisthidebots', 'watchlisthideown',
1178 'watchlisthideanons', 'watchlisthideliu' );
1179 if( $wgUseRCPatrol ) $watchlistToggles[] = 'watchlisthidepatrolled';
1182 Xml
::fieldset( wfMsg( 'prefs-watchlist' ) ) .
1183 Xml
::inputLabel( wfMsg( 'prefs-watchlist-days' ), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays
) . ' ' .
1184 wfMsgHTML( 'prefs-watchlist-days-max' ) .
1186 $this->getToggle( 'extendwatchlist' ) .
1187 Xml
::inputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits
) . ' ' .
1188 wfMsgHTML( 'prefs-watchlist-edits-max' ) .
1190 $this->getToggles( $watchlistToggles )
1193 if( $wgUser->isAllowed( 'createpage' ) ||
$wgUser->isAllowed( 'createtalk' ) ) {
1194 $wgOut->addHTML( $this->getToggle( 'watchcreations' ) );
1197 foreach( array( 'edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion' ) as $action => $toggle ) {
1198 if( $wgUser->isAllowed( $action ) )
1199 $wgOut->addHTML( $this->getToggle( $toggle ) );
1201 $this->mUsedToggles
['watchcreations'] = true;
1202 $this->mUsedToggles
['watchdefault'] = true;
1203 $this->mUsedToggles
['watchmoves'] = true;
1204 $this->mUsedToggles
['watchdeletion'] = true;
1206 $wgOut->addHTML( Xml
::closeElement( 'fieldset' ) );
1209 $mwsuggest = $wgEnableMWSuggest ?
1211 Xml
::label( wfMsg( 'mwsuggest-disable' ), 'wpDisableMWSuggest' ),
1212 Xml
::check( 'wpDisableMWSuggest', $this->mDisableMWSuggest
, array( 'id' => 'wpDisableMWSuggest' ) )
1215 // Elements for the search tab itself
1216 Xml
::openElement( 'fieldset' ) .
1217 Xml
::element( 'legend', null, wfMsg( 'searchresultshead' ) ) .
1218 // Elements for the search options in the search tab
1219 Xml
::openElement( 'fieldset' ) .
1220 Xml
::element( 'legend', null, wfMsg( 'prefs-searchoptions' ) ) .
1221 Xml
::openElement( 'table' ) .
1223 Xml
::label( wfMsg( 'resultsperpage' ), 'wpSearch' ),
1224 Xml
::input( 'wpSearch', 4, $this->mSearch
, array( 'id' => 'wpSearch' ) )
1227 Xml
::label( wfMsg( 'contextlines' ), 'wpSearchLines' ),
1228 Xml
::input( 'wpSearchLines', 4, $this->mSearchLines
, array( 'id' => 'wpSearchLines' ) )
1231 Xml
::label( wfMsg( 'contextchars' ), 'wpSearchChars' ),
1232 Xml
::input( 'wpSearchChars', 4, $this->mSearchChars
, array( 'id' => 'wpSearchChars' ) )
1235 Xml
::closeElement( 'table' ) .
1236 Xml
::closeElement( 'fieldset' ) .
1237 // Elements for the namespace options in the search tab
1238 Xml
::openElement( 'fieldset' ) .
1239 Xml
::element( 'legend', null, wfMsg( 'prefs-namespaces' ) ) .
1240 wfMsgExt( 'defaultns', array( 'parse' ) ) .
1242 Xml
::closeElement( 'fieldset' ) .
1243 // End of the search tab
1244 Xml
::closeElement( 'fieldset' )
1249 $uopt = $wgUser->getOption( 'underline' );
1251 Xml
::fieldset( wfMsg( 'prefs-misc' ) ) .
1252 Xml
::openElement( 'table' ) .
1254 <td class="mw-label">' .
1255 // Xml::label() cannot be used because 'stub-threshold' contains plain HTML
1256 Xml
::tags( 'label', array( 'for' => 'wpStubs' ), wfMsg( 'stub-threshold' ) ) .
1258 <td class="mw-input">' .
1259 Xml
::input( 'wpStubs', 6, $this->mStubs
, array( 'id' => 'wpStubs' ) ) .
1262 <td class="mw-label">' .
1263 Xml
::label( wfMsg( 'tog-underline' ), 'wpOpunderline' ) .
1265 <td class="mw-input">' .
1266 Xml
::openElement( 'select', array( 'id' => 'wpOpunderline', 'name' => 'wpOpunderline' ) ) .
1267 Xml
::option( wfMsg ( 'underline-never' ), '0', $uopt == 0 ) .
1268 Xml
::option( wfMsg ( 'underline-always' ), '1', $uopt == 1 ) .
1269 Xml
::option( wfMsg ( 'underline-default' ), '2', $uopt == 2 ) .
1270 Xml
::closeElement( 'select' ) .
1273 Xml
::closeElement( 'table' )
1276 # And now the rest = Misc.
1277 foreach ( $togs as $tname ) {
1278 if( !array_key_exists( $tname, $this->mUsedToggles
) ) {
1279 if( $tname == 'norollbackdiff' && $wgUser->isAllowed( 'rollback' ) )
1280 $wgOut->addHTML( $this->getToggle( $tname ) );
1282 $wgOut->addHTML( $this->getToggle( $tname ) );
1286 $wgOut->addHTML( '</fieldset>' );
1288 wfRunHooks( 'RenderPreferencesForm', array( $this, $wgOut ) );
1290 $token = htmlspecialchars( $wgUser->editToken() );
1291 $skin = $wgUser->getSkin();
1292 $rtl = $wgContLang->isRTL() ?
'left' : 'right';
1294 <table id='prefsubmit' cellpadding='0' width='100%' style='background:none;'><tr>
1295 <td><input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) .
1296 '"'.$skin->tooltipAndAccesskey('save')." />
1297 <input type='submit' name='wpReset' value=\"" . wfMsgHtml( 'resetprefs' ) . "\" /></td>
1298 <td align='$rtl'><input type='submit' name='wpRestore' value=\"" . wfMsgHtml( 'restoreprefs' ) . "\" /></td>
1301 <input type='hidden' name='wpEditToken' value=\"{$token}\" />
1304 $wgOut->addHTML( Xml
::tags( 'div', array( 'class' => "prefcache" ),
1305 wfMsgExt( 'clearyourcache', 'parseinline' ) )