r42156 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42155‎ | r42156 | r42157 >
Date:22:35, 16 October 2008
Author:skizzerz
Status:old
Tags:
Comment:
* updating EditUser extension so that it works with 1.13+ wikis
Modified paths:
  • /trunk/extensions/EditUser/EditUser.i18n.php (modified) (history)
  • /trunk/extensions/EditUser/EditUser.php (modified) (history)
  • /trunk/extensions/EditUser/EditUser_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EditUser/EditUser_body.php
@@ -1,25 +1,26 @@
22 <?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 */
74 class EditUser extends SpecialPage {
8 - var $mQuickbar, $mNewpass, $mRetypePass, $mStubs;
 5+ var $mQuickbar, $mOldpass, $mNewpass, $mRetypePass, $mStubs;
96 var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick;
107 var $mUserLanguage, $mUserVariant;
118 var $mSearch, $mRecent, $mRecentDays, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
129 var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
1310 var $mUnderline, $mWatchlistEdits;
 11+ var $user, $target, $mLogout;
1412
15 - public function __construct() {
 13+ function __construct() {
1614 SpecialPage::SpecialPage('EditUser', 'edituser');
1715 }
18 -
 16+ /**
 17+ * Constructor
 18+ * Load some values
 19+ */
1920 function loadGlobals( $par ) {
20 - global $wgContLang, $wgAllowRealName, $wgUser, $wgRequest, $wgOut;
 21+ global $wgContLang, $wgAllowRealName, $wgRequest;
 22+ $request = $wgRequest;
2123 $this->user = User::newFromName($par);
2224 $this->user->load();
23 - $request = $wgRequest;
2425 $this->mQuickbar = $request->getVal( 'wpQuickbar' );
2526 $this->mNewpass = $request->getVal( 'wpNewpass' );
2627 $this->mRetypePass =$request->getVal( 'wpRetypePass' );
@@ -50,12 +51,12 @@
5152 $this->mSuccess = $request->getCheck( 'success' );
5253 $this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' );
5354 $this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' );
54 -
 55+ $this->mDisableMWSuggest = $request->getCheck( 'wpDisableMWSuggest' );
 56+ $this->mLogout = $request->getCheck( 'wpLogout' ) && $this->mPosted;
5557 $this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
5658 $this->mPosted &&
57 - $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
 59+ $this->user->matchEditToken( $request->getVal( 'wpEditToken' ) );
5860
59 - $this->mLogout = $request->getCheck( 'wpLogout' ) && $this->mPosted;
6061 # User toggles (the big ugly unsorted list of checkboxes)
6162 $this->mToggles = array();
6263 if ( $this->mPosted ) {
@@ -85,7 +86,6 @@
8687 }
8788
8889 wfRunHooks( 'InitPreferencesForm', array( $this, $request ) );
89 - return true;
9090 }
9191
9292 public function execute( $par ) {
@@ -98,11 +98,11 @@
9999 wfLoadExtensionMessages( 'EditUser' );
100100
101101 $this->setHeaders();
102 - if(!isset($par))
 102+ $this->target = (isset($par)) ? $par : $wgRequest->getText('username', '');
 103+ if($this->target === '') {
103104 $wgOut->addHtml($this->makeSearchForm());
104 - $this->target = (isset($par)) ? $par : $wgRequest->getText('username', '');
105 - if($this->target === '')
106105 return;
 106+ }
107107 $targetuser = User::NewFromName( $this->target );
108108 if( $targetuser->getID() == 0 ) {
109109 $wgOut->addWikiText( wfMsg( 'edituser-nouser' ) );
@@ -113,6 +113,7 @@
114114 return;
115115 }
116116 $this->loadGlobals($this->target);
 117+ $wgOut->addHtml($this->makeSearchForm());
117118 $wgOut->addHtml('<br />');
118119 if ( wfReadOnly() ) {
119120 $wgOut->readOnlyPage();
@@ -156,7 +157,7 @@
157158 function validateIntOrNull( &$val, $min=0, $max=0x7fffffff ) {
158159 $val = trim($val);
159160 if($val === '') {
160 - return $val;
 161+ return null;
161162 } else {
162163 return $this->validateInt( $val, $min, $max );
163164 }
@@ -213,13 +214,13 @@
214215 * @access private
215216 */
216217 function savePreferences() {
217 - global $wgOut, $wgParser;
 218+ global $wgUser, $wgOut, $wgParser;
218219 global $wgEnableUserEmail, $wgEnableEmail;
219220 global $wgEmailAuthentication, $wgRCMaxAge;
220221 global $wgAuth, $wgEmailConfirmToEdit;
221222
222223
223 - if ( '' != $this->mNewpass && $wgAuth->allowPasswordChange() ) {
 224+ if ( $this->mNewpass !== '' && $wgAuth->allowPasswordChange() ) {
224225 if ( $this->mNewpass != $this->mRetypePass ) {
225226 wfRunHooks( 'PrefsPasswordAudit', array( $this->user, $this->mNewpass, 'badretype' ) );
226227 $this->mainPrefsForm( 'error', wfMsg( 'badretype' ) );
@@ -229,7 +230,7 @@
230231 try {
231232 $this->user->setPassword( $this->mNewpass );
232233 wfRunHooks( 'PrefsPasswordAudit', array( $this->user, $this->mNewpass, 'success' ) );
233 - $this->mNewpass = $this->mRetypePass = '';
 234+ $this->mNewpass = $this->mOldpass = $this->mRetypePass = '';
234235 } catch( PasswordError $e ) {
235236 wfRunHooks( 'PrefsPasswordAudit', array( $this->user, $this->mNewpass, 'error' ) );
236237 $this->mainPrefsForm( 'error', $e->getMessage() );
@@ -237,6 +238,7 @@
238239 }
239240 }
240241 $this->user->setRealName( $this->mRealName );
 242+ $oldOptions = $this->user->mOptions;
241243
242244 if( $this->user->getOption( 'language' ) !== $this->mUserLanguage ) {
243245 $needRedirect = true;
@@ -249,7 +251,7 @@
250252 if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
251253 global $wgLang;
252254 $this->mainPrefsForm( 'error',
253 - wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) );
 255+ wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) );
254256 return;
255257 } elseif( $this->mToggles['fancysig'] ) {
256258 if( $wgParser->validateSig( $this->mNick ) !== false ) {
@@ -287,6 +289,7 @@
288290 $this->user->setOption( 'thumbsize', $this->mThumbSize );
289291 $this->user->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
290292 $this->user->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) );
 293+ $this->user->setOption( 'disablesuggest', $this->mDisableMWSuggest );
291294
292295 # Set search namespace options
293296 foreach( $this->mSearchNs as $i => $value ) {
@@ -309,8 +312,10 @@
310313 if( ($newadr != '') && ($newadr != $oldadr) ) {
311314 # the user has supplied a new email address on the login page
312315 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();
315320 } else {
316321 $error = wfMsg( 'invalidemailaddress' );
317322 }
@@ -326,14 +331,13 @@
327332 }
328333 }
329334
330 - if (!$wgAuth->updateExternalDB($this->user)) {
 335+ if( !$wgAuth->updateExternalDB( $this->user ) ){
331336 $this->mainPrefsForm( 'error', wfMsg( 'externaldberror' ) );
332337 return;
333338 }
334339
335340 $msg = '';
336 - if ( !wfRunHooks( 'SavePreferences', array( $this, $this->user, &$msg ) ) ) {
337 - print "(($msg))";
 341+ if ( !wfRunHooks( 'SavePreferences', array( $this, $this->user, &$msg, $oldOptions ) ) ) {
338342 $this->mainPrefsForm( 'error', $msg );
339343 return;
340344 }
@@ -342,11 +346,11 @@
343347
344348 if( $needRedirect && $error === false ) {
345349 $title = SpecialPage::getTitleFor( 'Preferences' );
346 - $wgOut->redirect($title->getFullURL('success'));
 350+ $wgOut->redirect( $title->getFullURL( 'success' ) );
347351 return;
348352 }
349353
350 - $wgOut->setParserOptions( ParserOptions::newFromUser( $this->user ) );
 354+ $wgOut->parserOptions( ParserOptions::newFromUser( $this->user ) );
351355 $this->mainPrefsForm( $error === false ? 'success' : 'error', $error);
352356 }
353357
@@ -354,7 +358,7 @@
355359 * @access private
356360 */
357361 function resetPrefs() {
358 - global $wgLang, $wgContLang, $wgContLanguageCode, $wgAllowRealName;
 362+ global $wgUser, $wgLang, $wgContLang, $wgContLanguageCode, $wgAllowRealName;
359363
360364 $this->mNewpass = $this->mRetypePass = '';
361365 $this->mUserEmail = $this->user->getEmail();
@@ -386,6 +390,7 @@
387391 $this->mWatchlistEdits = $this->user->getOption( 'wllimit' );
388392 $this->mUnderline = $this->user->getOption( 'underline' );
389393 $this->mWatchlistDays = $this->user->getOption( 'watchlistdays' );
 394+ $this->mDisableMWSuggest = $this->user->getBoolOption( 'disablesuggest' );
390395
391396 $togs = User::getToggles();
392397 foreach ( $togs as $tname ) {
@@ -428,7 +433,7 @@
429434
430435
431436 function getToggle( $tname, $trailer = false, $disabled = false ) {
432 - global $wgLang;
 437+ global $wgUser, $wgLang;
433438
434439 $this->mUsedToggles[$tname] = true;
435440 $ttext = $wgLang->getUserToggle( $tname );
@@ -457,7 +462,7 @@
458463 }
459464
460465 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>";
462467 }
463468
464469 /**
@@ -468,24 +473,21 @@
469474 * @return xhtml block
470475 */
471476 function tableRow( $td1, $td2 = null, $td3 = null ) {
472 - global $wgContLang;
473477
474 - $align['align'] = $wgContLang->isRtl() ? 'right' : 'left';
475 -
476478 if ( is_null( $td3 ) ) {
477479 $td3 = '';
478480 } else {
479481 $td3 = Xml::tags( 'tr', null,
480 - Xml::tags( 'td', array( 'colspan' => '2' ), $td3 )
 482+ Xml::tags( 'td', array( 'class' => 'pref-label', 'colspan' => '2' ), $td3 )
481483 );
482484 }
483485
484486 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 );
486488 $td2 = '';
487489 } 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 );
490492 }
491493
492494 return Xml::tags( 'tr', null, $td1 . $td2 ). $td3 . "\n";
@@ -496,27 +498,25 @@
497499 * @access private
498500 */
499501 function mainPrefsForm( $status , $message = '' ) {
500 - global $wgOut, $wgLang, $wgContLang;
 502+ global $wgUser, $wgOut, $wgLang, $wgContLang, $wgAuth;
501503 global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
502 - global $wgDisableLangConversion;
 504+ global $wgDisableLangConversion, $wgDisableTitleConversion;
503505 global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
504506 global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
505507 global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
506 - global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
507 - global $wgEmailConfirmToEdit;
 508+ global $wgContLanguageCode, $wgDefaultSkin, $wgCookieExpiration;
 509+ global $wgEmailConfirmToEdit, $wgEnableMWSuggest;
508510
509 - $wgOut->setPageTitle( wfMsg( 'edituser' ) );
510 - $wgOut->setArticleRelated( false );
511 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
 511+ $wgOut->addScriptFile( 'prefs.js' );
512512
513513 $wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc.
514514
515515 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' );
517517 } else if ( 'error' == $status ) {
518 - $wgOut->addWikitext( '<div class="errorbox"><strong>' . $message . '</strong></div>' );
 518+ $wgOut->addWikiText( '<div class="errorbox"><strong>' . $message . '</strong></div>' );
519519 } else if ( '' != $status ) {
520 - $wgOut->addWikitext( $message . "\n----" );
 520+ $wgOut->addWikiText( $message . "\n----" );
521521 }
522522
523523 $qbs = $wgLang->getQuickbarSettings();
@@ -526,7 +526,6 @@
527527 $togs = User::getToggles();
528528
529529 $titleObj = SpecialPage::getTitleFor( 'EditUser' );
530 - $action = $titleObj->escapeLocalURL();
531530
532531 # Pre-expire some toggles so they won't show if disabled
533532 $this->mUsedToggles[ 'shownumberswatching' ] = true;
@@ -537,6 +536,7 @@
538537 $this->mUsedToggles[ 'enotifrevealaddr' ] = true;
539538 $this->mUsedToggles[ 'ccmeonemails' ] = true;
540539 $this->mUsedToggles[ 'uselivepreview' ] = true;
 540+ $this->mUsedToggles[ 'noconvertlink' ] = true;
541541
542542
543543 if ( !$this->mEmailFlag ) { $emfc = 'checked="checked"'; }
@@ -545,7 +545,13 @@
546546
547547 if ($wgEmailAuthentication && ($this->mUserEmail != '') ) {
548548 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 />';
550556 $disableEmailPrefs = false;
551557 } else {
552558 $disableEmailPrefs = true;
@@ -572,24 +578,55 @@
573579
574580 # </FIXME>
575581
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+ );
578590
579591 # User data
580592
581593 $wgOut->addHTML(
582 - Xml::openElement( 'fieldset ' ) .
583 - Xml::element( 'legend', null, wfMsg('prefs-personal') ) .
 594+ Xml::fieldset( wfMsg('prefs-personal') ) .
584595 Xml::openElement( 'table' ) .
585596 $this->tableRow( Xml::element( 'h2', null, wfMsg( 'prefs-personal' ) ) )
586597 );
587598
 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+
588618 $userInformationHtml =
589619 $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+
591622 $this->tableRow(
 623+ wfMsgExt( 'prefs-memberingroups', array( 'parseinline' ), count( $userEffectiveGroupsArray ) ),
 624+ $wgLang->commaList( $userEffectiveGroupsArray ) .
 625+ '<br />(' . implode( ' | ', $toolLinks ) . ')'
 626+ ) .
 627+
 628+ $this->tableRow(
592629 wfMsgHtml( 'prefs-edits' ),
593 - $wgLang->formatNum( User::edits( $this->user->getId() ) )
 630+ $wgLang->formatNum( $this->user->getEditCount() )
594631 );
595632
596633 if( wfRunHooks( 'PreferencesUserInformationPanel', array( $this, &$userInformationHtml ) ) ) {
@@ -624,7 +661,7 @@
625662 $invalidSig = $this->tableRow(
626663 '&nbsp;',
627664 Xml::element( 'span', array( 'class' => 'error' ),
628 - wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) )
 665+ wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) )
629666 );
630667 } elseif( !empty( $this->mToggles['fancysig'] ) &&
631668 false === $wgParser->validateSig( $this->mNick ) ) {
@@ -688,6 +725,16 @@
689726 )
690727 );
691728 }
 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+ }
