3 * Hold things related to displaying and saving user preferences.
5 * @subpackage SpecialPage
8 if( !defined( 'MEDIAWIKI' ) )
11 /* to get a list of languages in setting user's language preference */
12 require_once('languages/Names.php');
15 * Entry point that create the "Preferences" object
17 function wfSpecialPreferences() {
20 $form = new PreferencesForm( $wgRequest );
25 * Preferences form handling
26 * This object will show the preferences form and can save it as well.
28 * @subpackage SpecialPage
30 class PreferencesForm
{
31 var $mQuickbar, $mOldpass, $mNewpass, $mRetypePass, $mStubs;
32 var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick;
33 var $mUserLanguage, $mUserVariant;
34 var $mSearch, $mRecent, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
35 var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
41 function PreferencesForm( &$request ) {
42 global $wgLang, $wgContLang, $wgAllowRealName;
44 $this->mQuickbar
= $request->getVal( 'wpQuickbar' );
45 $this->mOldpass
= $request->getVal( 'wpOldpass' );
46 $this->mNewpass
= $request->getVal( 'wpNewpass' );
47 $this->mRetypePass
=$request->getVal( 'wpRetypePass' );
48 $this->mStubs
= $request->getVal( 'wpStubs' );
49 $this->mRows
= $request->getVal( 'wpRows' );
50 $this->mCols
= $request->getVal( 'wpCols' );
51 $this->mSkin
= $request->getVal( 'wpSkin' );
52 $this->mMath
= $request->getVal( 'wpMath' );
53 $this->mDate
= $request->getVal( 'wpDate' );
54 $this->mUserEmail
= $request->getVal( 'wpUserEmail' );
55 $this->mRealName
= ($wgAllowRealName) ?
$request->getVal( 'wpRealName' ) : '';
56 $this->mEmailFlag
= $request->getCheck( 'wpEmailFlag' ) ?
1 : 0;
57 $this->mNick
= $request->getVal( 'wpNick' );
58 $this->mUserLanguage
= $request->getVal( 'wpUserLanguage' );
59 $this->mUserVariant
= $request->getVal( 'wpUserVariant' );
60 $this->mSearch
= $request->getVal( 'wpSearch' );
61 $this->mRecent
= $request->getVal( 'wpRecent' );
62 $this->mHourDiff
= $request->getVal( 'wpHourDiff' );
63 $this->mSearchLines
= $request->getVal( 'wpSearchLines' );
64 $this->mSearchChars
= $request->getVal( 'wpSearchChars' );
65 $this->mImageSize
= $request->getVal( 'wpImageSize' );
67 $this->mAction
= $request->getVal( 'action' );
68 $this->mReset
= $request->getCheck( 'wpReset' );
69 $this->mPosted
= $request->wasPosted();
70 $this->mSaveprefs
= $request->getCheck( 'wpSaveprefs' ) && $this->mPosted
;
72 # User toggles (the big ugly unsorted list of checkboxes)
73 $this->mToggles
= array();
74 if ( $this->mPosted
) {
75 $togs = $wgLang->getUserToggles();
76 foreach ( $togs as $tname ) {
77 $this->mToggles
[$tname] = $request->getCheck( "wpOp$tname" ) ?
1 : 0;
81 $this->mUsedToggles
= array();
83 # Search namespace options
84 # Note: namespaces don't necessarily have consecutive keys
85 $this->mSearchNs
= array();
86 if ( $this->mPosted
) {
87 $namespaces = $wgContLang->getNamespaces();
88 foreach ( $namespaces as $i => $namespace ) {
90 $this->mSearchNs
[$i] = $request->getCheck( "wpNs$i" ) ?
1 : 0;
96 if ( !preg_match( '/^[a-z\-]*$/', $this->mUserLanguage
) ) {
97 $this->mUserLanguage
= 'nolanguage';
102 global $wgUser, $wgOut, $wgUseDynamicDates;
104 if ( 0 == $wgUser->getID() ) {
105 $wgOut->errorpage( 'prefsnologin', 'prefsnologintext' );
108 if ( wfReadOnly() ) {
109 $wgOut->readOnlyPage();
112 if ( $this->mReset
) {
114 $this->mainPrefsForm( wfMsg( 'prefsreset' ) );
115 } else if ( $this->mSaveprefs
) {
116 $this->savePreferences();
119 $this->mainPrefsForm( '' );
126 function validateInt( &$val, $min=0, $max=0x7fffffff ) {
128 $val = min($val, $max);
129 $val = max($val, $min);
136 function validateIntOrNull( &$val, $min=0, $max=0x7fffffff ) {
141 return $this->validateInt( $val, $min, $max );
148 function validateTimeZone( $s ) {
150 if ( strpos( $s, ':' ) ) {
152 $array = explode( ':' , $s );
153 $hour = intval( $array[0] );
154 $minute = intval( $array[1] );
156 $minute = intval( $s * 60 );
157 $hour = intval( $minute / 60 );
158 $minute = abs( $minute ) %
60;
160 $hour = min( $hour, 15 );
161 $hour = max( $hour, -15 );
162 $minute = min( $minute, 59 );
163 $minute = max( $minute, 0 );
164 $s = sprintf( "%02d:%02d", $hour, $minute );
172 function savePreferences() {
173 global $wgUser, $wgLang, $wgOut;
174 global $wgEnableUserEmail, $wgEnableEmail;
175 global $wgEmailAuthentication;
177 if ( '' != $this->mNewpass
) {
178 if ( $this->mNewpass
!= $this->mRetypePass
) {
179 $this->mainPrefsForm( wfMsg( 'badretype' ) );
183 if (!$wgUser->checkPassword( $this->mOldpass
)) {
184 $this->mainPrefsForm( wfMsg( 'wrongpassword' ) );
187 $wgUser->setPassword( $this->mNewpass
);
189 $wgUser->setRealName( $this->mRealName
);
190 $wgUser->setOption( 'language', $this->mUserLanguage
);
191 $wgUser->setOption( 'variant', $this->mUserVariant
);
192 $wgUser->setOption( 'nickname', $this->mNick
);
193 $wgUser->setOption( 'quickbar', $this->mQuickbar
);
194 $wgUser->setOption( 'skin', $this->mSkin
);
195 $wgUser->setOption( 'math', $this->mMath
);
196 $wgUser->setOption( 'date', $this->mDate
);
197 $wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch
) );
198 $wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines
) );
199 $wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars
) );
200 $wgUser->setOption( 'rclimit', $this->validateIntOrNull( $this->mRecent
) );
201 $wgUser->setOption( 'rows', $this->validateInt( $this->mRows
, 4, 1000 ) );
202 $wgUser->setOption( 'cols', $this->validateInt( $this->mCols
, 4, 1000 ) );
203 $wgUser->setOption( 'stubthreshold', $this->validateIntOrNull( $this->mStubs
) );
204 $wgUser->setOption( 'timecorrection', $this->validateTimeZone( $this->mHourDiff
, -12, 14 ) );
205 $wgUser->setOption( 'imagesize', $this->mImageSize
);
207 # Set search namespace options
208 foreach( $this->mSearchNs
as $i => $value ) {
209 $wgUser->setOption( "searchNs{$i}", $value );
212 if( $wgEnableEmail && $wgEnableUserEmail ) {
213 $wgUser->setOption( 'disablemail', $this->mEmailFlag
);
217 foreach ( $this->mToggles
as $tname => $tvalue ) {
218 $wgUser->setOption( $tname, $tvalue );
220 $wgUser->setCookies();
221 $wgUser->saveSettings();
223 if( $wgEnableEmail ) {
224 $newadr = strtolower( $this->mUserEmail
);
225 $oldadr = strtolower($wgUser->getEmail());
226 if (($newadr <> '') && ($newadr <> $oldadr)) { # the user has supplied a new email address on the login page
227 # prepare for authentication and mail a temporary password to newadr
228 require_once( 'SpecialUserlogin.php' );
229 if ( !$wgUser->isValidEmailAddr( $newadr ) ) {
230 $this->mainPrefsForm( wfMsg( 'invalidemailaddress' ) );
233 $wgUser->mEmail
= $newadr; # new behaviour: set this new emailaddr from login-page into user database record
234 $wgUser->mEmailAuthenticationtimestamp
= 0; # but flag as "dirty" = unauthenticated
235 $wgUser->saveSettings();
236 if ($wgEmailAuthentication) {
237 # mail a temporary password to the dirty address
238 # on "save options", this user will be logged-out automatically
239 $error = LoginForm
::mailPasswordInternal( $wgUser, true, $dummy );
241 return LoginForm
::mainLoginForm( wfMsg( 'passwordsentforemailauthentication', $wgUser->getName() ) );
243 return LoginForm
::mainLoginForm( wfMsg( 'mailerror', $error ) );
245 # if user returns, that new email address gets authenticated in checkpassword()
248 $wgUser->setEmail( strtolower($this->mUserEmail
) );
249 $wgUser->setCookies();
250 $wgUser->saveSettings();
254 $wgOut->setParserOptions( ParserOptions
::newFromUser( $wgUser ) );
255 $po = ParserOptions
::newFromUser( $wgUser );
256 $this->mainPrefsForm( wfMsg( 'savedprefs' ) );
262 function resetPrefs() {
263 global $wgUser, $wgLang, $wgContLang, $wgAllowRealName;
265 $this->mOldpass
= $this->mNewpass
= $this->mRetypePass
= '';
266 $this->mUserEmail
= $wgUser->getEmail();
267 $this->mUserEmailAuthenticationtimestamp
= $wgUser->getEmailAuthenticationtimestamp();
268 $this->mRealName
= ($wgAllowRealName) ?
$wgUser->getRealName() : '';
269 $this->mUserLanguage
= $wgUser->getOption( 'language' );
270 if( empty( $this->mUserLanguage
) ) {
271 # Quick hack for conversions, where this value is blank
272 global $wgContLanguageCode;
273 $this->mUserLanguage
= $wgContLanguageCode;
275 $this->mUserVariant
= $wgUser->getOption( 'variant');
276 if ( 1 == $wgUser->getOption( 'disablemail' ) ) { $this->mEmailFlag
= 1; }
277 else { $this->mEmailFlag
= 0; }
278 $this->mNick
= $wgUser->getOption( 'nickname' );
280 $this->mQuickbar
= $wgUser->getOption( 'quickbar' );
281 $this->mSkin
= $wgUser->getOption( 'skin' );
282 $this->mMath
= $wgUser->getOption( 'math' );
283 $this->mDate
= $wgUser->getOption( 'date' );
284 $this->mRows
= $wgUser->getOption( 'rows' );
285 $this->mCols
= $wgUser->getOption( 'cols' );
286 $this->mStubs
= $wgUser->getOption( 'stubthreshold' );
287 $this->mHourDiff
= $wgUser->getOption( 'timecorrection' );
288 $this->mSearch
= $wgUser->getOption( 'searchlimit' );
289 $this->mSearchLines
= $wgUser->getOption( 'contextlines' );
290 $this->mSearchChars
= $wgUser->getOption( 'contextchars' );
291 $this->mImageSize
= $wgUser->getOption( 'imagesize' );
292 $this->mRecent
= $wgUser->getOption( 'rclimit' );
294 $togs = $wgLang->getUserToggles();
295 foreach ( $togs as $tname ) {
296 $ttext = wfMsg('tog-'.$tname);
297 $this->mToggles
[$tname] = $wgUser->getOption( $tname );
300 $namespaces = $wgContLang->getNamespaces();
301 foreach ( $namespaces as $i => $namespace ) {
303 $this->mSearchNs
[$i] = $wgUser->getOption( 'searchNs'.$i );
311 function namespacesCheckboxes() {
312 global $wgContLang, $wgUser;
314 # Determine namespace checkboxes
315 $namespaces = $wgContLang->getNamespaces();
318 foreach ( $namespaces as $i => $name ) {
319 # Skip special or anything similar
322 if ( $this->mSearchNs
[$i] ) {
323 $checked = ' checked="checked"';
325 $name = str_replace( '_', ' ', $namespaces[$i] );
327 $name = wfMsg( 'blanknamespace' );
333 $r1 .= "<label><input type='checkbox' value=\"1\" name=\"" .
334 "wpNs$i\"{$checked} />{$name}</label>\n";
342 function getToggle( $tname, $trailer = false) {
343 global $wgUser, $wgLang;
345 $this->mUsedToggles
[$tname] = true;
346 $ttext = $wgLang->getUserToggle( $tname );
348 if ( 1 == $wgUser->getOption( $tname ) ) {
349 $checked = ' checked="checked"';
353 $trailer =($trailer) ?
$trailer : '';
354 return "<div><input type='checkbox' value=\"1\" "
355 . "id=\"$tname\" name=\"wpOp$tname\"$checked /><label for=\"$tname\">$ttext</label>$trailer</div>\n";
361 function mainPrefsForm( $err ) {
362 global $wgUser, $wgOut, $wgLang, $wgContLang, $wgUseDynamicDates, $wgValidSkinNames;
363 global $wgAllowRealName, $wgImageLimits;
364 global $wgLanguageNames, $wgDisableLangConversion;
365 global $wgEmailNotificationForWatchlistPages, $wgEmailNotificationForUserTalkPages,$wgEmailNotificationForMinorEdits;
366 global $wgRCShowWatchingUsers, $wgEmailNotificationRevealPageEditorAddress;
367 global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
368 global $wgContLanguageCode;
370 $wgOut->setPageTitle( wfMsg( 'preferences' ) );
371 $wgOut->setArticleRelated( false );
372 $wgOut->setRobotpolicy( 'noindex,nofollow' );
375 $wgOut->addHTML( "<p class='error'>" . htmlspecialchars( $err ) . "</p>\n" );
377 $uname = $wgUser->getName();
378 $uid = $wgUser->getID();
380 $wgOut->addWikiText( wfMsg( 'prefslogintext', $uname, $uid ) );
381 $wgOut->addWikiText( wfMsg('clearyourcache'));
383 $qbs = $wgLang->getQuickbarSettings();
384 $skinNames = $wgLang->getSkinNames();
385 $mathopts = $wgLang->getMathNames();
386 $dateopts = $wgLang->getDateFormats();
387 $togs = $wgLang->getUserToggles();
389 $titleObj = Title
::makeTitle( NS_SPECIAL
, 'Preferences' );
390 $action = $titleObj->escapeLocalURL();
392 $qb = wfMsg( 'qbsettings' );
393 $cp = wfMsg( 'changepassword' );
394 $sk = wfMsg( 'skin' );
395 $math = wfMsg( 'math' );
396 $dateFormat = wfMsg('dateformat');
397 $opw = wfMsg( 'oldpassword' );
398 $npw = wfMsg( 'newpassword' );
399 $rpw = wfMsg( 'retypenew' );
400 $svp = wfMsg( 'saveprefs' );
401 $rsp = wfMsg( 'resetprefs' );
402 $tbs = wfMsg( 'textboxsize' );
403 $tbr = wfMsg( 'rows' );
404 $tbc = wfMsg( 'columns' );
405 $ltz = wfMsg( 'localtime' );
406 $timezone = wfMsg( 'timezonelegend' );
407 $tzt = wfMsg( 'timezonetext' );
408 $tzo = wfMsg( 'timezoneoffset' );
409 $tzGuess = wfMsg( 'guesstimezone' );
410 $tzServerTime = wfMsg( 'servertime' );
411 $yem = wfMsg( 'youremail' );
412 $yrn = ($wgAllowRealName) ?
wfMsg( 'yourrealname' ) : '';
413 $yl = wfMsg( 'yourlanguage' );
414 $yv = wfMsg( 'yourvariant' );
415 $emf = wfMsg( 'emailflag' );
416 $ynn = wfMsg( 'yournick' );
417 $stt = wfMsg ( 'stubthreshold' ) ;
418 $srh = wfMsg( 'searchresultshead' );
419 $rpp = wfMsg( 'resultsperpage' );
420 $scl = wfMsg( 'contextlines' );
421 $scc = wfMsg( 'contextchars' );
422 $rcc = wfMsg( 'recentchangescount' );
423 $dsn = wfMsg( 'defaultns' );
425 $wgOut->addHTML( "<form id=\"preferences\" name=\"preferences\" action=\"$action\"
428 # First section: identity
431 $this->mUserEmail
= htmlspecialchars( $this->mUserEmail
);
432 $this->mRealName
= htmlspecialchars( $this->mRealName
);
433 $this->mNick
= htmlspecialchars( $this->mNick
);
434 if ( $this->mEmailFlag
) { $emfc = 'checked="checked"'; }
437 if ($wgEmailAuthentication && ($this->mUserEmail
!= '') ) {
438 if ($wgUser->getEmailAuthenticationtimestamp() != 0) {
439 $emailauthenticated = wfMsg('emailauthenticated',$wgLang->timeanddate($wgUser->getEmailAuthenticationtimestamp(), true ) ).'<br />';
442 $emailauthenticated = wfMsg('emailnotauthenticated').'<br />';
443 $disabled = ' '.wfMsg('disableduntilauthent');
446 $emailauthenticated = '';
449 if ($this->mUserEmail
== '') {
450 $disabled = ' '.wfMsg('disablednoemail');
453 $ps = $this->namespacesCheckboxes();
455 $enotifwatchlistpages = ($wgEmailNotificationForWatchlistPages) ?
$this->getToggle( 'enotifwatchlistpages', $disabled) : '';
456 $enotifusertalkpages = ($wgEmailNotificationForUserTalkPages) ?
$this->getToggle( 'enotifusertalkpages', $disabled) : '';
457 $enotifminoredits = ($wgEmailNotificationForMinorEdits) ?
$this->getToggle( 'enotifminoredits', $disabled) : '';
458 $enotifrevealaddr = ($wgEmailNotificationRevealPageEditorAddress) ?
$this->getToggle( 'enotifrevealaddr', $disabled) : '';
459 $prefs_help_email_enotif = ( $wgEmailNotificationForWatchlistPages ||
$wgEmailNotificationForUserTalkPages) ?
' ' . wfMsg('prefs-help-email-enotif') : '';
460 $prefs_help_realname = '';
462 $wgOut->addHTML( "<fieldset>
463 <legend>".wfMsg('prefs-personal')."</legend>");
465 if ($wgAllowRealName) {
466 $wgOut->addHTML("<div><label>$yrn: <input type='text' name=\"wpRealName\" value=\"{$this->mRealName}\" size='20' /></label></div>");
467 $prefs_help_realname = wfMsg('prefs-help-realname').'<br />';
470 if( $wgEnableEmail ) {
472 <div><label>$yem: <input type='text' name=\"wpUserEmail\" value=\"{$this->mUserEmail}\" size='20' /></label></div>" );
473 if( $wgEnableUserEmail ) {
477 $enotifwatchlistpages.
478 $enotifusertalkpages.
480 "<div><label><input type='checkbox' $emfc value=\"1\" name=\"wpEmailFlag\" />$emf.$disabled</label></div>" );
484 $fancysig = $this->getToggle( 'fancysig' );
486 <div><label>$ynn: <input type='text' name=\"wpNick\" value=\"{$this->mNick}\" size='25' /></label></div>
487 <div>$fancysig<br /></div>
488 <div><label>$yl: <select name=\"wpUserLanguage\">\n");
491 * If a bogus value is set, default to the content language.
492 * Otherwise, no default is selected and the user ends up
493 * with an Afrikaans interface since it's first in the list.
495 if( isset( $wgLanguageNames[$this->mUserLanguage
] ) ) {
496 $selectedLang = $this->mUserLanguage
;
498 $selectedLang = $wgContLanguageCode;
500 foreach($wgLanguageNames as $code => $name) {
502 /* only add languages that have a file */
503 $langfile="$IP/languages/Language".str_replace('-', '_', ucfirst($code)).".php";
504 if(file_exists($langfile) ||
$code == $wgContLanguageCode) {
505 $sel = ($code == $selectedLang)?
'selected="selected"' : '';
506 $wgOut->addHtml("\t<option value=\"$code\" $sel>$code - $name</option>\n");
509 $wgOut->addHtml("</select></label></div>\n" );
511 /* see if there are multiple language variants to choose from*/
512 if(!$wgDisableLangConversion) {
513 $variants = $wgContLang->getVariants();
514 $size=sizeof($variants);
516 $variantArray=array();
517 foreach($variants as $v) {
518 $v = str_replace( '_', '-', strtolower($v));
519 if($name=$wgLanguageNames[$v]) {
520 $variantArray[$v] = $name;
523 $size=sizeof($variantArray);
525 if(sizeof($variantArray) > 1) {
527 <div><label>$yv: <select name=\"wpUserVariant\">\n");
528 foreach($variantArray as $code => $name) {
529 $sel = ($code==$this->mUserVariant
)?
'selected="selected"' : '';
530 $wgOut->addHtml("\t<option value=\"$code\" $sel>$code - $name</option>\n");
534 # Fields for changing password
536 $this->mOldpass
= htmlspecialchars( $this->mOldpass
);
537 $this->mNewpass
= htmlspecialchars( $this->mNewpass
);
538 $this->mRetypePass
= htmlspecialchars( $this->mRetypePass
);
540 $wgOut->addHTML( "<fieldset>
542 <div><label>$opw: <input type='password' name=\"wpOldpass\" value=\"{$this->mOldpass}\" size='20' /></label></div>
543 <div><label>$npw: <input type='password' name=\"wpNewpass\" value=\"{$this->mNewpass}\" size='20' /></label></div>
544 <div><label>$rpw: <input type='password' name=\"wpRetypePass\" value=\"{$this->mRetypePass}\" size='20' /></label></div>
545 " . $this->getToggle( "rememberpassword" ) . "
547 <div class='prefsectiontip'>".$prefs_help_realname.wfMsg('prefs-help-email').$prefs_help_email_enotif."</div>\n</fieldset>\n" );
552 $wgOut->addHtml( "<fieldset>\n<legend>$qb</legend>\n" );
553 for ( $i = 0; $i < count( $qbs ); ++
$i ) {
554 if ( $i == $this->mQuickbar
) { $checked = ' checked="checked"'; }
555 else { $checked = ""; }
556 $wgOut->addHTML( "<div><label><input type='radio' name=\"wpQuickbar\"
557 value=\"$i\"$checked /> {$qbs[$i]}</label></div>\n" );
559 $wgOut->addHtml('<div class="prefsectiontip">'.wfMsg('qbsettingsnote').'</div>');
560 $wgOut->addHtml( "</fieldset>\n\n" );
564 $wgOut->addHTML( "<fieldset>\n<legend>$sk</legend>\n" );
565 # Only show members of $wgValidSkinNames rather than
566 # $skinNames (skins is all skin names from Language.php)
567 foreach ($wgValidSkinNames as $skinkey => $skinname ) {
568 if ( $skinkey == $this->mSkin
) {
569 $checked = ' checked="checked"';
573 if ( isset( $skinNames[$skinkey] ) ) {
574 $sn = $skinNames[$skinkey];
578 global $wgDefaultSkin;
579 if( $skinkey == $wgDefaultSkin ) {
580 $sn .= ' (' . wfMsg( 'default' ) . ')';
582 $wgOut->addHTML( "<div><label><input type='radio' name=\"wpSkin\"
583 value=\"$skinkey\"$checked /> {$sn}</label></div>\n" );
585 $wgOut->addHTML( "</fieldset>\n\n" );
589 $wgOut->addHTML( "<fieldset>\n<legend>$math</legend>\n" );
590 for ( $i = 0; $i < count( $mathopts ); ++
$i ) {
591 if ( $i == $this->mMath
) { $checked = ' checked="checked"'; }
592 else { $checked = ""; }
593 $wgOut->addHTML( "<div><label><input type='radio' name=\"wpMath\"
594 value=\"$i\"$checked /> ".wfMsg($mathopts[$i])."</label></div>\n" );
596 $wgOut->addHTML( "</fieldset>\n\n" );
600 if ( $wgUseDynamicDates ) {
601 $wgOut->addHTML( "<fieldset>\n<legend>$dateFormat</legend>\n" );
602 for ( $i = 0; $i < count( $dateopts ); ++
$i) {
603 if ( $i == $this->mDate
) {
604 $checked = ' checked="checked"';
608 $wgOut->addHTML( "<div><label><input type='radio' name=\"wpDate\" ".
609 "value=\"$i\"$checked /> {$dateopts[$i]}</label></div>\n" );
611 $wgOut->addHTML( "</fieldset>\n\n");
616 $nowlocal = $wgLang->time( $now = wfTimestampNow(), true );
617 $nowserver = $wgLang->time( $now, false );
618 $wgOut->addHTML( "<fieldset>
619 <legend>$tbs</legend>\n
621 <label>$tbr: <input type='text' name=\"wpRows\" value=\"{$this->mRows}\" size='6' /></label>
622 <label>$tbc: <input type='text' name=\"wpCols\" value=\"{$this->mCols}\" size='6' /></label>
624 $this->getToggle( "editwidth" ) .
625 $this->getToggle( "showtoolbar" ) .
626 $this->getToggle( "previewonfirst" ) .
627 $this->getToggle( "previewontop" ) .
628 $this->getToggle( "watchdefault" ) .
629 $this->getToggle( "minordefault" ) . "
633 <legend>$timezone</legend>
634 <div><b>$tzServerTime:</b> $nowserver</div>
635 <div><b>$ltz:</b> $nowlocal</div>
636 <div><label>$tzo*: <input type='text' name=\"wpHourDiff\" value=\"" . htmlspecialchars( $this->mHourDiff
) . "\" size='6' /></label></div>
637 <div><input type=\"button\" value=\"$tzGuess\" onclick=\"javascript:guessTimezone()\" id=\"guesstimezonebutton\" style=\"display:none\" /></div>
638 <div class='prefsectiontip'>* {$tzt}</div>
641 $shownumberswatching = ($wgRCShowWatchingUsers) ?
$this->getToggle('shownumberswatching') : '';
644 <fieldset><legend>".wfMsg('prefs-rc')."</legend>
645 <div><label>$rcc: <input type='text' name=\"wpRecent\" value=\"$this->mRecent\" size='6' /></label></div>" .
646 $this->getToggle( "hideminor" ) . $shownumberswatching .
647 $this->getToggle( "usenewrc" ) . $this->getToggle('showupdated', wfMsg('updatedmarker')) .
648 "<div><label>$stt: <input type='text' name=\"wpStubs\" value=\"$this->mStubs\" size='6' /></label></div>
649 <div><label>".wfMsg('imagemaxsize')."<select name=\"wpImageSize\">");
651 $imageLimitOptions='';
652 foreach ( $wgImageLimits as $index => $limits ) {
653 $selected = ($index == $this->mImageSize
) ?
'selected="selected"' : '';
654 $imageLimitOptions .= "<option value=\"{$index}\" {$selected}>{$limits[0]}x{$limits[1]}</option>\n";
656 $wgOut->addHTML( "{$imageLimitOptions}</select></label></div>
661 <legend>$srh</legend>
662 <div><label>$rpp: <input type='text' name=\"wpSearch\" value=\"$this->mSearch\" size='6' /></label></div>
663 <div><label>$scl: <input type='text' name=\"wpSearchLines\" value=\"$this->mSearchLines\" size='6' /></label></div>
664 <div><label>$scc: <input type='text' name=\"wpSearchChars\" value=\"$this->mSearchChars\" size='6' /></label></div>
667 <legend>$dsn</legend>
673 # Various checkbox options
675 $wgOut->addHTML("<fieldset><legend>".wfMsg('prefs-misc')."</legend>");
676 foreach ( $togs as $tname ) {
677 if( !array_key_exists( $tname, $this->mUsedToggles
) ) {
678 $wgOut->addHTML( $this->getToggle( $tname ) );
681 $wgOut->addHTML( "</fieldset>\n\n" );
684 <div id='prefsubmit'>
686 <input type='submit' name=\"wpSaveprefs\" value=\"$svp\" accesskey=\"".
687 wfMsg('accesskey-save')."\" title=\"[alt-".wfMsg('accesskey-save')."]\" />
688 <input type='submit' name=\"wpReset\" value=\"$rsp\" />