if( !defined( 'MEDIAWIKI' ) )
die();
-/** to get a list of languages in setting user's language preference */
-require_once('languages/Names.php');
-
/**
* Entry point that create the "Preferences" object
*/
var $mUserLanguage, $mUserVariant;
var $mSearch, $mRecent, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
+ var $mUnderline;
/**
* Constructor
$this->mSearchChars = $request->getVal( 'wpSearchChars' );
$this->mImageSize = $request->getVal( 'wpImageSize' );
$this->mThumbSize = $request->getInt( 'wpThumbSize' );
+ $this->mUnderline = $request->getInt( 'wpOpunderline' );
$this->mAction = $request->getVal( 'action' );
$this->mReset = $request->getCheck( 'wpReset' );
$this->mPosted = $request->wasPosted();
+
$this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
$this->mPosted &&
$wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
global $wgUser, $wgLang, $wgOut;
global $wgEnableUserEmail, $wgEnableEmail;
global $wgEmailAuthentication, $wgMinimalPasswordLength;
+ global $wgAuth;
+
if ( '' != $this->mNewpass ) {
if ( $this->mNewpass != $this->mRetypePass ) {
$this->mainPrefsForm( wfMsg( 'wrongpassword' ) );
return;
}
+ if (!$wgAuth->setPassword( $wgUser, $this->mNewpass )) {
+ $this->mainPrefsForm( wfMsg( 'externaldberror' ) );
+ return;
+ }
$wgUser->setPassword( $this->mNewpass );
}
$wgUser->setRealName( $this->mRealName );
$wgUser->setOption( 'nickname', $this->mNick );
$wgUser->setOption( 'quickbar', $this->mQuickbar );
$wgUser->setOption( 'skin', $this->mSkin );
- $wgUser->setOption( 'math', $this->mMath );
- $wgUser->setOption( 'date', $this->mDate );
+ global $wgUseTeX;
+ if( $wgUseTeX ) {
+ $wgUser->setOption( 'math', $this->mMath );
+ }
+ $wgUser->setOption( 'date', $this->validateInt( $this->mDate, 0, 10 ) );
$wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch ) );
$wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines ) );
$wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars ) );
$wgUser->setOption( 'timecorrection', $this->validateTimeZone( $this->mHourDiff, -12, 14 ) );
$wgUser->setOption( 'imagesize', $this->mImageSize );
$wgUser->setOption( 'thumbsize', $this->mThumbSize );
+ $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
# Set search namespace options
foreach( $this->mSearchNs as $i => $value ) {
foreach ( $this->mToggles as $tname => $tvalue ) {
$wgUser->setOption( $tname, $tvalue );
}
+ if (!$wgAuth->updateExternalDB($wgUser)) {
+ $this->mainPrefsForm( wfMsg( 'externaldberror' ) );
+ return;
+ }
$wgUser->setCookies();
$wgUser->saveSettings();
if( WikiError::isError( $result ) ) {
$error = wfMsg( 'mailerror', $result->getMessage() );
} else {
- $error = wfMsg( 'passwordsentforemailauthentication', $wgUser->getName() );
+ $error = wfMsg( 'eauthentsent', $wgUser->getName() );
}
}
} else {
$this->mImageSize = $wgUser->getOption( 'imagesize' );
$this->mThumbSize = $wgUser->getOption( 'thumbsize' );
$this->mRecent = $wgUser->getOption( 'rclimit' );
+ $this->mUnderline = $wgUser->getOption( 'underline' );
$togs = $wgLang->getUserToggles();
foreach ( $togs as $tname ) {
function mainPrefsForm( $err ) {
global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames;
global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
- global $wgLanguageNames, $wgDisableLangConversion;
- global $wgEmailNotificationForWatchlistPages, $wgEmailNotificationForUserTalkPages,$wgEmailNotificationForMinorEdits;
- global $wgRCShowWatchingUsers, $wgEmailNotificationRevealPageEditorAddress;
+ global $wgDisableLangConversion;
+ global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
+ global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
- global $wgContLanguageCode;
+ global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins;
$wgOut->setPageTitle( wfMsg( 'preferences' ) );
$wgOut->setArticleRelated( false );
$titleObj = Title::makeTitle( NS_SPECIAL, 'Preferences' );
$action = $titleObj->escapeLocalURL();
-
+
+ # 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;
# Enotif
# <FIXME>
if ($wgEmailAuthentication && ($this->mUserEmail != '') ) {
if( $wgUser->getEmailAuthenticationTimestamp() ) {
$emailauthenticated = wfMsg('emailauthenticated',$wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true ) ).'<br />';
- $disabled = '';
} else {
$skin = $wgUser->getSkin();
$emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
$skin->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Confirmemail' ),
wfMsg( 'emailconfirmlink' ) );
- $disabled = ' '.wfMsg('disableduntilauthent');
}
} else {
$emailauthenticated = '';
- $disabled = false; // If it hasn't been set already the wiki will spew errors
}
if ($this->mUserEmail == '') {
- $disabled = ' '.wfMsg('disablednoemail');
+ $emailauthenticated = wfMsg( 'noemailprefs' );
}
$ps = $this->namespacesCheckboxes();
- $enotifwatchlistpages = ($wgEmailNotificationForWatchlistPages) ? $this->getToggle( 'enotifwatchlistpages', $disabled) : '';
- $enotifusertalkpages = ($wgEmailNotificationForUserTalkPages) ? $this->getToggle( 'enotifusertalkpages', $disabled) : '';
- $enotifminoredits = ($wgEmailNotificationForMinorEdits) ? $this->getToggle( 'enotifminoredits', $disabled) : '';
- $enotifrevealaddr = ($wgEmailNotificationRevealPageEditorAddress) ? $this->getToggle( 'enotifrevealaddr', $disabled) : '';
- $prefs_help_email_enotif = ( $wgEmailNotificationForWatchlistPages || $wgEmailNotificationForUserTalkPages) ? ' ' . wfMsg('prefs-help-email-enotif') : '';
+ $enotifwatchlistpages = ($wgEnotifWatchlist) ? $this->getToggle( 'enotifwatchlistpages' ) : '';
+ $enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages' ) : '';
+ $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits' ) : '';
+ $enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr' ) : '';
+ $prefs_help_email_enotif = ( $wgEnotifWatchlist || $wgEnotifUserTalk) ? ' ' . wfMsg('prefs-help-email-enotif') : '';
$prefs_help_realname = '';
# </FIXME>
* Otherwise, no default is selected and the user ends up
* with an Afrikaans interface since it's first in the list.
*/
- $selectedLang = isset( $wgLanguageNames[$this->mUserLanguage] ) ? $this->mUserLanguage : $wgContLanguageCode;
+ $languages = $wgLang->getLanguageNames();
+ $selectedLang = isset( $languages[$this->mUserLanguage] ) ? $this->mUserLanguage : $wgContLanguageCode;
$selbox = null;
- foreach($wgLanguageNames as $code => $name) {
+ foreach($languages as $code => $name) {
global $IP;
/* only add languages that have a file */
$langfile="$IP/languages/Language".str_replace('-', '_', ucfirst($code)).".php";
foreach($variants as $v) {
$v = str_replace( '_', '-', strtolower($v));
- if($name = $wgLanguageNames[$v]) {
+ if($name = $languages[$v]) {
$variantArray[$v] = $name;
}
}
if ($wgEnableUserEmail) {
$emf = wfMsg( 'emailflag' );
$wgOut->addHTML(
- "<div><label><input type='checkbox' $emfc value=\"1\" name=\"wpEmailFlag\" />$emf.$disabled</label></div>" );
+ "<div><label><input type='checkbox' $emfc value=\"1\" name=\"wpEmailFlag\" />$emf</label></div>" );
}
$wgOut->addHTML( '</fieldset>' );
$wgOut->addHTML( "<div><label><input type='radio' name='wpQuickbar' value=\"$i\"$checked />{$qbs[$i]}</label></div>\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( "<input type='hidden' name='wpQuickbar' value='{$this->mQuickbar}' />" );
}
# Skin
# Only show members of $wgValidSkinNames rather than
# $skinNames (skins is all skin names from Language.php)
foreach ($wgValidSkinNames as $skinkey => $skinname ) {
- global $wgDefaultSkin;
-
+ if ( in_array( $skinkey, $wgSkipSkins ) ) {
+ continue;
+ }
$checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
$sn = isset( $skinNames[$skinkey] ) ? $skinNames[$skinkey] : $skinname;
# Math
#
- $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
- foreach ( $mathopts as $k => $v ) {
- $checked = $k == $this->mMath ? ' checked="checked"' : '';
- $wgOut->addHTML( "<div><label><input type='radio' name='wpMath' value=\"$k\"$checked /> ".wfMsg($v)."</label></div>\n" );
+ global $wgUseTeX;
+ if( $wgUseTeX ) {
+ $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
+ foreach ( $mathopts as $k => $v ) {
+ $checked = $k == $this->mMath ? ' checked="checked"' : '';
+ $wgOut->addHTML( "<div><label><input type='radio' name='wpMath' value=\"$k\"$checked /> ".wfMsg($v)."</label></div>\n" );
+ }
+ $wgOut->addHTML( "</fieldset>\n\n" );
}
- $wgOut->addHTML( "</fieldset>\n\n" );
# Files
#
$this->getToggles( array(
'hideminor',
$wgRCShowWatchingUsers ? 'shownumberswatching' : false,
- 'usenewrc',
- 'rcusemodstyle',
- array(
- 'showupdated',
- wfMsg('updatedmarker')
- ) )
+ 'usenewrc' )
) . '</fieldset>'
);
#
$wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') . '</legend>');
+ $msgUnderline = htmlspecialchars(wfMsg("tog-underline"));
+ $msgUnderlinenever = htmlspecialchars(wfMsg("underline-never"));
+ $msgUnderlinealways = htmlspecialchars(wfMsg("underline-always"));
+ $msgUnderlinedefault = htmlspecialchars(wfMsg("underline-default"));
+ $uopt = $wgUser->getOption("underline");
+ $s0 = $uopt == 0 ? " selected=\"selected\"" : "";
+ $s1 = $uopt == 1 ? " selected=\"selected\"" : "";
+ $s2 = $uopt == 2 ? " selected=\"selected\"" : "";
+ $wgOut->addHTML("
+<div class='toggle'><label>$msgUnderline
+<select name=\"wpOpunderline\">
+<option value=\"0\"$s0>$msgUnderlinenever</option>
+<option value=\"1\"$s1>$msgUnderlinealways</option>
+<option value=\"2\"$s2>$msgUnderlinedefault</option>
+</select>
+</label></div>
+");
foreach ( $togs as $tname ) {
if( !array_key_exists( $tname, $this->mUsedToggles ) ) {
$wgOut->addHTML( $this->getToggle( $tname ) );