692739 }
693740
694741 # Password
@@ -701,13 +748,19 @@
702749 $this->tableRow(
703750 Xml::label( wfMsg( 'retypenew' ), 'wpRetypePass' ),
704751 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 - )
710752 )
711753 );
 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+ }
712765 }
713766
714767 # <FIXME>
@@ -716,10 +769,13 @@
717770
718771 $moreEmail = '';
719772 if ($wgEnableUserEmail) {
 773+ // fixme -- the "allowemail" pseudotoggle is a hacked-together
 774+ // inversion for the "disableemail" preference.
720775 $emf = wfMsg( 'allowemail' );
721776 $disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
722777 $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 );
724780 }
725781
726782
@@ -731,8 +787,7 @@
732788 $enotifwatchlistpages.
733789 $enotifusertalkpages.
734790 $enotifminoredits.
735 - $moreEmail.
736 - $this->getToggle( 'ccmeonemails' )
 791+ $moreEmail
737792 )
738793 );
739794 }
@@ -764,10 +819,10 @@
765820 #
766821 $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" );
767822 $mptitle = Title::newMainPage();
768 - $previewtext = wfMsg('skinpreview');
 823+ $previewtext = wfMsg('skin-preview');
769824 # Only show members of Skin::getSkinNames() rather than
770825 # $skinNames (skins is all skin names from Language.php)
771 - $validSkinNames = Skin::getSkinNames();
 826+ $validSkinNames = Skin::getUsableSkins();
