Revision: 43509
Author: skizzerz
Date: 2008-11-14 23:05:48 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
* final fixes for this extension (updated current branch for updated Prefs,
actually fixed the fatal error glitch when using maintenance scripts)
Modified Paths:
--------------
trunk/extensions/EditUser/1.14/EditUser_body.php
trunk/extensions/EditUser/EditUser.php
Modified: trunk/extensions/EditUser/1.14/EditUser_body.php
===================================================================
--- trunk/extensions/EditUser/1.14/EditUser_body.php 2008-11-14 22:52:57 UTC
(rev 43508)
+++ trunk/extensions/EditUser/1.14/EditUser_body.php 2008-11-14 23:05:48 UTC
(rev 43509)
@@ -1,13 +1,12 @@
<?php
/* Shamelessly copied and modified from
/includes/specials/SpecialPreferences.php v1.14 */
class EditUser extends SpecialPage {
- var $mQuickbar, $mOldpass, $mNewpass, $mRetypePass, $mStubs;
+ var $mQuickbar, $mNewpass, $mRetypePass, $mStubs;
var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag,
$mNick;
var $mUserLanguage, $mUserVariant;
var $mSearch, $mRecent, $mRecentDays, $mHourDiff, $mSearchLines,
$mSearchChars, $mAction;
var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
var $mUnderline, $mWatchlistEdits;
- var $user, $target;
function __construct() {
SpecialPage::SpecialPage('EditUser', 'edituser');
@@ -23,11 +22,11 @@
$this->user->load();
$this->mQuickbar = $request->getVal( 'wpQuickbar' );
$this->mNewpass = $request->getVal( 'wpNewpass' );
- $this->mRetypePass = $request->getVal( 'wpRetypePass' );
+ $this->mRetypePass =$request->getVal( 'wpRetypePass' );
$this->mStubs = $request->getVal( 'wpStubs' );
$this->mRows = $request->getVal( 'wpRows' );
$this->mCols = $request->getVal( 'wpCols' );
- $this->mSkin = $request->getVal( 'wpSkin' );
+ $this->mSkin = Skin::normalizeKey( $request->getVal( 'wpSkin' )
);
$this->mMath = $request->getVal( 'wpMath' );
$this->mDate = $request->getVal( 'wpDate' );
$this->mUserEmail = $request->getVal( 'wpUserEmail' );
@@ -52,9 +51,10 @@
$this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' );
$this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' );
$this->mDisableMWSuggest = $request->getCheck(
'wpDisableMWSuggest' );
+
$this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
$this->mPosted &&
- $this->user->matchEditToken( $request->getVal(
'wpEditToken' ) );
+ $wgUser->matchEditToken( $request->getVal(
'wpEditToken' ) );
# User toggles (the big ugly unsorted list of checkboxes)
$this->mToggles = array();
@@ -217,7 +217,7 @@
global $wgAuth, $wgEmailConfirmToEdit;
- if ( $this->mNewpass !== '' && $wgAuth->allowPasswordChange() )
{
+ if ( ($this->mNewpass !== '' || $this->mOldpass !== '' ) &&
$wgAuth->allowPasswordChange() ) {
if ( $this->mNewpass != $this->mRetypePass ) {
wfRunHooks( 'PrefsPasswordAudit', array(
$this->user, $this->mNewpass, 'badretype' ) );
$this->mainPrefsForm( 'error', wfMsg(
'badretype' ) );
@@ -266,7 +266,10 @@
$this->user->setOption( 'variant', $this->mUserVariant );
$this->user->setOption( 'nickname', $this->mNick );
$this->user->setOption( 'quickbar', $this->mQuickbar );
- $this->user->setOption( 'skin', $this->mSkin );
+ global $wgAllowUserSkin;
+ if( $wgAllowUserSkin ) {
+ $this->user->setOption( 'skin', $this->mSkin );
+ }
global $wgUseTeX;
if( $wgUseTeX ) {
$this->user->setOption( 'math', $this->mMath );
@@ -627,7 +630,7 @@
);
if( wfRunHooks( 'PreferencesUserInformationPanel', array(
$this, &$userInformationHtml ) ) ) {
- $wgOut->addHtml( $userInformationHtml );
+ $wgOut->addHTML( $userInformationHtml );
}
if ( $wgAllowRealName ) {
@@ -712,7 +715,7 @@
}
if(count($variantArray) > 1) {
- $wgOut->addHtml(
+ $wgOut->addHTML(
$this->tableRow(
Xml::label( wfMsg(
'yourvariant' ), 'wpUserVariant' ),
Xml::tags( 'select',
@@ -724,7 +727,7 @@
}
if(count($variantArray) > 1 &&
!$wgDisableLangConversion && !$wgDisableTitleConversion) {
- $wgOut->addHtml(
+ $wgOut->addHTML(
Xml::tags( 'tr', null,
Xml::tags( 'td', array(
'colspan' => '2' ),
$this->getToggle(
"noconvertlink" )
@@ -799,46 +802,48 @@
# Quickbar
#
if ($this->mSkin == 'cologneblue' || $this->mSkin ==
'standard') {
- $wgOut->addHtml( "<fieldset>\n<legend>" . wfMsg(
'qbsettings' ) . "</legend>\n" );
+ $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg(
'qbsettings' ) . "</legend>\n" );
for ( $i = 0; $i < count( $qbs ); ++$i ) {
if ( $i == $this->mQuickbar ) { $checked = '
checked="checked"'; }
else { $checked = ""; }
$wgOut->addHTML( "<div><label><input
type='radio' name='wpQuickbar' value=\"$i\"$checked
/>{$qbs[$i]}</label></div>\n" );
}
- $wgOut->addHtml( "</fieldset>\n\n" );
+ $wgOut->addHTML( "</fieldset>\n\n" );
} else {
# Need to output a hidden option even if the relevant
skin is not in use,
# otherwise the preference will get reset to 0 on submit
- $wgOut->addHtml( wfHidden( 'wpQuickbar',
$this->mQuickbar ) );
+ $wgOut->addHTML( wfHidden( 'wpQuickbar',
$this->mQuickbar ) );
}
# Skin
#
- $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') .
"</legend>\n" );
- $mptitle = Title::newMainPage();
- $previewtext = wfMsg('skin-preview');
- # Only show members of Skin::getSkinNames() rather than
- # $skinNames (skins is all skin names from Language.php)
- $validSkinNames = Skin::getUsableSkins();
- # Sort by UI skin name. First though need to update
validSkinNames as sometimes
- # the skinkey & UI skinname differ (e.g. "standard" skinkey is
"Classic" in the UI).
- foreach ($validSkinNames as $skinkey => & $skinname ) {
- if ( isset( $skinNames[$skinkey] ) ) {
- $skinname = $skinNames[$skinkey];
+ global $wgAllowUserSkin;
+ if( $wgAllowUserSkin ) {
+ $wgOut->addHTML( "<fieldset>\n<legend>\n" .
wfMsg('skin') . "</legend>\n" );
+ $mptitle = Title::newMainPage();
+ $previewtext = wfMsg('skin-preview');
+ # Only show members of Skin::getSkinNames() rather than
+ # $skinNames (skins is all skin names from Language.php)
+ $validSkinNames = Skin::getUsableSkins();
+ # Sort by UI skin name. First though need to update
validSkinNames as sometimes
+ # the skinkey & UI skinname differ (e.g. "standard"
skinkey is "Classic" in the UI).
+ foreach ($validSkinNames as $skinkey => & $skinname ) {
+ if ( isset( $skinNames[$skinkey] ) ) {
+ $skinname = $skinNames[$skinkey];
+ }
}
+ asort($validSkinNames);
+ foreach ($validSkinNames as $skinkey => $sn ) {
+ $checked = $skinkey == $this->mSkin ? '
checked="checked"' : '';
+ $mplink =
htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
+ $previewlink = $wgAllowUserSkin ? "(<a
target='_blank' href=\"$mplink\">$previewtext</a>)" : '';
+ if( $skinkey == $wgDefaultSkin )
+ $sn .= ' (' . wfMsg( 'default' ) . ')';
+ $wgOut->addHTML( "<input type='radio'
name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label
for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br />\n" );
+ }
+ $wgOut->addHTML( "</fieldset>\n\n" );
}
- asort($validSkinNames);
- foreach ($validSkinNames as $skinkey => $sn ) {
- $checked = $skinkey == $this->mSkin ? '
checked="checked"' : '';
- $mplink =
htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
- $previewlink = "(<a target='_blank'
href=\"$mplink\">$previewtext</a>)";
- if( $skinkey == $wgDefaultSkin )
- $sn .= ' (' . wfMsg( 'default' ) . ')';
- $wgOut->addHTML( "<input type='radio' name='wpSkin'
id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label
for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br />\n" );
- }
- $wgOut->addHTML( "</fieldset>\n\n" );
-
# Math
#
global $wgUseTeX;
@@ -977,11 +982,12 @@
'externaldiff',
$wgLivePreview ? 'uselivepreview' : false,
'forceeditsummary',
- ) ) . '</fieldset>'
- );
+ ) ) );
+
+ $wgOut->addHTML( '</fieldset>' );
# Recent changes
- $wgOut->addHtml( '<fieldset><legend>' . wfMsgHtml( 'prefs-rc' )
. '</legend>' );
+ $wgOut->addHTML( '<fieldset><legend>' . wfMsgHtml( 'prefs-rc' )
. '</legend>' );
$rc = '<table><tr>';
$rc .= '<td>' . Xml::label( wfMsg( 'recentchangesdays' ),
'wpRecentDays' ) . '</td>';
@@ -990,42 +996,42 @@
$rc .= '<td>' . Xml::label( wfMsg( 'recentchangescount' ),
'wpRecent' ) . '</td>';
$rc .= '<td>' . Xml::input( 'wpRecent', 3, $this->mRecent,
array( 'id' => 'wpRecent' ) ) . '</td>';
$rc .= '</tr></table>';
- $wgOut->addHtml( $rc );
+ $wgOut->addHTML( $rc );
- $wgOut->addHtml( '<br />' );
+ $wgOut->addHTML( '<br />' );
$toggles[] = 'hideminor';
if( $wgRCShowWatchingUsers )
$toggles[] = 'shownumberswatching';
$toggles[] = 'usenewrc';
- $wgOut->addHtml( $this->getToggles( $toggles ) );
+ $wgOut->addHTML( $this->getToggles( $toggles ) );
- $wgOut->addHtml( '</fieldset>' );
+ $wgOut->addHTML( '</fieldset>' );
# Watchlist
- $wgOut->addHtml( '<fieldset><legend>' . wfMsgHtml(
'prefs-watchlist' ) . '</legend>' );
+ $wgOut->addHTML( '<fieldset><legend>' . wfMsgHtml(
'prefs-watchlist' ) . '</legend>' );
- $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-days' ),
'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays ) );
- $wgOut->addHtml( '<br /><br />' );
+ $wgOut->addHTML( wfInputLabel( wfMsg( 'prefs-watchlist-days' ),
'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays ) );
+ $wgOut->addHTML( '<br /><br />' );
- $wgOut->addHtml( $this->getToggle( 'extendwatchlist' ) );
- $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-edits'
), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) );
- $wgOut->addHtml( '<br /><br />' );
+ $wgOut->addHTML( $this->getToggle( 'extendwatchlist' ) );
+ $wgOut->addHTML( wfInputLabel( wfMsg( 'prefs-watchlist-edits'
), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) );
+ $wgOut->addHTML( '<br /><br />' );
- $wgOut->addHtml( $this->getToggles( array(
'watchlisthideminor', 'watchlisthidebots', 'watchlisthideown',
'watchlisthideanons', 'watchlisthideliu' ) ) );
+ $wgOut->addHTML( $this->getToggles( array(
'watchlisthideminor', 'watchlisthidebots', 'watchlisthideown',
'watchlisthideanons', 'watchlisthideliu' ) ) );
if( $this->user->isAllowed( 'createpage' ) ||
$this->user->isAllowed( 'createtalk' ) )
- $wgOut->addHtml( $this->getToggle( 'watchcreations' ) );
+ $wgOut->addHTML( $this->getToggle( 'watchcreations' ) );
foreach( array( 'edit' => 'watchdefault', 'move' =>
'watchmoves', 'delete' => 'watchdeletion' ) as $action => $toggle ) {
if( $this->user->isAllowed( $action ) )
- $wgOut->addHtml( $this->getToggle( $toggle ) );
+ $wgOut->addHTML( $this->getToggle( $toggle ) );
}
$this->mUsedToggles['watchcreations'] = true;
$this->mUsedToggles['watchdefault'] = true;
$this->mUsedToggles['watchmoves'] = true;
$this->mUsedToggles['watchdeletion'] = true;
- $wgOut->addHtml( '</fieldset>' );
+ $wgOut->addHTML( '</fieldset>' );
# Search
$mwsuggest = $wgEnableMWSuggest ?
@@ -1069,8 +1075,8 @@
# Misc
#
$wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') .
'</legend>');
- $wgOut->addHtml( '<label for="wpStubs">' . wfMsg(
'stub-threshold' ) . '</label> ' );
- $wgOut->addHtml( Xml::input( 'wpStubs', 6, $this->mStubs,
array( 'id' => 'wpStubs' ) ) );
+ $wgOut->addHTML( '<label for="wpStubs">' . wfMsg(
'stub-threshold' ) . '</label> ' );
+ $wgOut->addHTML( Xml::input( 'wpStubs', 6, $this->mStubs,
array( 'id' => 'wpStubs' ) ) );
$msgUnderline = htmlspecialchars( wfMsg ( 'tog-underline' ) );
$msgUnderlinenever = htmlspecialchars( wfMsg (
'underline-never' ) );
$msgUnderlinealways = htmlspecialchars( wfMsg (
'underline-always' ) );
@@ -1089,9 +1095,13 @@
foreach ( $togs as $tname ) {
if( !array_key_exists( $tname, $this->mUsedToggles ) ) {
- $wgOut->addHTML( $this->getToggle( $tname ) );
+ if( $tname == 'norollbackdiff' &&
$this->user->isAllowed( 'rollback' ) )
+ $wgOut->addHTML( $this->getToggle(
$tname ) );
+ else
+ $wgOut->addHTML( $this->getToggle(
$tname ) );
}
}
+
$wgOut->addHTML( '</fieldset>' );
wfRunHooks( 'RenderPreferencesForm', array( $this, $wgOut ) );
@@ -1108,10 +1118,9 @@
</div>
<input type='hidden' name='wpEditToken' value=\"{$token}\" />
- <input type='hidden' name='username' value=\"{$this->target}\" />
</div></form>\n" );
- $wgOut->addHtml( Xml::tags( 'div', array( 'class' =>
"prefcache" ),
+ $wgOut->addHTML( Xml::tags( 'div', array( 'class' =>
"prefcache" ),
wfMsgExt( 'clearyourcache', 'parseinline' ) )
);
}
Modified: trunk/extensions/EditUser/EditUser.php
===================================================================
--- trunk/extensions/EditUser/EditUser.php 2008-11-14 22:52:57 UTC (rev
43508)
+++ trunk/extensions/EditUser/EditUser.php 2008-11-14 23:05:48 UTC (rev
43509)
@@ -10,8 +10,11 @@
$dir = dirname(__FILE__) . '/';
-if(!file_exists($dir . substr($wgVersion, 0, 4) . 'EditUser_body.php')) {
- wfErrorLog("Your MediaWiki version \"$wgVersion\" is not supported by
the EditUser extension");
+#in case we're running a maintenance script and GlobalFunctions.php isn't
loaded...
+require_once("$IP/includes/GlobalFunctions.php");
+
+if(!file_exists($dir . substr($wgVersion, 0, 4) . '/EditUser_body.php')) {
+ wfDebug("Your MediaWiki version \"$wgVersion\" is not supported by the
EditUser extension");
return;
}
@@ -26,7 +29,7 @@
$wgExtensionMessagesFiles['EditUser'] = $dir . 'EditUser.i18n.php';
$wgExtensionAliasesFiles['EditUser'] = $dir . 'EditUser.alias.php';
-$wgAutoloadClasses['EditUser'] = $dir . substr($wgVersion, 0, 4) .
'EditUser_body.php';
+$wgAutoloadClasses['EditUser'] = $dir . substr($wgVersion, 0, 4) .
'/EditUser_body.php';
$wgSpecialPages['EditUser'] = 'EditUser';
$wgAvailableRights[] = 'edituser';
$wgAvaliableRights[] = 'edituser-exempt';
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs