Revert r34906, r34907, r34928 -- mixing high-level data into low-level storage functi...
[lhc/web/wiklou.git] / includes / SpecialPreferences.php
1 <?php
2 /**
3 * Hold things related to displaying and saving user preferences.
4 * @addtogroup SpecialPage
5 */
6
7 /**
8 * Entry point that create the "Preferences" object
9 */
10 function wfSpecialPreferences() {
11 global $wgRequest;
12
13 $form = new PreferencesForm( $wgRequest );
14 $form->execute();
15 }
16
17 /**
18 * Preferences form handling
19 * This object will show the preferences form and can save it as well.
20 * @addtogroup SpecialPage
21 */
22 class PreferencesForm {
23 var $mQuickbar, $mOldpass, $mNewpass, $mRetypePass, $mStubs;
24 var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick;
25 var $mUserLanguage, $mUserVariant;
26 var $mSearch, $mRecent, $mRecentDays, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
27 var $mReset, $mPosted, $mToggles, $mUseAjaxSearch, $mSearchNs, $mRealName, $mImageSize;
28 var $mUnderline, $mWatchlistEdits;
29
30 /**
31 * Constructor
32 * Load some values
33 */
34 function PreferencesForm( &$request ) {
35 global $wgContLang, $wgUser, $wgAllowRealName;
36
37 $this->mQuickbar = $request->getVal( 'wpQuickbar' );
38 $this->mOldpass = $request->getVal( 'wpOldpass' );
39 $this->mNewpass = $request->getVal( 'wpNewpass' );
40 $this->mRetypePass =$request->getVal( 'wpRetypePass' );
41 $this->mStubs = $request->getVal( 'wpStubs' );
42 $this->mRows = $request->getVal( 'wpRows' );
43 $this->mCols = $request->getVal( 'wpCols' );
44 $this->mSkin = $request->getVal( 'wpSkin' );
45 $this->mMath = $request->getVal( 'wpMath' );
46 $this->mDate = $request->getVal( 'wpDate' );
47 $this->mUserEmail = $request->getVal( 'wpUserEmail' );
48 $this->mRealName = $wgAllowRealName ? $request->getVal( 'wpRealName' ) : '';
49 $this->mEmailFlag = $request->getCheck( 'wpEmailFlag' ) ? 0 : 1;
50 $this->mNick = $request->getVal( 'wpNick' );
51 $this->mUserLanguage = $request->getVal( 'wpUserLanguage' );
52 $this->mUserVariant = $request->getVal( 'wpUserVariant' );
53 $this->mSearch = $request->getVal( 'wpSearch' );
54 $this->mRecent = $request->getVal( 'wpRecent' );
55 $this->mRecentDays = $request->getVal( 'wpRecentDays' );
56 $this->mHourDiff = $request->getVal( 'wpHourDiff' );
57 $this->mSearchLines = $request->getVal( 'wpSearchLines' );
58 $this->mSearchChars = $request->getVal( 'wpSearchChars' );
59 $this->mImageSize = $request->getVal( 'wpImageSize' );
60 $this->mThumbSize = $request->getInt( 'wpThumbSize' );
61 $this->mUnderline = $request->getInt( 'wpOpunderline' );
62 $this->mAction = $request->getVal( 'action' );
63 $this->mReset = $request->getCheck( 'wpReset' );
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->mUseAjaxSearch = $request->getCheck( 'wpUseAjaxSearch' );
69 $this->mDisableMWSuggest = $request->getCheck( 'wpDisableMWSuggest' );
70
71 $this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
72 $this->mPosted &&
73 $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
74
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;
81 }
82 }
83
84 $this->mUsedToggles = array();
85
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 ) {
92 if ( $i >= 0 ) {
93 $this->mSearchNs[$i] = $request->getCheck( "wpNs$i" ) ? 1 : 0;
94 }
95 }
96 }
97
98 # Validate language
99 if ( !preg_match( '/^[a-z\-]*$/', $this->mUserLanguage ) ) {
100 $this->mUserLanguage = 'nolanguage';
101 }
102
103 wfRunHooks( 'InitPreferencesForm', array( $this, $request ) );
104 }
105
106 function execute() {
107 global $wgUser, $wgOut;
108
109 if ( $wgUser->isAnon() ) {
110 $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext' );
111 return;
112 }
113 if ( wfReadOnly() ) {
114 $wgOut->readOnlyPage();
115 return;
116 }
117 if ( $this->mReset ) {
118 $this->resetPrefs();
119 $this->mainPrefsForm( 'reset', wfMsg( 'prefsreset' ) );
120 } else if ( $this->mSaveprefs ) {
121 $this->savePreferences();
122 } else {
123 $this->resetPrefs();
124 $this->mainPrefsForm( '' );
125 }
126 }
127 /**
128 * @access private
129 */
130 function validateInt( &$val, $min=0, $max=0x7fffffff ) {
131 $val = intval($val);
132 $val = min($val, $max);
133 $val = max($val, $min);
134 return $val;
135 }
136
137 /**
138 * @access private
139 */
140 function validateFloat( &$val, $min, $max=0x7fffffff ) {
141 $val = floatval( $val );
142 $val = min( $val, $max );
143 $val = max( $val, $min );
144 return( $val );
145 }
146
147 /**
148 * @access private
149 */
150 function validateIntOrNull( &$val, $min=0, $max=0x7fffffff ) {
151 $val = trim($val);
152 if($val === '') {
153 return $val;
154 } else {
155 return $this->validateInt( $val, $min, $max );
156 }
157 }
158
159 /**
160 * @access private
161 */
162 function validateDate( $val ) {
163 global $wgLang, $wgContLang;
164 if ( $val !== false && (
165 in_array( $val, (array)$wgLang->getDatePreferences() ) ||
166 in_array( $val, (array)$wgContLang->getDatePreferences() ) ) )
167 {
168 return $val;
169 } else {
170 return $wgLang->getDefaultDateFormat();
171 }
172 }
173
174 /**
175 * Used to validate the user inputed timezone before saving it as
176 * 'timecorrection', will return '00:00' if fed bogus data.
177 * Note: It's not a 100% correct implementation timezone-wise, it will
178 * accept stuff like '14:30',
179 * @access private
180 * @param string $s the user input
181 * @return string
182 */
183 function validateTimeZone( $s ) {
184 if ( $s !== '' ) {
185 if ( strpos( $s, ':' ) ) {
186 # HH:MM
187 $array = explode( ':' , $s );
188 $hour = intval( $array[0] );
189 $minute = intval( $array[1] );
190 } else {
191 $minute = intval( $s * 60 );
192 $hour = intval( $minute / 60 );
193 $minute = abs( $minute ) % 60;
194 }
195 # Max is +14:00 and min is -12:00, see:
196 # http://en.wikipedia.org/wiki/Timezone
197 $hour = min( $hour, 14 );
198 $hour = max( $hour, -12 );
199 $minute = min( $minute, 59 );
200 $minute = max( $minute, 0 );
201 $s = sprintf( "%02d:%02d", $hour, $minute );
202 }
203 return $s;
204 }
205
206 /**
207 * @access private
208 */
209 function savePreferences() {
210 global $wgUser, $wgOut, $wgParser;
211 global $wgEnableUserEmail, $wgEnableEmail;
212 global $wgEmailAuthentication, $wgRCMaxAge;
213 global $wgAuth, $wgEmailConfirmToEdit;
214
215
216 if ( '' != $this->mNewpass && $wgAuth->allowPasswordChange() ) {
217 if ( $this->mNewpass != $this->mRetypePass ) {
218 wfRunHooks( 'PrefsPasswordAudit', array( $wgUser, $this->mNewpass, 'badretype' ) );
219 $this->mainPrefsForm( 'error', wfMsg( 'badretype' ) );
220 return;
221 }
222
223 if (!$wgUser->checkPassword( $this->mOldpass )) {
224 wfRunHooks( 'PrefsPasswordAudit', array( $wgUser, $this->mNewpass, 'wrongpassword' ) );
225 $this->mainPrefsForm( 'error', wfMsg( 'wrongpassword' ) );
226 return;
227 }
228
229 try {
230 $wgUser->setPassword( $this->mNewpass );
231 wfRunHooks( 'PrefsPasswordAudit', array( $wgUser, $this->mNewpass, 'success' ) );
232 $this->mNewpass = $this->mOldpass = $this->mRetypePass = '';
233 } catch( PasswordError $e ) {
234 wfRunHooks( 'PrefsPasswordAudit', array( $wgUser, $this->mNewpass, 'error' ) );
235 $this->mainPrefsForm( 'error', $e->getMessage() );
236 return;
237 }
238 }
239 $wgUser->setRealName( $this->mRealName );
240 $oldOptions = $wgUser->mOptions;
241
242 if( $wgUser->getOption( 'language' ) !== $this->mUserLanguage ) {
243 $needRedirect = true;
244 } else {
245 $needRedirect = false;
246 }
247
248 # Validate the signature and clean it up as needed
249 global $wgMaxSigChars;
250 if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
251 global $wgLang;
252 $this->mainPrefsForm( 'error',
253 wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) );
254 return;
255 } elseif( $this->mToggles['fancysig'] ) {
256 if( $wgParser->validateSig( $this->mNick ) !== false ) {
257 $this->mNick = $wgParser->cleanSig( $this->mNick );
258 } else {
259 $this->mainPrefsForm( 'error', wfMsg( 'badsig' ) );
260 return;
261 }
262 } else {
263 // When no fancy sig used, make sure ~{3,5} get removed.
264 $this->mNick = $wgParser->cleanSigInSig( $this->mNick );
265 }
266
267 $wgUser->setOption( 'language', $this->mUserLanguage );
268 $wgUser->setOption( 'variant', $this->mUserVariant );
269 $wgUser->setOption( 'nickname', $this->mNick );
270 $wgUser->setOption( 'quickbar', $this->mQuickbar );
271 $wgUser->setOption( 'skin', $this->mSkin );
272 global $wgUseTeX;
273 if( $wgUseTeX ) {
274 $wgUser->setOption( 'math', $this->mMath );
275 }
276 $wgUser->setOption( 'date', $this->validateDate( $this->mDate ) );
277 $wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch ) );
278 $wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines ) );
279 $wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars ) );
280 $wgUser->setOption( 'rclimit', $this->validateIntOrNull( $this->mRecent ) );
281 $wgUser->setOption( 'rcdays', $this->validateInt($this->mRecentDays, 1, ceil($wgRCMaxAge / (3600*24))));
282 $wgUser->setOption( 'wllimit', $this->validateIntOrNull( $this->mWatchlistEdits, 0, 1000 ) );
283 $wgUser->setOption( 'rows', $this->validateInt( $this->mRows, 4, 1000 ) );
284 $wgUser->setOption( 'cols', $this->validateInt( $this->mCols, 4, 1000 ) );
285 $wgUser->setOption( 'stubthreshold', $this->validateIntOrNull( $this->mStubs ) );
286 $wgUser->setOption( 'timecorrection', $this->validateTimeZone( $this->mHourDiff, -12, 14 ) );
287 $wgUser->setOption( 'imagesize', $this->mImageSize );
288 $wgUser->setOption( 'thumbsize', $this->mThumbSize );
289 $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
290 $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) );
291 $wgUser->setOption( 'ajaxsearch', $this->mUseAjaxSearch );
292 $wgUser->setOption( 'disablesuggest', $this->mDisableMWSuggest );
293
294 # Set search namespace options
295 foreach( $this->mSearchNs as $i => $value ) {
296 $wgUser->setOption( "searchNs{$i}", $value );
297 }
298
299 if( $wgEnableEmail && $wgEnableUserEmail ) {
300 $wgUser->setOption( 'disablemail', $this->mEmailFlag );
301 }
302
303 # Set user toggles
304 foreach ( $this->mToggles as $tname => $tvalue ) {
305 $wgUser->setOption( $tname, $tvalue );
306 }
307
308 $error = false;
309 if( $wgEnableEmail ) {
310 $newadr = $this->mUserEmail;
311 $oldadr = $wgUser->getEmail();
312 if( ($newadr != '') && ($newadr != $oldadr) ) {
313 # the user has supplied a new email address on the login page
314 if( $wgUser->isValidEmailAddr( $newadr ) ) {
315 # new behaviour: set this new emailaddr from login-page into user database record
316 $wgUser->setEmail( $newadr );
317 # but flag as "dirty" = unauthenticated
318 $wgUser->invalidateEmail();
319 if ($wgEmailAuthentication) {
320 # Mail a temporary password to the dirty address.
321 # User can come back through the confirmation URL to re-enable email.
322 $result = $wgUser->sendConfirmationMail();
323 if( WikiError::isError( $result ) ) {
324 $error = wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
325 } else {
326 $error = wfMsg( 'eauthentsent', $wgUser->getName() );
327 }
328 }
329 } else {
330 $error = wfMsg( 'invalidemailaddress' );
331 }
332 } else {
333 if( $wgEmailConfirmToEdit && empty( $newadr ) ) {
334 $this->mainPrefsForm( 'error', wfMsg( 'noemailtitle' ) );
335 return;
336 }
337 $wgUser->setEmail( $this->mUserEmail );
338 }
339 if( $oldadr != $newadr ) {
340 wfRunHooks( 'PrefsEmailAudit', array( $wgUser, $oldadr, $newadr ) );
341 }
342 }
343
344 if( !$wgAuth->updateExternalDB( $wgUser ) ){
345 $this->mainPrefsForm( 'error', wfMsg( 'externaldberror' ) );
346 return;
347 }
348
349 $msg = '';
350 if ( !wfRunHooks( 'SavePreferences', array( $this, $wgUser, &$msg, $oldOptions ) ) ) {
351 $this->mainPrefsForm( 'error', $msg );
352 return;
353 }
354
355 $wgUser->setCookies();
356 $wgUser->saveSettings();
357
358 if( $needRedirect && $error === false ) {
359 $title = SpecialPage::getTitleFor( 'Preferences' );
360 $wgOut->redirect( $title->getFullURL( 'success' ) );
361 return;
362 }
363
364 $wgOut->parserOptions( ParserOptions::newFromUser( $wgUser ) );
365 $this->mainPrefsForm( $error === false ? 'success' : 'error', $error);
366 }
367
368 /**
369 * @access private
370 */
371 function resetPrefs() {
372 global $wgUser, $wgLang, $wgContLang, $wgContLanguageCode, $wgAllowRealName;
373
374 $this->mOldpass = $this->mNewpass = $this->mRetypePass = '';
375 $this->mUserEmail = $wgUser->getEmail();
376 $this->mUserEmailAuthenticationtimestamp = $wgUser->getEmailAuthenticationtimestamp();
377 $this->mRealName = ($wgAllowRealName) ? $wgUser->getRealName() : '';
378
379 # language value might be blank, default to content language
380 $this->mUserLanguage = $wgUser->getOption( 'language', $wgContLanguageCode );
381
382 $this->mUserVariant = $wgUser->getOption( 'variant');
383 $this->mEmailFlag = $wgUser->getOption( 'disablemail' ) == 1 ? 1 : 0;
384 $this->mNick = $wgUser->getOption( 'nickname' );
385
386 $this->mQuickbar = $wgUser->getOption( 'quickbar' );
387 $this->mSkin = Skin::normalizeKey( $wgUser->getOption( 'skin' ) );
388 $this->mMath = $wgUser->getOption( 'math' );
389 $this->mDate = $wgUser->getDatePreference();
390 $this->mRows = $wgUser->getOption( 'rows' );
391 $this->mCols = $wgUser->getOption( 'cols' );
392 $this->mStubs = $wgUser->getOption( 'stubthreshold' );
393 $this->mHourDiff = $wgUser->getOption( 'timecorrection' );
394 $this->mSearch = $wgUser->getOption( 'searchlimit' );
395 $this->mSearchLines = $wgUser->getOption( 'contextlines' );
396 $this->mSearchChars = $wgUser->getOption( 'contextchars' );
397 $this->mImageSize = $wgUser->getOption( 'imagesize' );
398 $this->mThumbSize = $wgUser->getOption( 'thumbsize' );
399 $this->mRecent = $wgUser->getOption( 'rclimit' );
400 $this->mRecentDays = $wgUser->getOption( 'rcdays' );
401 $this->mWatchlistEdits = $wgUser->getOption( 'wllimit' );
402 $this->mUnderline = $wgUser->getOption( 'underline' );
403 $this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' );
404 $this->mUseAjaxSearch = $wgUser->getBoolOption( 'ajaxsearch' );
405 $this->mDisableMWSuggest = $wgUser->getBoolOption( 'disablesuggest' );
406
407 $togs = User::getToggles();
408 foreach ( $togs as $tname ) {
409 $this->mToggles[$tname] = $wgUser->getOption( $tname );
410 }
411
412 $namespaces = $wgContLang->getNamespaces();
413 foreach ( $namespaces as $i => $namespace ) {
414 if ( $i >= NS_MAIN ) {
415 $this->mSearchNs[$i] = $wgUser->getOption( 'searchNs'.$i );
416 }
417 }
418
419 wfRunHooks( 'ResetPreferences', array( $this, $wgUser ) );
420 }
421
422 /**
423 * @access private
424 */
425 function namespacesCheckboxes() {
426 global $wgContLang;
427
428 # Determine namespace checkboxes
429 $namespaces = $wgContLang->getNamespaces();
430 $r1 = null;
431
432 foreach ( $namespaces as $i => $name ) {
433 if ($i < 0)
434 continue;
435 $checked = $this->mSearchNs[$i] ? "checked='checked'" : '';
436 $name = str_replace( '_', ' ', $namespaces[$i] );
437
438 if ( empty($name) )
439 $name = wfMsg( 'blanknamespace' );
440
441 $r1 .= "<input type='checkbox' value='1' name='wpNs$i' id='wpNs$i' {$checked}/> <label for='wpNs$i'>{$name}</label><br />\n";
442 }
443 return $r1;
444 }
445
446
447 function getToggle( $tname, $trailer = false, $disabled = false ) {
448 global $wgUser, $wgLang;
449
450 $this->mUsedToggles[$tname] = true;
451 $ttext = $wgLang->getUserToggle( $tname );
452
453 $checked = $wgUser->getOption( $tname ) == 1 ? ' checked="checked"' : '';
454 $disabled = $disabled ? ' disabled="disabled"' : '';
455 $trailer = $trailer ? $trailer : '';
456 return "<div class='toggle'><input type='checkbox' value='1' id=\"$tname\" name=\"wpOp$tname\"$checked$disabled />" .
457 " <span class='toggletext'><label for=\"$tname\">$ttext</label>$trailer</span></div>\n";
458 }
459
460 function getToggles( $items ) {
461 $out = "";
462 foreach( $items as $item ) {
463 if( $item === false )
464 continue;
465 if( is_array( $item ) ) {
466 list( $key, $trailer ) = $item;
467 } else {
468 $key = $item;
469 $trailer = false;
470 }
471 $out .= $this->getToggle( $key, $trailer );
472 }
473 return $out;
474 }
475
476 function addRow($td1, $td2) {
477 return "<tr><td class='mw-label'>$td1</td><td class='mw-input'>$td2</td></tr>";
478 }
479
480 /**
481 * Helper function for user information panel
482 * @param $td1 label for an item
483 * @param $td2 item or null
484 * @param $td3 optional help or null
485 * @return xhtml block
486 */
487 function tableRow( $td1, $td2 = null, $td3 = null ) {
488 global $wgContLang;
489
490 $align['align'] = $wgContLang->isRtl() ? 'right' : 'left';
491
492 if ( is_null( $td3 ) ) {
493 $td3 = '';
494 } else {
495 $td3 = Xml::tags( 'tr', null,
496 Xml::tags( 'td', array( 'colspan' => '2' ), $td3 )
497 );
498 }
499
500 if ( is_null( $td2 ) ) {
501 $td1 = Xml::tags( 'td', $align + array( 'colspan' => '2' ), $td1 );
502 $td2 = '';
503 } else {
504 $td1 = Xml::tags( 'td', $align, $td1 );
505 $td2 = Xml::tags( 'td', $align, $td2 );
506 }
507
508 return Xml::tags( 'tr', null, $td1 . $td2 ). $td3 . "\n";
509
510 }
511
512 /**
513 * @access private
514 */
515 function mainPrefsForm( $status , $message = '' ) {
516 global $wgUser, $wgOut, $wgLang, $wgContLang;
517 global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
518 global $wgDisableLangConversion;
519 global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
520 global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
521 global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
522 global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
523 global $wgEmailConfirmToEdit, $wgAjaxSearch, $wgEnableMWSuggest;
524
525 $wgOut->setPageTitle( wfMsg( 'preferences' ) );
526 $wgOut->setArticleRelated( false );
527 $wgOut->setRobotpolicy( 'noindex,nofollow' );
528 $wgOut->addScriptFile( 'prefs.js' );
529
530 $wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc.
531
532 if ( $this->mSuccess || 'success' == $status ) {
533 $wgOut->wrapWikiMsg( '<div class="successbox"><strong>$1</strong></div>', 'savedprefs' );
534 } else if ( 'error' == $status ) {
535 $wgOut->addWikiText( '<div class="errorbox"><strong>' . $message . '</strong></div>' );
536 } else if ( '' != $status ) {
537 $wgOut->addWikiText( $message . "\n----" );
538 }
539
540 $qbs = $wgLang->getQuickbarSettings();
541 $skinNames = $wgLang->getSkinNames();
542 $mathopts = $wgLang->getMathNames();
543 $dateopts = $wgLang->getDatePreferences();
544 $togs = User::getToggles();
545
546 $titleObj = SpecialPage::getTitleFor( 'Preferences' );
547 $action = $titleObj->escapeLocalURL();
548
549 # Pre-expire some toggles so they won't show if disabled
550 $this->mUsedToggles[ 'shownumberswatching' ] = true;
551 $this->mUsedToggles[ 'showupdated' ] = true;
552 $this->mUsedToggles[ 'enotifwatchlistpages' ] = true;
553 $this->mUsedToggles[ 'enotifusertalkpages' ] = true;
554 $this->mUsedToggles[ 'enotifminoredits' ] = true;
555 $this->mUsedToggles[ 'enotifrevealaddr' ] = true;
556 $this->mUsedToggles[ 'ccmeonemails' ] = true;
557 $this->mUsedToggles[ 'uselivepreview' ] = true;
558
559
560 if ( !$this->mEmailFlag ) { $emfc = 'checked="checked"'; }
561 else { $emfc = ''; }
562
563
564 if ($wgEmailAuthentication && ($this->mUserEmail != '') ) {
565 if( $wgUser->getEmailAuthenticationTimestamp() ) {
566 $emailauthenticated = wfMsg('emailauthenticated',$wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true ) ).'<br />';
567 $disableEmailPrefs = false;
568 } else {
569 $disableEmailPrefs = true;
570 $skin = $wgUser->getSkin();
571 $emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
572 $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ),
573 wfMsg( 'emailconfirmlink' ) ) . '<br />';
574 }
575 } else {
576 $emailauthenticated = '';
577 $disableEmailPrefs = false;
578 }
579
580 if ($this->mUserEmail == '') {
581 $emailauthenticated = wfMsg( 'noemailprefs' ) . '<br />';
582 }
583
584 $ps = $this->namespacesCheckboxes();
585
586 $enotifwatchlistpages = ($wgEnotifWatchlist) ? $this->getToggle( 'enotifwatchlistpages', false, $disableEmailPrefs ) : '';
587 $enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages', false, $disableEmailPrefs ) : '';
588 $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits', false, $disableEmailPrefs ) : '';
589 $enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr', false, $disableEmailPrefs ) : '';
590
591 # </FIXME>
592
593 $wgOut->addHTML( "<form action=\"$action\" method='post'>" );
594 $wgOut->addHTML( "<div id='preferences'>" );
595
596 # User data
597
598 $wgOut->addHTML(
599 Xml::openElement( 'fieldset ' ) .
600 Xml::element( 'legend', null, wfMsg('prefs-personal') ) .
601 Xml::openElement( 'table' ) .
602 $this->tableRow( Xml::element( 'h2', null, wfMsg( 'prefs-personal' ) ) )
603 );
604
605 $userInformationHtml =
606 $this->tableRow( wfMsgHtml( 'username' ), htmlspecialchars( $wgUser->getName() ) ) .
607 $this->tableRow( wfMsgHtml( 'uid' ), htmlspecialchars( $wgUser->getID() ) ) .
608 $this->tableRow(
609 wfMsgHtml( 'prefs-edits' ),
610 $wgLang->formatNum( User::edits( $wgUser->getId() ) )
611 );
612
613 if( wfRunHooks( 'PreferencesUserInformationPanel', array( $this, &$userInformationHtml ) ) ) {
614 $wgOut->addHtml( $userInformationHtml );
615 }
616
617 if ( $wgAllowRealName ) {
618 $wgOut->addHTML(
619 $this->tableRow(
620 Xml::label( wfMsg('yourrealname'), 'wpRealName' ),
621 Xml::input( 'wpRealName', 25, $this->mRealName, array( 'id' => 'wpRealName' ) ),
622 Xml::tags('div', array( 'class' => 'prefsectiontip' ),
623 wfMsgExt( 'prefs-help-realname', 'parseinline' )
624 )
625 )
626 );
627 }
628 if ( $wgEnableEmail ) {
629 $wgOut->addHTML(
630 $this->tableRow(
631 Xml::label( wfMsg('youremail'), 'wpUserEmail' ),
632 Xml::input( 'wpUserEmail', 25, $this->mUserEmail, array( 'id' => 'wpUserEmail' ) ),
633 Xml::tags('div', array( 'class' => 'prefsectiontip' ),
634 wfMsgExt( $wgEmailConfirmToEdit ? 'prefs-help-email-required' : 'prefs-help-email', 'parseinline' )
635 )
636 )
637 );
638 }
639
640 global $wgParser, $wgMaxSigChars;
641 if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
642 $invalidSig = $this->tableRow(
643 '&nbsp;',
644 Xml::element( 'span', array( 'class' => 'error' ),
645 wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) )
646 );
647 } elseif( !empty( $this->mToggles['fancysig'] ) &&
648 false === $wgParser->validateSig( $this->mNick ) ) {
649 $invalidSig = $this->tableRow(
650 '&nbsp;',
651 Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'badsig' ) )
652 );
653 } else {
654 $invalidSig = '';
655 }
656
657 $wgOut->addHTML(
658 $this->tableRow(
659 Xml::label( wfMsg( 'yournick' ), 'wpNick' ),
660 Xml::input( 'wpNick', 25, $this->mNick,
661 array(
662 'id' => 'wpNick',
663 // Note: $wgMaxSigChars is enforced in Unicode characters,
664 // both on the backend and now in the browser.
665 // Badly-behaved requests may still try to submit
666 // an overlong string, however.
667 'maxlength' => $wgMaxSigChars ) )
668 ) .
669 $invalidSig .
670 $this->tableRow( '&nbsp;', $this->getToggle( 'fancysig' ) )
671 );
672
673 list( $lsLabel, $lsSelect) = Xml::languageSelector( $this->mUserLanguage );
674 $wgOut->addHTML(
675 $this->tableRow( $lsLabel, $lsSelect )
676 );
677
678 /* see if there are multiple language variants to choose from*/
679 if(!$wgDisableLangConversion) {
680 $variants = $wgContLang->getVariants();
681 $variantArray = array();
682
683 $languages = Language::getLanguageNames( true );
684 foreach($variants as $v) {
685 $v = str_replace( '_', '-', strtolower($v));
686 if( array_key_exists( $v, $languages ) ) {
687 // If it doesn't have a name, we'll pretend it doesn't exist
688 $variantArray[$v] = $languages[$v];
689 }
690 }
691
692 $options = "\n";
693 foreach( $variantArray as $code => $name ) {
694 $selected = ($code == $this->mUserVariant);
695 $options .= Xml::option( "$code - $name", $code, $selected ) . "\n";
696 }
697
698 if(count($variantArray) > 1) {
699 $wgOut->addHtml(
700 $this->tableRow(
701 Xml::label( wfMsg( 'yourvariant' ), 'wpUserVariant' ),
702 Xml::tags( 'select',
703 array( 'name' => 'wpUserVariant', 'id' => 'wpUserVariant' ),
704 $options
705 )
706 )
707 );
708 }
709 }
710
711 # Password
712 if( $wgAuth->allowPasswordChange() ) {
713 $wgOut->addHTML(
714 $this->tableRow( Xml::element( 'h2', null, wfMsg( 'changepassword' ) ) ) .
715 $this->tableRow(
716 Xml::label( wfMsg( 'oldpassword' ), 'wpOldpass' ),
717 Xml::password( 'wpOldpass', 25, $this->mOldpass, array( 'id' => 'wpOldpass' ) )
718 ) .
719 $this->tableRow(
720 Xml::label( wfMsg( 'newpassword' ), 'wpNewpass' ),
721 Xml::password( 'wpNewpass', 25, $this->mNewpass, array( 'id' => 'wpNewpass' ) )
722 ) .
723 $this->tableRow(
724 Xml::label( wfMsg( 'retypenew' ), 'wpRetypePass' ),
725 Xml::password( 'wpRetypePass', 25, $this->mRetypePass, array( 'id' => 'wpRetypePass' ) )
726 ) .
727 Xml::tags( 'tr', null,
728 Xml::tags( 'td', array( 'colspan' => '2' ),
729 $this->getToggle( "rememberpassword" )
730 )
731 )
732 );
733 }
734
735 # <FIXME>
736 # Enotif
737 if ( $wgEnableEmail ) {
738
739 $moreEmail = '';
740 if ($wgEnableUserEmail) {
741 // fixme -- the "allowemail" pseudotoggle is a hacked-together
742 // inversion for the "disableemail" preference.
743 $emf = wfMsg( 'allowemail' );
744 $disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
745 $moreEmail =
746 "<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>" .
747 $this->getToggle( 'ccmeonemails', '', $disableEmailPrefs );
748 }
749
750
751 $wgOut->addHTML(
752 $this->tableRow( Xml::element( 'h2', null, wfMsg( 'email' ) ) ) .
753 $this->tableRow(
754 $emailauthenticated.
755 $enotifrevealaddr.
756 $enotifwatchlistpages.
757 $enotifusertalkpages.
758 $enotifminoredits.
759 $moreEmail
760 )
761 );
762 }
763 # </FIXME>
764
765 $wgOut->addHTML(
766 Xml::closeElement( 'table' ) .
767 Xml::closeElement( 'fieldset' )
768 );
769
770
771 # Quickbar
772 #
773 if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') {
774 $wgOut->addHtml( "<fieldset>\n<legend>" . wfMsg( 'qbsettings' ) . "</legend>\n" );
775 for ( $i = 0; $i < count( $qbs ); ++$i ) {
776 if ( $i == $this->mQuickbar ) { $checked = ' checked="checked"'; }
777 else { $checked = ""; }
778 $wgOut->addHTML( "<div><label><input type='radio' name='wpQuickbar' value=\"$i\"$checked />{$qbs[$i]}</label></div>\n" );
779 }
780 $wgOut->addHtml( "</fieldset>\n\n" );
781 } else {
782 # Need to output a hidden option even if the relevant skin is not in use,
783 # otherwise the preference will get reset to 0 on submit
784 $wgOut->addHtml( wfHidden( 'wpQuickbar', $this->mQuickbar ) );
785 }
786
787 # Skin
788 #
789 $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" );
790 $mptitle = Title::newMainPage();
791 $previewtext = wfMsg('skinpreview');
792 # Only show members of Skin::getSkinNames() rather than
793 # $skinNames (skins is all skin names from Language.php)
794 $validSkinNames = Skin::getSkinNames();
795 # Sort by UI skin name. First though need to update validSkinNames as sometimes
796 # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
797 foreach ($validSkinNames as $skinkey => & $skinname ) {
798 if ( isset( $skinNames[$skinkey] ) ) {
799 $skinname = $skinNames[$skinkey];
800 }
801 }
802 asort($validSkinNames);
803 foreach ($validSkinNames as $skinkey => $sn ) {
804 if ( in_array( $skinkey, $wgSkipSkins ) ) {
805 continue;
806 }
807 $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
808
809 $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
810 $previewlink = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
811 if( $skinkey == $wgDefaultSkin )
812 $sn .= ' (' . wfMsg( 'default' ) . ')';
813 $wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br />\n" );
814 }
815 $wgOut->addHTML( "</fieldset>\n\n" );
816
817 # Math
818 #
819 global $wgUseTeX;
820 if( $wgUseTeX ) {
821 $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
822 foreach ( $mathopts as $k => $v ) {
823 $checked = ($k == $this->mMath);
824 $wgOut->addHTML(
825 Xml::openElement( 'div' ) .
826 Xml::radioLabel( wfMsg( $v ), 'wpMath', $k, "mw-sp-math-$k", $checked ) .
827 Xml::closeElement( 'div' ) . "\n"
828 );
829 }
830 $wgOut->addHTML( "</fieldset>\n\n" );
831 }
832
833 # Files
834 #
835 $wgOut->addHTML(
836 "<fieldset>\n" . Xml::element( 'legend', null, wfMsg( 'files' ) ) . "\n"
837 );
838
839 $imageLimitOptions = null;
840 foreach ( $wgImageLimits as $index => $limits ) {
841 $selected = ($index == $this->mImageSize);
842 $imageLimitOptions .= Xml::option( "{$limits[0]}×{$limits[1]}" .
843 wfMsg('unit-pixel'), $index, $selected );
844 }
845
846 $imageSizeId = 'wpImageSize';
847 $wgOut->addHTML(
848 "<div>" . Xml::label( wfMsg('imagemaxsize'), $imageSizeId ) . " " .
849 Xml::openElement( 'select', array( 'name' => $imageSizeId, 'id' => $imageSizeId ) ) .
850 $imageLimitOptions .
851 Xml::closeElement( 'select' ) . "</div>\n"
852 );
853
854 $imageThumbOptions = null;
855 foreach ( $wgThumbLimits as $index => $size ) {
856 $selected = ($index == $this->mThumbSize);
857 $imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index,
858 $selected);
859 }
860
861 $thumbSizeId = 'wpThumbSize';
862 $wgOut->addHTML(
863 "<div>" . Xml::label( wfMsg('thumbsize'), $thumbSizeId ) . " " .
864 Xml::openElement( 'select', array( 'name' => $thumbSizeId, 'id' => $thumbSizeId ) ) .
865 $imageThumbOptions .
866 Xml::closeElement( 'select' ) . "</div>\n"
867 );
868
869 $wgOut->addHTML( "</fieldset>\n\n" );
870
871 # Date format
872 #
873 # Date/Time
874 #
875
876 $wgOut->addHTML(
877 Xml::openElement( 'fieldset' ) .
878 Xml::element( 'legend', null, wfMsg( 'datetime' ) ) . "\n"
879 );
880
881 if ($dateopts) {
882 $wgOut->addHTML(
883 Xml::openElement( 'fieldset' ) .
884 Xml::element( 'legend', null, wfMsg( 'dateformat' ) ) . "\n"
885 );
886 $idCnt = 0;
887 $epoch = '20010115161234'; # Wikipedia day
888 foreach( $dateopts as $key ) {
889 if( $key == 'default' ) {
890 $formatted = wfMsg( 'datedefault' );
891 } else {
892 $formatted = $wgLang->timeanddate( $epoch, false, $key );
893 }
894 $wgOut->addHTML(
895 Xml::tags( 'div', null,
896 Xml::radioLabel( $formatted, 'wpDate', $key, "wpDate$idCnt", $key == $this->mDate )
897 ) . "\n"
898 );
899 $idCnt++;
900 }
901 $wgOut->addHTML( Xml::closeElement( 'fieldset' ) . "\n" );
902 }
903
904 $nowlocal = $wgLang->time( $now = wfTimestampNow(), true );
905 $nowserver = $wgLang->time( $now, false );
906
907 $wgOut->addHTML(
908 Xml::openElement( 'fieldset' ) .
909 Xml::element( 'legend', null, wfMsg( 'timezonelegend' ) ) .
910 Xml::openElement( 'table' ) .
911 $this->addRow( wfMsg( 'servertime' ), $nowserver ) .
912 $this->addRow( wfMsg( 'localtime' ), $nowlocal ) .
913 $this->addRow(
914 Xml::label( wfMsg( 'timezoneoffset' ), 'wpHourDiff' ),
915 Xml::input( 'wpHourDiff', 6, $this->mHourDiff, array( 'id' => 'wpHourDiff' ) ) ) .
916 "<tr>
917 <td></td>
918 <td class='mw-submit'>" .
919 Xml::element( 'input',
920 array( 'type' => 'button',
921 'value' => wfMsg( 'guesstimezone' ),
922 'onclick' => 'javascript:guessTimezone()',
923 'id' => 'guesstimezonebutton',
924 'style' => 'display:none;' ) ) .
925 "</td>
926 </tr>" .
927 Xml::closeElement( 'table' ) .
928 Xml::tags( 'div', array( 'class' => 'prefsectiontip' ), wfMsgExt( 'timezonetext', 'parseinline' ) ).
929 Xml::closeElement( 'fieldset' ) .
930 Xml::closeElement( 'fieldset' ) . "\n\n"
931 );
932
933 # Editing
934 #
935 global $wgLivePreview;
936 $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'textboxsize' ) . '</legend>
937 <div>' .
938 wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) .
939 ' ' .
940 wfInputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols ) .
941 "</div>" .
942 $this->getToggles( array(
943 'editsection',
944 'editsectiononrightclick',
945 'editondblclick',
946 'editwidth',
947 'showtoolbar',
948 'previewonfirst',
949 'previewontop',
950 'minordefault',
951 'externaleditor',
952 'externaldiff',
953 $wgLivePreview ? 'uselivepreview' : false,
954 'forceeditsummary',
955 ) ) . '</fieldset>'
956 );
957
958 # Recent changes
959 $wgOut->addHtml( '<fieldset><legend>' . wfMsgHtml( 'prefs-rc' ) . '</legend>' );
960
961 $rc = '<table><tr>';
962 $rc .= '<td>' . Xml::label( wfMsg( 'recentchangesdays' ), 'wpRecentDays' ) . '</td>';
963 $rc .= '<td>' . Xml::input( 'wpRecentDays', 3, $this->mRecentDays, array( 'id' => 'wpRecentDays' ) ) . '</td>';
964 $rc .= '</tr><tr>';
965 $rc .= '<td>' . Xml::label( wfMsg( 'recentchangescount' ), 'wpRecent' ) . '</td>';
966 $rc .= '<td>' . Xml::input( 'wpRecent', 3, $this->mRecent, array( 'id' => 'wpRecent' ) ) . '</td>';
967 $rc .= '</tr></table>';
968 $wgOut->addHtml( $rc );
969
970 $wgOut->addHtml( '<br />' );
971
972 $toggles[] = 'hideminor';
973 if( $wgRCShowWatchingUsers )
974 $toggles[] = 'shownumberswatching';
975 $toggles[] = 'usenewrc';
976 $wgOut->addHtml( $this->getToggles( $toggles ) );
977
978 $wgOut->addHtml( '</fieldset>' );
979
980 # Watchlist
981 $wgOut->addHtml( '<fieldset><legend>' . wfMsgHtml( 'prefs-watchlist' ) . '</legend>' );
982
983 $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-days' ), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays ) );
984 $wgOut->addHtml( '<br /><br />' );
985
986 $wgOut->addHtml( $this->getToggle( 'extendwatchlist' ) );
987 $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) );
988 $wgOut->addHtml( '<br /><br />' );
989
990 $wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'watchlisthideminor' ) ) );
991
992 if( $wgUser->isAllowed( 'createpage' ) || $wgUser->isAllowed( 'createtalk' ) )
993 $wgOut->addHtml( $this->getToggle( 'watchcreations' ) );
994 foreach( array( 'edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion' ) as $action => $toggle ) {
995 if( $wgUser->isAllowed( $action ) )
996 $wgOut->addHtml( $this->getToggle( $toggle ) );
997 }
998 $this->mUsedToggles['watchcreations'] = true;
999 $this->mUsedToggles['watchdefault'] = true;
1000 $this->mUsedToggles['watchmoves'] = true;
1001 $this->mUsedToggles['watchdeletion'] = true;
1002
1003 $wgOut->addHtml( '</fieldset>' );
1004
1005 # Search
1006 $ajaxsearch = $wgAjaxSearch ?
1007 $this->addRow(
1008 Xml::label( wfMsg( 'useajaxsearch' ), 'wpUseAjaxSearch' ),
1009 Xml::check( 'wpUseAjaxSearch', $this->mUseAjaxSearch, array( 'id' => 'wpUseAjaxSearch' ) )
1010 ) : '';
1011 $mwsuggest = $wgEnableMWSuggest ?
1012 $this->addRow(
1013 Xml::label( wfMsg( 'mwsuggest-disable' ), 'wpDisableMWSuggest' ),
1014 Xml::check( 'wpDisableMWSuggest', $this->mDisableMWSuggest, array( 'id' => 'wpDisableMWSuggest' ) )
1015 ) : '';
1016 $wgOut->addHTML(
1017 Xml::openElement( 'fieldset' ) .
1018 Xml::element( 'legend', null, wfMsg( 'searchresultshead' ) ) .
1019 Xml::openElement( 'table' ) .
1020 $ajaxsearch .
1021 $this->addRow(
1022 Xml::label( wfMsg( 'resultsperpage' ), 'wpSearch' ),
1023 Xml::input( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) )
1024 ) .
1025 $this->addRow(
1026 Xml::label( wfMsg( 'contextlines' ), 'wpSearchLines' ),
1027 Xml::input( 'wpSearchLines', 4, $this->mSearchLines, array( 'id' => 'wpSearchLines' ) )
1028 ) .
1029 $this->addRow(
1030 Xml::label( wfMsg( 'contextchars' ), 'wpSearchChars' ),
1031 Xml::input( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) )
1032 ) .
1033 $mwsuggest .
1034 Xml::closeElement( 'table' ) .
1035 Xml::openElement( 'fieldset' ) .
1036 Xml::element( 'legend', null, wfMsg( 'defaultns' ) ) .
1037 $ps .
1038 Xml::closeElement( 'fieldset' ) .
1039 Xml::closeElement( 'fieldset' )
1040 );
1041
1042 # Misc
1043 #
1044 $wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') . '</legend>');
1045 $wgOut->addHtml( '<label for="wpStubs">' . wfMsg( 'stub-threshold' ) . '</label>&nbsp;' );
1046 $wgOut->addHtml( Xml::input( 'wpStubs', 6, $this->mStubs, array( 'id' => 'wpStubs' ) ) );
1047 $msgUnderline = htmlspecialchars( wfMsg ( 'tog-underline' ) );
1048 $msgUnderlinenever = htmlspecialchars( wfMsg ( 'underline-never' ) );
1049 $msgUnderlinealways = htmlspecialchars( wfMsg ( 'underline-always' ) );
1050 $msgUnderlinedefault = htmlspecialchars( wfMsg ( 'underline-default' ) );
1051 $uopt = $wgUser->getOption("underline");
1052 $s0 = $uopt == 0 ? ' selected="selected"' : '';
1053 $s1 = $uopt == 1 ? ' selected="selected"' : '';
1054 $s2 = $uopt == 2 ? ' selected="selected"' : '';
1055 $wgOut->addHTML("
1056 <div class='toggle'><p><label for='wpOpunderline'>$msgUnderline</label>
1057 <select name='wpOpunderline' id='wpOpunderline'>
1058 <option value=\"0\"$s0>$msgUnderlinenever</option>
1059 <option value=\"1\"$s1>$msgUnderlinealways</option>
1060 <option value=\"2\"$s2>$msgUnderlinedefault</option>
1061 </select></p></div>");
1062
1063 foreach ( $togs as $tname ) {
1064 if( !array_key_exists( $tname, $this->mUsedToggles ) ) {
1065 $wgOut->addHTML( $this->getToggle( $tname ) );
1066 }
1067 }
1068 $wgOut->addHTML( '</fieldset>' );
1069
1070 wfRunHooks( 'RenderPreferencesForm', array( $this, $wgOut ) );
1071
1072 $token = htmlspecialchars( $wgUser->editToken() );
1073 $skin = $wgUser->getSkin();
1074 $wgOut->addHTML( "
1075 <div id='prefsubmit'>
1076 <div>
1077 <input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) . '"'.$skin->tooltipAndAccesskey('save')." />
1078 <input type='submit' name='wpReset' value=\"" . wfMsgHtml( 'resetprefs' ) . "\" />
1079 </div>
1080
1081 </div>
1082
1083 <input type='hidden' name='wpEditToken' value=\"{$token}\" />
1084 </div></form>\n" );
1085
1086 $wgOut->addHtml( Xml::tags( 'div', array( 'class' => "prefcache" ),
1087 wfMsgExt( 'clearyourcache', 'parseinline' ) )
1088 );
1089 }
1090 }