772827 # Sort by UI skin name. First though need to update validSkinNames as sometimes
773828 # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
774829 foreach ($validSkinNames as $skinkey => & $skinname ) {
@@ -777,13 +832,10 @@
778833 }
779834 asort($validSkinNames);
780835 foreach ($validSkinNames as $skinkey => $sn ) {
781 - if ( in_array( $skinkey, $wgSkipSkins ) ) {
782 - continue;
783 - }
784836 $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
785837
786838 $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
787 - $previewlink = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
 839+ $previewlink = "(<a target='_blank' href=\"$mplink\">$previewtext</a>)";
788840 if( $skinkey == $wgDefaultSkin )
789841 $sn .= ' (' . wfMsg( 'default' ) . ')';
790842 $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 @@
816868 $imageLimitOptions = null;
817869 foreach ( $wgImageLimits as $index => $limits ) {
818870 $selected = ($index == $this->mImageSize);
819 - $imageLimitOptions .= Xml::option( "{$limits[0]}ֻ$limits[1]}" .
 871+ $imageLimitOptions .= Xml::option( "{$limits[0]}×{$limits[1]}" .
820872 wfMsg('unit-pixel'), $index, $selected );
821873 }
822874
@@ -849,40 +901,62 @@
850902 # Date/Time
851903 #
852904
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+ );
854909
855910 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+ );
857915 $idCnt = 0;
858916 $epoch = '20010115161234'; # Wikipedia day
859917 foreach( $dateopts as $key ) {
860918 if( $key == 'default' ) {
861 - $formatted = wfMsgHtml( 'datedefault' );
 919+ $formatted = wfMsg( 'datedefault' );
862920 } else {
863 - $formatted = htmlspecialchars( $wgLang->timeanddate( $epoch, false, $key ) );
 921+ $formatted = $wgLang->timeanddate( $epoch, false, $key );
864922 }
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+ );
868928 $idCnt++;
869929 }
870 - $wgOut->addHTML( "</fieldset>\n" );
 930+ $wgOut->addHTML( Xml::closeElement( 'fieldset' ) . "\n" );
