Index: trunk/extensions/EditUser/EditUser_body.php |
— | — | @@ -1,25 +1,26 @@ |
2 | 2 | <?php |
3 | | -/** |
4 | | - * Shamelessly copied + modified from SpecialPreferences.php (best way to change them, after all ^_^) |
5 | | - */ |
6 | | - |
| 3 | +/* Shamelessly copied and modified from /includes/specials/SpecialPreferences.php */ |
7 | 4 | class EditUser extends SpecialPage { |
8 | | - var $mQuickbar, $mNewpass, $mRetypePass, $mStubs; |
| 5 | + var $mQuickbar, $mOldpass, $mNewpass, $mRetypePass, $mStubs; |
9 | 6 | var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick; |
10 | 7 | var $mUserLanguage, $mUserVariant; |
11 | 8 | var $mSearch, $mRecent, $mRecentDays, $mHourDiff, $mSearchLines, $mSearchChars, $mAction; |
12 | 9 | var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize; |
13 | 10 | var $mUnderline, $mWatchlistEdits; |
| 11 | + var $user, $target, $mLogout; |
14 | 12 | |
15 | | - public function __construct() { |
| 13 | + function __construct() { |
16 | 14 | SpecialPage::SpecialPage('EditUser', 'edituser'); |
17 | 15 | } |
18 | | - |
| 16 | + /** |
| 17 | + * Constructor |
| 18 | + * Load some values |
| 19 | + */ |
19 | 20 | function loadGlobals( $par ) { |
20 | | - global $wgContLang, $wgAllowRealName, $wgUser, $wgRequest, $wgOut; |
| 21 | + global $wgContLang, $wgAllowRealName, $wgRequest; |
| 22 | + $request = $wgRequest; |
21 | 23 | $this->user = User::newFromName($par); |
22 | 24 | $this->user->load(); |
23 | | - $request = $wgRequest; |
24 | 25 | $this->mQuickbar = $request->getVal( 'wpQuickbar' ); |
25 | 26 | $this->mNewpass = $request->getVal( 'wpNewpass' ); |
26 | 27 | $this->mRetypePass =$request->getVal( 'wpRetypePass' ); |
— | — | @@ -50,12 +51,12 @@ |
51 | 52 | $this->mSuccess = $request->getCheck( 'success' ); |
52 | 53 | $this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' ); |
53 | 54 | $this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' ); |
54 | | - |
| 55 | + $this->mDisableMWSuggest = $request->getCheck( 'wpDisableMWSuggest' ); |
| 56 | + $this->mLogout = $request->getCheck( 'wpLogout' ) && $this->mPosted; |
55 | 57 | $this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) && |
56 | 58 | $this->mPosted && |
57 | | - $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) ); |
| 59 | + $this->user->matchEditToken( $request->getVal( 'wpEditToken' ) ); |
58 | 60 | |
59 | | - $this->mLogout = $request->getCheck( 'wpLogout' ) && $this->mPosted; |
60 | 61 | # User toggles (the big ugly unsorted list of checkboxes) |
61 | 62 | $this->mToggles = array(); |
62 | 63 | if ( $this->mPosted ) { |
— | — | @@ -85,7 +86,6 @@ |
86 | 87 | } |
87 | 88 | |
88 | 89 | wfRunHooks( 'InitPreferencesForm', array( $this, $request ) ); |
89 | | - return true; |
90 | 90 | } |
91 | 91 | |
92 | 92 | public function execute( $par ) { |
— | — | @@ -98,11 +98,11 @@ |
99 | 99 | wfLoadExtensionMessages( 'EditUser' ); |
100 | 100 | |
101 | 101 | $this->setHeaders(); |
102 | | - if(!isset($par)) |
| 102 | + $this->target = (isset($par)) ? $par : $wgRequest->getText('username', ''); |
| 103 | + if($this->target === '') { |
103 | 104 | $wgOut->addHtml($this->makeSearchForm()); |
104 | | - $this->target = (isset($par)) ? $par : $wgRequest->getText('username', ''); |
105 | | - if($this->target === '') |
106 | 105 | return; |
| 106 | + } |
107 | 107 | $targetuser = User::NewFromName( $this->target ); |
108 | 108 | if( $targetuser->getID() == 0 ) { |
109 | 109 | $wgOut->addWikiText( wfMsg( 'edituser-nouser' ) ); |
— | — | @@ -113,6 +113,7 @@ |
114 | 114 | return; |
115 | 115 | } |
116 | 116 | $this->loadGlobals($this->target); |
| 117 | + $wgOut->addHtml($this->makeSearchForm()); |
117 | 118 | $wgOut->addHtml('<br />'); |
118 | 119 | if ( wfReadOnly() ) { |
119 | 120 | $wgOut->readOnlyPage(); |
— | — | @@ -156,7 +157,7 @@ |
157 | 158 | function validateIntOrNull( &$val, $min=0, $max=0x7fffffff ) { |
158 | 159 | $val = trim($val); |
159 | 160 | if($val === '') { |
160 | | - return $val; |
| 161 | + return null; |
161 | 162 | } else { |
162 | 163 | return $this->validateInt( $val, $min, $max ); |
163 | 164 | } |
— | — | @@ -213,13 +214,13 @@ |
214 | 215 | * @access private |
215 | 216 | */ |
216 | 217 | function savePreferences() { |
217 | | - global $wgOut, $wgParser; |
| 218 | + global $wgUser, $wgOut, $wgParser; |
218 | 219 | global $wgEnableUserEmail, $wgEnableEmail; |
219 | 220 | global $wgEmailAuthentication, $wgRCMaxAge; |
220 | 221 | global $wgAuth, $wgEmailConfirmToEdit; |
221 | 222 | |
222 | 223 | |
223 | | - if ( '' != $this->mNewpass && $wgAuth->allowPasswordChange() ) { |
| 224 | + if ( $this->mNewpass !== '' && $wgAuth->allowPasswordChange() ) { |
224 | 225 | if ( $this->mNewpass != $this->mRetypePass ) { |
225 | 226 | wfRunHooks( 'PrefsPasswordAudit', array( $this->user, $this->mNewpass, 'badretype' ) ); |
226 | 227 | $this->mainPrefsForm( 'error', wfMsg( 'badretype' ) ); |
— | — | @@ -229,7 +230,7 @@ |
230 | 231 | try { |
231 | 232 | $this->user->setPassword( $this->mNewpass ); |
232 | 233 | wfRunHooks( 'PrefsPasswordAudit', array( $this->user, $this->mNewpass, 'success' ) ); |
233 | | - $this->mNewpass = $this->mRetypePass = ''; |
| 234 | + $this->mNewpass = $this->mOldpass = $this->mRetypePass = ''; |
234 | 235 | } catch( PasswordError $e ) { |
235 | 236 | wfRunHooks( 'PrefsPasswordAudit', array( $this->user, $this->mNewpass, 'error' ) ); |
236 | 237 | $this->mainPrefsForm( 'error', $e->getMessage() ); |
— | — | @@ -237,6 +238,7 @@ |
238 | 239 | } |
239 | 240 | } |
240 | 241 | $this->user->setRealName( $this->mRealName ); |
| 242 | + $oldOptions = $this->user->mOptions; |
241 | 243 | |
242 | 244 | if( $this->user->getOption( 'language' ) !== $this->mUserLanguage ) { |
243 | 245 | $needRedirect = true; |
— | — | @@ -249,7 +251,7 @@ |
250 | 252 | if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) { |
251 | 253 | global $wgLang; |
252 | 254 | $this->mainPrefsForm( 'error', |
253 | | - wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) ); |
| 255 | + wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) ); |
254 | 256 | return; |
255 | 257 | } elseif( $this->mToggles['fancysig'] ) { |
256 | 258 | if( $wgParser->validateSig( $this->mNick ) !== false ) { |
— | — | @@ -287,6 +289,7 @@ |
288 | 290 | $this->user->setOption( 'thumbsize', $this->mThumbSize ); |
289 | 291 | $this->user->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) ); |
290 | 292 | $this->user->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) ); |
| 293 | + $this->user->setOption( 'disablesuggest', $this->mDisableMWSuggest ); |
291 | 294 | |
292 | 295 | # Set search namespace options |
293 | 296 | foreach( $this->mSearchNs as $i => $value ) { |
— | — | @@ -309,8 +312,10 @@ |
310 | 313 | if( ($newadr != '') && ($newadr != $oldadr) ) { |
311 | 314 | # the user has supplied a new email address on the login page |
312 | 315 | if( $this->user->isValidEmailAddr( $newadr ) ) { |
313 | | - $this->user->mEmail = $newadr; # new behaviour: set this new emailaddr from login-page into user database record |
314 | | - $this->user->mEmailAuthenticated = wfTimestampNow(); #automatically emailconfirm them |
| 316 | + # new behaviour: set this new emailaddr from login-page into user database record |
| 317 | + $this->user->setEmail( $newadr ); |
| 318 | + # auto-authenticate it |
| 319 | + $this->user->confirmEmail(); |
315 | 320 | } else { |
316 | 321 | $error = wfMsg( 'invalidemailaddress' ); |
317 | 322 | } |
— | — | @@ -326,14 +331,13 @@ |
327 | 332 | } |
328 | 333 | } |
329 | 334 | |
330 | | - if (!$wgAuth->updateExternalDB($this->user)) { |
| 335 | + if( !$wgAuth->updateExternalDB( $this->user ) ){ |
331 | 336 | $this->mainPrefsForm( 'error', wfMsg( 'externaldberror' ) ); |
332 | 337 | return; |
333 | 338 | } |
334 | 339 | |
335 | 340 | $msg = ''; |
336 | | - if ( !wfRunHooks( 'SavePreferences', array( $this, $this->user, &$msg ) ) ) { |
337 | | - print "(($msg))"; |
| 341 | + if ( !wfRunHooks( 'SavePreferences', array( $this, $this->user, &$msg, $oldOptions ) ) ) { |
338 | 342 | $this->mainPrefsForm( 'error', $msg ); |
339 | 343 | return; |
340 | 344 | } |
— | — | @@ -342,11 +346,11 @@ |
343 | 347 | |
344 | 348 | if( $needRedirect && $error === false ) { |
345 | 349 | $title = SpecialPage::getTitleFor( 'Preferences' ); |
346 | | - $wgOut->redirect($title->getFullURL('success')); |
| 350 | + $wgOut->redirect( $title->getFullURL( 'success' ) ); |
347 | 351 | return; |
348 | 352 | } |
349 | 353 | |
350 | | - $wgOut->setParserOptions( ParserOptions::newFromUser( $this->user ) ); |
| 354 | + $wgOut->parserOptions( ParserOptions::newFromUser( $this->user ) ); |
351 | 355 | $this->mainPrefsForm( $error === false ? 'success' : 'error', $error); |
352 | 356 | } |
353 | 357 | |
— | — | @@ -354,7 +358,7 @@ |
355 | 359 | * @access private |
356 | 360 | */ |
357 | 361 | function resetPrefs() { |
358 | | - global $wgLang, $wgContLang, $wgContLanguageCode, $wgAllowRealName; |
| 362 | + global $wgUser, $wgLang, $wgContLang, $wgContLanguageCode, $wgAllowRealName; |
359 | 363 | |
360 | 364 | $this->mNewpass = $this->mRetypePass = ''; |
361 | 365 | $this->mUserEmail = $this->user->getEmail(); |
— | — | @@ -386,6 +390,7 @@ |
387 | 391 | $this->mWatchlistEdits = $this->user->getOption( 'wllimit' ); |
388 | 392 | $this->mUnderline = $this->user->getOption( 'underline' ); |
389 | 393 | $this->mWatchlistDays = $this->user->getOption( 'watchlistdays' ); |
| 394 | + $this->mDisableMWSuggest = $this->user->getBoolOption( 'disablesuggest' ); |
390 | 395 | |
391 | 396 | $togs = User::getToggles(); |
392 | 397 | foreach ( $togs as $tname ) { |
— | — | @@ -428,7 +433,7 @@ |
429 | 434 | |
430 | 435 | |
431 | 436 | function getToggle( $tname, $trailer = false, $disabled = false ) { |
432 | | - global $wgLang; |
| 437 | + global $wgUser, $wgLang; |
433 | 438 | |
434 | 439 | $this->mUsedToggles[$tname] = true; |
435 | 440 | $ttext = $wgLang->getUserToggle( $tname ); |
— | — | @@ -457,7 +462,7 @@ |
458 | 463 | } |
459 | 464 | |
460 | 465 | function addRow($td1, $td2) { |
461 | | - return "<tr><td align='right'>$td1</td><td align='left'>$td2</td></tr>"; |
| 466 | + return "<tr><td class='mw-label'>$td1</td><td class='mw-input'>$td2</td></tr>"; |
462 | 467 | } |
463 | 468 | |
464 | 469 | /** |
— | — | @@ -468,24 +473,21 @@ |
469 | 474 | * @return xhtml block |
470 | 475 | */ |
471 | 476 | function tableRow( $td1, $td2 = null, $td3 = null ) { |
472 | | - global $wgContLang; |
473 | 477 | |
474 | | - $align['align'] = $wgContLang->isRtl() ? 'right' : 'left'; |
475 | | - |
476 | 478 | if ( is_null( $td3 ) ) { |
477 | 479 | $td3 = ''; |
478 | 480 | } else { |
479 | 481 | $td3 = Xml::tags( 'tr', null, |
480 | | - Xml::tags( 'td', array( 'colspan' => '2' ), $td3 ) |
| 482 | + Xml::tags( 'td', array( 'class' => 'pref-label', 'colspan' => '2' ), $td3 ) |
481 | 483 | ); |
482 | 484 | } |
483 | 485 | |
484 | 486 | if ( is_null( $td2 ) ) { |
485 | | - $td1 = Xml::tags( 'td', $align + array( 'colspan' => '2' ), $td1 ); |
| 487 | + $td1 = Xml::tags( 'td', array( 'class' => 'pref-label', 'colspan' => '2' ), $td1 ); |
486 | 488 | $td2 = ''; |
487 | 489 | } else { |
488 | | - $td1 = Xml::tags( 'td', $align, $td1 ); |
489 | | - $td2 = Xml::tags( 'td', $align, $td2 ); |
| 490 | + $td1 = Xml::tags( 'td', array( 'class' => 'pref-label' ), $td1 ); |
| 491 | + $td2 = Xml::tags( 'td', array( 'class' => 'pref-input' ), $td2 ); |
490 | 492 | } |
491 | 493 | |
492 | 494 | return Xml::tags( 'tr', null, $td1 . $td2 ). $td3 . "\n"; |
— | — | @@ -496,27 +498,25 @@ |
497 | 499 | * @access private |
498 | 500 | */ |
499 | 501 | function mainPrefsForm( $status , $message = '' ) { |
500 | | - global $wgOut, $wgLang, $wgContLang; |
| 502 | + global $wgUser, $wgOut, $wgLang, $wgContLang, $wgAuth; |
501 | 503 | global $wgAllowRealName, $wgImageLimits, $wgThumbLimits; |
502 | | - global $wgDisableLangConversion; |
| 504 | + global $wgDisableLangConversion, $wgDisableTitleConversion; |
503 | 505 | global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits; |
504 | 506 | global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress; |
505 | 507 | global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication; |
506 | | - global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth; |
507 | | - global $wgEmailConfirmToEdit; |
| 508 | + global $wgContLanguageCode, $wgDefaultSkin, $wgCookieExpiration; |
| 509 | + global $wgEmailConfirmToEdit, $wgEnableMWSuggest; |
508 | 510 | |
509 | | - $wgOut->setPageTitle( wfMsg( 'edituser' ) ); |
510 | | - $wgOut->setArticleRelated( false ); |
511 | | - $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
| 511 | + $wgOut->addScriptFile( 'prefs.js' ); |
512 | 512 | |
513 | 513 | $wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc. |
514 | 514 | |
515 | 515 | if ( $this->mSuccess || 'success' == $status ) { |
516 | | - $wgOut->addWikitext( '<div class="successbox"><strong>'. wfMsg( 'savedprefs' ) . '</strong></div>' ); |
| 516 | + $wgOut->wrapWikiMsg( '<div class="successbox"><strong>$1</strong></div>', 'savedprefs' ); |
517 | 517 | } else if ( 'error' == $status ) { |
518 | | - $wgOut->addWikitext( '<div class="errorbox"><strong>' . $message . '</strong></div>' ); |
| 518 | + $wgOut->addWikiText( '<div class="errorbox"><strong>' . $message . '</strong></div>' ); |
519 | 519 | } else if ( '' != $status ) { |
520 | | - $wgOut->addWikitext( $message . "\n----" ); |
| 520 | + $wgOut->addWikiText( $message . "\n----" ); |
521 | 521 | } |
522 | 522 | |
523 | 523 | $qbs = $wgLang->getQuickbarSettings(); |
— | — | @@ -526,7 +526,6 @@ |
527 | 527 | $togs = User::getToggles(); |
528 | 528 | |
529 | 529 | $titleObj = SpecialPage::getTitleFor( 'EditUser' ); |
530 | | - $action = $titleObj->escapeLocalURL(); |
531 | 530 | |
532 | 531 | # Pre-expire some toggles so they won't show if disabled |
533 | 532 | $this->mUsedToggles[ 'shownumberswatching' ] = true; |
— | — | @@ -537,6 +536,7 @@ |
538 | 537 | $this->mUsedToggles[ 'enotifrevealaddr' ] = true; |
539 | 538 | $this->mUsedToggles[ 'ccmeonemails' ] = true; |
540 | 539 | $this->mUsedToggles[ 'uselivepreview' ] = true; |
| 540 | + $this->mUsedToggles[ 'noconvertlink' ] = true; |
541 | 541 | |
542 | 542 | |
543 | 543 | if ( !$this->mEmailFlag ) { $emfc = 'checked="checked"'; } |
— | — | @@ -545,7 +545,13 @@ |
546 | 546 | |
547 | 547 | if ($wgEmailAuthentication && ($this->mUserEmail != '') ) { |
548 | 548 | if( $this->user->getEmailAuthenticationTimestamp() ) { |
549 | | - $emailauthenticated = wfMsg('emailauthenticated',$wgLang->timeanddate($this->user->getEmailAuthenticationTimestamp(), true ) ).'<br />'; |
| 549 | + // date and time are separate parameters to facilitate localisation. |
| 550 | + // $time is kept for backward compat reasons. |
| 551 | + // 'emailauthenticated' is also used in SpecialConfirmemail.php |
| 552 | + $time = $wgLang->timeAndDate( $this->user->getEmailAuthenticationTimestamp(), true ); |
| 553 | + $d = $wgLang->date( $this->user->getEmailAuthenticationTimestamp(), true ); |
| 554 | + $t = $wgLang->time( $this->user->getEmailAuthenticationTimestamp(), true ); |
| 555 | + $emailauthenticated = wfMsg('emailauthenticated', $time, $d, $t ).'<br />'; |
550 | 556 | $disableEmailPrefs = false; |
551 | 557 | } else { |
552 | 558 | $disableEmailPrefs = true; |
— | — | @@ -572,24 +578,55 @@ |
573 | 579 | |
574 | 580 | # </FIXME> |
575 | 581 | |
576 | | - $wgOut->addHTML( "<form action=\"$action\" method='post'>" ); |
577 | | - $wgOut->addHTML( "<div id='preferences'>" ); |
| 582 | + $wgOut->addHTML( |
| 583 | + Xml::openElement( 'form', array( |
| 584 | + 'action' => $titleObj->getLocalUrl(), |
| 585 | + 'method' => 'post', |
| 586 | + 'id' => 'mw-preferences-form', |
| 587 | + ) ) . |
| 588 | + Xml::openElement( 'div', array( 'id' => 'preferences' ) ) |
| 589 | + ); |
578 | 590 | |
579 | 591 | # User data |
580 | 592 | |
581 | 593 | $wgOut->addHTML( |
582 | | - Xml::openElement( 'fieldset ' ) . |
583 | | - Xml::element( 'legend', null, wfMsg('prefs-personal') ) . |
| 594 | + Xml::fieldset( wfMsg('prefs-personal') ) . |
584 | 595 | Xml::openElement( 'table' ) . |
585 | 596 | $this->tableRow( Xml::element( 'h2', null, wfMsg( 'prefs-personal' ) ) ) |
586 | 597 | ); |
587 | 598 | |
| 599 | + # Get groups to which the user belongs |
| 600 | + $userEffectiveGroups = $this->user->getEffectiveGroups(); |
| 601 | + $userEffectiveGroupsArray = array(); |
| 602 | + foreach( $userEffectiveGroups as $ueg ) { |
| 603 | + if( $ueg == '*' ) { |
| 604 | + // Skip the default * group, seems useless here |
| 605 | + continue; |
| 606 | + } |
| 607 | + $userEffectiveGroupsArray[] = User::makeGroupLinkHTML( $ueg ); |
| 608 | + } |
| 609 | + asort( $userEffectiveGroupsArray ); |
| 610 | + |
| 611 | + $sk = $this->user->getSkin(); |
| 612 | + $toolLinks = array(); |
| 613 | + $toolLinks[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'ListGroupRights' ), wfMsg( 'listgrouprights' ) ); |
| 614 | + # At the moment one tool link only but be prepared for the future... |
| 615 | + # FIXME: Add a link to Special:Userrights for users who are allowed to use it. |
| 616 | + # $wgUser->isAllowed( 'userrights' ) seems to strict in some cases |
| 617 | + |
588 | 618 | $userInformationHtml = |
589 | 619 | $this->tableRow( wfMsgHtml( 'username' ), htmlspecialchars( $this->user->getName() ) ) . |
590 | | - $this->tableRow( wfMsgHtml( 'uid' ), htmlspecialchars( $this->user->getID() ) ) . |
| 620 | + $this->tableRow( wfMsgHtml( 'uid' ), $wgLang->formatNum( htmlspecialchars( $this->user->getId() ) ) ). |
| 621 | + |
591 | 622 | $this->tableRow( |
| 623 | + wfMsgExt( 'prefs-memberingroups', array( 'parseinline' ), count( $userEffectiveGroupsArray ) ), |
| 624 | + $wgLang->commaList( $userEffectiveGroupsArray ) . |
| 625 | + '<br />(' . implode( ' | ', $toolLinks ) . ')' |
| 626 | + ) . |
| 627 | + |
| 628 | + $this->tableRow( |
592 | 629 | wfMsgHtml( 'prefs-edits' ), |
593 | | - $wgLang->formatNum( User::edits( $this->user->getId() ) ) |
| 630 | + $wgLang->formatNum( $this->user->getEditCount() ) |
594 | 631 | ); |
595 | 632 | |
596 | 633 | if( wfRunHooks( 'PreferencesUserInformationPanel', array( $this, &$userInformationHtml ) ) ) { |
— | — | @@ -624,7 +661,7 @@ |
625 | 662 | $invalidSig = $this->tableRow( |
626 | 663 | ' ', |
627 | 664 | Xml::element( 'span', array( 'class' => 'error' ), |
628 | | - wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) ) |
| 665 | + wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) ) |
629 | 666 | ); |
630 | 667 | } elseif( !empty( $this->mToggles['fancysig'] ) && |
631 | 668 | false === $wgParser->validateSig( $this->mNick ) ) { |
— | — | @@ -688,6 +725,16 @@ |
689 | 726 | ) |
690 | 727 | ); |
691 | 728 | } |
| 729 | + |
| 730 | + if(count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) { |
| 731 | + $wgOut->addHtml( |
| 732 | + Xml::tags( 'tr', null, |
| 733 | + Xml::tags( 'td', array( 'colspan' => '2' ), |
| 734 | + $this->getToggle( "noconvertlink" ) |
| 735 | + ) |
| 736 | + ) |
| 737 | + ); |
| 738 | + } |
692 | 739 | } |
693 | 740 | |
694 | 741 | # Password |
— | — | @@ -701,13 +748,19 @@ |
702 | 749 | $this->tableRow( |
703 | 750 | Xml::label( wfMsg( 'retypenew' ), 'wpRetypePass' ), |
704 | 751 | Xml::password( 'wpRetypePass', 25, $this->mRetypePass, array( 'id' => 'wpRetypePass' ) ) |
705 | | - ) . |
706 | | - Xml::tags( 'tr', null, |
707 | | - Xml::tags( 'td', array( 'colspan' => '2' ), |
708 | | - $this->getToggle( "rememberpassword" ) |
709 | | - ) |
710 | 752 | ) |
711 | 753 | ); |
| 754 | + if( $wgCookieExpiration > 0 ){ |
| 755 | + $wgOut->addHTML( |
| 756 | + Xml::tags( 'tr', null, |
| 757 | + Xml::tags( 'td', array( 'colspan' => '2' ), |
| 758 | + $this->getToggle( "rememberpassword" ) |
| 759 | + ) |
| 760 | + ) |
| 761 | + ); |
| 762 | + } else { |
| 763 | + $this->mUsedToggles['rememberpassword'] = true; |
| 764 | + } |
712 | 765 | } |
713 | 766 | |
714 | 767 | # <FIXME> |
— | — | @@ -716,10 +769,13 @@ |
717 | 770 | |
718 | 771 | $moreEmail = ''; |
719 | 772 | if ($wgEnableUserEmail) { |
| 773 | + // fixme -- the "allowemail" pseudotoggle is a hacked-together |
| 774 | + // inversion for the "disableemail" preference. |
720 | 775 | $emf = wfMsg( 'allowemail' ); |
721 | 776 | $disabled = $disableEmailPrefs ? ' disabled="disabled"' : ''; |
722 | 777 | $moreEmail = |
723 | | - "<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>"; |
| 778 | + "<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>" . |
| 779 | + $this->getToggle( 'ccmeonemails', '', $disableEmailPrefs ); |
724 | 780 | } |
725 | 781 | |
726 | 782 | |
— | — | @@ -731,8 +787,7 @@ |
732 | 788 | $enotifwatchlistpages. |
733 | 789 | $enotifusertalkpages. |
734 | 790 | $enotifminoredits. |
735 | | - $moreEmail. |
736 | | - $this->getToggle( 'ccmeonemails' ) |
| 791 | + $moreEmail |
737 | 792 | ) |
738 | 793 | ); |
739 | 794 | } |
— | — | @@ -764,10 +819,10 @@ |
765 | 820 | # |
766 | 821 | $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" ); |
767 | 822 | $mptitle = Title::newMainPage(); |
768 | | - $previewtext = wfMsg('skinpreview'); |
| 823 | + $previewtext = wfMsg('skin-preview'); |
769 | 824 | # Only show members of Skin::getSkinNames() rather than |
770 | 825 | # $skinNames (skins is all skin names from Language.php) |
771 | | - $validSkinNames = Skin::getSkinNames(); |
| 826 | + $validSkinNames = Skin::getUsableSkins(); |
772 | 827 | # Sort by UI skin name. First though need to update validSkinNames as sometimes |
773 | 828 | # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI). |
774 | 829 | foreach ($validSkinNames as $skinkey => & $skinname ) { |
— | — | @@ -777,13 +832,10 @@ |
778 | 833 | } |
779 | 834 | asort($validSkinNames); |
780 | 835 | foreach ($validSkinNames as $skinkey => $sn ) { |
781 | | - if ( in_array( $skinkey, $wgSkipSkins ) ) { |
782 | | - continue; |
783 | | - } |
784 | 836 | $checked = $skinkey == $this->mSkin ? ' checked="checked"' : ''; |
785 | 837 | |
786 | 838 | $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey")); |
787 | | - $previewlink = "<a target='_blank' href=\"$mplink\">$previewtext</a>"; |
| 839 | + $previewlink = "(<a target='_blank' href=\"$mplink\">$previewtext</a>)"; |
788 | 840 | if( $skinkey == $wgDefaultSkin ) |
789 | 841 | $sn .= ' (' . wfMsg( 'default' ) . ')'; |
790 | 842 | $wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br />\n" ); |
— | — | @@ -815,7 +867,7 @@ |
816 | 868 | $imageLimitOptions = null; |
817 | 869 | foreach ( $wgImageLimits as $index => $limits ) { |
818 | 870 | $selected = ($index == $this->mImageSize); |
819 | | - $imageLimitOptions .= Xml::option( "{$limits[0]}ֻ$limits[1]}" . |
| 871 | + $imageLimitOptions .= Xml::option( "{$limits[0]}×{$limits[1]}" . |
820 | 872 | wfMsg('unit-pixel'), $index, $selected ); |
821 | 873 | } |
822 | 874 | |
— | — | @@ -849,40 +901,62 @@ |
850 | 902 | # Date/Time |
851 | 903 | # |
852 | 904 | |
853 | | - $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'datetime' ) . "</legend>\n" ); |
| 905 | + $wgOut->addHTML( |
| 906 | + Xml::openElement( 'fieldset' ) . |
| 907 | + Xml::element( 'legend', null, wfMsg( 'datetime' ) ) . "\n" |
| 908 | + ); |
854 | 909 | |
855 | 910 | if ($dateopts) { |
856 | | - $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'dateformat' ) . "</legend>\n" ); |
| 911 | + $wgOut->addHTML( |
| 912 | + Xml::openElement( 'fieldset' ) . |
| 913 | + Xml::element( 'legend', null, wfMsg( 'dateformat' ) ) . "\n" |
| 914 | + ); |
857 | 915 | $idCnt = 0; |
858 | 916 | $epoch = '20010115161234'; # Wikipedia day |
859 | 917 | foreach( $dateopts as $key ) { |
860 | 918 | if( $key == 'default' ) { |
861 | | - $formatted = wfMsgHtml( 'datedefault' ); |
| 919 | + $formatted = wfMsg( 'datedefault' ); |
862 | 920 | } else { |
863 | | - $formatted = htmlspecialchars( $wgLang->timeanddate( $epoch, false, $key ) ); |
| 921 | + $formatted = $wgLang->timeanddate( $epoch, false, $key ); |
864 | 922 | } |
865 | | - ($key == $this->mDate) ? $checked = ' checked="checked"' : $checked = ''; |
866 | | - $wgOut->addHTML( "<div><input type='radio' name=\"wpDate\" id=\"wpDate$idCnt\" ". |
867 | | - "value=\"$key\"$checked /> <label for=\"wpDate$idCnt\">$formatted</label></div>\n" ); |
| 923 | + $wgOut->addHTML( |
| 924 | + Xml::tags( 'div', null, |
| 925 | + Xml::radioLabel( $formatted, 'wpDate', $key, "wpDate$idCnt", $key == $this->mDate ) |
| 926 | + ) . "\n" |
| 927 | + ); |
868 | 928 | $idCnt++; |
869 | 929 | } |
870 | | - $wgOut->addHTML( "</fieldset>\n" ); |
| 930 | + $wgOut->addHTML( Xml::closeElement( 'fieldset' ) . "\n" ); |
871 | 931 | } |
872 | 932 | |
873 | 933 | $nowlocal = $wgLang->time( $now = wfTimestampNow(), true ); |
874 | 934 | $nowserver = $wgLang->time( $now, false ); |
875 | 935 | |
876 | | - $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'timezonelegend' ). '</legend><table>' . |
| 936 | + $wgOut->addHTML( |
| 937 | + Xml::openElement( 'fieldset' ) . |
| 938 | + Xml::element( 'legend', null, wfMsg( 'timezonelegend' ) ) . |
| 939 | + Xml::openElement( 'table' ) . |
877 | 940 | $this->addRow( wfMsg( 'servertime' ), $nowserver ) . |
878 | 941 | $this->addRow( wfMsg( 'localtime' ), $nowlocal ) . |
879 | 942 | $this->addRow( |
880 | | - '<label for="wpHourDiff">' . wfMsg( 'timezoneoffset' ) . '</label>', |
881 | | - "<input type='text' name='wpHourDiff' id='wpHourDiff' value=\"" . htmlspecialchars( $this->mHourDiff ) . "\" size='6' />" |
882 | | - ) . "<tr><td colspan='2'> |
883 | | - <input type='button' value=\"" . wfMsg( 'guesstimezone' ) ."\" |
884 | | - onclick='javascript:guessTimezone()' id='guesstimezonebutton' style='display:none;' /> |
885 | | - </td></tr></table><div class='prefsectiontip'>¹" . wfMsg( 'timezonetext' ) . "</div></fieldset> |
886 | | - </fieldset>\n\n" ); |
| 943 | + Xml::label( wfMsg( 'timezoneoffset' ), 'wpHourDiff' ), |
| 944 | + Xml::input( 'wpHourDiff', 6, $this->mHourDiff, array( 'id' => 'wpHourDiff' ) ) ) . |
| 945 | + "<tr> |
| 946 | + <td></td> |
| 947 | + <td class='mw-submit'>" . |
| 948 | + Xml::element( 'input', |
| 949 | + array( 'type' => 'button', |
| 950 | + 'value' => wfMsg( 'guesstimezone' ), |
| 951 | + 'onclick' => 'javascript:guessTimezone()', |
| 952 | + 'id' => 'guesstimezonebutton', |
| 953 | + 'style' => 'display:none;' ) ) . |
| 954 | + "</td> |
| 955 | + </tr>" . |
| 956 | + Xml::closeElement( 'table' ) . |
| 957 | + Xml::tags( 'div', array( 'class' => 'prefsectiontip' ), wfMsgExt( 'timezonetext', 'parseinline' ) ). |
| 958 | + Xml::closeElement( 'fieldset' ) . |
| 959 | + Xml::closeElement( 'fieldset' ) . "\n\n" |
| 960 | + ); |
887 | 961 | |
888 | 962 | # Editing |
889 | 963 | # |
— | — | @@ -941,7 +1015,7 @@ |
942 | 1016 | $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) ); |
943 | 1017 | $wgOut->addHtml( '<br /><br />' ); |
944 | 1018 | |
945 | | - $wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'watchlisthideminor' ) ) ); |
| 1019 | + $wgOut->addHtml( $this->getToggles( array( 'watchlisthideminor', 'watchlisthidebots', 'watchlisthideown', 'watchlisthideanons', 'watchlisthideliu' ) ) ); |
946 | 1020 | |
947 | 1021 | if( $this->user->isAllowed( 'createpage' ) || $this->user->isAllowed( 'createtalk' ) ) |
948 | 1022 | $wgOut->addHtml( $this->getToggle( 'watchcreations' ) ); |
— | — | @@ -957,20 +1031,43 @@ |
958 | 1032 | $wgOut->addHtml( '</fieldset>' ); |
959 | 1033 | |
960 | 1034 | # Search |
961 | | - $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'searchresultshead' ) . '</legend><table>' . |
| 1035 | + $mwsuggest = $wgEnableMWSuggest ? |
962 | 1036 | $this->addRow( |
963 | | - wfLabel( wfMsg( 'resultsperpage' ), 'wpSearch' ), |
964 | | - wfInput( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) ) |
| 1037 | + Xml::label( wfMsg( 'mwsuggest-disable' ), 'wpDisableMWSuggest' ), |
| 1038 | + Xml::check( 'wpDisableMWSuggest', $this->mDisableMWSuggest, array( 'id' => 'wpDisableMWSuggest' ) ) |
| 1039 | + ) : ''; |
| 1040 | + $wgOut->addHTML( |
| 1041 | + // Elements for the search tab itself |
| 1042 | + Xml::openElement( 'fieldset' ) . |
| 1043 | + Xml::element( 'legend', null, wfMsg( 'searchresultshead' ) ) . |
| 1044 | + // Elements for the search options in the search tab |
| 1045 | + Xml::openElement( 'fieldset' ) . |
| 1046 | + Xml::element( 'legend', null, wfMsg( 'prefs-searchoptions' ) ) . |
| 1047 | + Xml::openElement( 'table' ) . |
| 1048 | + $this->addRow( |
| 1049 | + Xml::label( wfMsg( 'resultsperpage' ), 'wpSearch' ), |
| 1050 | + Xml::input( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) ) |
965 | 1051 | ) . |
966 | 1052 | $this->addRow( |
967 | | - wfLabel( wfMsg( 'contextlines' ), 'wpSearchLines' ), |
968 | | - wfInput( 'wpSearchLines', 4, $this->mSearchLines, array( 'id' => 'wpSearchLines' ) ) |
| 1053 | + Xml::label( wfMsg( 'contextlines' ), 'wpSearchLines' ), |
| 1054 | + Xml::input( 'wpSearchLines', 4, $this->mSearchLines, array( 'id' => 'wpSearchLines' ) ) |
969 | 1055 | ) . |
970 | 1056 | $this->addRow( |
971 | | - wfLabel( wfMsg( 'contextchars' ), 'wpSearchChars' ), |
972 | | - wfInput( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) ) |
| 1057 | + Xml::label( wfMsg( 'contextchars' ), 'wpSearchChars' ), |
| 1058 | + Xml::input( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) ) |
973 | 1059 | ) . |
974 | | - "</table><fieldset><legend>" . wfMsg( 'defaultns' ) . "</legend>$ps</fieldset></fieldset>" ); |
| 1060 | + $mwsuggest . |
| 1061 | + Xml::closeElement( 'table' ) . |
| 1062 | + Xml::closeElement( 'fieldset' ) . |
| 1063 | + // Elements for the namespace options in the search tab |
| 1064 | + Xml::openElement( 'fieldset' ) . |
| 1065 | + Xml::element( 'legend', null, wfMsg( 'prefs-namespaces' ) ) . |
| 1066 | + wfMsgExt( 'defaultns', array( 'parse' ) ) . |
| 1067 | + $ps . |
| 1068 | + Xml::closeElement( 'fieldset' ) . |
| 1069 | + // End of the search tab |
| 1070 | + Xml::closeElement( 'fieldset' ) |
| 1071 | + ); |
975 | 1072 | |
976 | 1073 | # Misc |
977 | 1074 | # |
— | — | @@ -1001,15 +1098,14 @@ |
1002 | 1099 | $wgOut->addHTML( '</fieldset>' ); |
1003 | 1100 | |
1004 | 1101 | wfRunHooks( 'RenderPreferencesForm', array( $this, $wgOut ) ); |
1005 | | - global $wgUser; |
1006 | | - $token = htmlspecialchars( $wgUser->editToken() ); |
1007 | | - $skin = $wgUser->getSkin(); |
| 1102 | + |
| 1103 | + $token = htmlspecialchars( $this->user->editToken() ); |
| 1104 | + $skin = $this->user->getSkin(); |
1008 | 1105 | $wgOut->addHTML( " |
1009 | 1106 | <div id='prefsubmit'> |
1010 | 1107 | <div> |
1011 | 1108 | <input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) . '"'.$skin->tooltipAndAccesskey('save')." /> |
1012 | 1109 | <input type='submit' name='wpReset' value=\"" . wfMsgHtml( 'resetprefs' ) . "\" /> |
1013 | | - <input type='submit' name='wpLogout' value=\"" . wfMsgHtml( 'edituser-logout' ) . "\" /> |
1014 | 1110 | </div> |
1015 | 1111 | |
1016 | 1112 | </div> |
— | — | @@ -1021,9 +1117,8 @@ |
1022 | 1118 | $wgOut->addHtml( Xml::tags( 'div', array( 'class' => "prefcache" ), |
1023 | 1119 | wfMsgExt( 'clearyourcache', 'parseinline' ) ) |
1024 | 1120 | ); |
1025 | | - |
1026 | 1121 | } |
1027 | | - |
| 1122 | + |
1028 | 1123 | function makeSearchForm() { |
1029 | 1124 | $thisTitle = Title::makeTitle( NS_SPECIAL, $this->getName() ); |
1030 | 1125 | $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $thisTitle->getLocalUrl() ) ); |
Index: trunk/extensions/EditUser/EditUser.i18n.php |
— | — | @@ -11,13 +11,15 @@ |
12 | 12 | * @author Ryan Schmidt |
13 | 13 | */ |
14 | 14 | $messages['en'] = array( |
15 | | - 'edituser-desc' => 'Allows privileged users to edit other users\' preferences', |
16 | | - 'edituser' => 'Edit user', |
17 | | - 'edituser-logout' => 'Log user out', |
18 | | - 'edituser-username' => 'Name', |
19 | | - 'edituser-dosearch' => 'Search', |
20 | | - 'edituser-nouser' => 'The specified user does not exist', |
21 | | - 'edituser-exempt' => 'The specified user cannot be edited', |
| 15 | + 'edituser-desc' => 'Allows privileged users to edit other users\' preferences', |
| 16 | + 'edituser' => 'Edit user', |
| 17 | + 'edituser-logout' => 'Log user out', |
| 18 | + 'edituser-username' => 'Name', |
| 19 | + 'edituser-dosearch' => 'Search', |
| 20 | + 'edituser-nouser' => 'The specified user does not exist', |
| 21 | + 'edituser-exempt' => 'The specified user cannot be edited', |
| 22 | + 'right-edituser' => 'Edit the preferences of other users', |
| 23 | + 'right-edituser-exempt' => 'Cannot have their preferences edited by others', |
22 | 24 | ); |
23 | 25 | |
24 | 26 | /** Message documentation (Message documentation) |
Index: trunk/extensions/EditUser/EditUser.php |
— | — | @@ -10,9 +10,7 @@ |
11 | 11 | |
12 | 12 | $wgExtensionCredits['specialpage'][] = array( |
13 | 13 | 'name' => 'EditUser', |
14 | | - 'version' => '1.4.1', |
15 | | - 'svn-date' => '$LastChangedDate$', |
16 | | - 'svn-revision' => '$LastChangedRevision$', |
| 14 | + 'version' => '1.4.2', |
17 | 15 | 'author' => 'Ryan Schmidt', |
18 | 16 | 'description' => 'Allows privileged users to edit other users\' preferences', |
19 | 17 | 'descriptionmsg' => 'edituser-desc', |
— | — | @@ -28,3 +26,6 @@ |
29 | 27 | $wgAvaliableRights[] = 'edituser-exempt'; |
30 | 28 | $wgSpecialPageGroups['EditUser'] = 'users'; |
31 | 29 | |
| 30 | +#Default group permissions |
| 31 | +$wgGroupPermissions['bureaucrat']['edituser'] = true; |
| 32 | +$wgGroupPermissions['sysop']['edituser-exempt'] = true; |
\ No newline at end of file |