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;
109 if ( $wgUser->isAnon() ) {
110 $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext',
111 array( SpecialPage
::getTitleFor( 'Preferences' )->getPrefixedDBkey() ) );
114 if ( wfReadOnly() ) {
115 $wgOut->readOnlyPage();
118 if ( $this->mReset
) {
120 $this->mainPrefsForm( 'reset', wfMsg( 'prefsreset' ) );
121 } else if ( $this->mSaveprefs
) {
122 $this->savePreferences();
123 } else if ( $this->mRestoreprefs
) {
124 $this->restorePreferences();
127 $this->mainPrefsForm( '' );
133 function validateInt( &$val, $min=0, $max=0x7fffffff ) {
135 $val = min($val, $max);
136 $val = max($val, $min);
143 function validateFloat( &$val, $min, $max=0x7fffffff ) {
144 $val = floatval( $val );
145 $val = min( $val, $max );
146 $val = max( $val, $min );
153 function validateIntOrNull( &$val, $min=0, $max=0x7fffffff ) {
158 return $this->validateInt( $val, $min, $max );
165 function validateDate( $val ) {
166 global $wgLang, $wgContLang;
167 if ( $val !== false && (
168 in_array( $val, (array)$wgLang->getDatePreferences() ) ||
169 in_array( $val, (array)$wgContLang->getDatePreferences() ) ) )
173 return $wgLang->getDefaultDateFormat();
178 * Used to validate the user inputed timezone before saving it as
179 * 'timecorrection', will return 'System' if fed bogus data.
181 * @param string $tz the user input Zoneinfo timezone
182 * @param string $s the user input offset string
185 function validateTimeZone( $tz, $s ) {
186 $data = explode( '|', $tz, 3 );
187 switch ( $data[0] ) {
193 $data = explode( ':', $s, 2 );
195 if( count( $data ) == 2 ) {
196 $data[0] = intval( $data[0] );
197 $data[1] = intval( $data[1] );
198 $minDiff = abs( $data[0] ) * 60 +
$data[1];
199 if ( $data[0] < 0 ) $minDiff = -$minDiff;
201 $minDiff = intval( $data[0] ) * 60;
204 # Max is +14:00 and min is -12:00, see:
205 # http://en.wikipedia.org/wiki/Timezone
206 $minDiff = min( $minDiff, 840 ); # 14:00
207 $minDiff = max( $minDiff, -720 ); # -12:00
208 return 'Offset|'.$minDiff;
212 function validateGender( $val ) {
213 $valid = array( 'male', 'female', 'unknown' );
214 if ( in_array($val, $valid) ) {
217 return User
::getDefaultOption( 'gender' );
224 function savePreferences() {
225 global $wgUser, $wgOut, $wgParser;
226 global $wgEnableUserEmail, $wgEnableEmail;
227 global $wgEmailAuthentication, $wgRCMaxAge;
228 global $wgAuth, $wgEmailConfirmToEdit;
230 $wgUser->setRealName( $this->mRealName
);
231 $oldOptions = $wgUser->mOptions
;
233 if( $wgUser->getOption( 'language' ) !== $this->mUserLanguage
) {
234 $needRedirect = true;
236 $needRedirect = false;
239 # Validate the signature and clean it up as needed
240 global $wgMaxSigChars;
241 if( mb_strlen( $this->mNick
) > $wgMaxSigChars ) {
243 $this->mainPrefsForm( 'error',
244 wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) );
246 } elseif( $this->mToggles
['fancysig'] ) {
247 if( $wgParser->validateSig( $this->mNick
) !== false ) {
248 $this->mNick
= $wgParser->cleanSig( $this->mNick
);
250 $this->mainPrefsForm( 'error', wfMsg( 'badsig' ) );
254 // When no fancy sig used, make sure ~{3,5} get removed.
255 $this->mNick
= $wgParser->cleanSigInSig( $this->mNick
);
258 $wgUser->setOption( 'language', $this->mUserLanguage
);
259 $wgUser->setOption( 'variant', $this->mUserVariant
);
260 $wgUser->setOption( 'nickname', $this->mNick
);
261 $wgUser->setOption( 'quickbar', $this->mQuickbar
);
262 global $wgAllowUserSkin;
263 if( $wgAllowUserSkin ) {
264 $wgUser->setOption( 'skin', $this->mSkin
);
268 $wgUser->setOption( 'math', $this->mMath
);
270 $wgUser->setOption( 'date', $this->validateDate( $this->mDate
) );
271 $wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch
) );
272 $wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines
) );
273 $wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars
) );
274 $wgUser->setOption( 'rclimit', $this->validateIntOrNull( $this->mRecent
) );
275 $wgUser->setOption( 'rcdays', $this->validateInt($this->mRecentDays
, 1, ceil($wgRCMaxAge / (3600*24))));
276 $wgUser->setOption( 'wllimit', $this->validateIntOrNull( $this->mWatchlistEdits
, 0, 1000 ) );
277 $wgUser->setOption( 'rows', $this->validateInt( $this->mRows
, 4, 1000 ) );
278 $wgUser->setOption( 'cols', $this->validateInt( $this->mCols
, 4, 1000 ) );
279 $wgUser->setOption( 'stubthreshold', $this->validateIntOrNull( $this->mStubs
) );
280 $wgUser->setOption( 'timecorrection', $this->validateTimeZone( $this->mTimeZone
, $this->mHourDiff
) );
281 $wgUser->setOption( 'imagesize', $this->mImageSize
);
282 $wgUser->setOption( 'thumbsize', $this->mThumbSize
);
283 $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline
, 0, 2) );
284 $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays
, 0, 7 ) );
285 $wgUser->setOption( 'disablesuggest', $this->mDisableMWSuggest
);
286 $wgUser->setOption( 'gender', $this->validateGender( $this->mGender
) );
288 # Set search namespace options
289 foreach( $this->mSearchNs
as $i => $value ) {
290 $wgUser->setOption( "searchNs{$i}", $value );
293 if( $wgEnableEmail && $wgEnableUserEmail ) {
294 $wgUser->setOption( 'disablemail', $this->mEmailFlag
);
298 foreach ( $this->mToggles
as $tname => $tvalue ) {
299 $wgUser->setOption( $tname, $tvalue );
303 if( $wgEnableEmail ) {
304 $newadr = $this->mUserEmail
;
305 $oldadr = $wgUser->getEmail();
306 if( ($newadr != '') && ($newadr != $oldadr) ) {
307 # the user has supplied a new email address on the login page
308 if( $wgUser->isValidEmailAddr( $newadr ) ) {
309 # new behaviour: set this new emailaddr from login-page into user database record
310 $wgUser->setEmail( $newadr );
311 # but flag as "dirty" = unauthenticated
312 $wgUser->invalidateEmail();
313 if ($wgEmailAuthentication) {
314 # Mail a temporary password to the dirty address.
315 # User can come back through the confirmation URL to re-enable email.
316 $result = $wgUser->sendConfirmationMail();
317 if( WikiError
::isError( $result ) ) {
318 $error = wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
320 $error = wfMsg( 'eauthentsent', $wgUser->getName() );
324 $error = wfMsg( 'invalidemailaddress' );
327 if( $wgEmailConfirmToEdit && empty( $newadr ) ) {
328 $this->mainPrefsForm( 'error', wfMsg( 'noemailtitle' ) );
331 $wgUser->setEmail( $this->mUserEmail
);
333 if( $oldadr != $newadr ) {
334 wfRunHooks( 'PrefsEmailAudit', array( $wgUser, $oldadr, $newadr ) );
338 if( !$wgAuth->updateExternalDB( $wgUser ) ){
339 $this->mainPrefsForm( 'error', wfMsg( 'externaldberror' ) );
344 if ( !wfRunHooks( 'SavePreferences', array( $this, $wgUser, &$msg, $oldOptions ) ) ) {
345 $this->mainPrefsForm( 'error', $msg );
349 $wgUser->setCookies();
350 $wgUser->saveSettings();
352 if( $needRedirect && $error === false ) {
353 $title = SpecialPage
::getTitleFor( 'Preferences' );
354 $wgOut->redirect( $title->getFullURL( 'success' ) );
358 $wgOut->parserOptions( ParserOptions
::newFromUser( $wgUser ) );
359 $this->mainPrefsForm( $error === false ?
'success' : 'error', $error);
365 function resetPrefs() {
366 global $wgUser, $wgLang, $wgContLang, $wgContLanguageCode, $wgAllowRealName, $wgLocalTZoffset;
368 $this->mUserEmail
= $wgUser->getEmail();
369 $this->mUserEmailAuthenticationtimestamp
= $wgUser->getEmailAuthenticationtimestamp();
370 $this->mRealName
= ($wgAllowRealName) ?
$wgUser->getRealName() : '';
372 # language value might be blank, default to content language
373 $this->mUserLanguage
= $wgUser->getOption( 'language', $wgContLanguageCode );
375 $this->mUserVariant
= $wgUser->getOption( 'variant');
376 $this->mEmailFlag
= $wgUser->getOption( 'disablemail' ) == 1 ?
1 : 0;
377 $this->mNick
= $wgUser->getOption( 'nickname' );
379 $this->mQuickbar
= $wgUser->getOption( 'quickbar' );
380 $this->mSkin
= Skin
::normalizeKey( $wgUser->getOption( 'skin' ) );
381 $this->mMath
= $wgUser->getOption( 'math' );
382 $this->mDate
= $wgUser->getDatePreference();
383 $this->mRows
= $wgUser->getOption( 'rows' );
384 $this->mCols
= $wgUser->getOption( 'cols' );
385 $this->mStubs
= $wgUser->getOption( 'stubthreshold' );
387 $tz = $wgUser->getOption( 'timecorrection' );
388 $data = explode( '|', $tz, 3 );
390 switch ( $data[0] ) {
392 $this->mTimeZone
= $tz;
393 # Check if the specified TZ exists, and change to 'Offset' if
395 if ( !function_exists('timezone_open') || @timezone_open
( $data[2] ) === false ) {
396 $this->mTimeZone
= 'Offset';
397 $minDiff = intval( $data[1] );
402 $this->mTimeZone
= 'System|'.$wgLocalTZoffset;
405 $this->mTimeZone
= 'Offset';
406 $minDiff = intval( $data[1] );
409 $this->mTimeZone
= 'Offset';
410 $data = explode( ':', $tz, 2 );
411 if( count( $data ) == 2 ) {
412 $data[0] = intval( $data[0] );
413 $data[1] = intval( $data[1] );
414 $minDiff = abs( $data[0] ) * 60 +
$data[1];
415 if ( $data[0] < 0 ) $minDiff = -$minDiff;
417 $minDiff = intval( $data[0] ) * 60;
421 if ( is_null( $minDiff ) ) {
422 $this->mHourDiff
= '';
424 $this->mHourDiff
= sprintf( '%+03d:%02d', floor($minDiff/60), abs($minDiff)%60
);
427 $this->mSearch
= $wgUser->getOption( 'searchlimit' );
428 $this->mSearchLines
= $wgUser->getOption( 'contextlines' );
429 $this->mSearchChars
= $wgUser->getOption( 'contextchars' );
430 $this->mImageSize
= $wgUser->getOption( 'imagesize' );
431 $this->mThumbSize
= $wgUser->getOption( 'thumbsize' );
432 $this->mRecent
= $wgUser->getOption( 'rclimit' );
433 $this->mRecentDays
= $wgUser->getOption( 'rcdays' );
434 $this->mWatchlistEdits
= $wgUser->getOption( 'wllimit' );
435 $this->mUnderline
= $wgUser->getOption( 'underline' );
436 $this->mWatchlistDays
= $wgUser->getOption( 'watchlistdays' );
437 $this->mDisableMWSuggest
= $wgUser->getBoolOption( 'disablesuggest' );
438 $this->mGender
= $wgUser->getOption( 'gender' );
440 $togs = User
::getToggles();
441 foreach ( $togs as $tname ) {
442 $this->mToggles
[$tname] = $wgUser->getOption( $tname );
445 $namespaces = $wgContLang->getNamespaces();
446 foreach ( $namespaces as $i => $namespace ) {
447 if ( $i >= NS_MAIN
) {
448 $this->mSearchNs
[$i] = $wgUser->getOption( 'searchNs'.$i );
452 wfRunHooks( 'ResetPreferences', array( $this, $wgUser ) );
458 function restorePreferences() {
459 global $wgUser, $wgOut;
460 $wgUser->restoreOptions();
461 $wgUser->setCookies();
462 $wgUser->saveSettings();
463 $title = SpecialPage
::getTitleFor( 'Preferences' );
464 $wgOut->redirect( $title->getFullURL( 'success' ) );
470 function namespacesCheckboxes() {
473 # Determine namespace checkboxes
474 $namespaces = $wgContLang->getNamespaces();
477 foreach ( $namespaces as $i => $name ) {
480 $checked = $this->mSearchNs
[$i] ?
"checked='checked'" : '';
481 $name = str_replace( '_', ' ', $namespaces[$i] );
484 $name = wfMsg( 'blanknamespace' );
486 $r1 .= "<input type='checkbox' value='1' name='wpNs$i' id='wpNs$i' {$checked}/> <label for='wpNs$i'>{$name}</label><br />\n";
492 function getToggle( $tname, $trailer = false, $disabled = false ) {
493 global $wgUser, $wgLang;
495 $this->mUsedToggles
[$tname] = true;
496 $ttext = $wgLang->getUserToggle( $tname );
498 $checked = $wgUser->getOption( $tname ) == 1 ?
' checked="checked"' : '';
499 $disabled = $disabled ?
' disabled="disabled"' : '';
500 $trailer = $trailer ?
$trailer : '';
501 return "<div class='toggle'><input type='checkbox' value='1' id=\"$tname\" name=\"wpOp$tname\"$checked$disabled />" .
502 " <span class='toggletext'><label for=\"$tname\">$ttext</label>$trailer</span></div>\n";
505 function getToggles( $items ) {
507 foreach( $items as $item ) {
508 if( $item === false )
510 if( is_array( $item ) ) {
511 list( $key, $trailer ) = $item;
516 $out .= $this->getToggle( $key, $trailer );
521 function addRow($td1, $td2) {
522 return "<tr><td class='mw-label'>$td1</td><td class='mw-input'>$td2</td></tr>";
526 * Helper function for user information panel
527 * @param $td1 label for an item
528 * @param $td2 item or null
529 * @param $td3 optional help or null
530 * @return xhtml block
532 function tableRow( $td1, $td2 = null, $td3 = null ) {
534 if ( is_null( $td3 ) ) {
537 $td3 = Xml
::tags( 'tr', null,
538 Xml
::tags( 'td', array( 'class' => 'pref-label', 'colspan' => '2' ), $td3 )
542 if ( is_null( $td2 ) ) {
543 $td1 = Xml
::tags( 'td', array( 'class' => 'pref-label', 'colspan' => '2' ), $td1 );
546 $td1 = Xml
::tags( 'td', array( 'class' => 'pref-label' ), $td1 );
547 $td2 = Xml
::tags( 'td', array( 'class' => 'pref-input' ), $td2 );
550 return Xml
::tags( 'tr', null, $td1 . $td2 ). $td3 . "\n";
557 function mainPrefsForm( $status , $message = '' ) {
558 global $wgUser, $wgOut, $wgLang, $wgContLang, $wgAuth;
559 global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
560 global $wgDisableLangConversion, $wgDisableTitleConversion;
561 global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
562 global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
563 global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
564 global $wgContLanguageCode, $wgDefaultSkin, $wgCookieExpiration;
565 global $wgEmailConfirmToEdit, $wgEnableMWSuggest, $wgLocalTZoffset;
567 $wgOut->setPageTitle( wfMsg( 'preferences' ) );
568 $wgOut->setArticleRelated( false );
569 $wgOut->setRobotPolicy( 'noindex,nofollow' );
570 $wgOut->addScriptFile( 'prefs.js' );
572 $wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc.
574 if ( $this->mSuccess ||
'success' == $status ) {
575 $wgOut->wrapWikiMsg( '<div class="successbox"><strong>$1</strong></div>', 'savedprefs' );
576 } else if ( 'error' == $status ) {
577 $wgOut->addWikiText( '<div class="errorbox"><strong>' . $message . '</strong></div>' );
578 } else if ( '' != $status ) {
579 $wgOut->addWikiText( $message . "\n----" );
582 $qbs = $wgLang->getQuickbarSettings();
583 $mathopts = $wgLang->getMathNames();
584 $dateopts = $wgLang->getDatePreferences();
585 $togs = User
::getToggles();
587 $titleObj = SpecialPage
::getTitleFor( 'Preferences' );
589 # Pre-expire some toggles so they won't show if disabled
590 $this->mUsedToggles
[ 'shownumberswatching' ] = true;
591 $this->mUsedToggles
[ 'showupdated' ] = true;
592 $this->mUsedToggles
[ 'enotifwatchlistpages' ] = true;
593 $this->mUsedToggles
[ 'enotifusertalkpages' ] = true;
594 $this->mUsedToggles
[ 'enotifminoredits' ] = true;
595 $this->mUsedToggles
[ 'enotifrevealaddr' ] = true;
596 $this->mUsedToggles
[ 'ccmeonemails' ] = true;
597 $this->mUsedToggles
[ 'uselivepreview' ] = true;
598 $this->mUsedToggles
[ 'noconvertlink' ] = true;
601 if ( !$this->mEmailFlag
) { $emfc = 'checked="checked"'; }
605 if ($wgEmailAuthentication && ($this->mUserEmail
!= '') ) {
606 if( $wgUser->getEmailAuthenticationTimestamp() ) {
607 // date and time are separate parameters to facilitate localisation.
608 // $time is kept for backward compat reasons.
609 // 'emailauthenticated' is also used in SpecialConfirmemail.php
610 $time = $wgLang->timeAndDate( $wgUser->getEmailAuthenticationTimestamp(), true );
611 $d = $wgLang->date( $wgUser->getEmailAuthenticationTimestamp(), true );
612 $t = $wgLang->time( $wgUser->getEmailAuthenticationTimestamp(), true );
613 $emailauthenticated = wfMsg('emailauthenticated', $time, $d, $t ).'<br />';
614 $disableEmailPrefs = false;
616 $disableEmailPrefs = true;
617 $skin = $wgUser->getSkin();
618 $emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
619 $skin->makeKnownLinkObj( SpecialPage
::getTitleFor( 'Confirmemail' ),
620 wfMsg( 'emailconfirmlink' ) ) . '<br />';
623 $emailauthenticated = '';
624 $disableEmailPrefs = false;
627 if ($this->mUserEmail
== '') {
628 $emailauthenticated = wfMsg( 'noemailprefs' ) . '<br />';
631 $ps = $this->namespacesCheckboxes();
633 $enotifwatchlistpages = ($wgEnotifWatchlist) ?
$this->getToggle( 'enotifwatchlistpages', false, $disableEmailPrefs ) : '';
634 $enotifusertalkpages = ($wgEnotifUserTalk) ?
$this->getToggle( 'enotifusertalkpages', false, $disableEmailPrefs ) : '';
635 $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ?
$this->getToggle( 'enotifminoredits', false, $disableEmailPrefs ) : '';
636 $enotifrevealaddr = (($wgEnotifWatchlist ||
$wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ?
$this->getToggle( 'enotifrevealaddr', false, $disableEmailPrefs ) : '';
641 Xml
::openElement( 'form', array(
642 'action' => $titleObj->getLocalUrl(),
644 'id' => 'mw-preferences-form',
646 Xml
::openElement( 'div', array( 'id' => 'preferences' ) )
652 Xml
::fieldset( wfMsg('prefs-personal') ) .
653 Xml
::openElement( 'table' ) .
654 $this->tableRow( Xml
::element( 'h2', null, wfMsg( 'prefs-personal' ) ) )
657 # Get groups to which the user belongs
658 $userEffectiveGroups = $wgUser->getEffectiveGroups();
659 $userEffectiveGroupsArray = array();
660 foreach( $userEffectiveGroups as $ueg ) {
662 // Skip the default * group, seems useless here
665 $userEffectiveGroupsArray[] = User
::makeGroupLinkHTML( $ueg );
667 asort( $userEffectiveGroupsArray );
669 $sk = $wgUser->getSkin();
670 $toolLinks = array();
671 $toolLinks[] = $sk->makeKnownLinkObj( SpecialPage
::getTitleFor( 'ListGroupRights' ), wfMsg( 'listgrouprights' ) );
672 # At the moment one tool link only but be prepared for the future...
673 # FIXME: Add a link to Special:Userrights for users who are allowed to use it.
674 # $wgUser->isAllowed( 'userrights' ) seems to strict in some cases
676 $userInformationHtml =
677 $this->tableRow( wfMsgHtml( 'username' ), htmlspecialchars( $wgUser->getName() ) ) .
678 $this->tableRow( wfMsgHtml( 'uid' ), htmlspecialchars( $wgUser->getId() ) ) .
681 wfMsgExt( 'prefs-memberingroups', array( 'parseinline' ), count( $userEffectiveGroupsArray ) ),
682 $wgLang->commaList( $userEffectiveGroupsArray ) .
683 '<br />(' . $wgLang->pipeList( $toolLinks ) . ')'
687 wfMsgHtml( 'prefs-edits' ),
688 $wgLang->formatNum( $wgUser->getEditCount() )
691 if( wfRunHooks( 'PreferencesUserInformationPanel', array( $this, &$userInformationHtml ) ) ) {
692 $wgOut->addHTML( $userInformationHtml );
695 if ( $wgAllowRealName ) {
698 Xml
::label( wfMsg('yourrealname'), 'wpRealName' ),
699 Xml
::input( 'wpRealName', 25, $this->mRealName
, array( 'id' => 'wpRealName' ) ),
700 Xml
::tags('div', array( 'class' => 'prefsectiontip' ),
701 wfMsgExt( 'prefs-help-realname', 'parseinline' )
706 if ( $wgEnableEmail ) {
709 Xml
::label( wfMsg('youremail'), 'wpUserEmail' ),
710 Xml
::input( 'wpUserEmail', 25, $this->mUserEmail
, array( 'id' => 'wpUserEmail' ) ),
711 Xml
::tags('div', array( 'class' => 'prefsectiontip' ),
712 wfMsgExt( $wgEmailConfirmToEdit ?
'prefs-help-email-required' : 'prefs-help-email', 'parseinline' )
718 global $wgParser, $wgMaxSigChars;
719 if( mb_strlen( $this->mNick
) > $wgMaxSigChars ) {
720 $invalidSig = $this->tableRow(
722 Xml
::element( 'span', array( 'class' => 'error' ),
723 wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) )
725 } elseif( !empty( $this->mToggles
['fancysig'] ) &&
726 false === $wgParser->validateSig( $this->mNick
) ) {
727 $invalidSig = $this->tableRow(
729 Xml
::element( 'span', array( 'class' => 'error' ), wfMsg( 'badsig' ) )
737 Xml
::label( wfMsg( 'yournick' ), 'wpNick' ),
738 Xml
::input( 'wpNick', 25, $this->mNick
,
741 // Note: $wgMaxSigChars is enforced in Unicode characters,
742 // both on the backend and now in the browser.
743 // Badly-behaved requests may still try to submit
744 // an overlong string, however.
745 'maxlength' => $wgMaxSigChars ) )
748 $this->tableRow( ' ', $this->getToggle( 'fancysig' ) )
751 $gender = new XMLSelect( 'wpGender', 'wpGender', $this->mGender
);
752 $gender->addOption( wfMsg( 'gender-unknown' ), 'unknown' );
753 $gender->addOption( wfMsg( 'gender-male' ), 'male' );
754 $gender->addOption( wfMsg( 'gender-female' ), 'female' );
758 Xml
::label( wfMsg( 'yourgender' ), 'wpGender' ),
760 Xml
::tags( 'div', array( 'class' => 'prefsectiontip' ),
761 wfMsgExt( 'prefs-help-gender', 'parseinline' )
766 list( $lsLabel, $lsSelect) = Xml
::languageSelector( $this->mUserLanguage
, false );
768 $this->tableRow( $lsLabel, $lsSelect )
771 /* see if there are multiple language variants to choose from*/
772 if(!$wgDisableLangConversion) {
773 $variants = $wgContLang->getVariants();
774 $variantArray = array();
776 $languages = Language
::getLanguageNames( true );
777 foreach($variants as $v) {
778 $v = str_replace( '_', '-', strtolower($v));
779 if( array_key_exists( $v, $languages ) ) {
780 // If it doesn't have a name, we'll pretend it doesn't exist
781 $variantArray[$v] = $languages[$v];
786 foreach( $variantArray as $code => $name ) {
787 $selected = ($code == $this->mUserVariant
);
788 $options .= Xml
::option( "$code - $name", $code, $selected ) . "\n";
791 if(count($variantArray) > 1) {
794 Xml
::label( wfMsg( 'yourvariant' ), 'wpUserVariant' ),
796 array( 'name' => 'wpUserVariant', 'id' => 'wpUserVariant' ),
803 if(count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) {
805 Xml
::tags( 'tr', null,
806 Xml
::tags( 'td', array( 'colspan' => '2' ),
807 $this->getToggle( "noconvertlink" )
815 if( $wgAuth->allowPasswordChange() ) {
816 $link = $wgUser->getSkin()->link( SpecialPage
::getTitleFor( 'ResetPass' ), wfMsgHtml( 'prefs-resetpass' ),
817 array() , array('returnto' => SpecialPage
::getTitleFor( 'Preferences') ) );
819 $this->tableRow( Xml
::element( 'h2', null, wfMsg( 'changepassword' ) ) ) .
820 $this->tableRow( '<ul><li>' . $link . '</li></ul>' ) );
825 if ( $wgEnableEmail ) {
828 if ($wgEnableUserEmail) {
829 // fixme -- the "allowemail" pseudotoggle is a hacked-together
830 // inversion for the "disableemail" preference.
831 $emf = wfMsg( 'allowemail' );
832 $disabled = $disableEmailPrefs ?
' disabled="disabled"' : '';
834 "<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>" .
835 $this->getToggle( 'ccmeonemails', '', $disableEmailPrefs );
840 $this->tableRow( Xml
::element( 'h2', null, wfMsg( 'email' ) ) ) .
844 $enotifwatchlistpages.
845 $enotifusertalkpages.
854 Xml
::closeElement( 'table' ) .
855 Xml
::closeElement( 'fieldset' )
861 if ($this->mSkin
== 'cologneblue' ||
$this->mSkin
== 'standard') {
862 $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'qbsettings' ) . "</legend>\n" );
863 for ( $i = 0; $i < count( $qbs ); ++
$i ) {
864 if ( $i == $this->mQuickbar
) { $checked = ' checked="checked"'; }
865 else { $checked = ""; }
866 $wgOut->addHTML( "<div><label><input type='radio' name='wpQuickbar' value=\"$i\"$checked />{$qbs[$i]}</label></div>\n" );
868 $wgOut->addHTML( "</fieldset>\n\n" );
870 # Need to output a hidden option even if the relevant skin is not in use,
871 # otherwise the preference will get reset to 0 on submit
872 $wgOut->addHTML( Xml
::hidden( 'wpQuickbar', $this->mQuickbar
) );
877 global $wgAllowUserSkin;
878 if( $wgAllowUserSkin ) {
879 $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg( 'skin' ) . "</legend>\n" );
880 $mptitle = Title
::newMainPage();
881 $previewtext = wfMsg( 'skin-preview' );
882 # Only show members of Skin::getSkinNames() rather than
883 # $skinNames (skins is all skin names from Language.php)
884 $validSkinNames = Skin
::getUsableSkins();
885 # Sort by UI skin name. First though need to update validSkinNames as sometimes
886 # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
887 foreach ( $validSkinNames as $skinkey => &$skinname ) {
888 $msgName = "skinname-{$skinkey}";
889 $localisedSkinName = wfMsg( $msgName );
890 if ( !wfEmptyMsg( $msgName, $localisedSkinName ) ) {
891 $skinname = $localisedSkinName;
894 asort($validSkinNames);
895 foreach( $validSkinNames as $skinkey => $sn ) {
896 $checked = $skinkey == $this->mSkin ?
' checked="checked"' : '';
897 $mplink = htmlspecialchars( $mptitle->getLocalURL( "useskin=$skinkey" ) );
898 $previewlink = "(<a target='_blank' href=\"$mplink\">$previewtext</a>)";
900 global $wgAllowUserCss, $wgAllowUserJs;
901 if( $wgAllowUserCss ) {
902 $cssPage = Title
::makeTitleSafe( NS_USER
, $wgUser->getName().'/'.$skinkey.'.css' );
903 $customCSS = $sk->makeLinkObj( $cssPage, wfMsgExt('prefs-custom-css', array() ) );
904 $extraLinks .= " ($customCSS)";
906 if( $wgAllowUserJs ) {
907 $jsPage = Title
::makeTitleSafe( NS_USER
, $wgUser->getName().'/'.$skinkey.'.js' );
908 $customJS = $sk->makeLinkObj( $jsPage, wfMsgHtml('prefs-custom-js') );
909 $extraLinks .= " ($customJS)";
911 if( $skinkey == $wgDefaultSkin )
912 $sn .= ' (' . wfMsg( 'default' ) . ')';
913 $wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked />
914 <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink{$extraLinks}<br />\n" );
916 $wgOut->addHTML( "</fieldset>\n\n" );
923 $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
924 foreach ( $mathopts as $k => $v ) {
925 $checked = ($k == $this->mMath
);
927 Xml
::openElement( 'div' ) .
928 Xml
::radioLabel( wfMsg( $v ), 'wpMath', $k, "mw-sp-math-$k", $checked ) .
929 Xml
::closeElement( 'div' ) . "\n"
932 $wgOut->addHTML( "</fieldset>\n\n" );
937 $imageLimitOptions = null;
938 foreach ( $wgImageLimits as $index => $limits ) {
939 $selected = ($index == $this->mImageSize
);
940 $imageLimitOptions .= Xml
::option( "{$limits[0]}×{$limits[1]}" .
941 wfMsg('unit-pixel'), $index, $selected );
944 $imageThumbOptions = null;
945 foreach ( $wgThumbLimits as $index => $size ) {
946 $selected = ($index == $this->mThumbSize
);
947 $imageThumbOptions .= Xml
::option($size . wfMsg('unit-pixel'), $index,
951 $imageSizeId = 'wpImageSize';
952 $thumbSizeId = 'wpThumbSize';
954 Xml
::fieldset( wfMsg( 'files' ) ) . "\n" .
955 Xml
::openElement( 'table' ) .
957 <td class="mw-label">' .
958 Xml
::label( wfMsg( 'imagemaxsize' ), $imageSizeId ) .
960 <td class="mw-input">' .
961 Xml
::openElement( 'select', array( 'name' => $imageSizeId, 'id' => $imageSizeId ) ) .
963 Xml
::closeElement( 'select' ) .
966 <td class="mw-label">' .
967 Xml
::label( wfMsg( 'thumbsize' ), $thumbSizeId ) .
969 <td class="mw-input">' .
970 Xml
::openElement( 'select', array( 'name' => $thumbSizeId, 'id' => $thumbSizeId ) ) .
972 Xml
::closeElement( 'select' ) .
975 Xml
::closeElement( 'table' ) .
976 Xml
::closeElement( 'fieldset' )
985 Xml
::openElement( 'fieldset' ) .
986 Xml
::element( 'legend', null, wfMsg( 'datetime' ) ) . "\n"
991 Xml
::openElement( 'fieldset' ) .
992 Xml
::element( 'legend', null, wfMsg( 'dateformat' ) ) . "\n"
995 $epoch = '20010115161234'; # Wikipedia day
996 foreach( $dateopts as $key ) {
997 if( $key == 'default' ) {
998 $formatted = wfMsg( 'datedefault' );
1000 $formatted = $wgLang->timeanddate( $epoch, false, $key );
1003 Xml
::tags( 'div', null,
1004 Xml
::radioLabel( $formatted, 'wpDate', $key, "wpDate$idCnt", $key == $this->mDate
)
1009 $wgOut->addHTML( Xml
::closeElement( 'fieldset' ) . "\n" );
1012 $nowlocal = Xml
::openElement( 'span', array( 'id' => 'wpLocalTime' ) ) .
1013 $wgLang->time( $now = wfTimestampNow(), true ) .
1014 Xml
::closeElement( 'span' );
1015 $nowserver = $wgLang->time( $now, false ) .
1016 Xml
::hidden( 'wpServerTime', substr( $now, 8, 2 ) * 60 +
substr( $now, 10, 2 ) );
1019 Xml
::openElement( 'fieldset' ) .
1020 Xml
::element( 'legend', null, wfMsg( 'timezonelegend' ) ) .
1021 Xml
::openElement( 'table' ) .
1022 $this->addRow( wfMsg( 'servertime' ), $nowserver ) .
1023 $this->addRow( wfMsg( 'localtime' ), $nowlocal )
1025 $opt = Xml
::openElement( 'select', array(
1026 'name' => 'wpTimeZone',
1027 'id' => 'wpTimeZone',
1028 'onchange' => 'javascript:updateTimezoneSelection(false)' ) );
1029 $opt .= Xml
::option( wfMsg( 'timezoneuseserverdefault' ), "System|$wgLocalTZoffset", $this->mTimeZone
=== "System|$wgLocalTZoffset" );
1030 $opt .= Xml
::option( wfMsg( 'timezoneuseoffset' ), 'Offset', $this->mTimeZone
=== 'Offset' );
1032 if ( function_exists( 'timezone_identifiers_list' ) ) {
1033 # Read timezone list
1034 $tzs = timezone_identifiers_list();
1037 # Precache localized region names
1038 $tzRegions = array();
1039 $tzRegions['Africa'] = wfMsg( 'timezoneregion-africa' );
1040 $tzRegions['America'] = wfMsg( 'timezoneregion-america' );
1041 $tzRegions['Antarctica'] = wfMsg( 'timezoneregion-antarctica' );
1042 $tzRegions['Arctic'] = wfMsg( 'timezoneregion-arctic' );
1043 $tzRegions['Asia'] = wfMsg( 'timezoneregion-asia' );
1044 $tzRegions['Atlantic'] = wfMsg( 'timezoneregion-atlantic' );
1045 $tzRegions['Australia'] = wfMsg( 'timezoneregion-australia' );
1046 $tzRegions['Europe'] = wfMsg( 'timezoneregion-europe' );
1047 $tzRegions['Indian'] = wfMsg( 'timezoneregion-indian' );
1048 $tzRegions['Pacific'] = wfMsg( 'timezoneregion-pacific' );
1049 asort( $tzRegions );
1051 $selZone = explode( '|', $this->mTimeZone
, 3 );
1052 $selZone = ( $selZone[0] == 'ZoneInfo' ) ?
$selZone[2] : null;
1053 $now = date_create( 'now' );
1056 foreach ( $tzs as $tz ) {
1057 $z = explode( '/', $tz, 2 );
1059 # timezone_identifiers_list() returns a number of
1060 # backwards-compatibility entries. This filters them out of the
1061 # list presented to the user.
1062 if ( count( $z ) != 2 ||
!array_key_exists( $z[0], $tzRegions ) )
1066 $z[0] = $tzRegions[$z[0]];
1068 # Create region groups
1069 if ( $optgroup != $z[0] ) {
1070 if ( $optgroup !== '' ) {
1071 $opt .= Xml
::closeElement( 'optgroup' );
1074 $opt .= Xml
::openElement( 'optgroup', array( 'label' => $z[0] ) ) . "\n";
1077 $minDiff = floor( timezone_offset_get( timezone_open( $tz ), $now ) / 60 );
1078 $opt .= Xml
::option( str_replace( '_', ' ', $z[0] . '/' . $z[1] ), "ZoneInfo|$minDiff|$tz", $selZone === $tz, array( 'label' => $z[1] ) ) . "\n";
1080 if ( $optgroup !== '' ) $opt .= Xml
::closeElement( 'optgroup' );
1082 $opt .= Xml
::closeElement( 'select' );
1085 Xml
::label( wfMsg( 'timezoneselect' ), 'wpTimeZone' ),
1090 Xml
::label( wfMsg( 'timezoneoffset' ), 'wpHourDiff' ),
1091 Xml
::input( 'wpHourDiff', 6, $this->mHourDiff
, array(
1092 'id' => 'wpHourDiff',
1093 'onfocus' => 'javascript:updateTimezoneSelection(true)',
1094 'onblur' => 'javascript:updateTimezoneSelection(false)' ) ) ) .
1097 <td class='mw-submit'>" .
1098 Xml
::element( 'input',
1099 array( 'type' => 'button',
1100 'value' => wfMsg( 'guesstimezone' ),
1101 'onclick' => 'javascript:guessTimezone()',
1102 'id' => 'guesstimezonebutton',
1103 'style' => 'display:none;' ) ) .
1106 Xml
::closeElement( 'table' ) .
1107 Xml
::tags( 'div', array( 'class' => 'prefsectiontip' ), wfMsgExt( 'timezonetext', 'parseinline' ) ).
1108 Xml
::closeElement( 'fieldset' ) .
1109 Xml
::closeElement( 'fieldset' ) . "\n\n"
1114 global $wgLivePreview;
1116 Xml
::fieldset( wfMsg( 'textboxsize' ) ) .
1117 wfMsgHTML( 'prefs-edit-boxsize' ) . ' ' .
1118 Xml
::inputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows
) . ' ' .
1119 Xml
::inputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols
) .
1120 $this->getToggles( array(
1122 'editsectiononrightclick',
1131 $wgLivePreview ?
'uselivepreview' : false,
1136 $wgOut->addHTML( Xml
::closeElement( 'fieldset' ) );
1139 global $wgRCMaxAge, $wgUseRCPatrol;
1141 Xml
::fieldset( wfMsg( 'prefs-rc' ) ) .
1142 Xml
::openElement( 'table' ) .
1144 <td class="mw-label">' .
1145 Xml
::label( wfMsg( 'recentchangesdays' ), 'wpRecentDays' ) .
1147 <td class="mw-input">' .
1148 Xml
::input( 'wpRecentDays', 3, $this->mRecentDays
, array( 'id' => 'wpRecentDays' ) ) . ' ' .
1149 wfMsgExt( 'recentchangesdays-max', 'parsemag',
1150 $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) ) ) .
1153 <td class="mw-label">' .
1154 Xml
::label( wfMsg( 'recentchangescount' ), 'wpRecent' ) .
1156 <td class="mw-input">' .
1157 Xml
::input( 'wpRecent', 3, $this->mRecent
, array( 'id' => 'wpRecent' ) ) .
1160 Xml
::closeElement( 'table' ) .
1164 $toggles[] = 'hideminor';
1165 $toggles[] = 'rc_hidebots';
1166 $toggles[] = 'newpageshidebots';
1167 if( $wgUseRCPatrol ) {
1168 $toggles[] = 'hidepatrolled';
1169 $toggles[] = 'newpageshidepatrolled';
1171 $toggles[] = 'rc_hideown';
1172 $toggles[] = 'newpageshideown';
1173 if( $wgRCShowWatchingUsers ) $toggles[] = 'shownumberswatching';
1174 $toggles[] = 'usenewrc';
1177 $this->getToggles( $toggles ) .
1178 Xml
::closeElement( 'fieldset' )
1182 $watchlistToggles = array( 'watchlisthideminor', 'watchlisthidebots', 'watchlisthideown',
1183 'watchlisthideanons', 'watchlisthideliu' );
1184 if( $wgUseRCPatrol ) $watchlistToggles[] = 'watchlisthidepatrolled';
1187 Xml
::fieldset( wfMsg( 'prefs-watchlist' ) ) .
1188 Xml
::inputLabel( wfMsg( 'prefs-watchlist-days' ), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays
) . ' ' .
1189 wfMsgHTML( 'prefs-watchlist-days-max' ) .
1191 $this->getToggle( 'extendwatchlist' ) .
1192 Xml
::inputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits
) . ' ' .
1193 wfMsgHTML( 'prefs-watchlist-edits-max' ) .
1195 $this->getToggles( $watchlistToggles )
1198 if( $wgUser->isAllowed( 'createpage' ) ||
$wgUser->isAllowed( 'createtalk' ) ) {
1199 $wgOut->addHTML( $this->getToggle( 'watchcreations' ) );
1202 foreach( array( 'edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion' ) as $action => $toggle ) {
1203 if( $wgUser->isAllowed( $action ) )
1204 $wgOut->addHTML( $this->getToggle( $toggle ) );
1206 $this->mUsedToggles
['watchcreations'] = true;
1207 $this->mUsedToggles
['watchdefault'] = true;
1208 $this->mUsedToggles
['watchmoves'] = true;
1209 $this->mUsedToggles
['watchdeletion'] = true;
1211 $wgOut->addHTML( Xml
::closeElement( 'fieldset' ) );
1214 $mwsuggest = $wgEnableMWSuggest ?
1216 Xml
::label( wfMsg( 'mwsuggest-disable' ), 'wpDisableMWSuggest' ),
1217 Xml
::check( 'wpDisableMWSuggest', $this->mDisableMWSuggest
, array( 'id' => 'wpDisableMWSuggest' ) )
1220 // Elements for the search tab itself
1221 Xml
::openElement( 'fieldset' ) .
1222 Xml
::element( 'legend', null, wfMsg( 'searchresultshead' ) ) .
1223 // Elements for the search options in the search tab
1224 Xml
::openElement( 'fieldset' ) .
1225 Xml
::element( 'legend', null, wfMsg( 'prefs-searchoptions' ) ) .
1226 Xml
::openElement( 'table' ) .
1228 Xml
::label( wfMsg( 'resultsperpage' ), 'wpSearch' ),
1229 Xml
::input( 'wpSearch', 4, $this->mSearch
, array( 'id' => 'wpSearch' ) )
1232 Xml
::label( wfMsg( 'contextlines' ), 'wpSearchLines' ),
1233 Xml
::input( 'wpSearchLines', 4, $this->mSearchLines
, array( 'id' => 'wpSearchLines' ) )
1236 Xml
::label( wfMsg( 'contextchars' ), 'wpSearchChars' ),
1237 Xml
::input( 'wpSearchChars', 4, $this->mSearchChars
, array( 'id' => 'wpSearchChars' ) )
1240 Xml
::closeElement( 'table' ) .
1241 Xml
::closeElement( 'fieldset' ) .
1242 // Elements for the namespace options in the search tab
1243 Xml
::openElement( 'fieldset' ) .
1244 Xml
::element( 'legend', null, wfMsg( 'prefs-namespaces' ) ) .
1245 wfMsgExt( 'defaultns', array( 'parse' ) ) .
1247 Xml
::closeElement( 'fieldset' ) .
1248 // End of the search tab
1249 Xml
::closeElement( 'fieldset' )
1254 $uopt = $wgUser->getOption( 'underline' );
1256 Xml
::fieldset( wfMsg( 'prefs-misc' ) ) .
1257 Xml
::openElement( 'table' ) .
1259 <td class="mw-label">' .
1260 // Xml::label() cannot be used because 'stub-threshold' contains plain HTML
1261 Xml
::tags( 'label', array( 'for' => 'wpStubs' ), wfMsg( 'stub-threshold' ) ) .
1263 <td class="mw-input">' .
1264 Xml
::input( 'wpStubs', 6, $this->mStubs
, array( 'id' => 'wpStubs' ) ) .
1267 <td class="mw-label">' .
1268 Xml
::label( wfMsg( 'tog-underline' ), 'wpOpunderline' ) .
1270 <td class="mw-input">' .
1271 Xml
::openElement( 'select', array( 'id' => 'wpOpunderline', 'name' => 'wpOpunderline' ) ) .
1272 Xml
::option( wfMsg ( 'underline-never' ), '0', $uopt == 0 ) .
1273 Xml
::option( wfMsg ( 'underline-always' ), '1', $uopt == 1 ) .
1274 Xml
::option( wfMsg ( 'underline-default' ), '2', $uopt == 2 ) .
1275 Xml
::closeElement( 'select' ) .
1278 Xml
::closeElement( 'table' )
1281 # And now the rest = Misc.
1282 foreach ( $togs as $tname ) {
1283 if( !array_key_exists( $tname, $this->mUsedToggles
) ) {
1284 if( $tname == 'norollbackdiff' && $wgUser->isAllowed( 'rollback' ) )
1285 $wgOut->addHTML( $this->getToggle( $tname ) );
1287 $wgOut->addHTML( $this->getToggle( $tname ) );
1291 $wgOut->addHTML( '</fieldset>' );
1293 wfRunHooks( 'RenderPreferencesForm', array( $this, $wgOut ) );
1295 $token = htmlspecialchars( $wgUser->editToken() );
1296 $skin = $wgUser->getSkin();
1297 $rtl = $wgContLang->isRTL() ?
'left' : 'right';
1299 <table id='prefsubmit' cellpadding='0' width='100%' style='background:none;'><tr>
1300 <td><input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) .
1301 '"'.$skin->tooltipAndAccesskey('save')." />
1302 <input type='submit' name='wpReset' value=\"" . wfMsgHtml( 'resetprefs' ) . "\" /></td>
1303 <td align='$rtl'><input type='submit' name='wpRestore' value=\"" . wfMsgHtml( 'restoreprefs' ) . "\" /></td>
1306 <input type='hidden' name='wpEditToken' value=\"{$token}\" />
1309 $wgOut->addHTML( Xml
::tags( 'div', array( 'class' => "prefcache" ),
1310 wfMsgExt( 'clearyourcache', 'parseinline' ) )