871931 }
872932
873933 $nowlocal = $wgLang->time( $now = wfTimestampNow(), true );
874934 $nowserver = $wgLang->time( $now, false );
875935
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' ) .
877940 $this->addRow( wfMsg( 'servertime' ), $nowserver ) .
878941 $this->addRow( wfMsg( 'localtime' ), $nowlocal ) .
879942 $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+ );
887961
888962 # Editing
889963 #
@@ -941,7 +1015,7 @@
9421016 $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) );
9431017 $wgOut->addHtml( '<br /><br />' );
9441018
945 - $wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'watchlisthideminor' ) ) );
 1019+ $wgOut->addHtml( $this->getToggles( array( 'watchlisthideminor', 'watchlisthidebots', 'watchlisthideown', 'watchlisthideanons', 'watchlisthideliu' ) ) );
9461020
9471021 if( $this->user->isAllowed( 'createpage' ) || $this->user->isAllowed( 'createtalk' ) )
9481022 $wgOut->addHtml( $this->getToggle( 'watchcreations' ) );
@@ -957,20 +1031,43 @@
9581032 $wgOut->addHtml( '</fieldset>' );
9591033
9601034 # Search
961 - $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'searchresultshead' ) . '</legend><table>' .
 1035+ $mwsuggest = $wgEnableMWSuggest ?
9621036 $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' ) )
9651051 ) .
9661052 $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' ) )
9691055 ) .
9701056 $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' ) )
9731059 ) .
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+ );
9751072
9761073 # Misc
9771074 #
@@ -1001,15 +1098,14 @@
10021099 $wgOut->addHTML( '</fieldset>' );
10031100
10041101 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();
10081105 $wgOut->addHTML( "
10091106 <div id='prefsubmit'>
10101107 <div>
10111108 <input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) . '"'.$skin->tooltipAndAccesskey('save')." />
10121109 <input type='submit' name='wpReset' value=\"" . wfMsgHtml( 'resetprefs' ) . "\" />
1013 - <input type='submit' name='wpLogout' value=\"" . wfMsgHtml( 'edituser-logout' ) . "\" />
10141110 </div>
10151111
10161112 </div>
@@ -1021,9 +1117,8 @@
10221118 $wgOut->addHtml( Xml::tags( 'div', array( 'class' => "prefcache" ),
10231119 wfMsgExt( 'clearyourcache', 'parseinline' ) )
10241120 );
1025 -
10261121 }
1027 -
 1122+
10281123 function makeSearchForm() {
10291124 $thisTitle = Title::makeTitle( NS_SPECIAL, $this->getName() );
10301125 $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $thisTitle->getLocalUrl() ) );
Index: trunk/extensions/EditUser/EditUser.i18n.php
@@ -11,13 +11,15 @@
1212 * @author Ryan Schmidt
1313 */
1414 $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',
2224 );
2325
2426 /** Message documentation (Message documentation)
Index: trunk/extensions/EditUser/EditUser.php
@@ -10,9 +10,7 @@
1111
1212 $wgExtensionCredits['specialpage'][] = array(
1313 'name' => 'EditUser',
14 - 'version' => '1.4.1',
15 - 'svn-date' => '$LastChangedDate$',
16 - 'svn-revision' => '$LastChangedRevision$',
 14+ 'version' => '1.4.2',
1715 'author' => 'Ryan Schmidt',
1816 'description' => 'Allows privileged users to edit other users\' preferences',
1917 'descriptionmsg' => 'edituser-desc',
@@ -28,3 +26,6 @@
2927 $wgAvaliableRights[] = 'edituser-exempt';
3028 $wgSpecialPageGroups['EditUser'] = 'users';
3129
 30+#Default group permissions
 31+$wgGroupPermissions['bureaucrat']['edituser'] = true;
 32+$wgGroupPermissions['sysop']['edituser-exempt'] = true;
\ No newline at end of file

Status & tagging log