From 0b66a58364f6fbe2fb51093624f08e5d68c3c2bb Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 9 Oct 2006 07:17:06 +0000 Subject: [PATCH] Reverting r16861; incompatible change to message texts, breaks a lot of toggle displays on wikipedia --- RELEASE-NOTES | 1 - includes/SpecialPreferences.php | 92 ++++++++++++++------------------- 2 files changed, 40 insertions(+), 53 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 525e10cc29..b74b2bf0d8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -272,7 +272,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 7508) Added option to compress HTML pages by dumpHTML.php * (bug 7519) Add plural in SpecialWatchlist * (bug 7459) Magic word variables are always case sensitive -* Made messages used in Special:Preferences either plain text or wikitext (toggles) * Replaced {{SERVER}}{{localurl:xxx}} with {{fullurl:xxx}} in localisation files * Fix regression in Special:Watchlist text header * (bug 7510) Update article counts etc on undelete diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index aa1e8734ab..5eadf3d62c 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -409,8 +409,6 @@ class PreferencesForm { if ( empty($name) ) $name = wfMsg( 'blanknamespace' ); - $name = htmlspecialchars( $name ); - $r1 .= "
\n"; } return $r1; @@ -418,17 +416,10 @@ class PreferencesForm { function getToggle( $tname, $trailer = false, $disabled = false ) { - global $wgUser, $wgLang, $wgOut; + global $wgUser, $wgLang; $this->mUsedToggles[$tname] = true; - if ( $tname !== 'highlightbroken' ) { - $ttext = $wgOut->parse( $wgLang->getUserToggle( $tname ), false, true ); - if( preg_match( "~^

(.*)\n?

$~", $ttext, $m = array() ) ) { - $ttext = $m[1]; - } - } else { - $ttext = $wgLang->getUserToggle( $tname ); - } + $ttext = $wgLang->getUserToggle( $tname ); $checked = $wgUser->getOption( $tname ) == 1 ? ' checked="checked"' : ''; $disabled = $disabled ? ' disabled="disabled"' : ''; @@ -511,14 +502,12 @@ class PreferencesForm { if ($wgEmailAuthentication && ($this->mUserEmail != '') ) { if( $wgUser->getEmailAuthenticationTimestamp() ) { - $emailauthenticated = htmlspecialchars( wfMsg( 'emailauthenticated', - $wgLang->timeanddate( $wgUser->getEmailAuthenticationTimestamp(), true ) - ) ) .'
'; + $emailauthenticated = wfMsg('emailauthenticated',$wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true ) ).'
'; $disableEmailPrefs = false; } else { $disableEmailPrefs = true; $skin = $wgUser->getSkin(); - $emailauthenticated = wfMsgHtml( 'emailnotauthenticated' ) . '
' . + $emailauthenticated = wfMsg('emailnotauthenticated').'
' . $skin->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Confirmemail' ), wfMsg( 'emailconfirmlink' ) ); } @@ -548,18 +537,18 @@ class PreferencesForm { # User data # - $wgOut->addHTML( "
\n" . wfMsgHtml('prefs-personal') . "\n\n"); + $wgOut->addHTML( "
\n" . wfMsg('prefs-personal') . "\n
\n"); $wgOut->addHTML( $this->addRow( - wfMsgHtml( 'username'), + wfMsg( 'username'), $wgUser->getName() ) ); $wgOut->addHTML( $this->addRow( - wfMsgHtml( 'uid' ), + wfMsg( 'uid' ), $wgUser->getID() ) ); @@ -568,7 +557,7 @@ class PreferencesForm { if ($wgAllowRealName) { $wgOut->addHTML( $this->addRow( - '', + '', "mRealName}\" size='25' />" ) ); @@ -576,7 +565,7 @@ class PreferencesForm { if ($wgEnableEmail) { $wgOut->addHTML( $this->addRow( - '', + '', "mUserEmail}\" size='25' />" ) ); @@ -595,7 +584,7 @@ class PreferencesForm { $wgOut->addHTML( $this->addRow( - '', + '', "mNick}\" size='25' />" ) . $invalidSig . @@ -625,14 +614,13 @@ class PreferencesForm { $selectedLang = isset( $languages[$this->mUserLanguage] ) ? $this->mUserLanguage : $wgContLanguageCode; $selbox = null; foreach($languages as $code => $name) { - $name = htmlspecialchars( $name ); global $IP; $sel = ($code == $selectedLang)? ' selected="selected"' : ''; $selbox .= "\n"; } $wgOut->addHTML( $this->addRow( - '', + '', "" ) ); @@ -670,18 +658,18 @@ class PreferencesForm { $this->mNewpass = htmlspecialchars( $this->mNewpass ); $this->mRetypePass = htmlspecialchars( $this->mRetypePass ); - $wgOut->addHTML( '
' . wfMsgHtml( 'changepassword' ) . '
'); + $wgOut->addHTML( '
' . wfMsg( 'changepassword' ) . '
'); $wgOut->addHTML( $this->addRow( - '', + '', "mOldpass}\" size='20' />" ) . $this->addRow( - '', + '', "mNewpass}\" size='20' />" ) . $this->addRow( - '', + '', "mRetypePass}\" size='20' />" ) . "
\n" . @@ -691,7 +679,7 @@ class PreferencesForm { # # Enotif if ($wgEnableEmail) { - $wgOut->addHTML( '
' . wfMsgHtml( 'email' ) . '' ); + $wgOut->addHTML( '
' . wfMsg( 'email' ) . '' ); $wgOut->addHTML( $emailauthenticated. $enotifrevealaddr. @@ -699,7 +687,7 @@ class PreferencesForm { $enotifusertalkpages. $enotifminoredits ); if ($wgEnableUserEmail) { - $emf = wfMsgHtml( 'allowemail' ); + $emf = wfMsg( 'allowemail' ); $disabled = $disableEmailPrefs ? ' disabled="disabled"' : ''; $wgOut->addHTML( "
" ); @@ -715,7 +703,7 @@ class PreferencesForm { $tips[] = wfMsg( 'prefs-help-realname' ); if( $wgEnableEmail ) $tips[] = wfMsg( 'prefs-help-email' ); - $wgOut->addWikitext( '
' . implode( '
', $tips ) . '
' ); + $wgOut->addHtml( '
' . implode( '
', $tips ) . '
' ); } $wgOut->addHTML( '
' ); @@ -723,7 +711,7 @@ class PreferencesForm { # Quickbar # if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') { - $wgOut->addHtml( "
\n" . wfMsgHtml( 'qbsettings' ) . "\n" ); + $wgOut->addHtml( "
\n" . wfMsg( 'qbsettings' ) . "\n" ); for ( $i = 0; $i < count( $qbs ); ++$i ) { if ( $i == $this->mQuickbar ) { $checked = ' checked="checked"'; } else { $checked = ""; } @@ -738,9 +726,9 @@ class PreferencesForm { # Skin # - $wgOut->addHTML( "
\n\n" . wfMsgHtml('skin') . "\n" ); + $wgOut->addHTML( "
\n\n" . wfMsg('skin') . "\n" ); $mptitle = Title::newMainPage(); - $previewtext = wfMsgHtml('skinpreview'); + $previewtext = wfMsg('skinpreview'); # Only show members of Skin::getSkinNames() rather than # $skinNames (skins is all skin names from Language.php) $validSkinNames = Skin::getSkinNames(); @@ -754,7 +742,7 @@ class PreferencesForm { $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey")); $previewlink = "$previewtext"; if( $skinkey == $wgDefaultSkin ) - $sn .= ' (' . wfMsgHtml( 'default' ) . ')'; + $sn .= ' (' . wfMsg( 'default' ) . ')'; $wgOut->addHTML( " $previewlink
\n" ); } $wgOut->addHTML( "
\n\n" ); @@ -763,10 +751,10 @@ class PreferencesForm { # global $wgUseTeX; if( $wgUseTeX ) { - $wgOut->addHTML( "
\n" . wfMsgHtml('math') . '' ); + $wgOut->addHTML( "
\n" . wfMsg('math') . '' ); foreach ( $mathopts as $k => $v ) { $checked = $k == $this->mMath ? ' checked="checked"' : ''; - $wgOut->addHTML( "
\n" ); + $wgOut->addHTML( "
\n" ); } $wgOut->addHTML( "
\n\n" ); } @@ -774,8 +762,8 @@ class PreferencesForm { # Files # $wgOut->addHTML("
- " . wfMsgHtml( 'files' ) . " -
"); $imageLimitOptions = null; foreach ( $wgImageLimits as $index => $limits ) { @@ -785,7 +773,7 @@ class PreferencesForm { $imageThumbOptions = null; $wgOut->addHTML( "{$imageLimitOptions}
-
"); foreach ( $wgThumbLimits as $index => $size ) { $selected = ($index == $this->mThumbSize) ? 'selected="selected"' : ''; $imageThumbOptions .= "\n"; @@ -797,10 +785,10 @@ class PreferencesForm { # Date/Time # - $wgOut->addHTML( "
\n" . wfMsgHtml( 'datetime' ) . "\n" ); + $wgOut->addHTML( "
\n" . wfMsg( 'datetime' ) . "\n" ); if ($dateopts) { - $wgOut->addHTML( "
\n" . wfMsgHtml( 'dateformat' ) . "\n" ); + $wgOut->addHTML( "
\n" . wfMsg( 'dateformat' ) . "\n" ); $idCnt = 0; $epoch = '20010115161234'; # Wikipedia day foreach( $dateopts as $key ) { @@ -820,22 +808,22 @@ class PreferencesForm { $nowlocal = $wgLang->time( $now = wfTimestampNow(), true ); $nowserver = $wgLang->time( $now, false ); - $wgOut->addHTML( '
' . wfMsgHtml( 'timezonelegend' ). '' . - $this->addRow( wfMsgHtml( 'servertime' ), $nowserver ) . - $this->addRow( wfMsgHtml( 'localtime' ), $nowlocal ) . + $wgOut->addHTML( '
' . wfMsg( 'timezonelegend' ). '
' . + $this->addRow( wfMsg( 'servertime' ), $nowserver ) . + $this->addRow( wfMsg( 'localtime' ), $nowlocal ) . $this->addRow( - '', + '', "mHourDiff ) . "\" size='6' />" ) . "
- -
¹" . wfMsgHtml( 'timezonetext' ) . "
+
¹" . wfMsg( 'timezonetext' ) . "
\n\n" ); # Editing # global $wgLivePreview, $wgUseRCPatrol; - $wgOut->addHTML( '
' . wfMsgHtml( 'textboxsize' ) . ' + $wgOut->addHTML( '
' . wfMsg( 'textboxsize' ) . '
' . wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) . ' ' . @@ -861,7 +849,7 @@ class PreferencesForm { ); $this->mUsedToggles['autopatrol'] = true; # Don't show this up for users who can't; the handler below is dumb and doesn't know it - $wgOut->addHTML( '
' . wfMsgHtml('prefs-rc') . '' . + $wgOut->addHTML( '
' . htmlspecialchars(wfMsg('prefs-rc')) . '' . wfInputLabel( wfMsg( 'recentchangescount' ), 'wpRecent', 'wpRecent', 3, $this->mRecent ) . $this->getToggles( array( @@ -884,7 +872,7 @@ class PreferencesForm { $wgOut->addHTML( '
' ); # Search - $wgOut->addHTML( '
' . wfMsgHtml( 'searchresultshead' ) . '' . + $wgOut->addHTML( '
' . wfMsg( 'searchresultshead' ) . '
' . $this->addRow( wfLabel( wfMsg( 'resultsperpage' ), 'wpSearch' ), wfInput( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) ) @@ -897,11 +885,11 @@ class PreferencesForm { wfLabel( wfMsg( 'contextchars' ), 'wpSearchChars' ), wfInput( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) ) ) . - "
" . wfMsgHtml( 'defaultns' ) . "$ps
" ); + "
" . wfMsg( 'defaultns' ) . "$ps
" ); # Misc # - $wgOut->addHTML('
' . wfMsgHtml('prefs-misc') . ''); + $wgOut->addHTML('
' . wfMsg('prefs-misc') . ''); $wgOut->addHTML( wfInputLabel( wfMsg( 'stubthreshold' ), 'wpStubs', 'wpStubs', 6, $this->mStubs ) ); $msgUnderline = htmlspecialchars( wfMsg ( 'tog-underline' ) ); -- 2.20.1