2004-02-18 02:15:00 +00:00
|
|
|
|
<?php
|
2004-09-02 23:28:24 +00:00
|
|
|
|
/**
|
2004-09-08 01:24:35 +00:00
|
|
|
|
* Hold things related to displaying and saving user preferences.
|
2007-01-20 15:09:52 +00:00
|
|
|
|
* @addtogroup SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2004-09-08 01:24:35 +00:00
|
|
|
|
* Entry point that create the "Preferences" object
|
2004-09-02 23:28:24 +00:00
|
|
|
|
*/
|
|
|
|
|
|
function wfSpecialPreferences() {
|
2004-04-01 13:03:05 +00:00
|
|
|
|
global $wgRequest;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$form = new PreferencesForm( $wgRequest );
|
|
|
|
|
|
$form->execute();
|
2003-06-23 06:17:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
|
/**
|
2004-09-08 01:24:35 +00:00
|
|
|
|
* Preferences form handling
|
|
|
|
|
|
* This object will show the preferences form and can save it as well.
|
2007-01-20 15:09:52 +00:00
|
|
|
|
* @addtogroup SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
|
*/
|
2004-04-01 13:03:05 +00:00
|
|
|
|
class PreferencesForm {
|
2006-05-11 22:40:38 +00:00
|
|
|
|
var $mQuickbar, $mOldpass, $mNewpass, $mRetypePass, $mStubs;
|
|
|
|
|
|
var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick;
|
|
|
|
|
|
var $mUserLanguage, $mUserVariant;
|
2007-04-08 09:30:06 +00:00
|
|
|
|
var $mSearch, $mRecent, $mRecentDays, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
|
2007-12-16 15:46:27 +00:00
|
|
|
|
var $mReset, $mPosted, $mToggles, $mUseAjaxSearch, $mSearchNs, $mRealName, $mImageSize;
|
2006-05-11 22:40:38 +00:00
|
|
|
|
var $mUnderline, $mWatchlistEdits;
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
2004-09-08 01:24:35 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Constructor
|
|
|
|
|
|
* Load some values
|
|
|
|
|
|
*/
|
2005-07-24 07:09:53 +00:00
|
|
|
|
function PreferencesForm( &$request ) {
|
2006-11-29 11:43:58 +00:00
|
|
|
|
global $wgContLang, $wgUser, $wgAllowRealName;
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$this->mQuickbar = $request->getVal( 'wpQuickbar' );
|
|
|
|
|
|
$this->mOldpass = $request->getVal( 'wpOldpass' );
|
|
|
|
|
|
$this->mNewpass = $request->getVal( 'wpNewpass' );
|
|
|
|
|
|
$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->mMath = $request->getVal( 'wpMath' );
|
|
|
|
|
|
$this->mDate = $request->getVal( 'wpDate' );
|
|
|
|
|
|
$this->mUserEmail = $request->getVal( 'wpUserEmail' );
|
2005-04-25 23:04:44 +00:00
|
|
|
|
$this->mRealName = $wgAllowRealName ? $request->getVal( 'wpRealName' ) : '';
|
2005-10-11 23:11:33 +00:00
|
|
|
|
$this->mEmailFlag = $request->getCheck( 'wpEmailFlag' ) ? 0 : 1;
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$this->mNick = $request->getVal( 'wpNick' );
|
2004-09-08 03:39:32 +00:00
|
|
|
|
$this->mUserLanguage = $request->getVal( 'wpUserLanguage' );
|
2005-04-12 00:37:45 +00:00
|
|
|
|
$this->mUserVariant = $request->getVal( 'wpUserVariant' );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$this->mSearch = $request->getVal( 'wpSearch' );
|
|
|
|
|
|
$this->mRecent = $request->getVal( 'wpRecent' );
|
2007-04-08 09:30:06 +00:00
|
|
|
|
$this->mRecentDays = $request->getVal( 'wpRecentDays' );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$this->mHourDiff = $request->getVal( 'wpHourDiff' );
|
|
|
|
|
|
$this->mSearchLines = $request->getVal( 'wpSearchLines' );
|
|
|
|
|
|
$this->mSearchChars = $request->getVal( 'wpSearchChars' );
|
2004-09-10 00:53:31 +00:00
|
|
|
|
$this->mImageSize = $request->getVal( 'wpImageSize' );
|
2005-04-12 00:37:45 +00:00
|
|
|
|
$this->mThumbSize = $request->getInt( 'wpThumbSize' );
|
2005-07-05 19:33:44 +00:00
|
|
|
|
$this->mUnderline = $request->getInt( 'wpOpunderline' );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$this->mAction = $request->getVal( 'action' );
|
|
|
|
|
|
$this->mReset = $request->getCheck( 'wpReset' );
|
|
|
|
|
|
$this->mPosted = $request->wasPosted();
|
2005-08-19 13:27:32 +00:00
|
|
|
|
$this->mSuccess = $request->getCheck( 'success' );
|
2006-04-17 23:53:54 +00:00
|
|
|
|
$this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' );
|
2006-04-18 11:47:09 +00:00
|
|
|
|
$this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' );
|
2007-12-16 15:46:27 +00:00
|
|
|
|
$this->mUseAjaxSearch = $request->getCheck( 'wpUseAjaxSearch' );
|
2005-07-05 19:33:44 +00:00
|
|
|
|
|
2005-02-21 01:56:50 +00:00
|
|
|
|
$this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
|
|
|
|
|
|
$this->mPosted &&
|
|
|
|
|
|
$wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
|
|
|
|
|
# User toggles (the big ugly unsorted list of checkboxes)
|
|
|
|
|
|
$this->mToggles = array();
|
|
|
|
|
|
if ( $this->mPosted ) {
|
2006-07-26 07:15:39 +00:00
|
|
|
|
$togs = User::getToggles();
|
2004-07-23 07:03:52 +00:00
|
|
|
|
foreach ( $togs as $tname ) {
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$this->mToggles[$tname] = $request->getCheck( "wpOp$tname" ) ? 1 : 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2004-04-09 08:27:00 +00:00
|
|
|
|
$this->mUsedToggles = array();
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2004-04-01 13:03:05 +00:00
|
|
|
|
# Search namespace options
|
|
|
|
|
|
# Note: namespaces don't necessarily have consecutive keys
|
|
|
|
|
|
$this->mSearchNs = array();
|
|
|
|
|
|
if ( $this->mPosted ) {
|
2004-09-24 16:24:43 +00:00
|
|
|
|
$namespaces = $wgContLang->getNamespaces();
|
2004-04-01 13:03:05 +00:00
|
|
|
|
foreach ( $namespaces as $i => $namespace ) {
|
|
|
|
|
|
if ( $i >= 0 ) {
|
|
|
|
|
|
$this->mSearchNs[$i] = $request->getCheck( "wpNs$i" ) ? 1 : 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2005-01-17 08:40:08 +00:00
|
|
|
|
|
|
|
|
|
|
# Validate language
|
|
|
|
|
|
if ( !preg_match( '/^[a-z\-]*$/', $this->mUserLanguage ) ) {
|
|
|
|
|
|
$this->mUserLanguage = 'nolanguage';
|
|
|
|
|
|
}
|
2007-07-30 22:52:37 +00:00
|
|
|
|
|
2007-11-30 17:28:24 +00:00
|
|
|
|
wfRunHooks( 'InitPreferencesForm', array( $this, $request ) );
|
2003-06-23 06:17:35 +00:00
|
|
|
|
}
|
2003-07-01 08:27:32 +00:00
|
|
|
|
|
2004-04-01 13:03:05 +00:00
|
|
|
|
function execute() {
|
2005-03-26 01:28:33 +00:00
|
|
|
|
global $wgUser, $wgOut;
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-02-21 12:46:37 +00:00
|
|
|
|
if ( $wgUser->isAnon() ) {
|
2006-06-07 06:40:24 +00:00
|
|
|
|
$wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext' );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ( wfReadOnly() ) {
|
|
|
|
|
|
$wgOut->readOnlyPage();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ( $this->mReset ) {
|
|
|
|
|
|
$this->resetPrefs();
|
2005-08-19 13:27:32 +00:00
|
|
|
|
$this->mainPrefsForm( 'reset', wfMsg( 'prefsreset' ) );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
} else if ( $this->mSaveprefs ) {
|
|
|
|
|
|
$this->savePreferences();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$this->resetPrefs();
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$this->mainPrefsForm( '' );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
}
|
2003-07-01 08:27:32 +00:00
|
|
|
|
}
|
2005-07-20 03:30:44 +00:00
|
|
|
|
/**
|
2004-09-08 01:24:35 +00:00
|
|
|
|
* @access private
|
|
|
|
|
|
*/
|
|
|
|
|
|
function validateInt( &$val, $min=0, $max=0x7fffffff ) {
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$val = intval($val);
|
|
|
|
|
|
$val = min($val, $max);
|
|
|
|
|
|
$val = max($val, $min);
|
|
|
|
|
|
return $val;
|
2003-07-01 08:27:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2006-04-17 23:53:54 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @access private
|
|
|
|
|
|
*/
|
|
|
|
|
|
function validateFloat( &$val, $min, $max=0x7fffffff ) {
|
|
|
|
|
|
$val = floatval( $val );
|
|
|
|
|
|
$val = min( $val, $max );
|
|
|
|
|
|
$val = max( $val, $min );
|
|
|
|
|
|
return( $val );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-09-08 01:24:35 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @access private
|
|
|
|
|
|
*/
|
|
|
|
|
|
function validateIntOrNull( &$val, $min=0, $max=0x7fffffff ) {
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$val = trim($val);
|
2004-09-08 01:24:35 +00:00
|
|
|
|
if($val === '') {
|
2004-04-01 13:03:05 +00:00
|
|
|
|
return $val;
|
2004-01-26 02:55:07 +00:00
|
|
|
|
} else {
|
2004-04-01 13:03:05 +00:00
|
|
|
|
return $this->validateInt( $val, $min, $max );
|
2004-01-26 02:55:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2003-07-01 08:27:32 +00:00
|
|
|
|
|
2005-07-20 03:30:44 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @access private
|
|
|
|
|
|
*/
|
2006-08-10 08:00:53 +00:00
|
|
|
|
function validateDate( $val ) {
|
|
|
|
|
|
global $wgLang, $wgContLang;
|
|
|
|
|
|
if ( $val !== false && (
|
|
|
|
|
|
in_array( $val, (array)$wgLang->getDatePreferences() ) ||
|
|
|
|
|
|
in_array( $val, (array)$wgContLang->getDatePreferences() ) ) )
|
|
|
|
|
|
{
|
2005-07-20 03:30:44 +00:00
|
|
|
|
return $val;
|
2006-08-10 08:00:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
return $wgLang->getDefaultDateFormat();
|
|
|
|
|
|
}
|
2005-07-20 03:30:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-09-08 01:24:35 +00:00
|
|
|
|
/**
|
2005-04-02 22:17:05 +00:00
|
|
|
|
* Used to validate the user inputed timezone before saving it as
|
2007-03-25 21:40:02 +00:00
|
|
|
|
* 'timecorrection', will return '00:00' if fed bogus data.
|
2005-04-02 22:17:05 +00:00
|
|
|
|
* Note: It's not a 100% correct implementation timezone-wise, it will
|
|
|
|
|
|
* accept stuff like '14:30',
|
2004-09-08 01:24:35 +00:00
|
|
|
|
* @access private
|
2005-04-02 22:17:05 +00:00
|
|
|
|
* @param string $s the user input
|
|
|
|
|
|
* @return string
|
2004-09-08 01:24:35 +00:00
|
|
|
|
*/
|
|
|
|
|
|
function validateTimeZone( $s ) {
|
|
|
|
|
|
if ( $s !== '' ) {
|
|
|
|
|
|
if ( strpos( $s, ':' ) ) {
|
2004-04-01 13:03:05 +00:00
|
|
|
|
# HH:MM
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$array = explode( ':' , $s );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$hour = intval( $array[0] );
|
|
|
|
|
|
$minute = intval( $array[1] );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$minute = intval( $s * 60 );
|
|
|
|
|
|
$hour = intval( $minute / 60 );
|
|
|
|
|
|
$minute = abs( $minute ) % 60;
|
|
|
|
|
|
}
|
2005-04-02 22:17:05 +00:00
|
|
|
|
# Max is +14:00 and min is -12:00, see:
|
|
|
|
|
|
# http://en.wikipedia.org/wiki/Timezone
|
|
|
|
|
|
$hour = min( $hour, 14 );
|
|
|
|
|
|
$hour = max( $hour, -12 );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$minute = min( $minute, 59 );
|
|
|
|
|
|
$minute = max( $minute, 0 );
|
|
|
|
|
|
$s = sprintf( "%02d:%02d", $hour, $minute );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
}
|
2004-04-01 13:03:05 +00:00
|
|
|
|
return $s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-09-08 01:24:35 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @access private
|
|
|
|
|
|
*/
|
|
|
|
|
|
function savePreferences() {
|
2006-03-07 01:10:39 +00:00
|
|
|
|
global $wgUser, $wgOut, $wgParser;
|
2004-12-18 03:47:11 +00:00
|
|
|
|
global $wgEnableUserEmail, $wgEnableEmail;
|
2007-10-11 12:31:46 +00:00
|
|
|
|
global $wgEmailAuthentication, $wgRCMaxAge;
|
2007-10-11 07:11:51 +00:00
|
|
|
|
global $wgAuth, $wgEmailConfirmToEdit;
|
2005-06-03 11:56:02 +00:00
|
|
|
|
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
2006-06-29 00:57:56 +00:00
|
|
|
|
if ( '' != $this->mNewpass && $wgAuth->allowPasswordChange() ) {
|
2004-04-01 13:03:05 +00:00
|
|
|
|
if ( $this->mNewpass != $this->mRetypePass ) {
|
2007-11-30 17:28:24 +00:00
|
|
|
|
wfRunHooks( 'PrefsPasswordAudit', array( $wgUser, $this->mNewpass, 'badretype' ) );
|
2005-08-19 13:27:32 +00:00
|
|
|
|
$this->mainPrefsForm( 'error', wfMsg( 'badretype' ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2004-07-30 11:13:54 +00:00
|
|
|
|
|
|
|
|
|
|
if (!$wgUser->checkPassword( $this->mOldpass )) {
|
2007-11-30 17:28:24 +00:00
|
|
|
|
wfRunHooks( 'PrefsPasswordAudit', array( $wgUser, $this->mNewpass, 'wrongpassword' ) );
|
2005-08-19 13:27:32 +00:00
|
|
|
|
$this->mainPrefsForm( 'error', wfMsg( 'wrongpassword' ) );
|
2004-07-30 11:13:54 +00:00
|
|
|
|
return;
|
2004-04-01 13:03:05 +00:00
|
|
|
|
}
|
2006-12-12 04:15:00 +00:00
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
$wgUser->setPassword( $this->mNewpass );
|
2007-11-30 17:28:24 +00:00
|
|
|
|
wfRunHooks( 'PrefsPasswordAudit', array( $wgUser, $this->mNewpass, 'success' ) );
|
2006-12-12 04:15:00 +00:00
|
|
|
|
$this->mNewpass = $this->mOldpass = $this->mRetypePass = '';
|
|
|
|
|
|
} catch( PasswordError $e ) {
|
2007-11-30 17:28:24 +00:00
|
|
|
|
wfRunHooks( 'PrefsPasswordAudit', array( $wgUser, $this->mNewpass, 'error' ) );
|
2006-12-12 04:15:00 +00:00
|
|
|
|
$this->mainPrefsForm( 'error', $e->getMessage() );
|
2005-06-03 11:56:02 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
}
|
2004-04-18 02:28:35 +00:00
|
|
|
|
$wgUser->setRealName( $this->mRealName );
|
2005-08-19 13:27:32 +00:00
|
|
|
|
|
|
|
|
|
|
if( $wgUser->getOption( 'language' ) !== $this->mUserLanguage ) {
|
|
|
|
|
|
$needRedirect = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$needRedirect = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2006-01-07 23:37:40 +00:00
|
|
|
|
# Validate the signature and clean it up as needed
|
2007-06-13 16:28:19 +00:00
|
|
|
|
global $wgMaxSigChars;
|
2007-06-25 15:02:46 +00:00
|
|
|
|
if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
|
2007-06-13 16:28:19 +00:00
|
|
|
|
global $wgLang;
|
|
|
|
|
|
$this->mainPrefsForm( 'error',
|
|
|
|
|
|
wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) );
|
|
|
|
|
|
return;
|
|
|
|
|
|
} elseif( $this->mToggles['fancysig'] ) {
|
2007-11-28 14:26:30 +00:00
|
|
|
|
if( $wgParser->validateSig( $this->mNick ) !== false ) {
|
2006-01-12 22:38:55 +00:00
|
|
|
|
$this->mNick = $wgParser->cleanSig( $this->mNick );
|
2006-01-07 23:37:40 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
$this->mainPrefsForm( 'error', wfMsg( 'badsig' ) );
|
2007-06-13 16:13:05 +00:00
|
|
|
|
return;
|
2006-01-07 23:37:40 +00:00
|
|
|
|
}
|
2006-06-23 19:50:55 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
// When no fancy sig used, make sure ~{3,5} get removed.
|
|
|
|
|
|
$this->mNick = $wgParser->cleanSigInSig( $this->mNick );
|
2006-01-07 23:37:40 +00:00
|
|
|
|
}
|
2006-01-02 11:42:45 +00:00
|
|
|
|
|
2004-09-08 03:39:32 +00:00
|
|
|
|
$wgUser->setOption( 'language', $this->mUserLanguage );
|
2005-04-13 08:29:23 +00:00
|
|
|
|
$wgUser->setOption( 'variant', $this->mUserVariant );
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$wgUser->setOption( 'nickname', $this->mNick );
|
|
|
|
|
|
$wgUser->setOption( 'quickbar', $this->mQuickbar );
|
|
|
|
|
|
$wgUser->setOption( 'skin', $this->mSkin );
|
2005-05-29 20:43:30 +00:00
|
|
|
|
global $wgUseTeX;
|
|
|
|
|
|
if( $wgUseTeX ) {
|
|
|
|
|
|
$wgUser->setOption( 'math', $this->mMath );
|
|
|
|
|
|
}
|
2006-08-10 08:00:53 +00:00
|
|
|
|
$wgUser->setOption( 'date', $this->validateDate( $this->mDate ) );
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch ) );
|
|
|
|
|
|
$wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines ) );
|
|
|
|
|
|
$wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars ) );
|
|
|
|
|
|
$wgUser->setOption( 'rclimit', $this->validateIntOrNull( $this->mRecent ) );
|
2007-10-11 12:31:46 +00:00
|
|
|
|
$wgUser->setOption( 'rcdays', $this->validateInt($this->mRecentDays, 1, ceil($wgRCMaxAge / (3600*24))));
|
2006-04-18 11:47:09 +00:00
|
|
|
|
$wgUser->setOption( 'wllimit', $this->validateIntOrNull( $this->mWatchlistEdits, 0, 1000 ) );
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$wgUser->setOption( 'rows', $this->validateInt( $this->mRows, 4, 1000 ) );
|
|
|
|
|
|
$wgUser->setOption( 'cols', $this->validateInt( $this->mCols, 4, 1000 ) );
|
|
|
|
|
|
$wgUser->setOption( 'stubthreshold', $this->validateIntOrNull( $this->mStubs ) );
|
|
|
|
|
|
$wgUser->setOption( 'timecorrection', $this->validateTimeZone( $this->mHourDiff, -12, 14 ) );
|
2004-09-10 00:53:31 +00:00
|
|
|
|
$wgUser->setOption( 'imagesize', $this->mImageSize );
|
2005-04-12 00:37:45 +00:00
|
|
|
|
$wgUser->setOption( 'thumbsize', $this->mThumbSize );
|
2005-07-05 19:33:44 +00:00
|
|
|
|
$wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
|
2006-04-18 00:37:40 +00:00
|
|
|
|
$wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) );
|
2007-12-16 15:46:27 +00:00
|
|
|
|
$wgUser->setOption( 'ajaxsearch', $this->mUseAjaxSearch );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
|
|
|
|
|
# Set search namespace options
|
|
|
|
|
|
foreach( $this->mSearchNs as $i => $value ) {
|
|
|
|
|
|
$wgUser->setOption( "searchNs{$i}", $value );
|
2003-11-09 11:45:12 +00:00
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2004-11-25 06:20:01 +00:00
|
|
|
|
if( $wgEnableEmail && $wgEnableUserEmail ) {
|
|
|
|
|
|
$wgUser->setOption( 'disablemail', $this->mEmailFlag );
|
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
2004-04-01 13:03:05 +00:00
|
|
|
|
# Set user toggles
|
|
|
|
|
|
foreach ( $this->mToggles as $tname => $tvalue ) {
|
|
|
|
|
|
$wgUser->setOption( $tname, $tvalue );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-08-19 13:27:32 +00:00
|
|
|
|
$error = false;
|
2004-12-18 03:47:11 +00:00
|
|
|
|
if( $wgEnableEmail ) {
|
2005-04-27 01:16:47 +00:00
|
|
|
|
$newadr = $this->mUserEmail;
|
|
|
|
|
|
$oldadr = $wgUser->getEmail();
|
2007-12-17 23:40:30 +00:00
|
|
|
|
if( ($newadr != '') && ($newadr != $oldadr) ) {
|
2005-04-27 01:16:47 +00:00
|
|
|
|
# the user has supplied a new email address on the login page
|
|
|
|
|
|
if( $wgUser->isValidEmailAddr( $newadr ) ) {
|
|
|
|
|
|
$wgUser->mEmail = $newadr; # new behaviour: set this new emailaddr from login-page into user database record
|
|
|
|
|
|
$wgUser->mEmailAuthenticated = null; # but flag as "dirty" = unauthenticated
|
|
|
|
|
|
if ($wgEmailAuthentication) {
|
|
|
|
|
|
# Mail a temporary password to the dirty address.
|
|
|
|
|
|
# User can come back through the confirmation URL to re-enable email.
|
|
|
|
|
|
$result = $wgUser->sendConfirmationMail();
|
|
|
|
|
|
if( WikiError::isError( $result ) ) {
|
2005-08-19 13:27:32 +00:00
|
|
|
|
$error = wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
|
2005-04-27 01:16:47 +00:00
|
|
|
|
} else {
|
2005-05-14 17:55:04 +00:00
|
|
|
|
$error = wfMsg( 'eauthentsent', $wgUser->getName() );
|
2005-04-27 01:16:47 +00:00
|
|
|
|
}
|
2004-12-18 03:47:11 +00:00
|
|
|
|
}
|
2005-04-27 01:16:47 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
$error = wfMsg( 'invalidemailaddress' );
|
2004-12-18 03:47:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
2007-10-11 07:11:51 +00:00
|
|
|
|
if( $wgEmailConfirmToEdit && empty( $newadr ) ) {
|
|
|
|
|
|
$this->mainPrefsForm( 'error', wfMsg( 'noemailtitle' ) );
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2005-04-27 01:16:47 +00:00
|
|
|
|
$wgUser->setEmail( $this->mUserEmail );
|
2004-12-18 03:47:11 +00:00
|
|
|
|
}
|
2007-05-08 18:31:32 +00:00
|
|
|
|
if( $oldadr != $newadr ) {
|
2007-11-30 17:28:24 +00:00
|
|
|
|
wfRunHooks( 'PrefsEmailAudit', array( $wgUser, $oldadr, $newadr ) );
|
2007-05-08 18:31:32 +00:00
|
|
|
|
}
|
2004-12-18 03:47:11 +00:00
|
|
|
|
}
|
2004-11-29 05:52:26 +00:00
|
|
|
|
|
2007-10-12 10:27:57 +00:00
|
|
|
|
if (!$wgAuth->updateExternalDB($wgUser)) {
|
|
|
|
|
|
$this->mainPrefsForm( 'error', wfMsg( 'externaldberror' ) );
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$msg = '';
|
2007-11-30 17:28:24 +00:00
|
|
|
|
if ( !wfRunHooks( 'SavePreferences', array( $this, $wgUser, &$msg ) ) ) {
|
2007-10-12 10:27:57 +00:00
|
|
|
|
print "(($msg))";
|
|
|
|
|
|
$this->mainPrefsForm( 'error', $msg );
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$wgUser->setCookies();
|
|
|
|
|
|
$wgUser->saveSettings();
|
|
|
|
|
|
|
2005-08-19 13:27:32 +00:00
|
|
|
|
if( $needRedirect && $error === false ) {
|
2007-11-09 21:33:16 +00:00
|
|
|
|
$title = SpecialPage::getTitleFor( 'Preferences' );
|
2005-08-19 13:27:32 +00:00
|
|
|
|
$wgOut->redirect($title->getFullURL('success'));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-04-07 13:58:14 +00:00
|
|
|
|
$wgOut->setParserOptions( ParserOptions::newFromUser( $wgUser ) );
|
2005-08-19 13:27:32 +00:00
|
|
|
|
$this->mainPrefsForm( $error === false ? 'success' : 'error', $error);
|
2003-04-14 23:10:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-09-08 01:24:35 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @access private
|
2004-09-08 03:39:32 +00:00
|
|
|
|
*/
|
|
|
|
|
|
function resetPrefs() {
|
2006-12-14 20:28:38 +00:00
|
|
|
|
global $wgUser, $wgLang, $wgContLang, $wgContLanguageCode, $wgAllowRealName;
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$this->mOldpass = $this->mNewpass = $this->mRetypePass = '';
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$this->mUserEmail = $wgUser->getEmail();
|
2005-04-25 23:04:44 +00:00
|
|
|
|
$this->mUserEmailAuthenticationtimestamp = $wgUser->getEmailAuthenticationtimestamp();
|
2004-09-08 03:39:32 +00:00
|
|
|
|
$this->mRealName = ($wgAllowRealName) ? $wgUser->getRealName() : '';
|
2006-12-14 20:28:38 +00:00
|
|
|
|
|
|
|
|
|
|
# language value might be blank, default to content language
|
|
|
|
|
|
$this->mUserLanguage = $wgUser->getOption( 'language', $wgContLanguageCode );
|
|
|
|
|
|
|
2005-04-13 08:29:23 +00:00
|
|
|
|
$this->mUserVariant = $wgUser->getOption( 'variant');
|
2005-04-25 23:04:44 +00:00
|
|
|
|
$this->mEmailFlag = $wgUser->getOption( 'disablemail' ) == 1 ? 1 : 0;
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$this->mNick = $wgUser->getOption( 'nickname' );
|
|
|
|
|
|
|
|
|
|
|
|
$this->mQuickbar = $wgUser->getOption( 'quickbar' );
|
2005-12-19 23:36:43 +00:00
|
|
|
|
$this->mSkin = Skin::normalizeKey( $wgUser->getOption( 'skin' ) );
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$this->mMath = $wgUser->getOption( 'math' );
|
2006-07-26 07:15:39 +00:00
|
|
|
|
$this->mDate = $wgUser->getDatePreference();
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$this->mRows = $wgUser->getOption( 'rows' );
|
|
|
|
|
|
$this->mCols = $wgUser->getOption( 'cols' );
|
|
|
|
|
|
$this->mStubs = $wgUser->getOption( 'stubthreshold' );
|
|
|
|
|
|
$this->mHourDiff = $wgUser->getOption( 'timecorrection' );
|
|
|
|
|
|
$this->mSearch = $wgUser->getOption( 'searchlimit' );
|
|
|
|
|
|
$this->mSearchLines = $wgUser->getOption( 'contextlines' );
|
|
|
|
|
|
$this->mSearchChars = $wgUser->getOption( 'contextchars' );
|
2004-09-10 00:53:31 +00:00
|
|
|
|
$this->mImageSize = $wgUser->getOption( 'imagesize' );
|
2005-04-12 00:37:45 +00:00
|
|
|
|
$this->mThumbSize = $wgUser->getOption( 'thumbsize' );
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$this->mRecent = $wgUser->getOption( 'rclimit' );
|
2007-04-08 09:30:06 +00:00
|
|
|
|
$this->mRecentDays = $wgUser->getOption( 'rcdays' );
|
2006-04-18 11:47:09 +00:00
|
|
|
|
$this->mWatchlistEdits = $wgUser->getOption( 'wllimit' );
|
2005-07-05 19:33:44 +00:00
|
|
|
|
$this->mUnderline = $wgUser->getOption( 'underline' );
|
2006-04-17 23:53:54 +00:00
|
|
|
|
$this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' );
|
2007-12-16 15:46:27 +00:00
|
|
|
|
$this->mUseAjaxSearch = $wgUser->getBoolOption( 'ajaxsearch' );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
2006-07-26 07:15:39 +00:00
|
|
|
|
$togs = User::getToggles();
|
2004-07-23 07:03:52 +00:00
|
|
|
|
foreach ( $togs as $tname ) {
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$this->mToggles[$tname] = $wgUser->getOption( $tname );
|
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
2004-09-24 16:24:43 +00:00
|
|
|
|
$namespaces = $wgContLang->getNamespaces();
|
2004-04-01 13:03:05 +00:00
|
|
|
|
foreach ( $namespaces as $i => $namespace ) {
|
2005-05-03 13:05:50 +00:00
|
|
|
|
if ( $i >= NS_MAIN ) {
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$this->mSearchNs[$i] = $wgUser->getOption( 'searchNs'.$i );
|
2003-11-09 11:45:12 +00:00
|
|
|
|
}
|
2004-04-01 13:03:05 +00:00
|
|
|
|
}
|
2007-07-30 22:52:37 +00:00
|
|
|
|
|
2007-11-30 17:28:24 +00:00
|
|
|
|
wfRunHooks( 'ResetPreferences', array( $this, $wgUser ) );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2004-09-08 01:24:35 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @access private
|
|
|
|
|
|
*/
|
|
|
|
|
|
function namespacesCheckboxes() {
|
2006-03-07 01:10:39 +00:00
|
|
|
|
global $wgContLang;
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2004-04-01 13:03:05 +00:00
|
|
|
|
# Determine namespace checkboxes
|
2004-09-24 16:24:43 +00:00
|
|
|
|
$namespaces = $wgContLang->getNamespaces();
|
2005-05-02 13:28:43 +00:00
|
|
|
|
$r1 = null;
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
|
|
|
|
|
foreach ( $namespaces as $i => $name ) {
|
2005-05-02 13:28:43 +00:00
|
|
|
|
if ($i < 0)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
$checked = $this->mSearchNs[$i] ? "checked='checked'" : '';
|
|
|
|
|
|
$name = str_replace( '_', ' ', $namespaces[$i] );
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-05-02 13:28:43 +00:00
|
|
|
|
if ( empty($name) )
|
2005-07-24 07:09:53 +00:00
|
|
|
|
$name = wfMsg( 'blanknamespace' );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
2005-10-13 07:57:06 +00:00
|
|
|
|
$r1 .= "<input type='checkbox' value='1' name='wpNs$i' id='wpNs$i' {$checked}/> <label for='wpNs$i'>{$name}</label><br />\n";
|
2003-07-01 08:27:32 +00:00
|
|
|
|
}
|
2004-04-01 13:03:05 +00:00
|
|
|
|
return $r1;
|
2003-07-01 08:27:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-11 23:11:33 +00:00
|
|
|
|
function getToggle( $tname, $trailer = false, $disabled = false ) {
|
2006-10-09 07:17:06 +00:00
|
|
|
|
global $wgUser, $wgLang;
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2004-04-09 08:27:00 +00:00
|
|
|
|
$this->mUsedToggles[$tname] = true;
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$ttext = $wgLang->getUserToggle( $tname );
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-04-25 23:04:44 +00:00
|
|
|
|
$checked = $wgUser->getOption( $tname ) == 1 ? ' checked="checked"' : '';
|
2005-10-11 23:11:33 +00:00
|
|
|
|
$disabled = $disabled ? ' disabled="disabled"' : '';
|
2005-04-25 23:04:44 +00:00
|
|
|
|
$trailer = $trailer ? $trailer : '';
|
2005-10-11 23:11:33 +00:00
|
|
|
|
return "<div class='toggle'><input type='checkbox' value='1' id=\"$tname\" name=\"wpOp$tname\"$checked$disabled />" .
|
2005-08-02 13:35:19 +00:00
|
|
|
|
" <span class='toggletext'><label for=\"$tname\">$ttext</label>$trailer</span></div>\n";
|
2005-04-26 07:14:19 +00:00
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-04-26 07:14:19 +00:00
|
|
|
|
function getToggles( $items ) {
|
|
|
|
|
|
$out = "";
|
|
|
|
|
|
foreach( $items as $item ) {
|
|
|
|
|
|
if( $item === false )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
if( is_array( $item ) ) {
|
|
|
|
|
|
list( $key, $trailer ) = $item;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$key = $item;
|
|
|
|
|
|
$trailer = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
$out .= $this->getToggle( $key, $trailer );
|
|
|
|
|
|
}
|
|
|
|
|
|
return $out;
|
2005-04-25 23:04:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function addRow($td1, $td2) {
|
|
|
|
|
|
return "<tr><td align='right'>$td1</td><td align='left'>$td2</td></tr>";
|
2004-04-09 08:27:00 +00:00
|
|
|
|
}
|
2003-07-01 08:27:32 +00:00
|
|
|
|
|
2007-05-06 20:52:03 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Helper function for user information panel
|
|
|
|
|
|
* @param $td1 label for an item
|
|
|
|
|
|
* @param $td2 item or null
|
|
|
|
|
|
* @param $td3 optional help or null
|
|
|
|
|
|
* @return xhtml block
|
|
|
|
|
|
*/
|
|
|
|
|
|
function tableRow( $td1, $td2 = null, $td3 = null ) {
|
|
|
|
|
|
global $wgContLang;
|
2007-05-06 17:54:38 +00:00
|
|
|
|
|
2007-05-06 20:52:03 +00:00
|
|
|
|
$align['align'] = $wgContLang->isRtl() ? 'right' : 'left';
|
2007-05-06 17:54:38 +00:00
|
|
|
|
|
|
|
|
|
|
if ( is_null( $td3 ) ) {
|
|
|
|
|
|
$td3 = '';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$td3 = Xml::tags( 'tr', null,
|
|
|
|
|
|
Xml::tags( 'td', array( 'colspan' => '2' ), $td3 )
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2007-05-06 20:52:03 +00:00
|
|
|
|
if ( is_null( $td2 ) ) {
|
|
|
|
|
|
$td1 = Xml::tags( 'td', $align + array( 'colspan' => '2' ), $td1 );
|
|
|
|
|
|
$td2 = '';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$td1 = Xml::tags( 'td', $align, $td1 );
|
|
|
|
|
|
$td2 = Xml::tags( 'td', $align, $td2 );
|
|
|
|
|
|
}
|
2007-05-06 17:54:38 +00:00
|
|
|
|
|
|
|
|
|
|
return Xml::tags( 'tr', null, $td1 . $td2 ). $td3 . "\n";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-09-08 01:24:35 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @access private
|
|
|
|
|
|
*/
|
2005-08-19 13:27:32 +00:00
|
|
|
|
function mainPrefsForm( $status , $message = '' ) {
|
2006-07-02 15:57:59 +00:00
|
|
|
|
global $wgUser, $wgOut, $wgLang, $wgContLang;
|
2005-04-12 00:37:45 +00:00
|
|
|
|
global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
|
2005-05-25 04:09:33 +00:00
|
|
|
|
global $wgDisableLangConversion;
|
2005-05-14 17:55:04 +00:00
|
|
|
|
global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
|
|
|
|
|
|
global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
|
2004-12-18 03:47:11 +00:00
|
|
|
|
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
|
2006-06-29 00:57:56 +00:00
|
|
|
|
global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
|
2007-12-16 15:46:27 +00:00
|
|
|
|
global $wgEmailConfirmToEdit, $wgAjaxSearch;
|
2004-12-18 03:47:11 +00:00
|
|
|
|
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$wgOut->setPageTitle( wfMsg( 'preferences' ) );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$wgOut->setArticleRelated( false );
|
2004-09-08 01:24:35 +00:00
|
|
|
|
$wgOut->setRobotpolicy( 'noindex,nofollow' );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
2007-05-08 20:48:02 +00:00
|
|
|
|
$wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc.
|
|
|
|
|
|
|
2005-08-19 13:27:32 +00:00
|
|
|
|
if ( $this->mSuccess || 'success' == $status ) {
|
2008-02-18 07:25:35 +00:00
|
|
|
|
$wgOut->wrapWikiMsg( '<div class="successbox"><strong>$1</strong></div>', 'savedprefs' );
|
2005-08-19 13:27:32 +00:00
|
|
|
|
} else if ( 'error' == $status ) {
|
2008-02-18 07:25:35 +00:00
|
|
|
|
$wgOut->addWikiText( '<div class="errorbox"><strong>' . $message . '</strong></div>' );
|
2005-08-19 13:27:32 +00:00
|
|
|
|
} else if ( '' != $status ) {
|
2008-02-18 07:25:35 +00:00
|
|
|
|
$wgOut->addWikiText( $message . "\n----" );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
}
|
2006-03-07 01:41:55 +00:00
|
|
|
|
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$qbs = $wgLang->getQuickbarSettings();
|
|
|
|
|
|
$skinNames = $wgLang->getSkinNames();
|
|
|
|
|
|
$mathopts = $wgLang->getMathNames();
|
2006-07-26 07:15:39 +00:00
|
|
|
|
$dateopts = $wgLang->getDatePreferences();
|
|
|
|
|
|
$togs = User::getToggles();
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
2006-10-30 06:25:31 +00:00
|
|
|
|
$titleObj = SpecialPage::getTitleFor( 'Preferences' );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$action = $titleObj->escapeLocalURL();
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-06-26 09:33:51 +00:00
|
|
|
|
# Pre-expire some toggles so they won't show if disabled
|
|
|
|
|
|
$this->mUsedToggles[ 'shownumberswatching' ] = true;
|
|
|
|
|
|
$this->mUsedToggles[ 'showupdated' ] = true;
|
|
|
|
|
|
$this->mUsedToggles[ 'enotifwatchlistpages' ] = true;
|
|
|
|
|
|
$this->mUsedToggles[ 'enotifusertalkpages' ] = true;
|
|
|
|
|
|
$this->mUsedToggles[ 'enotifminoredits' ] = true;
|
|
|
|
|
|
$this->mUsedToggles[ 'enotifrevealaddr' ] = true;
|
2006-12-01 18:39:43 +00:00
|
|
|
|
$this->mUsedToggles[ 'ccmeonemails' ] = true;
|
2006-03-04 16:17:23 +00:00
|
|
|
|
$this->mUsedToggles[ 'uselivepreview' ] = true;
|
2005-04-26 23:56:28 +00:00
|
|
|
|
|
2007-05-06 17:54:38 +00:00
|
|
|
|
|
2005-10-11 23:11:33 +00:00
|
|
|
|
if ( !$this->mEmailFlag ) { $emfc = 'checked="checked"'; }
|
2005-04-26 23:56:28 +00:00
|
|
|
|
else { $emfc = ''; }
|
|
|
|
|
|
|
2005-10-11 23:11:33 +00:00
|
|
|
|
|
2005-04-26 23:56:28 +00:00
|
|
|
|
if ($wgEmailAuthentication && ($this->mUserEmail != '') ) {
|
|
|
|
|
|
if( $wgUser->getEmailAuthenticationTimestamp() ) {
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$emailauthenticated = wfMsg('emailauthenticated',$wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true ) ).'<br />';
|
2005-10-11 23:11:33 +00:00
|
|
|
|
$disableEmailPrefs = false;
|
2005-04-26 23:56:28 +00:00
|
|
|
|
} else {
|
2005-10-11 23:11:33 +00:00
|
|
|
|
$disableEmailPrefs = true;
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$skin = $wgUser->getSkin();
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ),
|
2007-08-07 01:20:20 +00:00
|
|
|
|
wfMsg( 'emailconfirmlink' ) ) . '<br />';
|
2005-04-26 23:56:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$emailauthenticated = '';
|
2005-10-11 23:11:33 +00:00
|
|
|
|
$disableEmailPrefs = false;
|
2005-04-26 23:56:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->mUserEmail == '') {
|
2007-08-07 01:20:20 +00:00
|
|
|
|
$emailauthenticated = wfMsg( 'noemailprefs' ) . '<br />';
|
2005-04-26 23:56:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ps = $this->namespacesCheckboxes();
|
|
|
|
|
|
|
2005-10-11 23:11:33 +00:00
|
|
|
|
$enotifwatchlistpages = ($wgEnotifWatchlist) ? $this->getToggle( 'enotifwatchlistpages', false, $disableEmailPrefs ) : '';
|
|
|
|
|
|
$enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages', false, $disableEmailPrefs ) : '';
|
|
|
|
|
|
$enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits', false, $disableEmailPrefs ) : '';
|
|
|
|
|
|
$enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr', false, $disableEmailPrefs ) : '';
|
2005-04-26 23:56:28 +00:00
|
|
|
|
|
|
|
|
|
|
# </FIXME>
|
|
|
|
|
|
|
2005-10-11 00:33:23 +00:00
|
|
|
|
$wgOut->addHTML( "<form action=\"$action\" method='post'>" );
|
|
|
|
|
|
$wgOut->addHTML( "<div id='preferences'>" );
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-04-25 23:04:44 +00:00
|
|
|
|
# User data
|
2004-05-19 20:54:00 +00:00
|
|
|
|
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$wgOut->addHTML(
|
|
|
|
|
|
Xml::openElement( 'fieldset ' ) .
|
|
|
|
|
|
Xml::element( 'legend', null, wfMsg('prefs-personal') ) .
|
|
|
|
|
|
Xml::openElement( 'table' ) .
|
2007-05-06 20:52:03 +00:00
|
|
|
|
$this->tableRow( Xml::element( 'h2', null, wfMsg( 'prefs-personal' ) ) )
|
2007-05-06 17:54:38 +00:00
|
|
|
|
);
|
2004-12-18 03:47:11 +00:00
|
|
|
|
|
2006-12-30 11:39:58 +00:00
|
|
|
|
$userInformationHtml =
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$this->tableRow( wfMsgHtml( 'username' ), htmlspecialchars( $wgUser->getName() ) ) .
|
2007-08-13 20:03:18 +00:00
|
|
|
|
$this->tableRow( wfMsgHtml( 'uid' ), htmlspecialchars( $wgUser->getID() ) ) .
|
|
|
|
|
|
$this->tableRow(
|
|
|
|
|
|
wfMsgHtml( 'prefs-edits' ),
|
|
|
|
|
|
$wgLang->formatNum( User::edits( $wgUser->getId() ) )
|
|
|
|
|
|
);
|
2007-05-06 17:54:38 +00:00
|
|
|
|
|
2006-12-30 11:39:58 +00:00
|
|
|
|
if( wfRunHooks( 'PreferencesUserInformationPanel', array( $this, &$userInformationHtml ) ) ) {
|
|
|
|
|
|
$wgOut->addHtml( $userInformationHtml );
|
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2007-05-06 17:54:38 +00:00
|
|
|
|
if ( $wgAllowRealName ) {
|
2005-04-21 23:19:02 +00:00
|
|
|
|
$wgOut->addHTML(
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$this->tableRow(
|
|
|
|
|
|
Xml::label( wfMsg('yourrealname'), 'wpRealName' ),
|
|
|
|
|
|
Xml::input( 'wpRealName', 25, $this->mRealName, array( 'id' => 'wpRealName' ) ),
|
|
|
|
|
|
Xml::tags('div', array( 'class' => 'prefsectiontip' ),
|
|
|
|
|
|
wfMsgExt( 'prefs-help-realname', 'parseinline' )
|
|
|
|
|
|
)
|
2005-04-26 16:01:28 +00:00
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2007-05-06 17:54:38 +00:00
|
|
|
|
if ( $wgEnableEmail ) {
|
2005-04-26 16:01:28 +00:00
|
|
|
|
$wgOut->addHTML(
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$this->tableRow(
|
|
|
|
|
|
Xml::label( wfMsg('youremail'), 'wpUserEmail' ),
|
|
|
|
|
|
Xml::input( 'wpUserEmail', 25, $this->mUserEmail, array( 'id' => 'wpUserEmail' ) ),
|
|
|
|
|
|
Xml::tags('div', array( 'class' => 'prefsectiontip' ),
|
2007-10-11 07:11:51 +00:00
|
|
|
|
wfMsgExt( $wgEmailConfirmToEdit ? 'prefs-help-email-required' : 'prefs-help-email', 'parseinline' )
|
2007-05-06 17:54:38 +00:00
|
|
|
|
)
|
2005-04-25 23:04:44 +00:00
|
|
|
|
)
|
|
|
|
|
|
);
|
2004-11-25 06:20:01 +00:00
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2007-06-13 16:28:19 +00:00
|
|
|
|
global $wgParser, $wgMaxSigChars;
|
2007-06-25 15:02:46 +00:00
|
|
|
|
if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
|
2007-06-13 16:28:19 +00:00
|
|
|
|
$invalidSig = $this->tableRow(
|
|
|
|
|
|
' ',
|
|
|
|
|
|
Xml::element( 'span', array( 'class' => 'error' ),
|
|
|
|
|
|
wfMsg( 'badsiglength', $wgLang->formatNum( $wgMaxSigChars ) ) )
|
|
|
|
|
|
);
|
|
|
|
|
|
} elseif( !empty( $this->mToggles['fancysig'] ) &&
|
2007-05-06 17:54:38 +00:00
|
|
|
|
false === $wgParser->validateSig( $this->mNick ) ) {
|
|
|
|
|
|
$invalidSig = $this->tableRow(
|
2005-11-15 00:38:39 +00:00
|
|
|
|
' ',
|
2007-05-06 17:54:38 +00:00
|
|
|
|
Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'badsig' ) )
|
2005-11-15 00:38:39 +00:00
|
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$invalidSig = '';
|
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2005-04-26 16:21:54 +00:00
|
|
|
|
$wgOut->addHTML(
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$this->tableRow(
|
|
|
|
|
|
Xml::label( wfMsg( 'yournick' ), 'wpNick' ),
|
2007-06-13 16:28:19 +00:00
|
|
|
|
Xml::input( 'wpNick', 25, $this->mNick,
|
|
|
|
|
|
array(
|
|
|
|
|
|
'id' => 'wpNick',
|
2007-06-25 15:02:46 +00:00
|
|
|
|
// Note: $wgMaxSigChars is enforced in Unicode characters,
|
|
|
|
|
|
// both on the backend and now in the browser.
|
|
|
|
|
|
// Badly-behaved requests may still try to submit
|
|
|
|
|
|
// an overlong string, however.
|
2007-06-13 16:28:19 +00:00
|
|
|
|
'maxlength' => $wgMaxSigChars ) )
|
2005-07-24 07:09:53 +00:00
|
|
|
|
) .
|
2005-11-15 00:38:39 +00:00
|
|
|
|
$invalidSig .
|
2007-05-06 20:52:03 +00:00
|
|
|
|
$this->tableRow( ' ', $this->getToggle( 'fancysig' ) )
|
2005-04-26 16:21:54 +00:00
|
|
|
|
);
|
2004-09-17 15:09:22 +00:00
|
|
|
|
|
2007-05-06 17:54:38 +00:00
|
|
|
|
list( $lsLabel, $lsSelect) = Xml::languageSelector( $this->mUserLanguage );
|
2005-10-11 23:11:33 +00:00
|
|
|
|
$wgOut->addHTML(
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$this->tableRow( $lsLabel, $lsSelect )
|
2005-10-11 23:11:33 +00:00
|
|
|
|
);
|
2004-09-27 15:10:26 +00:00
|
|
|
|
|
|
|
|
|
|
/* see if there are multiple language variants to choose from*/
|
2004-10-19 18:02:44 +00:00
|
|
|
|
if(!$wgDisableLangConversion) {
|
|
|
|
|
|
$variants = $wgContLang->getVariants();
|
2005-11-05 07:10:09 +00:00
|
|
|
|
$variantArray = array();
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$languages = Language::getLanguageNames( true );
|
2004-10-19 18:02:44 +00:00
|
|
|
|
foreach($variants as $v) {
|
|
|
|
|
|
$v = str_replace( '_', '-', strtolower($v));
|
2005-11-05 07:10:09 +00:00
|
|
|
|
if( array_key_exists( $v, $languages ) ) {
|
|
|
|
|
|
// If it doesn't have a name, we'll pretend it doesn't exist
|
|
|
|
|
|
$variantArray[$v] = $languages[$v];
|
2004-10-19 18:02:44 +00:00
|
|
|
|
}
|
2004-09-27 15:10:26 +00:00
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2006-11-27 19:49:48 +00:00
|
|
|
|
$options = "\n";
|
|
|
|
|
|
foreach( $variantArray as $code => $name ) {
|
|
|
|
|
|
$selected = ($code == $this->mUserVariant);
|
|
|
|
|
|
$options .= Xml::option( "$code - $name", $code, $selected ) . "\n";
|
2005-04-25 23:04:44 +00:00
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-04-25 23:04:44 +00:00
|
|
|
|
if(count($variantArray) > 1) {
|
|
|
|
|
|
$wgOut->addHtml(
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$this->tableRow(
|
|
|
|
|
|
Xml::label( wfMsg( 'yourvariant' ), 'wpUserVariant' ),
|
|
|
|
|
|
Xml::tags( 'select',
|
|
|
|
|
|
array( 'name' => 'wpUserVariant', 'id' => 'wpUserVariant' ),
|
|
|
|
|
|
$options
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
2005-04-25 23:04:44 +00:00
|
|
|
|
);
|
2004-09-27 15:10:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2005-04-25 23:04:44 +00:00
|
|
|
|
|
|
|
|
|
|
# Password
|
2007-05-06 17:54:38 +00:00
|
|
|
|
if( $wgAuth->allowPasswordChange() ) {
|
2006-06-29 00:57:56 +00:00
|
|
|
|
$wgOut->addHTML(
|
2007-05-06 20:52:03 +00:00
|
|
|
|
$this->tableRow( Xml::element( 'h2', null, wfMsg( 'changepassword' ) ) ) .
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$this->tableRow(
|
|
|
|
|
|
Xml::label( wfMsg( 'oldpassword' ), 'wpOldpass' ),
|
2007-05-08 00:37:16 +00:00
|
|
|
|
Xml::password( 'wpOldpass', 25, $this->mOldpass, array( 'id' => 'wpOldpass' ) )
|
2006-06-29 00:57:56 +00:00
|
|
|
|
) .
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$this->tableRow(
|
|
|
|
|
|
Xml::label( wfMsg( 'newpassword' ), 'wpNewpass' ),
|
2007-05-08 00:37:16 +00:00
|
|
|
|
Xml::password( 'wpNewpass', 25, $this->mNewpass, array( 'id' => 'wpNewpass' ) )
|
2006-06-29 00:57:56 +00:00
|
|
|
|
) .
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$this->tableRow(
|
|
|
|
|
|
Xml::label( wfMsg( 'retypenew' ), 'wpRetypePass' ),
|
2007-05-08 00:37:16 +00:00
|
|
|
|
Xml::password( 'wpRetypePass', 25, $this->mRetypePass, array( 'id' => 'wpRetypePass' ) )
|
2006-06-29 00:57:56 +00:00
|
|
|
|
) .
|
2007-05-06 17:54:38 +00:00
|
|
|
|
Xml::tags( 'tr', null,
|
|
|
|
|
|
Xml::tags( 'td', array( 'colspan' => '2' ),
|
|
|
|
|
|
$this->getToggle( "rememberpassword" )
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
2006-06-29 00:57:56 +00:00
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-04-26 23:56:28 +00:00
|
|
|
|
# <FIXME>
|
|
|
|
|
|
# Enotif
|
2007-05-06 17:54:38 +00:00
|
|
|
|
if ( $wgEnableEmail ) {
|
|
|
|
|
|
|
|
|
|
|
|
$moreEmail = '';
|
2005-10-11 23:11:33 +00:00
|
|
|
|
if ($wgEnableUserEmail) {
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$emf = wfMsg( 'allowemail' );
|
2005-10-11 23:11:33 +00:00
|
|
|
|
$disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$moreEmail =
|
|
|
|
|
|
"<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>";
|
2005-10-11 23:11:33 +00:00
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2007-05-06 17:54:38 +00:00
|
|
|
|
|
|
|
|
|
|
$wgOut->addHTML(
|
2007-05-06 20:52:03 +00:00
|
|
|
|
$this->tableRow( Xml::element( 'h2', null, wfMsg( 'email' ) ) ) .
|
|
|
|
|
|
$this->tableRow(
|
|
|
|
|
|
$emailauthenticated.
|
|
|
|
|
|
$enotifrevealaddr.
|
|
|
|
|
|
$enotifwatchlistpages.
|
|
|
|
|
|
$enotifusertalkpages.
|
|
|
|
|
|
$enotifminoredits.
|
|
|
|
|
|
$moreEmail.
|
|
|
|
|
|
$this->getToggle( 'ccmeonemails' )
|
2007-05-06 17:54:38 +00:00
|
|
|
|
)
|
|
|
|
|
|
);
|
2006-03-07 01:10:39 +00:00
|
|
|
|
}
|
2007-05-06 20:52:03 +00:00
|
|
|
|
# </FIXME>
|
2005-04-26 23:56:28 +00:00
|
|
|
|
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$wgOut->addHTML(
|
|
|
|
|
|
Xml::closeElement( 'table' ) .
|
|
|
|
|
|
Xml::closeElement( 'fieldset' )
|
|
|
|
|
|
);
|
2004-04-22 08:51:04 +00:00
|
|
|
|
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-04-25 23:04:44 +00:00
|
|
|
|
# Quickbar
|
2004-04-22 08:51:04 +00:00
|
|
|
|
#
|
2005-04-07 15:35:45 +00:00
|
|
|
|
if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') {
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$wgOut->addHtml( "<fieldset>\n<legend>" . wfMsg( 'qbsettings' ) . "</legend>\n" );
|
2005-04-07 15:35:45 +00:00
|
|
|
|
for ( $i = 0; $i < count( $qbs ); ++$i ) {
|
|
|
|
|
|
if ( $i == $this->mQuickbar ) { $checked = ' checked="checked"'; }
|
|
|
|
|
|
else { $checked = ""; }
|
2005-04-25 23:04:44 +00:00
|
|
|
|
$wgOut->addHTML( "<div><label><input type='radio' name='wpQuickbar' value=\"$i\"$checked />{$qbs[$i]}</label></div>\n" );
|
2005-04-07 15:35:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
$wgOut->addHtml( "</fieldset>\n\n" );
|
2005-06-28 14:37:10 +00:00
|
|
|
|
} else {
|
2005-07-24 07:09:53 +00:00
|
|
|
|
# Need to output a hidden option even if the relevant skin is not in use,
|
2005-06-28 14:37:10 +00:00
|
|
|
|
# otherwise the preference will get reset to 0 on submit
|
2006-05-15 09:45:14 +00:00
|
|
|
|
$wgOut->addHtml( wfHidden( 'wpQuickbar', $this->mQuickbar ) );
|
2004-04-22 08:51:04 +00:00
|
|
|
|
}
|
2004-05-17 23:18:37 +00:00
|
|
|
|
|
2005-04-25 23:04:44 +00:00
|
|
|
|
# Skin
|
2004-04-01 13:03:05 +00:00
|
|
|
|
#
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" );
|
2005-07-24 07:09:53 +00:00
|
|
|
|
$mptitle = Title::newMainPage();
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$previewtext = wfMsg('skinpreview');
|
2006-07-02 15:57:59 +00:00
|
|
|
|
# Only show members of Skin::getSkinNames() rather than
|
2004-04-01 13:03:05 +00:00
|
|
|
|
# $skinNames (skins is all skin names from Language.php)
|
2006-07-02 15:57:59 +00:00
|
|
|
|
$validSkinNames = Skin::getSkinNames();
|
2006-11-03 06:08:08 +00:00
|
|
|
|
# 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 ) {
|
2005-05-29 06:18:10 +00:00
|
|
|
|
if ( in_array( $skinkey, $wgSkipSkins ) ) {
|
|
|
|
|
|
continue;
|
2005-07-24 07:09:53 +00:00
|
|
|
|
}
|
2005-04-25 23:04:44 +00:00
|
|
|
|
$checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
|
|
|
|
|
$mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
|
|
|
|
|
|
$previewlink = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
|
2005-04-25 23:04:44 +00:00
|
|
|
|
if( $skinkey == $wgDefaultSkin )
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$sn .= ' (' . wfMsg( 'default' ) . ')';
|
2006-07-02 21:21:11 +00:00
|
|
|
|
$wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br />\n" );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
}
|
2004-05-19 20:54:00 +00:00
|
|
|
|
$wgOut->addHTML( "</fieldset>\n\n" );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
|
2005-04-25 23:04:44 +00:00
|
|
|
|
# Math
|
2004-04-01 13:03:05 +00:00
|
|
|
|
#
|
2005-05-29 20:43:30 +00:00
|
|
|
|
global $wgUseTeX;
|
|
|
|
|
|
if( $wgUseTeX ) {
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
|
2005-05-29 20:43:30 +00:00
|
|
|
|
foreach ( $mathopts as $k => $v ) {
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$checked = ($k == $this->mMath);
|
|
|
|
|
|
$wgOut->addHTML(
|
|
|
|
|
|
Xml::openElement( 'div' ) .
|
|
|
|
|
|
Xml::radioLabel( wfMsg( $v ), 'wpMath', $k, "mw-sp-math-$k", $checked ) .
|
|
|
|
|
|
Xml::closeElement( 'div' ) . "\n"
|
|
|
|
|
|
);
|
2005-05-29 20:43:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
$wgOut->addHTML( "</fieldset>\n\n" );
|
2004-04-01 13:03:05 +00:00
|
|
|
|
}
|
2005-04-12 00:37:45 +00:00
|
|
|
|
|
|
|
|
|
|
# Files
|
|
|
|
|
|
#
|
2006-11-27 19:49:48 +00:00
|
|
|
|
$wgOut->addHTML(
|
|
|
|
|
|
"<fieldset>\n" . Xml::element( 'legend', null, wfMsg( 'files' ) ) . "\n"
|
|
|
|
|
|
);
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2006-07-26 07:15:39 +00:00
|
|
|
|
$imageLimitOptions = null;
|
|
|
|
|
|
foreach ( $wgImageLimits as $index => $limits ) {
|
2006-11-27 19:49:48 +00:00
|
|
|
|
$selected = ($index == $this->mImageSize);
|
|
|
|
|
|
$imageLimitOptions .= Xml::option( "{$limits[0]}×{$limits[1]}" .
|
|
|
|
|
|
wfMsg('unit-pixel'), $index, $selected );
|
2006-07-26 07:15:39 +00:00
|
|
|
|
}
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2006-11-27 19:49:48 +00:00
|
|
|
|
$imageSizeId = 'wpImageSize';
|
|
|
|
|
|
$wgOut->addHTML(
|
|
|
|
|
|
"<div>" . Xml::label( wfMsg('imagemaxsize'), $imageSizeId ) . " " .
|
|
|
|
|
|
Xml::openElement( 'select', array( 'name' => $imageSizeId, 'id' => $imageSizeId ) ) .
|
|
|
|
|
|
$imageLimitOptions .
|
|
|
|
|
|
Xml::closeElement( 'select' ) . "</div>\n"
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2006-07-26 07:15:39 +00:00
|
|
|
|
$imageThumbOptions = null;
|
|
|
|
|
|
foreach ( $wgThumbLimits as $index => $size ) {
|
2006-11-27 19:49:48 +00:00
|
|
|
|
$selected = ($index == $this->mThumbSize);
|
|
|
|
|
|
$imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index,
|
|
|
|
|
|
$selected);
|
2006-07-26 07:15:39 +00:00
|
|
|
|
}
|
2006-11-27 19:49:48 +00:00
|
|
|
|
|
|
|
|
|
|
$thumbSizeId = 'wpThumbSize';
|
|
|
|
|
|
$wgOut->addHTML(
|
|
|
|
|
|
"<div>" . Xml::label( wfMsg('thumbsize'), $thumbSizeId ) . " " .
|
|
|
|
|
|
Xml::openElement( 'select', array( 'name' => $thumbSizeId, 'id' => $thumbSizeId ) ) .
|
|
|
|
|
|
$imageThumbOptions .
|
|
|
|
|
|
Xml::closeElement( 'select' ) . "</div>\n"
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$wgOut->addHTML( "</fieldset>\n\n" );
|
2005-04-12 00:37:45 +00:00
|
|
|
|
|
2006-03-07 01:10:39 +00:00
|
|
|
|
# Date format
|
|
|
|
|
|
#
|
2005-10-11 02:52:38 +00:00
|
|
|
|
# Date/Time
|
|
|
|
|
|
#
|
|
|
|
|
|
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'datetime' ) . "</legend>\n" );
|
2005-10-11 02:52:38 +00:00
|
|
|
|
|
2005-03-26 01:28:33 +00:00
|
|
|
|
if ($dateopts) {
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'dateformat' ) . "</legend>\n" );
|
2005-10-13 07:57:06 +00:00
|
|
|
|
$idCnt = 0;
|
2006-07-19 10:30:42 +00:00
|
|
|
|
$epoch = '20010115161234'; # Wikipedia day
|
2006-07-26 07:15:39 +00:00
|
|
|
|
foreach( $dateopts as $key ) {
|
|
|
|
|
|
if( $key == 'default' ) {
|
2005-11-08 00:57:09 +00:00
|
|
|
|
$formatted = wfMsgHtml( 'datedefault' );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$formatted = htmlspecialchars( $wgLang->timeanddate( $epoch, false, $key ) );
|
|
|
|
|
|
}
|
2005-03-26 01:28:33 +00:00
|
|
|
|
($key == $this->mDate) ? $checked = ' checked="checked"' : $checked = '';
|
2005-10-13 07:57:06 +00:00
|
|
|
|
$wgOut->addHTML( "<div><input type='radio' name=\"wpDate\" id=\"wpDate$idCnt\" ".
|
2005-11-08 00:57:09 +00:00
|
|
|
|
"value=\"$key\"$checked /> <label for=\"wpDate$idCnt\">$formatted</label></div>\n" );
|
2005-10-13 07:57:06 +00:00
|
|
|
|
$idCnt++;
|
2003-07-06 02:48:06 +00:00
|
|
|
|
}
|
2005-10-11 02:52:38 +00:00
|
|
|
|
$wgOut->addHTML( "</fieldset>\n" );
|
2003-07-01 12:47:44 +00:00
|
|
|
|
}
|
2005-04-11 22:54:14 +00:00
|
|
|
|
|
2004-04-01 13:03:05 +00:00
|
|
|
|
$nowlocal = $wgLang->time( $now = wfTimestampNow(), true );
|
|
|
|
|
|
$nowserver = $wgLang->time( $now, false );
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2006-12-11 20:56:58 +00:00
|
|
|
|
$wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'timezonelegend' ). '</legend><table>' .
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$this->addRow( wfMsg( 'servertime' ), $nowserver ) .
|
|
|
|
|
|
$this->addRow( wfMsg( 'localtime' ), $nowlocal ) .
|
2005-04-25 23:04:44 +00:00
|
|
|
|
$this->addRow(
|
2006-10-09 07:17:06 +00:00
|
|
|
|
'<label for="wpHourDiff">' . wfMsg( 'timezoneoffset' ) . '</label>',
|
2005-10-13 07:57:06 +00:00
|
|
|
|
"<input type='text' name='wpHourDiff' id='wpHourDiff' value=\"" . htmlspecialchars( $this->mHourDiff ) . "\" size='6' />"
|
2005-04-25 23:04:44 +00:00
|
|
|
|
) . "<tr><td colspan='2'>
|
2006-10-09 07:17:06 +00:00
|
|
|
|
<input type='button' value=\"" . wfMsg( 'guesstimezone' ) ."\"
|
2005-04-25 23:04:44 +00:00
|
|
|
|
onclick='javascript:guessTimezone()' id='guesstimezonebutton' style='display:none;' />
|
2006-10-09 07:17:06 +00:00
|
|
|
|
</td></tr></table><div class='prefsectiontip'>¹" . wfMsg( 'timezonetext' ) . "</div></fieldset>
|
2005-07-24 07:09:53 +00:00
|
|
|
|
</fieldset>\n\n" );
|
|
|
|
|
|
|
2005-04-11 22:54:14 +00:00
|
|
|
|
# Editing
|
|
|
|
|
|
#
|
2007-01-12 10:03:51 +00:00
|
|
|
|
global $wgLivePreview;
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'textboxsize' ) . '</legend>
|
2006-05-15 09:45:14 +00:00
|
|
|
|
<div>' .
|
|
|
|
|
|
wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) .
|
|
|
|
|
|
' ' .
|
|
|
|
|
|
wfInputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols ) .
|
|
|
|
|
|
"</div>" .
|
2005-05-02 13:28:43 +00:00
|
|
|
|
$this->getToggles( array(
|
|
|
|
|
|
'editsection',
|
|
|
|
|
|
'editsectiononrightclick',
|
|
|
|
|
|
'editondblclick',
|
|
|
|
|
|
'editwidth',
|
|
|
|
|
|
'showtoolbar',
|
|
|
|
|
|
'previewonfirst',
|
|
|
|
|
|
'previewontop',
|
2005-07-24 07:09:53 +00:00
|
|
|
|
'minordefault',
|
2005-05-02 13:28:43 +00:00
|
|
|
|
'externaleditor',
|
2006-02-23 20:03:51 +00:00
|
|
|
|
'externaldiff',
|
2006-03-18 22:47:40 +00:00
|
|
|
|
$wgLivePreview ? 'uselivepreview' : false,
|
2006-03-25 00:57:14 +00:00
|
|
|
|
'forceeditsummary',
|
|
|
|
|
|
) ) . '</fieldset>'
|
2005-05-02 13:28:43 +00:00
|
|
|
|
);
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2007-04-08 09:30:06 +00:00
|
|
|
|
# Recent changes
|
|
|
|
|
|
$wgOut->addHtml( '<fieldset><legend>' . wfMsgHtml( 'prefs-rc' ) . '</legend>' );
|
|
|
|
|
|
|
|
|
|
|
|
$rc = '<table><tr>';
|
|
|
|
|
|
$rc .= '<td>' . Xml::label( wfMsg( 'recentchangesdays' ), 'wpRecentDays' ) . '</td>';
|
|
|
|
|
|
$rc .= '<td>' . Xml::input( 'wpRecentDays', 3, $this->mRecentDays, array( 'id' => 'wpRecentDays' ) ) . '</td>';
|
|
|
|
|
|
$rc .= '</tr><tr>';
|
|
|
|
|
|
$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( '<br />' );
|
|
|
|
|
|
|
|
|
|
|
|
$toggles[] = 'hideminor';
|
|
|
|
|
|
if( $wgRCShowWatchingUsers )
|
|
|
|
|
|
$toggles[] = 'shownumberswatching';
|
|
|
|
|
|
$toggles[] = 'usenewrc';
|
|
|
|
|
|
$wgOut->addHtml( $this->getToggles( $toggles ) );
|
|
|
|
|
|
|
|
|
|
|
|
$wgOut->addHtml( '</fieldset>' );
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2006-04-17 23:53:54 +00:00
|
|
|
|
# Watchlist
|
2006-12-16 21:36:01 +00:00
|
|
|
|
$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( $this->getToggle( 'extendwatchlist' ) );
|
|
|
|
|
|
$wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) );
|
|
|
|
|
|
$wgOut->addHtml( '<br /><br />' );
|
|
|
|
|
|
|
2006-12-29 13:48:36 +00:00
|
|
|
|
$wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'watchlisthideminor' ) ) );
|
2007-01-04 14:08:51 +00:00
|
|
|
|
|
|
|
|
|
|
if( $wgUser->isAllowed( 'createpage' ) || $wgUser->isAllowed( 'createtalk' ) )
|
|
|
|
|
|
$wgOut->addHtml( $this->getToggle( 'watchcreations' ) );
|
|
|
|
|
|
foreach( array( 'edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion' ) as $action => $toggle ) {
|
|
|
|
|
|
if( $wgUser->isAllowed( $action ) )
|
|
|
|
|
|
$wgOut->addHtml( $this->getToggle( $toggle ) );
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->mUsedToggles['watchcreations'] = true;
|
|
|
|
|
|
$this->mUsedToggles['watchdefault'] = true;
|
|
|
|
|
|
$this->mUsedToggles['watchmoves'] = true;
|
|
|
|
|
|
$this->mUsedToggles['watchdeletion'] = true;
|
|
|
|
|
|
|
2006-12-16 21:36:01 +00:00
|
|
|
|
$wgOut->addHtml( '</fieldset>' );
|
2006-04-17 23:53:54 +00:00
|
|
|
|
|
|
|
|
|
|
# Search
|
2007-12-16 15:46:27 +00:00
|
|
|
|
$ajaxsearch = $wgAjaxSearch ?
|
|
|
|
|
|
$this->addRow(
|
|
|
|
|
|
wfLabel( wfMsg( 'useajaxsearch' ), 'wpUseAjaxSearch' ),
|
|
|
|
|
|
wfCheck( 'wpUseAjaxSearch', $this->mUseAjaxSearch, array( 'id' => 'wpUseAjaxSearch' ) )
|
|
|
|
|
|
) : '';
|
2006-12-11 20:56:58 +00:00
|
|
|
|
$wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'searchresultshead' ) . '</legend><table>' .
|
2007-12-16 15:46:27 +00:00
|
|
|
|
$ajaxsearch .
|
2005-10-13 07:57:06 +00:00
|
|
|
|
$this->addRow(
|
2006-05-15 09:45:14 +00:00
|
|
|
|
wfLabel( wfMsg( 'resultsperpage' ), 'wpSearch' ),
|
|
|
|
|
|
wfInput( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) )
|
2005-10-13 07:57:06 +00:00
|
|
|
|
) .
|
|
|
|
|
|
$this->addRow(
|
2006-05-15 09:45:14 +00:00
|
|
|
|
wfLabel( wfMsg( 'contextlines' ), 'wpSearchLines' ),
|
|
|
|
|
|
wfInput( 'wpSearchLines', 4, $this->mSearchLines, array( 'id' => 'wpSearchLines' ) )
|
2005-10-13 07:57:06 +00:00
|
|
|
|
) .
|
|
|
|
|
|
$this->addRow(
|
2006-05-15 09:45:14 +00:00
|
|
|
|
wfLabel( wfMsg( 'contextchars' ), 'wpSearchChars' ),
|
|
|
|
|
|
wfInput( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) )
|
2005-10-13 07:57:06 +00:00
|
|
|
|
) .
|
2006-10-09 07:17:06 +00:00
|
|
|
|
"</table><fieldset><legend>" . wfMsg( 'defaultns' ) . "</legend>$ps</fieldset></fieldset>" );
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2005-04-25 23:04:44 +00:00
|
|
|
|
# Misc
|
2004-04-09 08:27:00 +00:00
|
|
|
|
#
|
2006-10-09 07:17:06 +00:00
|
|
|
|
$wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') . '</legend>');
|
2007-06-05 02:39:18 +00:00
|
|
|
|
$wgOut->addHtml( '<label for="wpStubs">' . wfMsg( 'stub-threshold' ) . '</label> ' );
|
|
|
|
|
|
$wgOut->addHtml( Xml::input( 'wpStubs', 6, $this->mStubs, array( 'id' => 'wpStubs' ) ) );
|
2005-10-13 07:57:06 +00:00
|
|
|
|
$msgUnderline = htmlspecialchars( wfMsg ( 'tog-underline' ) );
|
|
|
|
|
|
$msgUnderlinenever = htmlspecialchars( wfMsg ( 'underline-never' ) );
|
2005-10-21 20:44:59 +00:00
|
|
|
|
$msgUnderlinealways = htmlspecialchars( wfMsg ( 'underline-always' ) );
|
2005-10-13 07:57:06 +00:00
|
|
|
|
$msgUnderlinedefault = htmlspecialchars( wfMsg ( 'underline-default' ) );
|
2005-07-05 19:33:44 +00:00
|
|
|
|
$uopt = $wgUser->getOption("underline");
|
2005-10-21 20:44:59 +00:00
|
|
|
|
$s0 = $uopt == 0 ? ' selected="selected"' : '';
|
|
|
|
|
|
$s1 = $uopt == 1 ? ' selected="selected"' : '';
|
|
|
|
|
|
$s2 = $uopt == 2 ? ' selected="selected"' : '';
|
2005-07-05 19:33:44 +00:00
|
|
|
|
$wgOut->addHTML("
|
2006-12-28 17:09:52 +00:00
|
|
|
|
<div class='toggle'><p><label for='wpOpunderline'>$msgUnderline</label>
|
2005-10-13 07:57:06 +00:00
|
|
|
|
<select name='wpOpunderline' id='wpOpunderline'>
|
2005-07-05 19:33:44 +00:00
|
|
|
|
<option value=\"0\"$s0>$msgUnderlinenever</option>
|
|
|
|
|
|
<option value=\"1\"$s1>$msgUnderlinealways</option>
|
|
|
|
|
|
<option value=\"2\"$s2>$msgUnderlinedefault</option>
|
2006-12-28 17:09:52 +00:00
|
|
|
|
</select></p></div>");
|
|
|
|
|
|
|
2004-07-23 07:03:52 +00:00
|
|
|
|
foreach ( $togs as $tname ) {
|
2004-04-09 15:22:18 +00:00
|
|
|
|
if( !array_key_exists( $tname, $this->mUsedToggles ) ) {
|
2004-05-19 20:54:00 +00:00
|
|
|
|
$wgOut->addHTML( $this->getToggle( $tname ) );
|
2004-04-09 08:27:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2005-04-26 07:14:19 +00:00
|
|
|
|
$wgOut->addHTML( '</fieldset>' );
|
2004-04-09 08:27:00 +00:00
|
|
|
|
|
2007-11-30 17:28:24 +00:00
|
|
|
|
wfRunHooks( 'RenderPreferencesForm', array( $this, $wgOut ) );
|
2007-07-30 22:52:37 +00:00
|
|
|
|
|
2007-06-23 10:15:10 +00:00
|
|
|
|
$token = htmlspecialchars( $wgUser->editToken() );
|
2007-01-10 05:18:30 +00:00
|
|
|
|
$skin = $wgUser->getSkin();
|
2004-04-09 08:27:00 +00:00
|
|
|
|
$wgOut->addHTML( "
|
2004-05-19 20:54:00 +00:00
|
|
|
|
<div id='prefsubmit'>
|
2004-04-09 08:27:00 +00:00
|
|
|
|
<div>
|
2007-01-10 05:18:30 +00:00
|
|
|
|
<input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) . '"'.$skin->tooltipAndAccesskey('save')." />
|
2005-12-06 01:32:13 +00:00
|
|
|
|
<input type='submit' name='wpReset' value=\"" . wfMsgHtml( 'resetprefs' ) . "\" />
|
2004-04-09 08:27:00 +00:00
|
|
|
|
</div>
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2004-05-19 20:54:00 +00:00
|
|
|
|
</div>
|
2005-07-24 07:09:53 +00:00
|
|
|
|
|
2007-06-23 10:15:10 +00:00
|
|
|
|
<input type='hidden' name='wpEditToken' value=\"{$token}\" />
|
2005-10-11 00:33:23 +00:00
|
|
|
|
</div></form>\n" );
|
|
|
|
|
|
|
2007-05-06 17:54:38 +00:00
|
|
|
|
$wgOut->addHtml( Xml::tags( 'div', array( 'class' => "prefcache" ),
|
|
|
|
|
|
wfMsgExt( 'clearyourcache', 'parseinline' ) )
|
|
|
|
|
|
);
|
2006-03-07 01:41:55 +00:00
|
|
|
|
|
2003-07-01 12:47:44 +00:00
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
}
|
2007-06-29 01:19:14 +00:00
|
|
|
|
|