diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2006-10-11 20:21:25 +0000 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2006-10-11 20:21:25 +0000 |
commit | d81f562b712f2387fa02290bf2ca86392ab356f2 (patch) | |
tree | d666cdefbe6ac320827a2c6cb473581b46e22c4c /includes/SpecialPreferences.php | |
parent | 183851b06bd6c52f3cae5375f433da720d410447 (diff) |
Aktualisierung auf Version 1.8.1
Diffstat (limited to 'includes/SpecialPreferences.php')
-rw-r--r-- | includes/SpecialPreferences.php | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index c6003b7c..5eadf3d6 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -74,7 +74,7 @@ class PreferencesForm { # User toggles (the big ugly unsorted list of checkboxes) $this->mToggles = array(); if ( $this->mPosted ) { - $togs = $wgLang->getUserToggles(); + $togs = User::getToggles(); foreach ( $togs as $tname ) { $this->mToggles[$tname] = $request->getCheck( "wpOp$tname" ) ? 1 : 0; } @@ -156,11 +156,16 @@ class PreferencesForm { /** * @access private */ - function validateDate( &$val, $min = 0, $max=0x7fffffff ) { - if ( ( sprintf('%d', $val) === $val && $val >= $min && $val <= $max ) || $val == 'ISO 8601' ) + function validateDate( $val ) { + global $wgLang, $wgContLang; + if ( $val !== false && ( + in_array( $val, (array)$wgLang->getDatePreferences() ) || + in_array( $val, (array)$wgContLang->getDatePreferences() ) ) ) + { return $val; - else - return 0; + } else { + return $wgLang->getDefaultDateFormat(); + } } /** @@ -257,7 +262,7 @@ class PreferencesForm { if( $wgUseTeX ) { $wgUser->setOption( 'math', $this->mMath ); } - $wgUser->setOption( 'date', $this->validateDate( $this->mDate, 0, 20 ) ); + $wgUser->setOption( 'date', $this->validateDate( $this->mDate ) ); $wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch ) ); $wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines ) ); $wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars ) ); @@ -356,7 +361,7 @@ class PreferencesForm { $this->mQuickbar = $wgUser->getOption( 'quickbar' ); $this->mSkin = Skin::normalizeKey( $wgUser->getOption( 'skin' ) ); $this->mMath = $wgUser->getOption( 'math' ); - $this->mDate = $wgUser->getOption( 'date' ); + $this->mDate = $wgUser->getDatePreference(); $this->mRows = $wgUser->getOption( 'rows' ); $this->mCols = $wgUser->getOption( 'cols' ); $this->mStubs = $wgUser->getOption( 'stubthreshold' ); @@ -371,7 +376,7 @@ class PreferencesForm { $this->mUnderline = $wgUser->getOption( 'underline' ); $this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' ); - $togs = $wgLang->getUserToggles(); + $togs = User::getToggles(); foreach ( $togs as $tname ) { $ttext = wfMsg('tog-'.$tname); $this->mToggles[$tname] = $wgUser->getOption( $tname ); @@ -470,8 +475,8 @@ class PreferencesForm { $qbs = $wgLang->getQuickbarSettings(); $skinNames = $wgLang->getSkinNames(); $mathopts = $wgLang->getMathNames(); - $dateopts = $wgLang->getDateFormats(); - $togs = $wgLang->getUserToggles(); + $dateopts = $wgLang->getDatePreferences(); + $togs = User::getToggles(); $titleObj = Title::makeTitle( NS_SPECIAL, 'Preferences' ); $action = $titleObj->escapeLocalURL(); @@ -595,7 +600,7 @@ class PreferencesForm { * Make sure the site language is in the list; a custom language code * might not have a defined name... */ - $languages = $wgLang->getLanguageNames(); + $languages = $wgLang->getLanguageNames( true ); if( !array_key_exists( $wgContLanguageCode, $languages ) ) { $languages[$wgContLanguageCode] = $wgContLanguageCode; } @@ -610,12 +615,8 @@ class PreferencesForm { $selbox = null; foreach($languages as $code => $name) { global $IP; - /* only add languages that have a file */ - $langfile="$IP/languages/Language".str_replace('-', '_', ucfirst($code)).".php"; - if(file_exists($langfile) || $code == $wgContLanguageCode) { - $sel = ($code == $selectedLang)? ' selected="selected"' : ''; - $selbox .= "<option value=\"$code\"$sel>$code - $name</option>\n"; - } + $sel = ($code == $selectedLang)? ' selected="selected"' : ''; + $selbox .= "<option value=\"$code\"$sel>$code - $name</option>\n"; } $wgOut->addHTML( $this->addRow( @@ -764,20 +765,20 @@ class PreferencesForm { <legend>" . wfMsg( 'files' ) . "</legend> <div><label for='wpImageSize'>" . wfMsg('imagemaxsize') . "</label> <select id='wpImageSize' name='wpImageSize'>"); - $imageLimitOptions = null; - foreach ( $wgImageLimits as $index => $limits ) { - $selected = ($index == $this->mImageSize) ? 'selected="selected"' : ''; - $imageLimitOptions .= "<option value=\"{$index}\" {$selected}>{$limits[0]}×{$limits[1]}". wfMsgHtml('unit-pixel') ."</option>\n"; - } + $imageLimitOptions = null; + foreach ( $wgImageLimits as $index => $limits ) { + $selected = ($index == $this->mImageSize) ? 'selected="selected"' : ''; + $imageLimitOptions .= "<option value=\"{$index}\" {$selected}>{$limits[0]}×{$limits[1]}". wfMsgHtml('unit-pixel') ."</option>\n"; + } - $imageThumbOptions = null; - $wgOut->addHTML( "{$imageLimitOptions}</select></div> - <div><label for='wpThumbSize'>" . wfMsg('thumbsize') . "</label> <select name='wpThumbSize' id='wpThumbSize'>"); - foreach ( $wgThumbLimits as $index => $size ) { - $selected = ($index == $this->mThumbSize) ? 'selected="selected"' : ''; - $imageThumbOptions .= "<option value=\"{$index}\" {$selected}>{$size}". wfMsgHtml('unit-pixel') ."</option>\n"; - } - $wgOut->addHTML( "{$imageThumbOptions}</select></div></fieldset>\n\n"); + $imageThumbOptions = null; + $wgOut->addHTML( "{$imageLimitOptions}</select></div> + <div><label for='wpThumbSize'>" . wfMsg('thumbsize') . "</label> <select name='wpThumbSize' id='wpThumbSize'>"); + foreach ( $wgThumbLimits as $index => $size ) { + $selected = ($index == $this->mThumbSize) ? 'selected="selected"' : ''; + $imageThumbOptions .= "<option value=\"{$index}\" {$selected}>{$size}". wfMsgHtml('unit-pixel') ."</option>\n"; + } + $wgOut->addHTML( "{$imageThumbOptions}</select></div></fieldset>\n\n"); # Date format # @@ -789,9 +790,9 @@ class PreferencesForm { if ($dateopts) { $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'dateformat' ) . "</legend>\n" ); $idCnt = 0; - $epoch = '20010408091234'; - foreach($dateopts as $key => $option) { - if( $key == MW_DATE_DEFAULT ) { + $epoch = '20010115161234'; # Wikipedia day + foreach( $dateopts as $key ) { + if( $key == 'default' ) { $formatted = wfMsgHtml( 'datedefault' ); } else { $formatted = htmlspecialchars( $wgLang->timeanddate( $epoch, false, $key ) ); @@ -816,8 +817,7 @@ class PreferencesForm { ) . "<tr><td colspan='2'> <input type='button' value=\"" . wfMsg( 'guesstimezone' ) ."\" onclick='javascript:guessTimezone()' id='guesstimezonebutton' style='display:none;' /> - </td></tr></table></fieldset> - <div class='prefsectiontip'>¹" . wfMsg( 'timezonetext' ) . "</div> + </td></tr></table><div class='prefsectiontip'>¹" . wfMsg( 'timezonetext' ) . "</div></fieldset> </fieldset>\n\n" ); # Editing |